Compare commits

...
Author SHA1 Message Date
bobboau 3b92333b16 fixed the bug with fighter beams not giveing you kills 2003-02-26 02:56:55 +00:00
bobboau 7238ae9025 fixing my bug fix for the warp model, and not being able to find it 2003-02-25 16:46:01 +00:00
bobboau f6634e882c doh... forgot something in the beam rendering code 2003-02-25 07:15:07 +00:00
bobboau f99a3916de fixed a bunch of fighter beam bugs,
most notabley the sound now works corectly,
and they have limeted range with atenuated damage (table option)
added bank specific compatabilities
2003-02-25 06:22:50 +00:00
inquisitor cc9f972e80 added dxguid, ddraw, and strmiids.lib 2003-02-24 02:01:49 +00:00
inquisitor 609da60af3 added dxguid, ddraw, and strmiids.lib 2003-02-24 01:25:11 +00:00
wmcoolmon 7b794ea056 Refixed the splash screen loading code so that it still works with the demo VPs (Loading "2_PreLoad" and "PreLoad") and put logo support back in. Logo support does nothing unless "PreLoadLogo" and/or"2_PreLoadLogo" exist within the search path. 2003-02-23 20:55:57 +00:00
wmcoolmon 3f66617c68 Uncommented the sections of code that actually played a movie for a given mission. (Removed when daveb cleaned out the movie code for the release) 2003-02-23 03:13:03 +00:00
wmcoolmon f8f60965a9 Added cutscenes/movie.cpp(.h) and directx/dx8show.cpp(.h), which contain movie playing code. Don't compile these if you don't have the DX8 SDK. 2003-02-22 04:24:59 +00:00
wmcoolmon 6f0832c6d8 DirectX-specific code for movie-playing functions in cutscenes/movie.cpp. Ask RT if you have any questions about it; I just commited it :). 2003-02-22 04:20:47 +00:00
wmcoolmon 33c321d328 Movie playing code; use movie_play and movie_play_two to play movies using Directshow. Depends on directx/dx8show.cpp 2003-02-22 04:17:58 +00:00
wmcoolmon 16fdb53870 Added "os_app_activate_set" 2003-02-22 04:14:21 +00:00
wmcoolmon b5ab80797d Added "-dshowvid" command-line option, which must be set in order for movies to play. 2003-02-22 04:13:17 +00:00
phreak 1385a9c6ac stupid typo -- my bad 2003-02-16 19:00:56 +00:00
phreak a11c390fd5 fixed typecasting warnings 2003-02-16 18:55:59 +00:00
phreak a498b79b2d fixed around splash screen
2_splash.pcx is loaded in 1024x768
splash.pcx is loaded in 640x480 or 2_splash.pcx isn't found
2003-02-16 18:53:59 +00:00
phreak 6a22f2443e tweaked some more stuff 2003-02-16 18:43:13 +00:00
bobboau cd2597f3a2 added glow map nebula bug fix for d3d, someone should add a fix for glide too
more importantly I (think I) have fixed all major bugs with fighter beams, and added a bit of new functionality
2003-02-16 05:14:29 +00:00
Goober5000 d32a38c267 fixed version bumpage... the version is 3.5.0, not 3.50.0 ;)
--Goober5000
2003-02-05 07:04:31 +00:00
Goober5000 64bcc9942e made my fighterbay code more forgiving of eccentric modeling hacks...
ships can now use the Faustus hangar again :)
--Goober5000
2003-02-05 06:57:56 +00:00
phreak cf750429cb started to finalize before 3.50 release.
added support for GL_EXT_texture_filter_ansiotropic
2003-02-01 02:57:42 +00:00
phreak 32843f18f8 bumped to 3.50 2003-01-30 23:24:34 +00:00
phreak d7bd110ffe cleaned up debug output 2003-01-30 23:19:33 +00:00
phreak 36176b8eb4 enabled RGB lighting for OpenGL 2003-01-30 23:19:14 +00:00
Goober5000 8c94fbd199 finished up my fighterbay code - ships will not be able to arrive from or depart into
fighterbays that have been destroyed (but you have to explicitly say in the tables
that the fighterbay takes damage in order to enable this)
--Goober5000
2003-01-27 07:46:33 +00:00
DTP d9e1e01afc Part of bumping MAX_SHIPS to 250 max_ship_types. Server now no more Crashes on kill, when max_shiptypes is above 200. Note Client still cant join. narrowing it down. 2003-01-27 01:12:15 +00:00
DTP 8edec19426 Part of bumping MAX_SHIPS to 250 max_ship_types. Server now no more Crashes on kill, when max_shiptypes is above 200. Note Client still cant join. narrowing it down. 2003-01-27 00:51:46 +00:00
DTP 5419f3b5de temporary fix, added some // so that we can do debug builds. i expect Goober5000 will fix it soon. 2003-01-26 23:30:53 +00:00
wmcoolmon 6df0403964 Minor mod to preload screen code, added separate 1024x768 logo
-C
2003-01-26 20:04:32 +00:00
Goober5000 2bef522bfc changed change-music to change-soundtrack
--Goober5000
2003-01-26 18:37:19 +00:00
wmcoolmon 4e86a928b3 Added title screen support to retail version. When FS2 loads, it will build a list of PCX files in the current directory, then attempt to display one. If no PCX files exist, it will try to display one of the title screens defined in the code. Freespace 2 will then attempt to superimpose a logo in the upper-left hand corner of the screen. If neither can be displayed, FS2 will function normally. 2003-01-26 02:58:33 +00:00
Goober5000 254b4f6603 oops - fixed the nebula bug that wasn't completely fixed :)
--Goober5000
2003-01-26 00:20:01 +00:00
Goober5000 7373203236 added preloader to change-ship-model and change-ship-class so that the game
doesn't hesitate when switching models in the middle of missions
--Goober5000
2003-01-25 04:54:36 +00:00
Goober5000 55a4c34bab added change-music sexp and bumped MAX_SOUNDTRACKS from 10 to 25
--Ian Warfield
2003-01-25 04:17:39 +00:00
Goober5000 b060ac5928 aw, nuts - fixed a dumb bug with my new don't-collide-invisible code :p
--Goober5000
2003-01-24 03:48:11 +00:00
Goober5000 ab27958761 fixed a small nebula ship trail bug
--Goober5000
2003-01-24 03:15:11 +00:00
Goober5000 dca1600f46 fixed a few bugs in Bobboau's implementation of the glow sexps; also added
help for the sexps in sexp_tree
--Goober5000
2003-01-21 17:24:16 +00:00
bobboau 218ac8a0d7 added several sExps for turning glow points and glow maps on and off 2003-01-20 05:40:50 +00:00
Goober5000 cac96f1a44 cleaned up build output a bit
--Goober5000
2003-01-19 22:45:35 +00:00
Goober5000 55948f0db1 removed unreferenced variable
--Goober5000
2003-01-19 22:25:10 +00:00
Goober5000 c80033de55 fixed a bunch of bugs -- the support ship sexp, the "no-subspace-drive" flag,
and departure into hangars should now all work properly
--Goober5000
2003-01-19 22:20:23 +00:00
Goober5000 dd378506ee fixed fiddly code
--Goober5000
2003-01-19 09:14:05 +00:00
Goober5000 9e890d8df5 more tweaky bug fixes
--Goober5000
2003-01-19 09:10:40 +00:00
Goober5000 f4030700dc fixed two dumb bugs in the set-support-ship code
--Goober5000
2003-01-19 08:37:52 +00:00
Goober5000 b7f924ea6b actually added the set-support-ship sexp; much of the other commit was
groundwork (data types and stuff)
--Goober5000
2003-01-19 07:45:38 +00:00
Goober5000 c5c4fd08e9 oops - forgot a bit of departure code :)
--Goober5000
2003-01-19 07:13:05 +00:00
Goober5000 bf7871905e fixed a bunch of bugs - "no-subspace-drive" should now work properly for
all ships, and all ships who have their departure anchor set to a capital ship
should exit to that ship when told to depart
--Goober5000
2003-01-19 07:02:16 +00:00
Goober5000 28ef47c26f got rid of nameplate stuff (superceded by texture replacement)
--Goober5000
2003-01-19 06:44:39 +00:00
bobboau 7a6e12df06 redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it 2003-01-19 01:07:43 +00:00
Goober5000 97130623dc made "no-subspace-drive" applicable to all ships and fixed a really *STUPID*
bug that made FRED keep crashing (missing comma, bleagh!)
--Goober5000
2003-01-18 23:25:39 +00:00
phreak a1ad295557 added 'ddsutils' folder to project 2003-01-18 20:00:49 +00:00
phreak ecc552eda8 fixed around the bmpman system to now accept compressed textures 2003-01-18 19:55:16 +00:00
phreak 56d7afd8a0 texture mapper now supports DXTC compressed textures 2003-01-18 19:49:45 +00:00
phreak 46e465b1d2 added tcache flag TCACHE_FLAG_COMPRESSED 2003-01-18 19:49:02 +00:00
phreak 4c52cb0441 added some defines that deal with mages using DXTC 2003-01-18 19:48:19 +00:00
phreak 4da09ccefc these files deal with reading .dds files which use DXTC texture compression 2003-01-18 19:45:20 +00:00
Goober5000 389921bd48 added "no-subspace-drive" flag for ships
--Goober5000
2003-01-18 10:00:43 +00:00
Goober5000 e9f6827211 fixed bug I inadvertently introduced by modifying SIF_ flags with sexps rather
than SF_ flags
--Goober5000
2003-01-18 09:25:42 +00:00
Goober5000 042d935a80 fixed some really strange behavior with strings not being truncated at the
# symbol
--Goober5000
2003-01-17 07:59:09 +00:00
Goober5000 1f7fee5baa Allowed selection of either $Texture Replace, which keeps track of individual
replacement textures for a ship, or $Duplicate Model Texture Replace, which
duplicates a model and reskins it.  Use $Duplicate Model Texture Replace
if you want to substitute an animated texture or a transparent texture.
--Goober5000
2003-01-17 04:57:17 +00:00
Goober5000 ff33077291 added capability to the $Texture replace code to substitute the textures
without needing and extra model, however, this way you can't substitute
transparent or animated textures
--Goober5000
2003-01-17 01:48:50 +00:00
Goober5000 70c909302c yay! got texture replacement to work!!!
--Goober5000
2003-01-16 06:49:11 +00:00
Goober5000 900f57bc94 NOW the model duplicates work! :p
still gotta do the textures, but it shouldn't be hard now
--Goober5000
2003-01-15 23:23:30 +00:00
anonymous 41fabe25bd fixed the demo compilation. Define FS2_DEMO globally to compile as a demo. Make sure warp.pof is in your data/models directory. 2003-01-15 21:29:05 +00:00
inquisitor 1e634da6dd Test commit, ignore 2003-01-15 20:49:50 +00:00
Goober5000 a4386862f5 did the XSTR for the turret thing
--Goober5000
2003-01-15 20:49:10 +00:00
Goober5000 7435ddd89b oops, that'll introduce a bug - naming it just plain "Turret" instead
--Goober5000
2003-01-15 16:52:27 +00:00
Goober5000 f1e5508023 capship ballistic weapon displays "Cannon" on HUD instead of "Laser Turret"
--Goober5000
2003-01-15 16:48:59 +00:00
Goober5000 0fd8e46ea2 assigning duplicate models to ships now works; committing so I have a base
to fall back to as I work on texture replacement
--Goober5000
2003-01-15 08:57:23 +00:00
Goober5000 cb4764e8d0 changed most references to modelnum to use ship instead of ship_info --
this will help with the change-model sexp and any other instances of model
changing
--Goober5000
2003-01-15 07:09:09 +00:00
Goober5000 0c55ff682b added texture replacement parse - will be implemented later
--Goober5000
2003-01-15 05:24:23 +00:00
Goober5000 8659222b82 bumped main halls down to 10
--Goober5000
2003-01-15 05:19:07 +00:00
Goober5000 64b2332534 moved texture loading around a bit; added Texture_replace in preparation
for some cool stuff
--Goober5000
2003-01-15 05:18:13 +00:00
Goober5000 303278228a argh - fixed the stupid message persona bug with <any wingman>
Bobboau, please check your code!
--Goober5000
2003-01-14 06:13:23 +00:00
Goober5000 16baec8877 commented out some mprintfs that were clogging up the debug spew
--Goober5000
2003-01-14 05:53:58 +00:00
Goober5000 0b7cc9aa9d fixed minor potential bug
--Goober5000
2003-01-14 04:01:33 +00:00
Goober5000 77bc1ed93b allowed for up to 256 main halls
--Goober5000
2003-01-14 04:00:16 +00:00
Goober5000 d2969046d4 bug hunting; fixed the beam whack effect bug
--Goober5000
2003-01-13 23:20:01 +00:00
wmcoolmon b3c67343e5 Added MISSION_FLAG_NO_NEB_TRAILS and removed MISSION_FLAG_ST_OVERRIDE_NEB. Also changed code to set flags as necessary 2003-01-13 02:09:12 +00:00
wmcoolmon f26624902f Very slightly optimized code 2003-01-12 03:26:41 +00:00
wmcoolmon f96196c271 It turns out the version in the CVS did not toggle the ship trails with the flag...fixed this. 2003-01-12 00:19:55 +00:00
wmcoolmon f47b3c0fd0 Added code for "Ship Trails override Nebula" 2003-01-11 01:00:25 +00:00
Goober5000 170ac43ebe I found these two beautiful functions in ship.cpp - ship_change_model
and change_ship_type - so I made them into sexps :)
--Goober5000
2003-01-10 04:14:19 +00:00
inquisitor 93e0b43b03 Rollback to 2.7 to fix glow code issue that phreak noticed.
-Quiz
2003-01-09 22:23:38 +00:00
phreak b9c9069c5a fixed a small error in bob's glowmap code 2003-01-09 21:22:36 +00:00
phreak fdc9b42d14 fixed a small error in bob's code 2003-01-09 21:20:21 +00:00
phreak 6cb690996d glowmaps in OpenGL, yay! 2003-01-09 21:19:54 +00:00
phreak eb63396934 glowmaps unloaded if their parent is 2003-01-09 21:19:25 +00:00
Goober5000 f1aa394d29 fixed the giant thruster glow bug
--Goober5000
2003-01-09 05:55:55 +00:00
Goober5000 415969fca0 snagged a potential bug
--Goober5000
2003-01-09 05:52:25 +00:00
Goober5000 dfbd9ad9d0 fixed debriefing music in non-campaign missions
--Goober5000
2003-01-08 19:49:15 +00:00
Goober5000 a50424930b added ai-chase-any-except sexp
--Goober5000
2003-01-07 20:06:44 +00:00
phreak 9843ff7b49 fixed problem in win32_create_window() that disabled OpenGL from running in windowed mode 2003-01-07 00:02:08 +00:00
Goober5000 7ea79b3ed4 implemented keep-safe-distance
--Goober5000
2003-01-06 22:57:23 +00:00
Goober5000 b783b7e364 allowed fighters and bombers to accept the stay-near-ship and
keep-safe-distance orders
--Goober5000
2003-01-06 21:52:58 +00:00
Goober5000 60d0011159 nasssty bugs, we hates them, yesss we do, preciousssss
:)
--Goober5000
2003-01-06 20:29:28 +00:00
Goober5000 e730044cc1 cleaned up some stuff with model_set_thrust and a commented Assert that
shouldn't have been
--Goober5000
2003-01-06 19:33:22 +00:00
Goober5000 60ea566ecc a wee failsafe added
--Goober5000
2003-01-06 18:50:37 +00:00
Goober5000 fd797419dd hmm... moved +Squad Logo to immediately beneath $Name
--Goober5000
2003-01-06 17:19:14 +00:00
Goober5000 3a5a785f51 added wing configurable squad logos - put +Squad Logo: filename.pcx as
the last entry in each wing that you want (but the player's squad logo will
still be the squad logo for the player's wing)
--Goober5000
2003-01-06 17:14:52 +00:00
bobboau 65564198ef disabled decals (for now), removed the warp ray thingys,
made some better error mesages while parseing weapons and ships tbls,
and... oh ya, added glow mapping
2003-01-05 23:41:51 +00:00
Goober5000 def0b0ceb0 added capability of is-iff and change-iff to have wings as well as ships
as their arguments; also allowed a bunch of sexps to accept the player
as an argument where they would previously display a parse error
--Goober5000
2003-01-05 01:26:35 +00:00
Goober5000 01776721ab fixed the order sexp
--Goober5000
2003-01-04 23:15:39 +00:00
Goober5000 6f7d012184 Fixed some minor bugs, and added a primitive-sensors flag, where if a ship
has primitive sensors it can't target anything and objects don't appear
on radar if they're outside a certain range.  This range can be modified
via the sexp primitive-sensors-set-range.
--Goober5000
2003-01-03 21:58:08 +00:00
Goober5000 7d4d468e58 this is the way we squash the bugs, squash the bugs, squash the bugs
this is the way we squash the bugs, so early in the morning :p
--Goober5000
2003-01-02 03:09:01 +00:00
Goober5000 d1a870b372 added don't-collide-invisible and collide-invisible sexps
--Goober5000
2003-01-02 00:35:21 +00:00
Goober5000 680e55e493 added ship-vaporize and ship-no-vaporize sexps
--Goober5000
2003-01-01 23:33:34 +00:00
Goober5000 c779bae39a bumped to 3.4
--Goober5000
2002-12-31 20:09:14 +00:00
Goober5000 5a4fafec31 tweaked stuff
--Goober5000
2002-12-31 19:35:14 +00:00
Goober5000 cfcc94c2bb if it ain't broke, don't fix it
--Goober5000
2002-12-31 19:18:41 +00:00
Goober5000 8d1c8fad7c if it ain't broke, don't fix it
--Goober5000
2002-12-31 18:59:43 +00:00
Goober5000 c6cc437092 simplified end-user implementation of ballistic primaries
--Goober5000
2002-12-31 08:20:31 +00:00
Goober5000 6a30e96439 added damaged-escort-priority-all sexp
--Goober5000
2002-12-31 07:26:40 +00:00
Goober5000 95d7869aa6 fixed escort list behavior for stealthy ships
--Goober5000
2002-12-31 05:17:13 +00:00
Goober5000 95a26b87ce made force feedback stronger when firing ballistic primaries
--Goober5000
2002-12-30 06:16:09 +00:00
phreak 6c0bfdd0b7 added damage-escort-list as a new sexp 2002-12-27 20:16:18 +00:00
Goober5000 0e19a3a614 the insidious beam bug is now squashed AND committed!
--Goober5000
2002-12-27 17:58:11 +00:00
Goober5000 35350315b7 removed the existing stealth sexps and replaced them with the following...
ship-stealthy
ship-unstealthy
is-ship-stealthy
friendly-stealth-invisible
friendly-stealth-visible
is-friendly-stealth-visible
--Goober5000
2002-12-27 02:57:51 +00:00
Goober5000 8f97380d75 meh - changed is-cargo-x to is-cargo
--Goober5000
2002-12-25 01:22:23 +00:00
Goober5000 fe6bac98c7 added change-ai-class and is-ai-class, and I think I may also have nailed the
is-iff bug; did some other bug hunting as well
--Goober5000
2002-12-24 07:42:29 +00:00
Goober5000 77c5502b19 added a wee cautionary note
--Goober5000
2002-12-24 07:38:59 +00:00
Goober5000 065eb6f1d5 added set-cargo and is-cargo-x sexps
--Goober5000
2002-12-23 23:01:27 +00:00
phreak 103e4b2b22 defined USE_OPENGL for debug and release builds 2002-12-23 21:13:41 +00:00
phreak cb4e5b551f dumb typo 2002-12-23 19:25:39 +00:00
phreak c22d9a7e99 added code that displays an error if user's OGL version is less than 1.2 2002-12-23 17:52:51 +00:00
Goober5000 2b52cf3896 Bah - Andsager is a moron. :) I see no reason why rand shouldn't work
multiple times.  It's been fixed thus.
--Goober5000
2002-12-23 05:41:08 +00:00
Goober5000 5b16bd3748 Squashed some Volition bugs! :O Some of the sexps for dealing with more than
one ship would return after only dealing with the first ship.

Also added the following sexps:
is-ship-stealthed
ship-force-stealth
ship-force-nostealth
ship-remove-stealth-forcing

They toggle the stealth flag on and off.  If a ship is forced stealthy, it won't even
show up for friendly ships.
--Goober5000
2002-12-23 05:18:52 +00:00
Goober5000 40bbe0cd39 removed stipulation that "Instructor" be present for training-msg sexp to work
--Goober5000

(This is fun! :))
2002-12-23 01:47:17 +00:00
Goober5000 661dc39d9c hack: turn on ship trails if in nebula - restores backward compatibility
--Goober5000
2002-12-22 22:59:04 +00:00
Goober5000 07c240e9a1 tweaked positioning of the new HUD graphics
--Goober5000
2002-12-22 21:31:01 +00:00
Goober5000 93f20cb8e4 added primaries-depleted and primary-ammo-pct sexps -- useful for ships with
ballistic primaries
--Goober5000
2002-12-22 21:12:22 +00:00
Goober5000 e512f60386 Subcategories implemented. :) So far all that's been done is the Change menu, but other
subcategorizations are possible.  Here are the instructions from sexp.h...
"Adding more subcategories is possible with the new code.  All that needs to be done is
to add a #define here (a number from 0x0000 to 0x00ff ORred with the category that it
goes under), some appropriate case statements in get_subcategory() (in sexp.cpp) that
will return the subcategory for each sexp that uses it, and the submenu name in the
op_submenu[] array in sexp_tree.cpp."

Please note that I rearranged a whole bunch of sexps in the Operators[] array in sexp.cpp
in order to make the subcategories work better, so if you get a whole bunch of differences
or even conflicts, just ignore them. :)
--Goober5000
2002-12-22 17:22:47 +00:00
Goober5000 59442ea786 commented out the warning if you don't have the new ballistic HUD graphics - it would probably get annoying (just use the old ones without comment)
--Goober5000
2002-12-21 18:03:49 +00:00
Goober5000 ee8a7f67a7 rearranged the sexp list and got the preliminary subcategories working - still need to work on the actual submenu
--Goober5000
2002-12-21 17:58:11 +00:00
DTP c2c24787da did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe 2002-12-21 13:39:25 +00:00
Goober5000 60f69cb79b Updated the cargo-known-delay and cap-subsys-cargo-known-delay sexps to work correctly if set-scanned and set-unscanned are used repeatedly with the same ship or ship subsystem. In most cases, this functionality will never be needed, but it's nice to know that it's here. :) However, I should point out that cap-subsys-cargo-known-delay will recognize only the first instance of a subsystem being revealed once the ship is no longer in the mission. Here is the relevant bit I put into the sexp handling routine...
"Since there is no way to keep track of subsystem status once a ship has departed or has been destroyed, check the mission log.  This will work in 99.9999999% of all cases; however, if the mission designer repeatedly sets and resets the scanned status of the subsystem, the mission log will only return the first occurrence of the subsystem cargo being revealed (regardless of whether it was first hidden using set-unscanned).  Normally, ships keep track of cargo data in the subsystem struct, but once/ the ship has left the mission, the subsystem linked list is purged, causing the loss of this information.  I judged the significant rework of the subsystem code not worth the rare instance that this sexp may be required to work in this way, especially since this problem only occurs after the ship departs.  If the mission designer really needs this functionality, he or she can achieve the same result with creative combinations of event chaining and is-event-true."

Please note that this problem only occurs with cap-subsys-cargo-known-delay, only if the subsystem scanned status is revealed more than once, and then only after the ship is no longer in the mission.  Sufficiently rare, I figured, that I could afford to not worry about it.
--Goober5000
2002-12-20 07:17:23 +00:00
Goober5000 3bc70fc2c2 added capability of storing time_subsys_cargo_revealed
--Goober5000
2002-12-20 07:09:03 +00:00
DTP f09a3c0a09 DTP FIX, fast fix to the beam/shield bug problem. will maybe commit later when i find out why this is getting triggered when it should not 2002-12-20 00:50:41 +00:00
Goober5000 f15a879898 oops - squashed a bug :)
--Goober5000
2002-12-19 10:54:37 +00:00
Goober5000 984f3f0aa7 implemented the revised HUD weapon display for ballistic primaries
--Goober5000
2002-12-19 10:46:14 +00:00
phreak 1559d18757 tidied up game_init() a bit.. took out a bunch of unneeded ifdefs like E3_BUILD
Added option to access OpenGL from the registry keys.  searches for "OpenGL-"
whoever is in charge of the launcher might want to know this.
2002-12-18 22:21:23 +00:00
Goober5000 c2c0ca0eeb added set-scanned and set-unscanned sexps
PLEASE NOTE: These sexps will cause cargo-known-delay and cap-subsys-cargo-known-delay to not work correctly if set-scanned and set-unscanned are used more than once.  I'll fix this later.

--Goober5000
2002-12-17 03:25:30 +00:00
DTP 754c35f2f5 fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED. 2002-12-17 03:08:18 +00:00
DTP 2bbd5a806b wrong name :) 2002-12-17 02:22:34 +00:00
Goober5000 5891192fda cosmetic fixed; also OP_SET_SCANNED and OP_SET_UNSCANNED added in preparation for the set-scanned and set-unscanned sexp commit
--Goober5000
2002-12-17 02:21:42 +00:00
DTP 5effb36530 cleaned up after Goober5000 :). it will make a mess in debug builds. added a couple of ifndef _debugs. 2002-12-17 02:21:06 +00:00
Goober5000 bc72cea911 added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
--Goober5000
2002-12-17 02:18:40 +00:00
DTP ec8886cf09 Bumped MAX JUMP-nodes to 50. if anybody wants a Jump-node forest 2002-12-17 01:56:36 +00:00
phreak bce0cc4ca0 optimized fullscreen/minimized functions.. alot faster 2002-12-16 23:28:52 +00:00
DTP 66eaf28ac8 fixed a minor glitch, replaced <> with ", so that it takes project glXXX.h, and not compilers glXXX.h 2002-12-15 18:59:57 +00:00
phreak d728b3d745 opengl headers 2002-12-15 16:57:15 +00:00
DTP 11426ed5a2 FIX; player can now have all ships set in FRED2 as allowed playerships in singleplayer 2002-12-15 06:50:49 +00:00
DTP 386abb7000 Bumped fire_dealy on_empty_secondary to 1000 2002-12-15 06:29:24 +00:00
Goober5000 476fb7bbfc removed mission flag for fighterbay damage; instead made damage display contingent on whether the fighterbay subsystem is assigned a damage percentage in ships.tbl
--Goober5000
2002-12-14 17:09:28 +00:00
phreak c825720ae0 added a command line that displays frames per second when enabled.
use "-fps"
2002-12-14 17:09:08 +00:00
phreak 6e407fff7b copied from grgpenglw32x.cpp. 2002-12-14 16:14:52 +00:00
Goober5000 11b24d23aa added mission flag to show subsystem damage for fighterbays
~Goober5000~
2002-12-14 01:55:04 +00:00
Goober5000 2135e20299 small tweaks and bug fixes for the ballistic primary conversion
~Goober5000~
2002-12-13 08:13:30 +00:00
Goober5000 123277167b added distance-ship-subsystem sexp
~Goober5000~
2002-12-12 08:01:57 +00:00
Goober5000 4a9f85674f Full-fledged ballistic primary support added! Try it and see! :) 2002-12-10 05:43:35 +00:00
Goober5000 719579177e Full-fledged ballistic primary support added! Try it and see! :)
Fixed lead indicator behavior; Phreak's version didn't work properly.
2002-12-10 05:42:42 +00:00
Goober5000 3f6a1f33d4 Full-fledged ballistic primary support added! Try it and see! :)
Preliminary support added for selecting additional primaries (more than 2) and secondaries (more than 3) if this is implemented later.
Transports can now dock with fighters, bombers, & stealth ships.
2002-12-10 05:41:38 +00:00
DTP 688dee73c2 DTP; added decals.h and decals.cpp to the project, aswell as the directory 2002-12-10 00:44:38 +00:00
Goober5000 5fa10d82f4 fixed misspelling 2002-12-09 08:37:31 +00:00
Goober5000 4cde77929f fixed misspelling 2002-12-09 08:26:24 +00:00
bobboau 41f66ee2f3 inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
it needs a better renderer, but is in prety good shape for now,
I also (think) I squashed a bug in the warpmodel code
2002-12-07 01:37:43 +00:00
phreak 2ee9db9479 extension framework implemented(no extensions work YET) -phreak 2002-12-05 00:49:25 +00:00
DTP f87883712e lowered MAX_POLYGON_MODELS FROM 198 to 128 for safety reasons since we bumped back MAX_SHIP_TYPES to 130 2002-12-04 09:44:34 +00:00
Goober5000 ea22ebfe09 implemented beam-free-all-by-default mission flag 2002-12-03 23:05:13 +00:00
Goober5000 0edd905be5 added myself to the credits list :)
~Goober5000
2002-12-03 22:14:06 +00:00
Goober5000 47e2ff7500 fixed player-entry-delay bug 2002-12-03 00:00:52 +00:00
Goober5000 c011621363 fixed misspelling 2002-12-02 23:56:12 +00:00
Goober5000 8c47d95901 fixed misspelling 2002-12-02 23:26:08 +00:00
Goober5000 e08be40462 fixed misspelling of "category" as "catagory" 2002-12-02 23:24:35 +00:00
Goober5000 d7022ad67b commented out an unneeded variable (int ret) in psnet_socket_options 2002-12-02 23:18:53 +00:00
Goober5000 38f435eba8 commented out an unneeded variable (ship *shipp) in model_really_render 2002-12-02 23:16:45 +00:00
Goober5000 6f429c16ee fixed mispelling of "category" as "catagory" 2002-12-02 23:14:17 +00:00
Goober5000 dfaebd0908 fixed mispelling of "category" as "catagory" 2002-12-02 20:49:14 +00:00
Goober5000 d6abb06544 fixed mispelling of "category" as "catagory" 2002-12-02 20:37:26 +00:00
sesquipedalian d950369202 end-mission sexp added 2002-11-28 00:00:37 +00:00
sesquipedalian 745fc385e9 Added Phreak's fix for the weapons room bug. Can now view a modified weapons.tbl in the tech room without crashing 2002-11-27 01:20:51 +00:00
phreak f02a1caced added OGL_inited global. Sets to 0 even if OGL isn't defined by preproccessor
-phreak
2002-11-22 20:56:15 +00:00
phreak e547962d31 changed around some page-in functions to work with opengl
changed bm_set_components_opengl
-phreak
2002-11-22 20:55:27 +00:00
phreak 31fe8e2a4c finished off all remaining problems with 32 bit mode, fullscreen mode
and colors.  Still needs some tweaking, but works near perfect
2002-11-22 20:54:16 +00:00
phreak 1b1dc86fb6 added some opengl defines for shield detail -phreak 2002-11-22 20:52:29 +00:00
DTP 7539390fc3 DTP; fix at line 6785 in parse/SEXP.cpp, a forgotten "{", when the is tagged thing was Fixed 2002-11-20 21:22:31 +00:00
sesquipedalian ad7b508184 Adding in EdrickV's fix to the is-tagged sexp. 2002-11-19 02:15:50 +00:00
phreak 0fa37a5b62 made ogl be used if "NDEBUG" is not defined and "USE_OPENGL" is defined - phreak 2002-11-18 21:34:16 +00:00
phreak 1cbfc73384 added some lines that makes ogl work in windowed mode for fullneb - phreak 2002-11-18 21:32:48 +00:00
phreak c58ae29dd5 added some ogl functionality - phreak 2002-11-18 21:32:11 +00:00
phreak 96e442b564 complete overhaul, works in 16 bit mode -phreak 2002-11-18 21:31:36 +00:00
phreak e817f867af added bm_select_components functions for OpenGL -phreak 2002-11-18 21:27:13 +00:00
bobboau 8c8c96bb89 added nameplate code 2002-11-14 06:15:03 +00:00
bobboau f0e7af10bb added warp model and type 1 glow points
and well as made the new glow file type,
some general improvement to fighter beams,
2002-11-14 04:18:17 +00:00
phreak 4e44bcfdef updated parse_weapon to parse custom corkscrew missiles 2002-11-11 20:18:30 +00:00
phreak d4cea3a9ff changed around the 'weapon_info' struct to allow for custom corkscrew missiles 2002-11-11 20:11:02 +00:00
phreak f06b7dfd20 changed cscrew_create and cscrew_process_post
to allow for custom corkscrew properties
2002-11-11 20:09:12 +00:00
phreak 6dd4f692e2 changed a line in ship_fire_secondary to allow for custom
amounts of corkscrew missiles fired
2002-11-11 20:05:52 +00:00
133 changed files with 23980 additions and 3676 deletions

No files matched your search

+2 -2
View File
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /I "code" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "WIN32" /U "_DEBUG" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /I "code" /D "_MBCS" /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "USE_OPENGL" /U "_DEBUG" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -69,7 +69,7 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W4 /Gm /Gi /GX /ZI /Od /I "code" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "NO_CD_CHECK" /D "USE_DX81" /U "NDEBUG" /Fr /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W4 /Gm /Gi /GX /ZI /Od /I "code" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "NO_CD_CHECK" /D "USE_DX81" /D "USE_OPENGL" /U "NDEBUG" /Fr /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
+286 -28
View File
@@ -9,13 +9,42 @@
/*
* $Logfile: /Freespace2/code/Bmpman/BmpMan.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.11 $
* $Date: 2003-01-19 01:07:41 $
* $Author: bobboau $
*
* Code to load and manage all bitmaps for the game
*
* $Log: not supported by cvs2svn $
* Revision 2.10 2003/01/18 19:55:16 phreak
* fixed around the bmpman system to now accept compressed textures
*
* Revision 2.9 2003/01/09 22:23:38 inquisitor
* Rollback to 2.7 to fix glow code issue that phreak noticed.
* -Quiz
*
* Revision 2.7 2003/01/05 23:41:50 bobboau
* disabled decals (for now), removed the warp ray thingys,
* made some better error mesages while parseing weapons and ships tbls,
* and... oh ya, added glow mapping
*
* Revision 2.6 2002/12/02 23:26:08 Goober5000
* fixed misspelling
*
* Revision 2.5 2002/12/02 20:46:41 Goober5000
* fixed misspelling of "category" as "catagory"
*
* Revision 2.4 2002/11/22 20:55:27 phreak
* changed around some page-in functions to work with opengl
* changed bm_set_components_opengl
* -phreak
*
* Revision 2.3 2002/11/18 21:27:13 phreak
* added bm_select_components functions for OpenGL -phreak
*
* Revision 2.2 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.1 2002/07/07 19:55:58 penguin
* Back-port to MSVC
*
@@ -250,7 +279,7 @@
* Added code to print the number of bitmap slots in use between levels.
*
* 82 2/16/98 3:54p John
* Changed a bunch of mprintfs to catagorize to BmpInfo
* Changed a bunch of mprintfs to categorize to BmpInfo
*
* 81 2/13/98 5:00p John
* Made user bitmaps not get wrote to level cache file.
@@ -491,11 +520,17 @@
#include "graphics/grinternal.h"
#include "tgautils/tgautils.h"
#include "ship/ship.h"
#include "ddsutils/ddsutils.h"
#ifndef NDEBUG
#define BMPMAN_NDEBUG
#endif
extern int Texture_compression_enabled;
int GLOWMAP = -1;
// keep this defined to use per-ship nondarkening pixels
#define BMPMAN_SPECIAL_NONDARK
@@ -506,6 +541,9 @@ int bm_inited = 0;
#define BM_TYPE_USER 2
#define BM_TYPE_ANI 3 // in-house ANI format
#define BM_TYPE_TGA 4 // 16 bit targa
#define BM_TYPE_DXT1 5 // 24 bit with switchable alpha (compressed)
#define BM_TYPE_DXT3 6 // 32 bit with 4 bit alpha (compressed)
#define BM_TYPE_DXT5 7 // 32 bit with 8 bit alpha (compressed)
typedef union bm_extra_info {
struct {
@@ -544,6 +582,7 @@ typedef struct bitmap_entry {
// Data for animations and user bitmaps
bm_extra_info info;
int mem_taken; //how much memory it takes up
#ifdef BMPMAN_NDEBUG
// bookeeping
ubyte used_last_frame; // If set, then it was used last frame
@@ -751,8 +790,6 @@ void bm_init()
#endif
bm_free_data(i); // clears flags, bbp, data, etc
}
}
#ifdef BMPMAN_NDEBUG
@@ -899,16 +936,15 @@ int bm_load_sub(char *real_filename, char *ext, int *handle)
}
// try and find the file
/*
CFILE *test = cfopen(filename, "rb");
if(test != NULL){
cfclose(test);
return 0;
}
*/
// could not be found
return 0;
return -1;
}
// This loads a bitmap so we can draw with it later.
@@ -922,8 +958,10 @@ int bm_load( char * real_filename )
int w, h, bpp;
char filename[MAX_FILENAME_LEN];
int tga = 0;
int dds = 0;
int handle;
int found = 0;
unsigned char type;
if ( !bm_inited ) bm_init();
@@ -940,23 +978,51 @@ int bm_load( char * real_filename )
//Int3();
*p = 0;
}
// try and find a compressed tex first
// unless we're cant do so
if (Texture_compression_enabled)
{
switch(bm_load_sub(filename, ".dds", &handle)){
// error
case -1:
break;
// found as a file
case 0:
found = 1;
dds=1;
strcat(filename, ".dds");
break;
// found as pre-existing
case 1:
found = 1;
return handle;
}
}
// try and find the pcx file
switch(bm_load_sub(filename, ".pcx", &handle)){
// error
case -1:
break;
if (!found)
{
// found as a file
case 0:
found = 1;
strcat(filename, ".pcx");
break;
// try and find the pcx file
switch(bm_load_sub(filename, ".pcx", &handle)){
// error
case -1:
break;
// found as a file
case 0:
found = 1;
strcat(filename, ".pcx");
break;
// found as pre-existing
// found as pre-existing
case 1:
found = 1;
return handle;
}
}
if(!found){
@@ -979,13 +1045,45 @@ int bm_load( char * real_filename )
}
}
if (dds)
{
int ct;
int dds_error=dds_read_header ( filename, &w, &h, &bpp, &ct);
if (dds_error != DDS_ERROR_NONE)
{
mprintf(("Couldn't open '%s -- error description %s\n", filename, dds_error_string(dds_error)));
return -1;
}
mprintf(("Found a .dds file! %s\n", filename));
switch (ct)
{
case DDS_DXT1:
type=BM_TYPE_DXT1;
break;
case DDS_DXT3:
type=BM_TYPE_DXT3;
break;
case DDS_DXT5:
type=BM_TYPE_DXT5;
break;
default:
Error(LOCATION, "bad DDS file compression. Not using DXT1,3,5 %s", filename);
return -1;
}
}
// if its a tga file
if(tga){
else if(tga){
int tga_error=targa_read_header( filename, &w, &h, &bpp, NULL );
if ( tga_error != TARGA_ERROR_NONE ) {
mprintf(( "Couldn't open '%s'\n", filename ));
return -1;
}
type = BM_TYPE_TGA;
}
// if its a pcx file
else {
@@ -994,6 +1092,7 @@ int bm_load( char * real_filename )
mprintf(( "Couldn't open '%s'\n", filename ));
return -1;
}
type=BM_TYPE_PCX;
}
// Error( LOCATION, "Unknown bitmap type %s\n", filename );
@@ -1019,7 +1118,7 @@ int bm_load( char * real_filename )
// Mark the slot as filled, because cf_read might load a new bitmap
// into this slot.
bm_bitmaps[n].type = tga ? (ubyte)BM_TYPE_TGA : (ubyte)BM_TYPE_PCX;
bm_bitmaps[n].type = type;
bm_bitmaps[n].signature = Bm_next_signature++;
Assert ( strlen(filename) < MAX_FILENAME_LEN );
strncpy(bm_bitmaps[n].filename, filename, MAX_FILENAME_LEN-1 );
@@ -1670,6 +1769,35 @@ void bm_lock_tga( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyt
bm_convert_format( bitmapnum, bmp, bpp, flags );
}
//lock a dds file
void bm_lock_dds( int handle, int bitmapnum, bitmap_entry *be, bitmap *bmp, ubyte bpp, ubyte flags )
{
uint data;
int size;
int error;
Assert(Texture_compression_enabled);
Assert(&be->bm == bmp);
#ifdef BMPMAN_NDEBUG
Assert( be->data_size > 0 );
#endif
//data is malloc'ed in the function
error=dds_read_bitmap( be->filename, &size, &data );
if (error != DDS_ERROR_NONE)
{
Error(LOCATION, "error loading %s -- %s", be->filename, dds_error_string(error));
}
bmp->bpp=bpp;
bmp->data=data;
bmp->flags =0;
be->mem_taken=size;
}
MONITOR( NumBitmapPage );
MONITOR( SizeBitmapPage );
@@ -1703,9 +1831,19 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
} else {
if(flags & BMP_AABITMAP){
Assert( bpp == 8 );
} else {
} else if ((flags & BMP_TEX_NONCOMP) && (!(flags & BMP_TEX_COMP))) {
Assert( bpp == 16 );
}
else if (flags & BMP_TEX_DXT1){
Assert(bpp==24);
}
else if (flags & (BMP_TEX_DXT3 | BMP_TEX_DXT5)){
Assert(bpp==32);
}
else
{
Assert(0); //?
}
}
}
@@ -1788,6 +1926,12 @@ bitmap * bm_lock( int handle, ubyte bpp, ubyte flags )
bm_lock_tga( handle, bitmapnum, be, bmp, bpp, flags );
break;
case BM_TYPE_DXT1:
case BM_TYPE_DXT3:
case BM_TYPE_DXT5:
bm_lock_dds( handle, bitmapnum, be, bmp, bpp, flags );
break;
default:
Warning(LOCATION, "Unsupported type in bm_lock -- %d\n", be->type );
return NULL;
@@ -2050,6 +2194,8 @@ DCF(bmpman,"Shows/changes bitmap caching parameters and usage")
}
}
extern int OGL_inited;
// Marks a texture as being used for this level
void bm_page_in_texture( int bitmapnum, int nframes )
{
@@ -2059,7 +2205,27 @@ void bm_page_in_texture( int bitmapnum, int nframes )
bm_bitmaps[n+i].preloaded = 1;
if ( D3D_enabled ) {
//check if its compressed
if (OGL_inited)
{
switch (bm_bitmaps[n+i].type)
{
case BM_TYPE_DXT1:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT1;
continue;
case BM_TYPE_DXT3:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT3;
continue;
case BM_TYPE_DXT5:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT5;
continue;
}
}
if ( D3D_enabled || OGL_inited ) {
bm_bitmaps[n+i].used_flags = BMP_TEX_OTHER;
} else {
bm_bitmaps[n+i].used_flags = 0;
@@ -2077,7 +2243,7 @@ void bm_page_in_nondarkening_texture( int bitmapnum, int nframes )
bm_bitmaps[n+i].preloaded = 4;
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
bm_bitmaps[n+i].used_flags = BMP_TEX_NONDARK;
} else {
bm_bitmaps[n+i].used_flags = 0;
@@ -2096,7 +2262,26 @@ void bm_page_in_xparent_texture( int bitmapnum, int nframes)
bm_bitmaps[n+i].preloaded = 3;
if ( D3D_enabled ) {
//check if its compressed
if (OGL_inited)
{
switch (bm_bitmaps[n+i].type)
{
case BM_TYPE_DXT1:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT1;
continue;
case BM_TYPE_DXT3:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT3;
continue;
case BM_TYPE_DXT5:
bm_bitmaps[n+i].used_flags = BMP_TEX_DXT5;
continue;
}
}
if ( D3D_enabled || OGL_inited ) {
// bm_bitmaps[n+i].used_flags = BMP_NO_PALETTE_MAP;
bm_bitmaps[n+i].used_flags = BMP_TEX_XPARENT;
} else {
@@ -2115,7 +2300,7 @@ void bm_page_in_aabitmap( int bitmapnum, int nframes )
bm_bitmaps[n+i].preloaded = 2;
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
bm_bitmaps[n+i].used_flags = BMP_AABITMAP;
} else {
bm_bitmaps[n+i].used_flags = 0;
@@ -2238,7 +2423,10 @@ int bm_get_cache_slot( int bitmap_id, int separate_ani_frames )
{
int n = bitmap_id % MAX_BITMAPS;
Assert( bm_bitmaps[n].handle == bitmap_id ); // INVALID BITMAP HANDLE
if( bm_bitmaps[n].handle != bitmap_id ){//this should rightfully squash the invalid bitmap handel bug for the glow mapping
mprintf(("bitmap handel %d is not equil to bitmap id %d",bm_bitmaps[n].handle,bitmap_id));
return -1; // INVALID BITMAP HANDLE
}
bitmap_entry *be = &bm_bitmaps[n];
@@ -2334,6 +2522,22 @@ void bm_set_components_argb_d3d_32_tex(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte
}
}
void bm_set_components_opengl(ubyte *pixel, ubyte *rv, ubyte *gv, ubyte *bv, ubyte *av)
{
// rgba
*((ushort*)pixel) |= (ushort)(( (int)*rv / Gr_current_red->scale ) << Gr_current_red->shift);
*((ushort*)pixel) |= (ushort)(( (int)*gv / Gr_current_green->scale ) << Gr_current_green->shift);
*((ushort*)pixel) |= (ushort)(( (int)*bv / Gr_current_blue->scale ) << Gr_current_blue->shift);
*((ushort*)pixel) &= ~(0x8000);
if (*((ushort*)pixel) == (ushort)Gr_current_green->mask) {
*((ushort*)pixel) = 0;
} else {
if(*av){
*((ushort*)pixel) |= 0x8000;
}
}
}
// for selecting pixel formats
void BM_SELECT_SCREEN_FORMAT()
{
@@ -2361,6 +2565,13 @@ void BM_SELECT_SCREEN_FORMAT()
#endif // ifndef NO_DIRECT3D
}
}
#ifdef USE_OPENGL
else if (gr_screen.mode == GR_OPENGL)
{
bm_set_components = bm_set_components_opengl;
}
#endif
#else
bm_set_components = bm_set_components_argb_d3d_16_screen;
#endif // ifdef WIN32
@@ -2392,6 +2603,12 @@ void BM_SELECT_TEX_FORMAT()
#endif
}
}
#ifdef USE_OPENGL
else if (gr_screen.mode == GR_OPENGL)
{
bm_set_components = bm_set_components_opengl;
}
#endif
#else
bm_set_components = bm_set_components_argb_d3d_16_tex;
#endif // ifdef WIN32
@@ -2423,6 +2640,12 @@ void BM_SELECT_ALPHA_TEX_FORMAT()
#endif
}
}
#ifdef USE_OPENGL
else if (gr_screen.mode == GR_OPENGL)
{
bm_set_components = bm_set_components_opengl;
}
#endif
#else
bm_set_components = bm_set_components_argb_d3d_16_tex;
#endif // ifdef WIN32
@@ -2611,3 +2834,38 @@ void bm_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h)
*w = sx < (sections->num_x - 1) ? MAX_BMAP_SECTION_SIZE : bw - sections->sx[sx];
*h = sy < (sections->num_y - 1) ? MAX_BMAP_SECTION_SIZE : bh - sections->sy[sy];
}
int bm_is_compressed(int num)
{
int n=num % MAX_BITMAPS;
//duh
if (!Texture_compression_enabled)
return 0;
Assert(num==bm_bitmaps[n].handle);
switch (bm_bitmaps[n].type)
{
case BM_TYPE_DXT1:
return 1;
case BM_TYPE_DXT3:
return 2;
case BM_TYPE_DXT5:
return 3;
}
return 0;
}
//needed only for compressed bitmaps
int bm_get_size(int num)
{
int n=num % MAX_BITMAPS;
if (!bm_is_compressed(num))
return 0;
Assert(num==bm_bitmaps[n].handle);
return bm_bitmaps[n].mem_taken;
}
+19 -3
View File
@@ -9,13 +9,24 @@
/*
* $Logfile: /Freespace2/code/Bmpman/BmpMan.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:21 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-01-19 01:07:41 $
* $Author: bobboau $
*
* Prototypes for Bitmap Manager functions
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2003/01/18 19:55:16 phreak
* fixed around the bmpman system to now accept compressed textures
*
* Revision 2.1 2003/01/05 23:41:50 bobboau
* disabled decals (for now), removed the warp ray thingys,
* made some better error mesages while parseing weapons and ships tbls,
* and... oh ya, added glow mapping
*
* 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
*
@@ -351,4 +362,9 @@ void bm_get_components(ubyte *pixel, ubyte *r, ubyte *g, ubyte *b, ubyte *a);
// given a bitmap and a section, return the size (w, h)
void bm_get_section_size(int bitmapnum, int sx, int sy, int *w, int *h);
extern int GLOWMAP; //this holds a reference to a map that is a fully lit version of it's index -Bobboau
int bm_is_compressed(int num);
int bm_get_size(int num);
#endif
+37 -3
View File
@@ -9,11 +9,30 @@
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.cpp $
* $Revision: 2.11 $
* $Date: 2002-11-10 16:32:42 $
* $Author: DTP $
* $Revision: 2.17 $
* $Date: 2003-02-22 04:13:17 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2002/12/21 13:39:25 DTP
* did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
*
* Revision 2.15 2002/12/17 03:08:18 DTP
* fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED.
*
* Revision 2.14 2002/12/17 02:22:34 DTP
* wrong name :)
*
* Revision 2.13 2002/12/17 02:21:06 DTP
* cleaned up after phreak :). it will make a mess in debug builds. added a couple of ifndef _debugs.
*
* Revision 2.12 2002/12/14 17:09:08 phreak
* added a command line that displays frames per second when enabled.
* use "-fps"
*
* Revision 2.11 2002/11/10 16:32:42 DTP
* -DTP reworked mod support,
*
* Revision 2.10 2002/11/10 16:30:53 DTP
* -DTP reworked mod support,
*
@@ -278,7 +297,9 @@ cmdline_parm almission_arg("-almission", NULL); //DTP for autoload Multi mission
cmdline_parm gf4fix_arg("-GF4FIX", NULL); //DTP for random tigers GF4fix
cmdline_parm allslev_arg("-ALLSLEV", NULL); //Give access to all single player missions
cmdline_parm phreak_arg("-phreak", NULL); // Change to phreaks options including new targetting code
cmdline_parm dshowvid_arg("-dshowvid", NULL); // Allows video streaming
cmdline_parm mod_arg("-mod", NULL); //DTP modsupport
cmdline_parm fps_arg("-fps", NULL);
int Cmdline_multi_stream_chat_to_file = 0;
int Cmdline_freespace_no_sound = 0;
@@ -310,6 +331,8 @@ int Cmdline_window = 0;
int Cmdline_gf4fix = 0; // DTP for randomstigers GF4 fix.
int Cmdline_allslev = 0;
int Cmdline_phreak = 0;
int Cmdline_dshowvid = 0;
int Cmdline_show_fps = 0;
@@ -688,9 +711,20 @@ int parse_cmdline(int argc, char *argv[])
Cmdline_phreak = 1;
}
if(dshowvid_arg.found() ) {
Cmdline_dshowvid = 1;
}
if(mod_arg.found() ) {
Cmdline_mod = mod_arg.str();
}
if (fps_arg.found())
{
Cmdline_show_fps = 1;
}
return 1;
}
+22 -3
View File
@@ -10,11 +10,26 @@
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
* $Revision: 2.12 $
* $Date: 2002-11-10 16:30:53 $
* $Author: DTP $
* $Revision: 2.17 $
* $Date: 2003-02-22 04:13:17 $
* $Author: wmcoolmon $
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2002/12/21 13:39:25 DTP
* did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
*
* Revision 2.15 2002/12/17 03:08:18 DTP
* fix to Show_framerate. seems it will call an unresolved external error during fred builds. modified my ifndefs a bit, dsw modified to include preprocessor tag FRED.
*
* Revision 2.14 2002/12/17 02:22:34 DTP
* wrong name :)
*
* Revision 2.13 2002/12/17 02:21:06 DTP
* cleaned up after phreak :). it will make a mess in debug builds. added a couple of ifndef _debugs.
*
* Revision 2.12 2002/11/10 16:30:53 DTP
* -DTP reworked mod support,
*
* Revision 2.11 2002/10/31 21:14:16 DTP
* DTP Quickly added something needed to cmdline.h, since otherwise we can not compile the code as it misses some externals. Thought a rollback rolled all back.
*
@@ -225,6 +240,10 @@ 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_dshowvid; //WMC Toggles movie playing support
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.
#endif
+51 -7
View File
@@ -41,7 +41,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "..\Release\Profile"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /Ob2 /I "." /D "_WINDOWS" /D "WIN32" /D "NDEBUG" /U "_DEBUG" /YX /FD /c
# ADD CPP /nologo /G5 /MT /W4 /GX /Zi /Ot /Ow /Og /Oi /Oy /Ob2 /I "." /D "NDEBUG" /D "_WINDOWS" /D "WIN32" /D "USE_OPENGL" /U "_DEBUG" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -64,7 +64,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "..\Debug\Profile"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W4 /Gm /Gi /GX /ZI /Od /I "." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /U "NDEBUG" /FR /YX /FD /GZ /c
# ADD CPP /nologo /G5 /MTd /W4 /Gm /Gi /GX /ZI /Od /I "." /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "USE_OPENGL" /U "NDEBUG" /FR /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -207,6 +207,14 @@ SOURCE=.\Cutscene\Cutscenes.cpp
SOURCE=.\Cutscene\Cutscenes.h
# End Source File
# Begin Source File
SOURCE=.\cutscene\movie.cpp
# End Source File
# Begin Source File
SOURCE=.\cutscene\movie.h
# End Source File
# End Group
# Begin Group "Debris"
@@ -249,6 +257,14 @@ SOURCE=.\debugconsole\timerbar.h
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\directx\dx8show.cpp
# End Source File
# Begin Source File
SOURCE=.\directx\dx8show.h
# End Source File
# Begin Source File
SOURCE=.\DirectX\vasync.h
# End Source File
# Begin Source File
@@ -317,10 +333,6 @@ SOURCE=.\DirectX\vdvp.h
# End Source File
# Begin Source File
SOURCE=.\DirectX\vDdraw.lib
# End Source File
# Begin Source File
SOURCE=.\DirectX\vDinput.lib
# End Source File
# Begin Source File
@@ -329,7 +341,15 @@ SOURCE=.\DirectX\vDsound.lib
# End Source File
# Begin Source File
SOURCE=.\DirectX\vDxguid.lib
SOURCE=.\directx\ddraw.lib
# End Source File
# Begin Source File
SOURCE=.\directx\dxguid.lib
# End Source File
# Begin Source File
SOURCE=.\directx\strmiids.lib
# End Source File
# End Group
# Begin Group "Fireball"
@@ -2491,5 +2511,29 @@ SOURCE=.\Network\stand_gui.cpp
SOURCE=.\Network\stand_gui.h
# End Source File
# End Group
# Begin Group "Decals"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\decals\decals.cpp
# End Source File
# Begin Source File
SOURCE=.\decals\decals.h
# End Source File
# End Group
# Begin Group "ddsutils"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\ddsutils\ddsutils.cpp
# End Source File
# Begin Source File
SOURCE=.\ddsutils\ddsutils.h
# End Source File
# End Group
# End Target
# End Project
+10 -4
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.h $
* $Revision: 2.2 $
* $Date: 2002-10-19 19:29:27 $
* $Author: bobboau $
* $Revision: 2.4 $
* $Date: 2002-12-02 23:52:02 $
* $Author: Goober5000 $
*
* Header file for keyboard, joystick and mouse configuration
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/12/02 20:47:28 Goober5000
* fixed misspelling of "category" as "catagory"
*
* Revision 2.2 2002/10/19 19:29:27 bobboau
* inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry
*
* Revision 2.1 2002/10/17 20:40:50 randomtiger
* Added ability to remove HUD ingame on keypress shift O
* So I've added a new key to the bind list and made use of already existing hud removal code.
@@ -299,7 +305,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 (catagory) it belongs in
char tab; // what tab (category) it belongs in
char *text; // describes the action in the config screen
char type; // manner control should be checked in
short key_id; // actual key bound to action
+150
View File
@@ -0,0 +1,150 @@
#include <windows.h>
#include "movie.h"
#include "directx/dx8show.h"
#include "osapi/osapi.h"
#include "cmdline/cmdline.h"
#include "graphics/2d.h"
#include "debugconsole/dbugfile.h"
bool movie_shutdown_fgx = false;
void movie_set_shutdown_fgx(bool state)
{
movie_shutdown_fgx = state;
}
bool movie_play(char *name, int unknown_value)
{
// This should not be uncommented
if(!Cmdline_dshowvid)
{
return true;
}
/*
** Check file exists
*/
FILE *fp = fopen(name,"rb");
DBUGFILE_OUTPUT_1("About to play: %s",name);
if(fp == NULL)
{
DBUGFILE_OUTPUT_0("MOVIE ERROR: Cant open movie file");
return true;
}
fclose(fp);
if(movie_shutdown_fgx == true)
{
gr_activate(0);
}
#ifdef _WIN32
os_app_activate_set(false);
dx8show_set_hwnd((void *) os_get_window());
// ShowWindow((HWND) os_get_window(),SW_HIDE);
// ShowWindow((HWND) os_get_window(),SW_MINIMIZE);
dx8show_play_cutscene(name);
// ShowWindow((HWND) os_get_window(),SW_RESTORE);
// ShowWindow((HWND) os_get_window(),SW_SHOW);
os_app_activate_set(true);
/*
// Comment this back in if the freespace window isnt coming back after the movie ends
if((HWND) os_get_window() != NULL)
{
if(GetForegroundWindow() != (HWND) os_get_window())
{
DBUGFILE_OUTPUT_0("Using SetForegroundWindow last");
SetForegroundWindow((HWND) os_get_window());
}
}
*/
#endif // _WIN32
if(movie_shutdown_fgx == true)
{
gr_activate(1);
}
return true;
}
bool movie_play_two(char *name1, char *name2, int unknown_value)
{
bool result = true;
// This should not be uncommented
if(!Cmdline_dshowvid)
{
return true;
}
/*
** Check file exists
*/
FILE *fp = fopen(name1,"rb");
DBUGFILE_OUTPUT_1("About to play: %s",name1);
if(fp == NULL)
{
DBUGFILE_OUTPUT_0("MOVIE ERROR: Cant open movie file");
/*
** Check second file exists
*/
FILE *fp2 = fopen(name2,"rb");
DBUGFILE_OUTPUT_1("About to play: %s",name2);
if(fp2 == NULL)
{
DBUGFILE_OUTPUT_0("MOVIE ERROR: Cant open movie file");
return true;
}
fclose(fp2);
}
fclose(fp);
if(movie_shutdown_fgx == true)
{
gr_activate(0);
}
#ifdef _WIN32
os_app_activate_set(false);
dx8show_play_cutscene(name1);
{
MSG msg;
while(PeekMessage(&msg, (HWND) os_get_window(), 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
dx8show_play_cutscene(name2);
os_app_activate_set(true);
#endif
if(movie_shutdown_fgx == true)
{
gr_activate(1);
}
return result;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef _MOVIE_HEADER_FILE
#define _MOVIE_HEADER_FILE
void movie_set_shutdown_fgx(bool state);
bool movie_play(char *name, int unknown_value = 0);
bool movie_play_two(char *name1, char *name2, int unknown_value = 0);
#endif
+175
View File
@@ -0,0 +1,175 @@
#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)
{
char code[5];
CFILE *ddsfile;
char real_name[MAX_FILENAME_LEN];
char *p;
int retval=DDS_ERROR_NONE;
int ct;
int bits=0;
//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");
memset(code,0,sizeof(code));
//try to open the file
ddsfile = cfopen(real_name, "rb");
//file not found
if (!ddsfile)
{
return DDS_ERROR_INVALID_FILENAME;
}
//read the code
cfread(code,1,4,ddsfile);
code[4]=0;
//check it
if (strncmp(code,DDS_FILECODE,4)!=0)
{
return DDS_ERROR_BAD_HEADER;
}
//read the header
cfread(lpddsd,sizeof(DDSURFACEDESC2),1,ddsfile);
//stuff important info
if (width) *width=lpddsd->dwWidth;
if (height) *height=lpddsd->dwHeight;
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 (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)
{
DDSURFACEDESC2 ddsd;
return dds_read_header_internal(&ddsd, filename, width, height, bpp, compression_type);
}
//reads pixel info from a dds file
int dds_read_bitmap(char *filename, int *size, uint* data)
{
int retval;
DDSURFACEDESC2 ddsd;
int w,h,ct,bpp;
CFILE *cfp;
ubyte* tmp;
//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);
Assert(retval==DDS_ERROR_NONE);
//get some more info from the surface
*size=ddsd.dwMipMapCount > 1 ? ddsd.dwLinearSize * 2 : ddsd.dwLinearSize;
//open it up and go to the data section
cfp=cfopen(filename,"rb");
cfseek(cfp,DDS_OFFSET, CF_SEEK_SET);
//get the data
tmp=(ubyte*)malloc(*size);
if (!tmp)
{
cfclose(cfp);
return DDS_ERROR_NO_MEM; //barf
}
cfread(tmp,1,*size,cfp);
*data=(uint)tmp;
//we look done here
cfclose(cfp);
return DDS_ERROR_NONE;
}
//returns string representation of DDS_** error code
const char *dds_error_string(int code)
{
switch (code)
{
case DDS_ERROR_NONE:
return "No error";
case DDS_ERROR_NO_MEM:
return "Insufficient memory";
case DDS_ERROR_INVALID_FILENAME:
return "File not found";
case DDS_ERROR_BAD_HEADER:
return "Filecode did not equal \"DDS \"";
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";
default:
return "Abort, retry, fail?";
}
//get a warning otherwise
return "Abort, retry, fail?";
}
+119
View File
@@ -0,0 +1,119 @@
//header file to load .dds files
//these use dxtc texture compression
#ifndef __DDS_H
#define __DDS_H
#include "globalincs/pstypes.h"
#include "directx/vddraw.h"
#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_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_DXT1 1
#define DDS_DXT3 3
#define DDS_DXT5 5
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#endif //defined(MAKEFOURCC)
// FOURCC codes for DX compressed-texture pixel formats
#define FOURCC_DXT1 (MAKEFOURCC('D','X','T','1'))
#define FOURCC_DXT2 (MAKEFOURCC('D','X','T','2'))
#define FOURCC_DXT3 (MAKEFOURCC('D','X','T','3'))
#define FOURCC_DXT4 (MAKEFOURCC('D','X','T','4'))
#define FOURCC_DXT5 (MAKEFOURCC('D','X','T','5'))
#define DDS_FILECODE "DDS "
#ifndef DUMMYUNIONNAMEN
#if defined(__cplusplus) || !defined(NONAMELESSUNION)
#define DUMMYUNIONNAMEN(n)
#else
#define DUMMYUNIONNAMEN(n) u##n
#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);
} DDSCAPS2;
typedef struct _DDSURFACEDESC2
{
DWORD dwSize; // size of the DDSURFACEDESC structure
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);
DDSCAPS2 ddsCaps; // direct draw surface capabilities
DWORD dwTextureStage; // stage in multitexture cascade
} DDSURFACEDESC2, FAR* LPDDSURFACEDESC2;
#define DDS_OFFSET 4+sizeof(DDSURFACEDESC2) //place where the data starts -- should be 128
//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);
//reads bitmap
//size of the data it stored in size
int dds_read_bitmap(char *filename, int *size, uint* data);
//returns a string from a DDS error code
const char* dds_error_string(int code);
extern int Texture_compression_enabled;
#endif //__DDS_H
+1 -1
View File
@@ -79,7 +79,7 @@ void timerbar_end_frame()
int xsize = (int) profiles[i].frame_total.QuadPart / 60;
// break condition in else
while(1)
for (;;)
{
// if bar runs over
if(last_xpos + xsize > WIDTH)
+824
View File
@@ -0,0 +1,824 @@
//sorce file for decals-Bobboau
//and no, I don't have any idea what I'm doing
#include "decals/decals.h"
#include "ship/ship.h"
#include "render/3d.h"
#include "io/timer.h"
#include "math/fvi.h"
#include "lighting/lighting.h"
//#define DECALS_ENABLED
int decal_intersect_seg_with_cube(vector * poly_point, vector start, vector end, vector cube_point[8], matrix orient, int ints=1);
int decal_intersect_poly_with_cube(vector * poly_point, vector point[3], vector cube_point[8], int ints);
decal_model d_model;
int poly_num = 0;
static vector decal_cube_point[8];
static vector decal_cube_plane[6][2];
static vector decal_hit_point;
static vector decal_hit_vect;
static float decal_hit_radius;
static matrix decal_orient;
static vector * decal_point_list[MAX_DECAL_DEFPOINTS];
static int decal_poly[MAX_DECAL_DEFPOINTS];
static decal * new_decal;
static int nverts;
static float min_rad;
static int back_faceing;
/*
vector uvec, rvec;
vector temp;
temp = *pos;
vm_vec_sub( &rvec, Eyeposition, &temp );
vm_vec_normalize( &rvec );
vm_vec_crossprod(&uvec,fvec,&rvec);
vm_vec_normalize(&uvec);
vm_vec_scale_add( top, &temp, &uvec, w/2.0f );
vm_vec_scale_add( bot, &temp, &uvec, -w/2.0f );
*/
int decal_find_next(object *obj){
ship *shipp = &Ships[obj->instance];
int oldest = shipp->decals[0].timestamp;
for(int i = 0; i < MAX_SHIP_DECALS; i++){
if(shipp->decals[i].is_valid != 1){ //use up all the unused decals first
return i%MAX_SHIP_DECALS;
}
}
for(i = 1; i < MAX_SHIP_DECALS; i++){
if(shipp->decals[i].timestamp > oldest){ //then get the oldest one
oldest = i;
}
}
return oldest%MAX_SHIP_DECALS;
}
int decal_create_simple(object *obj, decal_point *point, int texture){//makes a simple non-clipped decal
#ifdef DECALS_ENABLED
mprintf(("a decal is about to be made at %0.2f, %0.2f, %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));
mprintf(("orient fvec at %0.2f, %0.2f, %0.2f\n", point->orient.vec.fvec.xyz.x, point->orient.vec.fvec.xyz.y, point->orient.vec.fvec.xyz.z));
if(obj->type != OBJ_SHIP){
return 0;
}
// vertex vert[1][2];
// vector vec[4];
vector center = point->pnt;
float rad = point->radius;
if(rad <=0) rad = 10;
mprintf(("radius %f\n",rad));
vector plain_point[4];
// mprintf(("orient uvec x %0.2f %0.2f %0.2f\n", point->orient.vec.uvec.xyz.x, point->orient.vec.uvec.xyz.y, point->orient.vec.uvec.xyz.z));
// mprintf(("orient rvec x %0.2f %0.2f %0.2f\n", point->orient.vec.rvec.xyz.x, point->orient.vec.rvec.xyz.y, point->orient.vec.rvec.xyz.z));
// mprintf(("orient fvec x %0.2f %0.2f %0.2f\n", point->orient.vec.fvec.xyz.x, point->orient.vec.fvec.xyz.y, point->orient.vec.fvec.xyz.z));
plain_point[0] = point->orient.vec.uvec;
plain_point[1] = plain_point[0];
vm_vec_negate(&plain_point[1]);
plain_point[2] = point->orient.vec.rvec;
plain_point[3] = plain_point[2];
vm_vec_negate(&plain_point[3]);
mprintf(("\n"));
int dinx = decal_find_next(obj);
ship *shipp = &Ships[obj->instance];
decal *dec = shipp->decals;
vm_vec_scale_add( &dec[0].vert[0], &center, &plain_point[0], rad );
vm_vec_scale_add( &dec[0].vert[1], &center, &plain_point[2], rad );
vm_vec_scale_add( &dec[0].vert[2], &center, &plain_point[1], rad );
vm_vec_scale_add( &dec[0].vert[3], &center, &plain_point[3], rad );
dec[dinx].poly[0].point[0] = 0;
dec[dinx].poly[0].point[1] = 1;
dec[dinx].poly[0].point[2] = 2;
dec[dinx].poly[1].point[0] = 0;
dec[dinx].poly[1].point[1] = 3;
dec[0].poly[1].point[2] = 2;
dec[dinx].poly[0].uv[0].u = 0; dec[0].poly[0].uv[0].v = 0;
dec[dinx].poly[0].uv[1].u = 0; dec[0].poly[0].uv[1].v = 1;
dec[dinx].poly[0].uv[2].u = 1; dec[0].poly[0].uv[2].v = 1;
dec[dinx].poly[1].uv[0].u = 0; dec[0].poly[1].uv[0].v = 0;
dec[dinx].poly[1].uv[1].u = 1; dec[0].poly[1].uv[1].v = 0;
dec[dinx].poly[1].uv[2].u = 1; dec[0].poly[1].uv[2].v = 1;
dec[dinx].texture = texture;
dec[dinx].n_poly = 2;
dec[dinx].is_valid = 1;
dec[dinx].timestamp = timestamp();
mprintf(("a decal should have been made at %0.2f %0.2f %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));
//Int3();
#endif
return 1;
}
#define duw(p) (*((uint *) (p)))
#define dw(p) (*((int *) (p)))
#define dwp(p) ((int *) (p))
#define dvp(p) ((vector *) (p))
#define dfl(p) (*((float *) (p)))
//creates a decal, returns decal index on succes, -1 on failure
int decal_create(object * obj, decal_point *point, int subobject, int texture, int backfaced_texture){
#ifdef DECALS_ENABLED
mprintf(("a decal is about to be made at %0.2f, %0.2f, %0.2f\n", point->pnt.xyz.x, point->pnt.xyz.y, point->pnt.xyz.z));
if(obj->type != OBJ_SHIP){
return -1;
}
if(texture == -1)return -1;
if(point->radius <= 0)return -1;
vector center = point->pnt;
float rad = point->radius;
if(rad <=0) rad = 1;
mprintf(("radius %f\n",rad));
vector plain_point[4];
vector cube_point[8];
//define the decals dimentions
plain_point[0] = point->orient.vec.uvec;
plain_point[1] = plain_point[0];
vm_vec_negate(&plain_point[1]);
plain_point[2] = point->orient.vec.rvec;
plain_point[3] = plain_point[2];
vm_vec_negate(&plain_point[3]);
vector topcenter;
vector bvec = point->orient.vec.fvec;
vm_vec_negate(&bvec);
vm_vec_scale_add(&topcenter, &center, &bvec, rad);
for(int i = 0; i < 4; i++){
vm_vec_scale_add( &cube_point[i], &topcenter, &plain_point[i], rad );
vm_vec_scale_add( &cube_point[i+4], &cube_point[i], &point->orient.vec.fvec, rad*2);
}
float max_rad = vm_vec_dist_quick(&center, &cube_point[0]); //the cube points are all equidistant, right?
min_rad = fl_sqrt((rad * rad)/2); //the cube points are all equidistant, right?
mprintf(("decal defined\n"));
//define the decals dimentions
//set up the decal model
ship *shipp = &Ships[obj->instance];
decal *sdec = shipp->decals;
polymodel *pm = model_get(shipp->modelnum);
bsp_info * sm;
sm = &pm->submodel[subobject];
// decal_model dmod = pm->submodel[subobject].dec_model;// sm->dec_model;
// decal_model tdec; //temporary decal model for holding the culled down part of the decal
//setting up the decal cube
vector test_vec, temp1, temp2;
for(i = 0; i<8; i++)decal_cube_point[i] = cube_point[i];
decal_orient = point->orient;
decal_cube_plane[0][0] = cube_point[5];
temp1 = decal_orient.vec.uvec;
temp2 = decal_orient.vec.rvec;
vm_vec_avg(&test_vec, &temp1, &temp2);
vm_vec_normalize(&test_vec);
decal_cube_plane[0][1] = test_vec;
// mprintf(("plane 0 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][0].xyz.x, decal_cube_plane[0][0].xyz.y, decal_cube_plane[0][0].xyz.z));
// mprintf(("plane 0 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][1].xyz.x, decal_cube_plane[0][1].xyz.y, decal_cube_plane[0][1].xyz.z));
decal_cube_plane[1][0] = cube_point[0];
vm_vec_negate(&test_vec);
decal_cube_plane[1][1] = test_vec;
// mprintf(("plane 1 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[1][0].xyz.x, decal_cube_plane[1][0].xyz.y, decal_cube_plane[1][0].xyz.z));
// mprintf(("plane 1 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[1][1].xyz.x, decal_cube_plane[1][1].xyz.y, decal_cube_plane[1][1].xyz.z));
decal_cube_plane[2][0] = cube_point[5];
vm_vec_negate(&temp2);
vm_vec_avg(&test_vec, &temp1, &temp2);
vm_vec_normalize(&test_vec);
decal_cube_plane[2][1] = test_vec;
// mprintf(("plane 2 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[2][0].xyz.x, decal_cube_plane[2][0].xyz.y, decal_cube_plane[2][0].xyz.z));
// mprintf(("plane 2 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[2][1].xyz.x, decal_cube_plane[2][1].xyz.y, decal_cube_plane[2][1].xyz.z));
decal_cube_plane[3][0] = cube_point[0];
vm_vec_negate(&test_vec);
decal_cube_plane[3][1] = test_vec;
// mprintf(("plane 3 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[3][0].xyz.x, decal_cube_plane[3][0].xyz.y, decal_cube_plane[3][0].xyz.z));
// mprintf(("plane 3 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[3][1].xyz.x, decal_cube_plane[3][1].xyz.y, decal_cube_plane[3][1].xyz.z));
test_vec = decal_orient.vec.fvec;
decal_cube_plane[4][0] = cube_point[0];
decal_cube_plane[4][1] = test_vec;
// mprintf(("plane 4 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[4][0].xyz.x, decal_cube_plane[4][0].xyz.y, decal_cube_plane[4][0].xyz.z));
// mprintf(("plane 4 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[4][1].xyz.x, decal_cube_plane[4][1].xyz.y, decal_cube_plane[4][1].xyz.z));
vm_vec_negate(&test_vec);
decal_cube_plane[5][0] = cube_point[5];
decal_cube_plane[5][1] = test_vec;
// mprintf(("plane 5 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[5][0].xyz.x, decal_cube_plane[5][0].xyz.y, decal_cube_plane[5][0].xyz.z));
// mprintf(("plane 5 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[5][1].xyz.x, decal_cube_plane[5][1].xyz.y, decal_cube_plane[5][1].xyz.z));
//setting up the decal cube
mprintf(("cube set up\n"));
decal_hit_point = point->pnt;
decal_hit_radius = max_rad;
decal_hit_vect = point->orient.vec.fvec;
poly_num = 0;
nverts = 0;
//go and find decals for each submodel
// for(int z = 0; z<pm->n_models;z++){
int dinx = decal_find_next(obj);
mprintf(("decal is number %d\n", dinx));
sdec[dinx].is_valid = 0;
new_decal = &shipp->decals[dinx];
if(backfaced_texture != -1){
back_faceing = 1;
}else{
back_faceing = 0;
}
decal_create_sub((ubyte *)pm->submodel[subobject].bsp_data);
mprintf(("deacal defined\n"));
sdec[dinx].texture = texture;
sdec[dinx].backfaced_texture = backfaced_texture;
sdec[dinx].is_valid = 1;
sdec[dinx].timestamp = timestamp();
sdec[dinx].n_poly = poly_num;
sdec[dinx].state = 1;
sdec[dinx].lifetime = 3000;
sdec[dinx].frames = 1;
sdec[dinx].importance = 0;
sdec[dinx].radius = max_rad;
sdec[dinx].position = point->pnt;
mprintf(("a decal should have been made with %d polys\n",sdec[0].n_poly));
return dinx;
#else
return -1;
#endif
}
//decal_model d_model;
// Point list
// +0 int id
// +4 int size
// +8 int n_verts
// +12 int n_norms
// +16 int offset from start of chunk to vertex data
// +20 n_verts*char norm_counts
// +offset vertex data. Each vertex n is a point followed by norm_counts[n] normals.
void decal_create_defpoints(ubyte * p )
{
// mprintf(("entering decal decal_create_defpoints\n"));
int n;
nverts = dw(p+8);
int offset = dw(p+16);
mprintf(("%d verts\n",nverts));
ubyte * normcount = p+20;
vector *src = dvp(p+offset);
Assert( nverts < 1200 );
for (n=0; n<nverts; n++ ) {
decal_point_list[n] = src;
new_decal->vert[n].xyz = src->xyz;
src += normcount[n]+1;
// mprintf(("defpoint %d, x %0.2f, y %0.2f, z %0.2f\n",n,d_model.vert[n].xyz.x,d_model.vert[n].xyz.y,d_model.vert[n].xyz.z));
}
}
// Sortnorms
// +0 int id
// +4 int size
// +8 vector normal
// +20 vector center
// +32 float radius
// 36 int front offset
// 40 int back offset
// 44 int prelist offset
// 48 int postlist offset
// 52 int online offset
void decal_create_sortnorm(ubyte * p)
{
// mprintf(("entering decal_create_sortnorm\n"));
int frontlist = dw(p+36);
int backlist = dw(p+40);
int prelist = dw(p+44);
int postlist = dw(p+48);
int onlist = dw(p+52);
vector min, max;
min.xyz = dvp(p+56)->xyz;
max.xyz = dvp(p+68)->xyz;
min.xyz.x += decal_hit_radius;
min.xyz.y += decal_hit_radius;
min.xyz.z += decal_hit_radius;
max.xyz.x += decal_hit_radius;
max.xyz.y += decal_hit_radius;
max.xyz.z += decal_hit_radius;
/* if (!fvi_ray_boundingbox( &min, &max, &decal_hit_point, &decal_hit_vect, NULL )) {
return;
}
*/
if (prelist) decal_create_sub(p+prelist);
if (backlist) decal_create_sub(p+backlist);
if (onlist) decal_create_sub(p+onlist);
if (frontlist) decal_create_sub(p+frontlist);
if (postlist) decal_create_sub(p+postlist);
}
/*
typedef struct model_tmap_vert {
short vertnum;
short normnum;
float u,v;
} model_tmap_vert;
*/
//int poly_num = 0;
// Textured Poly
// +0 int id
// +4 int size
// +8 vector normal
// +20 vector normal_point
// +32 int tmp = 0
// +36 int nverts
// +40 int tmap_num
// +44 nverts*(model_tmap_vert) vertlist (n,u,v)
void decal_create_tmappoly(ubyte * p)
{
// mprintf(("entering decal_create_tmappoly\n"));
if(poly_num >= MAX_DECAL_POLY){
mprintf(("bugging out becase there are too many polys in the decal\n"));
return;
}
int i;
int nv;
// uv_pair uvlist[TMAP_MAX_VERTS];
// vector points[TMAP_MAX_VERTS];
model_tmap_vert *verts;
nv = dw(p+36);
if ( nv < 0 ) return;
// int tmap_num = dw(p+40);
/*
if ( (!(Mc->flags & MC_CHECK_INVISIBLE_FACES)) && (Mc_pm->textures[tmap_num] < 0) ) {
// Don't check invisible polygons.
return;
}
*/
verts = (model_tmap_vert *)(p+44);
vector temppoly[820];
for (i=0;i<nv;i++) {
decal_poly[i] = (int)verts[i].vertnum;
temppoly[i].xyz = decal_point_list[decal_poly[i]]->xyz;
}
vector pnorm;
vm_vec_perp(&pnorm, decal_point_list[decal_poly[0]], decal_point_list[decal_poly[1]], decal_point_list[decal_poly[2]]);
float back = vm_vec_dot(&decal_cube_plane[4][1], &pnorm);
if( (back_faceing == 0) && (back >= 0) )return;
//poly culling
vector pcenter;
vm_vec_avg_n(&pcenter, nv, temppoly);
float pradius = 0;
float dist = 0;
for (i=0;i<nv;i++) {
dist = vm_vec_dist(decal_point_list[decal_poly[i]], &pcenter);
if(dist>pradius){
pradius = dist;
}
}
//if it's too far to posably get near the cube get out
if(vm_vec_dist_quick(&pcenter, &decal_hit_point) >= (pradius + decal_hit_radius)){
// mprintf(("leaveing becase poly is too far away\n"));
return;
}
//this is for faster testing, I'm not sure if it's realy makeing it faster or not
for(int k = 0; k<6; k++){
int first_good = -1;
for(i = 0; ((i< nv) && (first_good == -1)); i++){
if(fvi_point_dist_plane(&decal_cube_plane[k][0], &decal_cube_plane[k][1], decal_point_list[decal_poly[i]]) > 0){
first_good = i;
}
}
if(first_good == -1){
// mprintf(("all points are behind a plane, polygon is not in the cube\n"));
return;
}
}
//poly culling
int temp_poly[820];
int skip = 0, numv = 0, valid = 0;
// mprintf(("starting to test the poly, with %d verts in it\n",nv));
for(k = 0; k<6; k++){
//find the first point in front of the plain
int first_good = -1;
for(i = 0; ((i< nv) && (first_good == -1)); i++){
// mprintf(("testing point %d with plane %d\n", i, k));
// mprintf(("point's position is x %0.2f y %0.2f z %0.2f\n", decal_point_list[decal_poly[i]]->xyz.x, decal_point_list[decal_poly[i]]->xyz.y, decal_point_list[decal_poly[i]]->xyz.z));
// mprintf(("plane's position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[k][0].xyz.x, decal_cube_plane[k][0].xyz.y, decal_cube_plane[k][0].xyz.z));
// mprintf(("plane's normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[k][1].xyz.x, decal_cube_plane[k][1].xyz.y, decal_cube_plane[k][1].xyz.z));
if(fvi_point_dist_plane(&decal_cube_plane[k][0], &decal_cube_plane[k][1], decal_point_list[decal_poly[i]]) > 0){
first_good = i;
// mprintf(("%d is the first good point\n", i));
}
}
if(first_good == -1){
// mprintf(("all points are behind a plane, polygon is not in the cube\n"));
return;
}else{
valid = 1;
}
//first point in front of the plane is good of corse
// temp_poly[0] = decal_poly[(first_good + nv)%nv];
numv = 0;
//go through each point and see if there is an intersection between it the next point and the current plane
//if there is then make the intersection point the next point in the poly
//ignor all points untill there is another intersection
//other wise make the next point the next point in the poly
// if(k==1)Int3();
int is_infront = 1, is_infront2 = 1;
for(i = first_good; i < (nv + first_good); i++){
// mprintf(("looking for intersections between point %d and point %d, with plane %d\n", i%nv, (i + 1)%nv, k));
// mprintf((" point %d, is at, x %0.2f y %0.2f z %0.2f and point %d, is at, x %0.2f y %0.2f z %0.2f\n", i%nv, decal_point_list[decal_poly[i]]->xyz.x, decal_point_list[decal_poly[i]]->xyz.y, decal_point_list[decal_poly[i]]->xyz.z, (i + 1)%nv, decal_point_list[decal_poly[(i + 1)%nv]]->xyz.x, decal_point_list[decal_poly[(i + 1)%nv]]->xyz.y, decal_point_list[decal_poly[(i + 1)%nv]]->xyz.z));
is_infront2 = is_infront;
float is_in = fvi_point_dist_plane(&decal_cube_plane[k][0], &decal_cube_plane[k][1], decal_point_list[decal_poly[(i + 1)%nv]]);
if(is_in > 0){
is_infront = 1;
}else{
is_infront= 0;
}
if(is_infront != is_infront2){
if(fvi_segment_plane(&new_decal->vert[nverts], &decal_cube_plane[k][0], &decal_cube_plane[k][1], decal_point_list[decal_poly[i%nv]], decal_point_list[decal_poly[(i + 1)%nv]], 0)){
// mprintf(("segment %d %d has an an itersection\n", i%nv, (i + 1)%nv));
decal_point_list[nverts] = &new_decal->vert[nverts];
// mprintf(("new decal defpoint has been added as number %d at x %0.2f y %0.2f z %0.2f\n",nverts, new_decal->vert[nverts].xyz.x, new_decal->vert[nverts].xyz.y, new_decal->vert[nverts].xyz.z));
temp_poly[numv] = nverts++;
// mprintf(("temp_poly point %d, should have been set to defpoint %d, it was set to %d\n",numv, nverts-1, temp_poly[numv]));
skip = (skip+1)%2;
// mprintf(("skip has been set to %d\n",skip));
numv++;
if((skip == 0)){
// mprintf(("adding point, becase it is after an intersection point\n", (i + 1)%nv));
temp_poly[numv] = decal_poly[(i + 1)%nv];
numv++;
}
}else{
// mprintf(("there sould have been an intersection but there wasnt"));
}
}else{
if((skip == 0)){//don't copy the first point
// mprintf(("segment %d %d has no itersection, copying\n", i%nv, (i + 1)%nv));
temp_poly[numv] = decal_poly[(i + 1)%nv];
numv++;
}else{
// mprintf(("skipping segment %d %d becase it isn't in front of the plane\n", i%nv, (i + 1)%nv));
}
}
}
// mprintf(("temp poly has %d points\n", numv));
for(int h = 0; h < numv; h++){
decal_poly[h] = temp_poly[h];
mprintf(("seting decal_poly point %d to %d\n",h,temp_poly[h]));
}
nv = numv;
numv=0;
// mprintf(("decal_poly now has has %d points\n", nv));
if(nv < 3)return; //if at any time we get fewer than three points this poly is dead
}
// mprintf(("copying the poly to the decal\n"));
//copy a triangulated version of the poly to the new decal
if((valid == 1) && (nv > 2)){
/* for (i=1;i<(nv-1);i++) {
if(poly_num >= MAX_DECAL_POLY){
mprintf(("bugging out becase there are too many polys in the decal\n"));
return;
}
new_decal->poly[poly_num].point[0] = decal_poly[0];
new_decal->poly[poly_num].point[1] = decal_poly[i];
new_decal->poly[poly_num].point[2] = decal_poly[i+1];
new_decal->poly[poly_num].norm = pnorm;
if(back > 0){
new_decal->poly[poly_num].backfaced = 0;
}else{
new_decal->poly[poly_num].backfaced = 1;
}
for (k=0;k<3;k++) {
//calculate the UV coords
new_decal->poly[poly_num].uv[k].u = (fvi_point_dist_plane(&decal_cube_plane[0][0], &decal_cube_plane[0][1], &new_decal->vert[new_decal->poly[poly_num].point[k]]) / (min_rad*2));
new_decal->poly[poly_num].uv[k].v = (fvi_point_dist_plane(&decal_cube_plane[2][0], &decal_cube_plane[2][1], &new_decal->vert[new_decal->poly[poly_num].point[k]]) / (min_rad*2));
}
// mprintf(("decal poly %d, vert 0 being set to %d, vert 1 %d, and vert 2 %d\n", poly_num, new_decal->poly[poly_num].point[0], new_decal->poly[poly_num].point[1], new_decal->poly[poly_num].point[2]));
poly_num++;
}*/
for (i=1;i<nv;i++){
if(poly_num >= MAX_DECAL_POLY){
mprintf(("bugging out becase there are too many polys in the decal\n"));
return;
}
if(i >= MAX_DECAL_POLY_POINT){
mprintf(("bugging out becase there are too many points in the poly\n"));
return;
}
new_decal->poly[poly_num].point[i] = decal_poly[i];
new_decal->poly[poly_num].norm = pnorm;
if(back > 0){
new_decal->poly[poly_num].backfaced = 0;
}else{
new_decal->poly[poly_num].backfaced = 1;
}
//calculate the UV coords
new_decal->poly[poly_num].uv[i].u = (fvi_point_dist_plane(&decal_cube_plane[0][0], &decal_cube_plane[0][1], &new_decal->vert[new_decal->poly[poly_num].point[i]]) / (min_rad*2));
new_decal->poly[poly_num].uv[i].v = (fvi_point_dist_plane(&decal_cube_plane[2][0], &decal_cube_plane[2][1], &new_decal->vert[new_decal->poly[poly_num].point[i]]) / (min_rad*2));
// mprintf(("decal poly %d, vert 0 being set to %d, vert 1 %d, and vert 2 %d\n", poly_num, new_decal->poly[poly_num].point[0], new_decal->poly[poly_num].point[1], new_decal->poly[poly_num].point[2]));
}
poly_num++;
}else{
// mprintf(("no poly, all points are out side of planes"));
}
mprintf(("there are now %d polys in the current decal\n", poly_num));
}
int decal_create_sub(void *model_ptr )
{
// mprintf(("plane 0 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][0].xyz.x, decal_cube_plane[0][0].xyz.y, decal_cube_plane[0][0].xyz.z));
// mprintf(("plane 0 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][1].xyz.x, decal_cube_plane[0][1].xyz.y, decal_cube_plane[0][1].xyz.z));
// mprintf(("entering decal_create_sub\n"));
ubyte *p = (ubyte *)model_ptr;
int chunk_type, chunk_size;
chunk_type = dw(p);
chunk_size = dw(p+4);
// mprintf(("plane 0 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][0].xyz.x, decal_cube_plane[0][0].xyz.y, decal_cube_plane[0][0].xyz.z));
// mprintf(("plane 0 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][1].xyz.x, decal_cube_plane[0][1].xyz.y, decal_cube_plane[0][1].xyz.z));
while (chunk_type != DP_EOF) {
// mprintf(( "Processing chunk type %d, len=%d\n", chunk_type, chunk_size ));
// mprintf(("plane 0 position is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][0].xyz.x, decal_cube_plane[0][0].xyz.y, decal_cube_plane[0][0].xyz.z));
// mprintf(("plane 0 normal is x %0.2f y %0.2f z %0.2f\n", decal_cube_plane[0][1].xyz.x, decal_cube_plane[0][1].xyz.y, decal_cube_plane[0][1].xyz.z));
switch (chunk_type) {
case DP_EOF: return 1;
case DP_DEFPOINTS: decal_create_defpoints(p); break;
case DP_FLATPOLY: break;// I don't want any of these anyway-Bobboau decal_create_flatpoly(p); break;
case DP_TMAPPOLY: decal_create_tmappoly(p); break;
case DP_SORTNORM: decal_create_sortnorm(p); break;
case DP_BOUNDBOX:
/* if (!mc_ray_boundingbox( vp(p+8), vp(p+20), &Mc_p0, &Mc_direction, NULL )) {
return 1;
}*/
break;
default:
mprintf(( "Bad chunk type %d, len=%d in decal_create_sub\n", chunk_type, chunk_size ));
Int3(); // Bad chunk type!
return 0;
}
// mprintf(( "current chunk offset %d\n", (int)p ));
p += chunk_size;
chunk_type = dw(p);
chunk_size = dw(p+4);
}
return 1;
}
int decal_make_model(polymodel * pm){
return 1;
}
/*
void decal_render_all(object * obj){
if(obj->type != OBJ_SHIP){
return;
}
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
// mprintf(("about to render all decals\n"));
ship *shipp = &Ships[obj->instance];
for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
for(int i = 0; i<dec->n_poly; i++){
mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
gr_set_bitmap(dec->texture, 0, GR_BITBLT_MODE_NORMAL, 1.0f );
if((dec->poly[i].backfaced == 1) && (dec->backfaced_texture)){
gr_set_bitmap(dec->backfaced_texture, 0, GR_BITBLT_MODE_NORMAL, 1.0f );
}
for( int j = 0; j < 3; j++){
// vecs[j] = dec->vert[i][j];
// vector pos;
// vm_vert2vec(&vecs[j], &pos);
// vm_vec_add2(&pos, &obj->pos);
g3_rotate_vertex(&vecs[j], &dec->vert[dec->poly[i].point[j]]);
g3_project_vertex(&vecs[j]);
vecs[j].u = dec->poly[i].uv[j].u;
vecs[j].v = dec->poly[i].uv[j].v;
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));
}
gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);
}
}
}
// mprintf(("decals rendered\n"));
}
*/
void decal_render_all(object * obj){
#ifdef DECALS_ENABLED
if(obj->type != OBJ_SHIP){
return;
}
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
// mprintf(("about to render all decals\n"));
ship *shipp = &Ships[obj->instance];
polymodel *pm = model_get( shipp->modelnum );
for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
vector g_pos;
vm_vec_add(&g_pos, &dec->position, &obj->pos);
float dist = vm_vec_dist_quick(&g_pos, &View_position);
if(dist < (dec->radius*10)){
mprintf(("decal %d too far away to be drawn %0.2f\n", h, dist));
continue;
}
for(int i = 0; i<dec->n_poly; i++){
// if((pm->submodel[dec->submodel_parent].blown_off != 0) && (dec->submodel_parent > 0))continue;
for( int j = 0; j < 3; j++){
// vecs[j] = dec->vert[i][j];
// vector pos;
// vm_vert2vec(&vecs[j], &pos);
// vm_vec_add2(&pos, &obj->pos);
vector pnt = dec->vert[dec->poly[i].point[j]];
if(dec->submodel_parent != pm->detail[0]){
matrix m;
angles angs = pm->submodel[dec->submodel_parent].angs;
angs.b = PI2 - angs.b;
angs.p = PI2 - angs.p;
angs.h = PI2 - angs.h;
mprintf(("decal is child of a submodel, who's angles are b %0.2f p %0.2f h %0.2f, it should be rotateing with it\n", angs.b, angs.p, angs.h));
vector offset = pm->submodel[dec->submodel_parent].offset;
vm_angles_2_matrix(&m, &angs);
vector p = pnt;
vm_vec_rotate(&pnt, &p, &m);
vm_vec_add2(&pnt, &offset);
}
g3_rotate_vertex(&vecs[j], &pnt);
g3_project_vertex(&vecs[j]);
vecs[j].u = dec->poly[i].uv[j].u;
vecs[j].v = dec->poly[i].uv[j].v;
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));
/*
if ( D3D_enabled ) {
light_apply_rgb( &vlist[j]->r, &vlist[j]->g, &vlist[j]->b, &pnt, &dec->poly[i].norm, 0 );
} else {
vlist[j]->b = light_apply( &pnt, &dec->poly[i].norm, 0 );
}
*/
}
gr_set_bitmap(dec->texture, 0, GR_BITBLT_MODE_NORMAL, 1.0f );
if((dec->poly[i].backfaced == 1) && (dec->backfaced_texture > -1)){
gr_set_bitmap(dec->backfaced_texture, 0, GR_BITBLT_MODE_NORMAL, 1.0f );
mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->backfaced_texture));
}else{
mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
}
// gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT | TMAP_FLAG_RGB | TMAP_FLAG_GOURAUD );
// gr_set_cull(1);
}
}
}
// mprintf(("decals rendered\n"));
#endif
}
+80
View File
@@ -0,0 +1,80 @@
//header file for makeing decals-Bobboau
#ifndef _DECAL_H
#define _DECAL_H
#define MAX_DECAL_POLY 20
#define MAX_DECAL_POLY_POINT 10
#define MAX_DECAL_DEFPOINTS 1000
#define MAX_DECAL_POINT 10
#define MAX_SHIP_DECALS 25
#include "globalincs/pstypes.h"
#include "object/object.h"
#define DP_EOF 0
#define DP_DEFPOINTS 1
#define DP_FLATPOLY 2
#define DP_TMAPPOLY 3
#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;
//extern decal_model d_model;
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;
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_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);
/*
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
*/
Binary file not shown.
+240
View File
@@ -0,0 +1,240 @@
#include <dshow.h>
#include <stdio.h>
#include "osapi/osapi.h"
#include "dx8show.h"
#include "debugconsole/dbugfile.h"
//
// Constants
//
const int KEYBOARD_SAMPLE_FREQ = 200; // Sample user input on an interval
//
// Globals
//
IGraphBuilder *pGB = NULL;
IMediaControl *pMC = NULL;
IVideoWindow *pVW = NULL;
IMediaEvent *pME = NULL;
//
// Function prototypes
//
HRESULT get_interfaces(void);
bool play_media(LPTSTR movie_filename);
bool set_fullscreen(void);
void cleanup_interfaces(void);
HWND internal_hwnd = NULL;
// This define, 0 by default, if set to 1 will run window binding code which currently
// doesnt work, left in for fun
#define VIS_CODE 0
//
// Helper Macros (Jump-If-Failed, Log-If-Failed)
//
#define RUN_FUNCTION_ROF(x) if(FAILED(hr=(x))) \
{DBUGFILE_OUTPUT_0("FAILED in " #x); return false;}
#define RUN_FUNCTION_GET_INTERFACE(x) if(FAILED(hr=(x))) \
{DBUGFILE_OUTPUT_0("FAILED " #x); cleanup_interfaces(); return hr;}
#define RUN_FUNCTION(x) if(FAILED(hr=(x))) \
{DBUGFILE_OUTPUT_0("FAILED " #x);}
#define RELEASE(i) {if (i) i->Release(); i = NULL;}
void process_messages(HWND hwnd)
{
MSG msg;
while(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
void dx8show_set_hwnd(void *hwnd)
{
internal_hwnd = (HWND) hwnd;
}
bool dx8show_play_cutscene(char *movie_file)
{
HRESULT hr;
// Initialize COM
RUN_FUNCTION_ROF(CoInitialize(NULL));
// Get DirectShow interfaces
RUN_FUNCTION_ROF(get_interfaces());
if(internal_hwnd == NULL)
{
internal_hwnd = (HWND) os_get_window();
}
#if VIS_CODE
RUN_FUNCTION(pVW->put_Visible(OATRUE));
RUN_FUNCTION(pVW->put_Owner((OAHWND) internal_hwnd));
#endif
// Play the movie / cutscene
play_media(movie_file);
#if VIS_CODE
RUN_FUNCTION(pVW->put_Visible(OAFALSE));
RUN_FUNCTION(pVW->put_Owner(NULL));
#endif
// Release DirectShow interfaces
cleanup_interfaces();
CoUninitialize();
return true;
}
HRESULT get_interfaces(void)
{
HRESULT hr = S_OK;
// Instantiate filter graph interface
RUN_FUNCTION_GET_INTERFACE(CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **) &pGB));
// Get interfaces to control playback & screensize
RUN_FUNCTION_GET_INTERFACE(pGB->QueryInterface(IID_IMediaControl, (void **) &pMC));
RUN_FUNCTION_GET_INTERFACE(pGB->QueryInterface(IID_IVideoWindow, (void **) &pVW));
// Get interface to allow the app to wait for completion of playback
RUN_FUNCTION_GET_INTERFACE(pGB->QueryInterface(IID_IMediaEventEx, (void **)&pME));
return hr;
}
void cleanup_interfaces(void)
{
// Release the DirectShow interfaces
RELEASE(pMC);
RELEASE(pVW);
RELEASE(pME);
RELEASE(pGB);
}
bool play_media(LPTSTR movie_filename)
{
HRESULT hr;
WCHAR file_name[MAX_PATH];
#ifndef UNICODE
MultiByteToWideChar(CP_ACP, 0, movie_filename, -1, file_name, MAX_PATH);
#else
lstrcpy(file_name, movie_filename);
#endif
// Allow DirectShow to create the FilterGraph for this media file
RUN_FUNCTION_ROF(pGB->RenderFile(file_name, NULL));
// Set the message drain of the video window to point to our hidden application window. This allows
// keyboard input to be transferred to our main window for processing.
//
// If this is an audio-only or MIDI file, then put_MessageDrain will fail.
//
RUN_FUNCTION(pVW->put_MessageDrain((OAHWND) internal_hwnd));
if(set_fullscreen() == false)
{
return false;
}
// Display first frame of the movie and play
RUN_FUNCTION_ROF(pMC->Pause());
RUN_FUNCTION_ROF(pMC->Run());
// Update state variables
bool movie_continue = true;
// Enter a loop of checking for events and sampling keyboard input
while (movie_continue)
{
long event_code, param1, param2;
// Has there been a media event? Look for end of stream condition.
if(E_ABORT != pME->GetEvent(&event_code, &param1, &param2, 0))
{
// Is this the end of the movie?
if (event_code == EC_COMPLETE)
{
movie_continue = false;
}
// Free the media event resources.
RUN_FUNCTION(pME->FreeEventParams(event_code, param1, param2));
}
// Give system threads time to run (and don't sample user input madly)
Sleep(KEYBOARD_SAMPLE_FREQ);
MSG msg;
// Quits movie if escape, space or return is pressed
while(PeekMessage(&msg, internal_hwnd, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
if(msg.message != WM_KEYDOWN)
{
DispatchMessage(&msg);
continue;
}
switch(msg.wParam )
{
case VK_ESCAPE:
case VK_SPACE:
case VK_RETURN:
{
DBUGFILE_OUTPUT_0("User skipped cut scene");
movie_continue = false;
}
}
}
}
return true;
}
bool set_fullscreen(void)
{
HRESULT hr;
LONG mode;
HWND drain=0;
if (!pVW)
{
return S_FALSE;
}
// Read current state
RUN_FUNCTION_ROF(pVW->get_FullScreenMode(&mode));
if (mode == OAFALSE)
{
// Save current message drain
RUN_FUNCTION_ROF(pVW->get_MessageDrain((OAHWND *) &drain));
// This is very important. It ensures that the video window doesnt end
// up playing behind the main window
SetFocus(drain);
// Set message drain to application main window
RUN_FUNCTION_ROF(pVW->put_MessageDrain((OAHWND) internal_hwnd));
// Switch to full-screen mode
mode = OATRUE;
RUN_FUNCTION_ROF(pVW->put_FullScreenMode(mode));
}
return true;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef _DX8SHOW_HEADER_FILE
#define _DX8SHOW_HEADER_FILE
bool dx8show_play_cutscene(char *filename);
void dx8show_set_hwnd(void *hwnd);
#endif
Binary file not shown.
Binary file not shown.
+23 -5
View File
@@ -9,13 +9,21 @@
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2002-12-07 01:37:41 $
* $Author: bobboau $
*
* Code to move, render and otherwise deal with fireballs.
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/11/14 04:18:16 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -343,7 +351,9 @@
#include "gamesnd/gamesnd.h"
#include "localization/localize.h"
#define WARPHOLE_GROW_TIME (1.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
int wm;
#define WARPHOLE_GROW_TIME (3.5f) // time for warphole to reach max size (also time to shrink to nothing once it begins to shrink)
#define MAX_FIREBALL_LOD 4
@@ -508,7 +518,9 @@ void fireball_load_data()
if ( Warp_glow_bitmap == -1 ) {
Warp_glow_bitmap = bm_load( NOX("warpglow01") );
}
}
// polymodel Warp_pm;
}
@@ -537,6 +549,11 @@ void fireball_init()
Fireballs[i].objnum = -1;
}
mprintf(("loading warp model"));
wm = -1;
wm = model_load("warp.pof", 0, NULL, 0);
mprintf((" %d\n", wm));
}
@@ -630,6 +647,7 @@ void fireball_render(object * obj)
//rad = (fb->total_time - t )*obj->radius/WARPHOLE_GROW_TIME;
}
//rad = obj->radius;
// obj->alt_rad = rad;
warpin_render(&obj->orient, &obj->pos, Fireballs[num].current_bitmap, rad, percent_life, obj->radius );
+9 -4
View File
@@ -5,17 +5,20 @@
* or otherwise commercially exploit the source or things you created based on the
* source.
*
*/
*/
/*
* $Logfile: /Freespace2/code/Fireball/FireBalls.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-11-14 04:18:16 $
* $Author: bobboau $
*
* Prototypes for fireball functions
*
* $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:22 penguin
* Warpcore CVS sync
*
@@ -207,3 +210,5 @@ extern void warpin_render(matrix *orient, vector *pos, int texture_bitmap_num, f
extern int Warp_glow_bitmap; // Internal
#endif /* _FIREBALLS_H */
extern int wm;
+113 -38
View File
@@ -7,15 +7,23 @@
*
*/
/*
/*
* $Logfile: /Freespace2/code/Fireball/WarpInEffect.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-01-05 23:41:50 $
* $Author: bobboau $
*
* Code for rendering the warp in effects for ships
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/11/14 04:18:16 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.1 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -135,6 +143,9 @@
#include "fireball/fireballs.h"
#include "globalincs/linklist.h"
#include "io/timer.h"
#include "Weapon/Beam.h"
extern int wm;
DCF(norm,"normalize a zero length vector")
{
@@ -164,15 +175,19 @@ void draw_face( vertex *v1, vertex *v2, vertex *v3 )
}
#define wSTUFF_VERTICES() do { verts[0]->u = 0.5f; verts[0]->v = 0.0f; verts[1]->u = 1.0f; verts[1]->v = 0.0f; verts[2]->u = 1.0f; verts[2]->v = 1.0f; verts[3]->u = 0.5f; verts[3]->v = 1.0f; } while(0);
#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(matrix *orient, vector *pos, int texture_bitmap_num, float radius, float life_percent, float max_radius )
{
int i;
int saved_gr_zbuffering = gr_zbuffer_get();
// gr_zbuffering = 0;
gr_set_bitmap( texture_bitmap_num, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
float Grid_depth = radius/2.5f;
@@ -180,43 +195,109 @@ void warpin_render(matrix *orient, vector *pos, int texture_bitmap_num, float ra
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];
vertex verts[5];
vm_vec_scale_add( &vecs[0], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
if(wm > -1){
float model_Interp_scale_x = radius /20;
float model_Interp_scale_y = radius /20;
float model_Interp_scale_z = max_radius /20;
vm_vec_scale_add( &vecs[1], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
set_warp_gloabals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, texture_bitmap_num, (radius/max_radius) );
float dist = vm_vec_dist_quick( pos, &Eye_position );
vm_vec_scale_add( &vecs[2], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
model_set_detail_level((int)(dist / (radius * 10.0f)));
gr_set_cull(0);
model_render( wm, orient, pos, MR_NO_LIGHTING | MR_NORMAL);
gr_set_cull(1);
vm_vec_scale_add( &vecs[3], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
// Warp_Map = -1;//un sets the warp map
// vm_vec_scale_add( &vecs[4], &center, &orient->vec.fvec, -Grid_depth );
vecs[4] = center;
model_Interp_scale_x = 1.0f;
model_Interp_scale_y = 1.0f;
model_Interp_scale_z = 1.0f;
set_warp_gloabals(model_Interp_scale_x, model_Interp_scale_y, model_Interp_scale_z, -1, 0.0f);
gr_set_cull(0);
/*
//this is that half done effect that was pissing people off-Bobboau
matrix m;
vector 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){
angle = ANG_TO_RAD(135.0f * (life_percent * 5.0f));
}
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;
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));
verts[0].u = 0.01f; verts[0].v = 0.01f;
verts[1].u = 0.99f; verts[1].v = 0.01f;
verts[2].u = 0.99f; verts[2].v = 0.99f;
verts[3].u = 0.01f; verts[3].v = 0.99f;
verts[4].u = 0.5f; verts[4].v = 0.5f;
vertex h1[4]; // halves of a beam section
vertex *verts[4] = { &h1[0], &h1[1], &h1[2], &h1[3] };
vector top1, bottom1, top2, bottom2;
for (i=0; i<5; i++ ) {
g3_rotate_vertex( &verts[i], &vecs[i] );
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);
mprintf(( "top1 %f %f %f, botom1 %f %f %f, \n",top1.xyz.x, top1.xyz.y, top1.xyz.z, bottom1.xyz.x, bottom1.xyz.y, bottom1.xyz.z));
mprintf(( "top2 %f %f %f, botom2 %f %f %f, \n",top2.xyz.x, top2.xyz.y, top2.xyz.z, bottom2.xyz.x, bottom2.xyz.y, bottom2.xyz.z));
wR_VERTICES(); // rotate and project the vertices
wP_VERTICES();
wSTUFF_VERTICES(); // stuff the beam with creamy goodness (texture coords)
gr_set_bitmap(Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.9999f);
g3_draw_poly( 4, verts, TMAP_FLAG_TILED | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT); // added TMAP_FLAG_TILED flag for beam texture tileing -Bobboau
}
*/
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 );
vm_vec_scale_add( &vecs[0], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[0], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[1], &center, &orient->vec.uvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[1], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[2], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.rvec, radius );
vm_vec_scale_add2( &vecs[2], &orient->vec.fvec, Grid_depth );
vm_vec_scale_add( &vecs[3], &center, &orient->vec.uvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.rvec, -radius );
vm_vec_scale_add2( &vecs[3], &orient->vec.fvec, Grid_depth );
// vm_vec_scale_add( &vecs[4], ¢er, &orient->vec.fvec, -Grid_depth );
vecs[4] = center;
verts[0].u = 0.01f; verts[0].v = 0.01f;
verts[1].u = 0.99f; verts[1].v = 0.01f;
verts[2].u = 0.99f; verts[2].v = 0.99f;
verts[3].u = 0.01f; verts[3].v = 0.99f;
verts[4].u = 0.5f; verts[4].v = 0.5f;
for (i=0; i<5; i++ ) {
g3_rotate_vertex( &verts[i], &vecs[i] );
}
draw_face( &verts[0], &verts[4], &verts[1] );
draw_face( &verts[1], &verts[4], &verts[2] );
draw_face( &verts[4], &verts[3], &verts[2] );
draw_face( &verts[0], &verts[3], &verts[4] );
}
draw_face( &verts[0], &verts[4], &verts[1] );
draw_face( &verts[1], &verts[4], &verts[2] );
draw_face( &verts[4], &verts[3], &verts[2] );
draw_face( &verts[0], &verts[3], &verts[4] );
if ( Warp_glow_bitmap != -1 ) {
gr_set_bitmap( Warp_glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
@@ -265,9 +346,3 @@ void warpin_render(matrix *orient, vector *pos, int texture_bitmap_num, float ra
gr_zbuffer_set( saved_gr_zbuffering );
}
+193 -54
View File
@@ -9,13 +9,59 @@
/*
* $Logfile: /Freespace2/code/Freespace2/FreeSpace.cpp $
* $Revision: 2.13 $
* $Date: 2002-10-22 17:42:09 $
* $Author: randomtiger $
* $Revision: 2.26 $
* $Date: 2003-02-23 20:55:57 $
* $Author: wmcoolmon $
*
* Freespace main body
*
* $Log: not supported by cvs2svn $
* Revision 2.25 2003/02/16 19:00:56 phreak
* stupid typo -- my bad
*
* Revision 2.24 2003/02/16 18:53:59 phreak
* fixed around splash screen
* 2_splash.pcx is loaded in 1024x768
* splash.pcx is loaded in 640x480 or 2_splash.pcx isn't found
*
* Revision 2.23 2003/01/30 23:18:21 phreak
* cleaned up debug output
*
* Revision 2.22 2003/01/26 20:04:32 wmcoolmon
* Minor mod to preload screen code, added separate 1024x768 logo
* -C
*
* Revision 2.21 2003/01/26 02:58:33 wmcoolmon
* Added title screen support to retail version. When FS2 loads, it will build a list of PCX files in the current directory, then attempt to display one. If no PCX files exist, it will try to display one of the title screens defined in the code. Freespace 2 will then attempt to superimpose a logo in the upper-left hand corner of the screen. If neither can be displayed, FS2 will function normally.
*
* Revision 2.20 2003/01/20 05:40:49 bobboau
* added several sExps for turning glow points and glow maps on and off
*
* Revision 2.19 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.18 2003/01/15 21:26:35 anonymous
* fixed the demo compilation. Define FS2_DEMO globally to compile as a demo. Make sure warp.pof is in your data/models directory.
*
* Revision 2.17 2003/01/14 04:00:16 Goober5000
* allowed for up to 256 main halls
* --Goober5000
*
* Revision 2.16 2002/12/21 13:39:03 DTP
* did bit more house keeping. modfied Phreaks fps cmdline a bit, so that we dont have to specific build code.libs for fred, but can use the same code.lib for both fs2_open.exe and fred2_open.exe
*
* Revision 2.15 2002/12/18 22:21:23 phreak
* tidied up game_init() a bit.. took out a bunch of unneeded ifdefs like E3_BUILD
* Added option to access OpenGL from the registry keys. searches for "OpenGL-"
* whoever is in charge of the launcher might want to know this.
*
* Revision 2.14 2002/11/18 21:34:16 phreak
* made ogl be used if "NDEBUG" is not defined and "USE_OPENGL" is defined - phreak
*
* Revision 2.13 2002/10/22 17:42:09 randomtiger
* Fixed lighting bug that caused special pause to crash on debug build.
* Also added TAB functionality for special pause that toggles HUD. - RT
*
* Revision 2.12 2002/10/19 03:50:28 randomtiger
* Added special pause mode for easier action screenshots.
* Added new command line parameter for accessing all single missions in tech room. - RT
@@ -1067,17 +1113,25 @@ static char *Game_loading_ani_fname[GR_NUM_RESOLUTIONS] = {
};
#if defined(FS2_DEMO)
static char *Game_demo_title_screen_fname[GR_NUM_RESOLUTIONS] = {
static char *Game_title_screen_fname[GR_NUM_RESOLUTIONS] = {
"PreLoad",
"2_PreLoad"
};
#elif defined(OEM_BUILD)
static char *Game_demo_title_screen_fname[GR_NUM_RESOLUTIONS] = {
static char *Game_title_screen_fname[GR_NUM_RESOLUTIONS] = {
"OEMPreLoad",
"2_OEMPreLoad"
};
#else
static char *Game_title_screen_fname[GR_NUM_RESOLUTIONS] = {
"PreLoad",
"2_PreLoad"
};
#endif
static char *Game_logo_screen_fname[GR_NUM_RESOLUTIONS] = {
"PreLoadLogo",
"2_PreLoadLogo"
};
#ifdef _WIN32
// cdrom stuff
@@ -1214,7 +1268,7 @@ void game_framerate_check()
Gf_critical_time += flFrametime;
}
if(!Show_framerate){
if((!Show_framerate) || (!Cmdline_show_fps)) {
return;
}
@@ -2368,44 +2422,38 @@ void game_init()
int trying_d3d = 0;
if (!Is_standalone && ptr && (strstr(ptr, NOX("3DFX Glide")))) {
#ifdef E3_BUILD
// always 640 for E3
gr_init(GR_640, GR_GLIDE);
#else
// regular or hi-res ?
#ifdef NDEBUG
if(has_sparky_hi && strstr(ptr, NOX("(1024x768)"))){
#else
if(strstr(ptr, NOX("(1024x768)"))){
#endif
gr_init(GR_1024, GR_GLIDE);
} else {
gr_init(GR_640, GR_GLIDE);
}
#endif
} else if (!Is_standalone && ptr && (strstr(ptr, NOX("Direct 3D -") ))) {
#ifdef E3_BUILD
// always 640 for E3
trying_d3d = 1;
gr_init(GR_640, GR_DIRECT3D, depth);
#else
// regular or hi-res ?
#ifdef NDEBUG
if(has_sparky_hi && strstr(ptr, NOX("(1024x768)"))){
#else
if(strstr(ptr, NOX("(1024x768)"))){
#endif
// Direct 3D
trying_d3d = 1;
gr_init(GR_1024, GR_DIRECT3D, depth);
} else {
// Direct 3D
trying_d3d = 1;
gr_init(GR_640, GR_DIRECT3D, depth);
}
#endif
} else if (!Is_standalone && ptr && (strstr(ptr, NOX("OpenGL -") ))){
if (has_sparky_hi && strstr(ptr,NOX("1024x768"))){
gr_init(GR_1024, GR_OPENGL, depth);
} else {
gr_init(GR_640, GR_OPENGL, depth);
}
} else {
// Software
//NOT USED ANYMORE
Error(LOCATION,"Software mode is unsupported, use hardware acceleration. If not using software mode, then something was misspelled. GET A PROGRAMMER!!");
/*
#ifndef NDEBUG
if ( Use_fullscreen_at_startup && !Is_standalone) {
gr_init(GR_640, GR_DIRECTDRAW);
@@ -2419,6 +2467,7 @@ void game_init()
gr_init(GR_640, GR_SOFTWARE);
}
#endif
*/
}
// tried d3d ?
@@ -2455,12 +2504,12 @@ void game_init()
gr_set_gamma(Freespace_gamma);
#if defined(FS2_DEMO) || defined(OEM_BUILD)
//#if defined(FS2_DEMO) || defined(OEM_BUILD)
// add title screen
if(!Is_standalone){
display_title_screen();
}
#endif
//#endif
#ifndef NO_NETWORK
// attempt to load up master tracker registry info (login and password)
@@ -2509,7 +2558,9 @@ void game_init()
control_config_common_init(); // sets up localization stuff in the control config
parse_rank_tbl();
#ifndef FS2_DEMO
parse_medal_tbl();
#endif
cutscene_init();
key_init();
mouse_init();
@@ -2629,7 +2680,7 @@ void game_get_framerate()
}
Framecount++;
if (Show_framerate) {
if ((Show_framerate) || (Cmdline_show_fps)) {
gr_set_color_fast(&HUD_color_debug);
gr_string( 570, 2, text );
}
@@ -3961,6 +4012,8 @@ void game_flip_page_and_time_it()
void game_simulation_frame()
{
// mprintf(("about to render a frame\n"));
#ifndef NO_NETWORK
// blow ships up in multiplayer dogfight
if((Game_mode & GM_MULTIPLAYER) && (Net_player != NULL) && (Net_player->flags & NETINFO_FLAG_AM_MASTER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT) && (f2fl(Missiontime) >= 2.0f) && !dogfight_blown){
@@ -3992,6 +4045,7 @@ void game_simulation_frame()
// process AWACS stuff - do this first thing
awacs_process();
//mprintf(("awacs procesed\n"));
// single player, set Player hits_this_frame to 0
if ( !(Game_mode & GM_MULTIPLAYER) && Player ) {
@@ -4013,6 +4067,7 @@ void game_simulation_frame()
// the basic idea being that because it con be confusing to deal with them on a multi-frame basis, they are only valid for
// frame
ship_process_targeting_lasers();
//mprintf(("targeting lasers procesed\n"));
// do this here so that it works for multiplayer
if ( Viewer_obj ) {
@@ -4039,6 +4094,7 @@ void game_simulation_frame()
} else {
physics_set_viewer( NULL, PHYSICS_VIEWER_FRONT );
}
//mprintf(("view stuff done\n"));
#define VM_PADLOCK_UP (1 << 7)
#define VM_PADLOCK_REAR (1 << 8)
@@ -4082,11 +4138,14 @@ void game_simulation_frame()
mission_eval_goals();
}
#endif // ifndef NO_NETWORK
//mprintf(("arivals\\departures done\n"));
// always check training objectives, even in multiplayer missions. we need to do this so that the directives gauge works properly on clients
if(!(Game_mode & GM_DEMO_PLAYBACK)){
training_check_objectives();
}
// mprintf(("objectives procesed\n"));
#ifndef NO_NETWORK
// do all interpolation now
@@ -4102,12 +4161,15 @@ void game_simulation_frame()
// move all objects - does interpolation now as well
obj_move_all(flFrametime);
}
// mprintf(("interpolation procesed\n"));
#endif // ifndef NO_NETWORK
// only process the message queue when the player is "in" the game
if ( !Pre_player_entry ){
message_queue_process(); // process any messages send to the player
}
//mprintf(("message queue procesed\n"));
if(!(Game_mode & GM_DEMO_PLAYBACK)){
message_maybe_distort(); // maybe distort incoming message if comms damaged
@@ -4115,12 +4177,14 @@ void game_simulation_frame()
player_process_pending_praise(); // maybe send off a delayed praise message to the player
player_maybe_play_all_alone_msg(); // mabye tell the player he is all alone
}
//mprintf(("assorted player stuff procesed\n"));
if(!(Game_mode & GM_STANDALONE_SERVER)){
// process some stuff every frame (before frame is rendered)
emp_process_local();
hud_update_frame(); // update hud systems
//mprintf(("HUD updated\n"));
if (!physics_paused) {
// Move particle system
@@ -4137,9 +4201,11 @@ void game_simulation_frame()
shockwave_move_all(flFrametime); // update all the shockwaves
}
//mprintf(("physics stuff procesed\n"));
// subspace missile strikes
ssm_process();
//mprintf(("SSM procesed\n"));
#ifndef NO_SOUND
obj_snd_do_frame(); // update the object-linked persistant sounds
@@ -4152,8 +4218,10 @@ void game_simulation_frame()
if ( Game_subspace_effect ) {
game_start_subspace_ambient_sound();
}
//mprintf(("sound procesed\n"));
#endif
}
}
// mprintf(("frame rendered\n"));
}
// Maybe render and process the dead-popup
@@ -4738,6 +4806,9 @@ void game_do_frame()
game_set_frametime(GS_STATE_GAME_PLAY);
game_update_missiontime();
// if (Player_ship->flags & SF_DYING)
// flFrametime /= 15.0;
#if !defined(NO_NETWORK) && !defined(NO_STANDALONE)
if (Game_mode & GM_STANDALONE_SERVER) {
std_multi_set_standalone_missiontime(f2fl(Missiontime));
@@ -6019,11 +6090,7 @@ void game_enter_state( int old_state, int new_state )
#if defined(PRESS_TOUR_BUILD) || defined(PD_BUILD)
mht_init();
#else
if (Player->on_bastion) {
main_hall_init(1);
} else {
main_hall_init(0);
}
main_hall_init(Player->main_hall);
#endif
break;
@@ -7909,6 +7976,10 @@ if ( FS_VERSION_BUILD == 0 ) {
sprintf(str,"V%d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
}
#ifdef FS2_DEMO
strcat(str, " Demo");
#endif
#ifdef _DEBUG
strcat(str, " Dbg");
#endif
@@ -8804,16 +8875,18 @@ int game_do_cd_mission_check(char *filename)
// checksums, just keep a list of all valid ones, if it matches any of them, keep it
#define NUM_SHIPS_TBL_CHECKSUMS 1
/*
#ifdef FS2_DEMO
int Game_ships_tbl_checksums[NUM_SHIPS_TBL_CHECKSUMS] = {
-463907578, // US - beta 1
//-463907578, // US - beta 1
1696074201, // FS2 demo
};
*/
#else
int Game_ships_tbl_checksums[NUM_SHIPS_TBL_CHECKSUMS] = {
// -1022810006, // 1.0 FULL
-1254285366 // 1.2 FULL (German)
};
#endif
void verify_ships_tbl()
{
@@ -8871,16 +8944,18 @@ DCF(shipspew, "display the checksum for the current ships.tbl")
// checksums, just keep a list of all valid ones, if it matches any of them, keep it
#define NUM_WEAPONS_TBL_CHECKSUMS 1
/*
#ifdef FS2_DEMO
int Game_weapons_tbl_checksums[NUM_WEAPONS_TBL_CHECKSUMS] = {
141718090, // US - beta 1
//141718090, // US - beta 1
-266420030, // demo 1
};
*/
#else
int Game_weapons_tbl_checksums[NUM_WEAPONS_TBL_CHECKSUMS] = {
// 399297860, // 1.0 FULL
-553984927 // 1.2 FULL (german)
};
#endif
void verify_weapons_tbl()
{
@@ -8944,17 +9019,64 @@ int game_hacked_data()
return 0;
}
//#define MAX_SPLASHSCREENS 64
//char Splash_screens[MAX_SPLASHSCREENS][MAX_FILENAME_LEN];
void display_title_screen()
{
#if defined(FS2_DEMO) || defined(OEM_BUILD)
///int title_bitmap;
int title_bitmap = -1;
int title_logo =-1;
/* _finddata_t find;
long find_handle;
char current_dir[256];
// load bitmap
int title_bitmap = bm_load(Game_demo_title_screen_fname[gr_screen.res]);
if (title_bitmap == -1) {
return;
//Get the find string
_getcwd(current_dir, 256);
strcat(current_dir, DIR_SEPARATOR_STR);
strcat(current_dir, "*.pcx");
//Let the search begin!
find_handle = _findfirst(current_dir, &find);
int i = 0;
if(find_handle != -1)
{
char *p;
do {
if(!(find.attrib & _A_SUBDIR) && (strlen(find.name) < MAX_FILENAME_LEN)) {
p = strchr( find.name, '.' );
if(p) {
*p = '\0';
}
if(stricmp(find.name, Game_logo_screen_fname[gr_screen.res])
&& stricmp(find.name, Game_title_screen_fname[gr_screen.res]))
{
strcpy(Splash_screens[i], find.name);
i++;
}
if(i == MAX_SPLASHSCREENS) {
break;
}
}
} while(!_findnext(find_handle, &find));
}
if(i) {
srand(time(NULL));
title_bitmap = bm_load(Splash_screens[rand() % i]);
} else {
title_bitmap = bm_load(Game_title_screen_fname[gr_screen.res]);
}
if (title_bitmap == -1 && title_logo == -1) {
// return;
}
*/
#ifndef NO_DIRECT3D
// d3d
if((gr_screen.mode == GR_DIRECT3D) && (Gr_bitmap_poly)){
@@ -8963,11 +9085,31 @@ void display_title_screen()
}
#endif
// set
gr_set_bitmap(title_bitmap);
title_logo = bm_load(Game_logo_screen_fname[gr_screen.res]);
title_bitmap = bm_load(Game_title_screen_fname[gr_screen.res]);
// draw
gr_bitmap(0, 0);
if(title_bitmap != -1)
{
// set
gr_set_bitmap(title_bitmap);
//Get bitmap's width and height
int width, height;
bm_get_info(title_bitmap, &width, &height);
//Draw it in the center of the screen
gr_bitmap((gr_screen.max_w - width)/2, (gr_screen.max_h - height)/2);
bm_unload(title_bitmap);
}
if(title_logo != -1)
{
gr_set_bitmap(title_logo);
gr_bitmap(0,0);
bm_unload(title_logo);
}
#ifndef NO_DIRECT3D
// d3d
@@ -8979,9 +9121,6 @@ void display_title_screen()
// flip
gr_flip();
bm_unload(title_bitmap);
#endif // FS2_DEMO || OEM_BUILD
}
// return true if the game is running with "low memory", which is less than 48MB
+30 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-25 04:17:39 $
* $Author: Goober5000 $
*
* C module for high-level control of event driven music
*
* $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:22 penguin
* Warpcore CVS sync
*
@@ -1415,6 +1418,30 @@ int event_music_next_soundtrack(int delta)
return Current_soundtrack_num;
}
// Goober5000 - along the same lines; this is for the sexp
void event_sexp_change_music(char *name)
{
Assert(name);
int i, new_soundtrack = -1;
if ( Event_music_enabled == FALSE || Event_music_level_inited == FALSE )
{
return;
}
for (i=0; i<Num_soundtracks; i++)
{
if (!stricmp(name, Soundtracks[i].name))
{
new_soundtrack = i;
}
}
event_music_level_close();
event_music_level_init(new_soundtrack);
}
// ----------------------------------------------------------------
// event_music_get_soundtrack_name()
//
+8 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/EventMusic.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-25 04:17:39 $
* $Author: Goober5000 $
*
* Header file for high-level control of event driven music
*
* $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:22 penguin
* Warpcore CVS sync
*
@@ -185,7 +188,7 @@ typedef struct tagSOUNDTRACK_INFO {
char pattern_fnames[MAX_PATTERNS][MAX_FILENAME_LEN];
} SOUNDTRACK_INFO;
#define MAX_SOUNDTRACKS 10
#define MAX_SOUNDTRACKS 25
extern SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS];
extern int Num_soundtracks;
@@ -217,6 +220,7 @@ void event_music_start_default();
void event_music_get_info(char *outbuf);
void event_music_get_soundtrack_name(char *outbuf);
int event_music_next_soundtrack(int delta);
void event_sexp_change_music(char *name);
void event_music_set_soundtrack(char *name);
void event_music_set_score(int score_index, char *name);
int event_music_get_spooled_music_index(char *name);
+10 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Gamesnd/GameSnd.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-10 05:43:35 $
* $Author: Goober5000 $
*
* Routines to keep track of which sound files go where
*
* $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:22 penguin
* Warpcore CVS sync
*
@@ -530,6 +533,10 @@ extern game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
// copilot
#define SND_COPILOT 162
// added for ballistic primaries - Goober5000
#define SND_BALLISTIC_START_LOAD 165
#define SND_BALLISTIC_LOAD 166
// supernova 1 and supernova 2
#define SND_SUPERNOVA_1 173
#define SND_SUPERNOVA_2 174
@@ -538,7 +545,6 @@ extern game_snd Snds_flyby[MAX_SPECIES_NAMES][2];
#define SND_LIGHTNING_1 180
#define SND_LIGHTNING_2 181
//---------------------------------------------------
// Interface sounds
//---------------------------------------------------
+30 -12
View File
@@ -9,13 +9,22 @@
/*
* $Logfile: /Freespace2/code/GlobalIncs/PsTypes.h $
* $Revision: 2.4 $
* $Date: 2002-08-06 01:49:08 $
* $Author: penguin $
* $Revision: 2.7 $
* $Date: 2003-01-18 19:48:19 $
* $Author: phreak $
*
* Header file containg global typedefs, constants and macros
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2002/12/02 23:56:12 Goober5000
* fixed misspelling
*
* Revision 2.5 2002/12/02 20:49:14 Goober5000
* fixed misspelling of "category" as "catagory"
*
* Revision 2.4 2002/08/06 01:49:08 penguin
* Renamed ccode members to cc_or and cc_and
*
* Revision 2.3 2002/08/01 01:41:04 penguin
* The big include file move
*
@@ -328,13 +337,22 @@ typedef struct vertex {
ubyte pad[2]; // pad structure to be 4 byte aligned.
} vertex;
#define BMP_AABITMAP (1<<0) // antialiased bitmap
#define BMP_AABITMAP (1<<0) // antialiased bitmap
#define BMP_TEX_XPARENT (1<<1) // transparent texture
#define BMP_TEX_NONDARK (1<<2) // nondarkening texture
#define BMP_TEX_OTHER (1<<3) // so we can identify all "normal" textures
#define BMP_TEX_OTHER (1<<3) // so we can identify all "normal" textures
#define BMP_TEX_DXT1 (1<<4) // dxt1 compressed 8r8g8b1a (24bit)
#define BMP_TEX_DXT3 (1<<5) // dxt3 compressed 8r8g8b4a (32bit)
#define BMP_TEX_DXT5 (1<<6) // dxt5 compressed 8r8g8b8a (32bit)
//compressed texture types
#define BMP_TEX_COMP ( BMP_TEX_DXT1 | BMP_TEX_DXT3 | BMP_TEX_DXT5 )
//non compressed textures
#define BMP_TEX_NONCOMP ( BMP_TEX_XPARENT | BMP_TEX_NONDARK | BMP_TEX_OTHER )
// any texture type
#define BMP_TEX_ANY ( BMP_TEX_XPARENT | BMP_TEX_NONDARK | BMP_TEX_OTHER )
#define BMP_TEX_ANY ( BMP_TEX_COMP | BMP_TEX_NONCOMP )
// max res == 1024x768. max texture size == 256
#define MAX_BMAP_SECTIONS_X 4
@@ -383,12 +401,12 @@ extern void _cdecl Warning( char * filename, int line, char * format, ... );
// or,
// Error( LOCATION, "Error opening %s", filename );
#if defined(NDEBUG)
//#if defined(NDEBUG)
#define Assert(x) do {} while (0)
#else
void gr_activate(int);
#define Assert(x) do { if (!(x)){ gr_activate(0); WinAssert(#x,__FILE__,__LINE__); gr_activate(1); } } while (0)
#endif
//#else
//void gr_activate(int);
//#define Assert(x) do { if (!(x)){ gr_activate(0); WinAssert(#x,__FILE__,__LINE__); gr_activate(1); } } while (0)
//#endif
//#define Int3() _asm { int 3 }
@@ -497,7 +515,7 @@ extern float Dc_arg_float; // If Dc_arg_type & ARG_FLOAT is set, then this is th
void dc_printf( char *format, ... );
// Each dc_arg_type can have one or more of these flags set.
// This is because some things can fit into two catagories.
// This is because some things can fit into two categories.
// Like 1 can be an integer, a float, a string, or a true boolean
// value.
#define ARG_NONE (1<<0) // no argument
+9 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/GlobalIncs/SystemVars.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-11-22 20:56:15 $
* $Author: phreak $
*
* Variables and constants common to FreeSpace and Fred.
*
* $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:22 penguin
* Warpcore CVS sync
*
@@ -233,7 +236,9 @@ int Fred_found_unknown_ship_during_parsing = 0;
// If true, then we are using Direct3D hardware. This is used for game type stuff
// that changes when you're using hardware.
int D3D_enabled = 0;
int D3D_enabled = 0;
int OGL_inited=0;
// Values used for noise for thruster animations
float Noise[NOISE_NUM_FRAMES] = {
+14 -4
View File
@@ -9,12 +9,22 @@
/*
* $Logfile: /Freespace2/code/GlobalIncs/version.h $
* $Revision: 2.3 $
* $Date: 2002-11-10 20:40:02 $
* $Author: inquisitor $
* $Revision: 2.6 $
* $Date: 2003-02-05 07:04:31 $
* $Author: Goober5000 $
*
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2003/01/30 23:24:34 phreak
* bumped to 3.50
*
* Revision 2.4 2002/12/31 20:09:14 Goober5000
* bumped to 3.4
* --Goober5000
*
* Revision 2.3 2002/11/10 20:40:02 inquisitor
* Bumped to 3.3
*
* Revision 2.2 2002/08/13 03:32:25 penguin
* Bumped to version 3.2
*
@@ -129,7 +139,7 @@
// Major.Minor.Bugfix
#define FS_VERSION_MAJOR 3 // major version
#define FS_VERSION_MINOR 3 // increase by 1 for minor revs
#define FS_VERSION_MINOR 5 // increase by 1 for minor revs
#define FS_VERSION_BUILD 0 // bugfix release
#define VERSION_LOC_FNAME "version.nfo"
+16 -6
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Graphics/2d.cpp $
* $Revision: 2.3 $
* $Date: 2002-08-01 01:41:04 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2002-11-18 21:32:11 $
* $Author: phreak $
*
* Main file for 2d primitives.
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/08/01 01:41:04 penguin
* The big include file move
*
* Revision 2.2 2002/07/30 14:29:15 unknownplayer
*
* Started work on DX8.1 implementation. Updated the project files to encompass
@@ -921,7 +924,7 @@ int gr_init(int res, int mode, int depth, int fred_x, int fred_y)
#if defined(HARDWARE_ONLY) && defined(_WIN32)
if(!Fred_running && !Pofview_running && !Nebedit_running && !Is_standalone){
if((mode != GR_GLIDE) && (mode != GR_DIRECT3D)){
if((mode != GR_GLIDE) && (mode != GR_DIRECT3D) && (mode != GR_OPENGL)){
mprintf(("Forcing glide startup!\n"));
mode = GR_GLIDE;
}
@@ -1022,6 +1025,9 @@ int gr_init(int res, int mode, int depth, int fred_x, int fred_y)
#ifdef USE_OPENGL
case GR_OPENGL:
Gr_bitmap_poly=1;
gr_screen.bits_per_pixel=depth;
gr_screen.bytes_per_pixel=depth/8;
gr_opengl_init();
break;
#endif // ifdef USE_OPENGL
@@ -1088,6 +1094,8 @@ void gr_force_windowed()
#ifdef USE_OPENGL
case GR_OPENGL:
extern void opengl_minimize();
opengl_minimize();
break;
#endif // ifdef USE_OPENGL
@@ -1140,6 +1148,8 @@ void gr_activate(int active)
#ifdef USE_OPENGL
case GR_OPENGL:
extern void gr_opengl_activate(int active);
gr_opengl_activate(active);
break;
#endif // ifdef USE_OPENGL
@@ -1203,8 +1213,8 @@ void gr_bitmap(int x, int y)
int x_line, y_line;
int w, h;
// d3d and glide support texture poly shiz
if(((gr_screen.mode == GR_DIRECT3D) || (gr_screen.mode == GR_GLIDE)) && Gr_bitmap_poly){
// d3d and glide support texture poly shiz, ogl does too
if(((gr_screen.mode == GR_DIRECT3D) || (gr_screen.mode == GR_GLIDE) || (gr_screen.mode== GR_OPENGL)) && Gr_bitmap_poly){
int idx, s_idx;
// float u_scale, v_scale;
bitmap_section_info *sections;
+373
View File
@@ -0,0 +1,373 @@
/*++ BUILD Version: 0004 // Increment this if a change has global effects
Copyright (c) 1985-95, Microsoft Corporation
Module Name:
glaux.h
Abstract:
Procedure declarations, constant definitions and macros for the OpenGL
Auxiliary Library.
--*/
#ifndef __GLAUX_H__
#define __GLAUX_H__
/*
* (c) Copyright 1993, Silicon Graphics, Inc.
* ALL RIGHTS RESERVED
* Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
* and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
* written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR
* FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
* GRAPHICS, INC. BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT,
* SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY
* KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING WITHOUT LIMITATION,
* LOSS OF PROFIT, LOSS OF USE, SAVINGS OR REVENUE, OR THE CLAIMS OF
* THIRD PARTIES, WHETHER OR NOT SILICON GRAPHICS, INC. HAS BEEN
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
*
* US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
* clause at DFARS 252.227-7013 and/or in similar or successor
* clauses in the FAR or the DOD or NASA FAR Supplement.
* Unpublished-- rights reserved under the copyright laws of the
* United States. Contractor/manufacturer is Silicon Graphics,
* Inc., 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
*
* OpenGL(TM) is a trademark of Silicon Graphics, Inc.
*/
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
** ToolKit Window Types
** In the future, AUX_RGBA may be a combination of both RGB and ALPHA
*/
#define AUX_RGB 0
#define AUX_RGBA AUX_RGB
#define AUX_INDEX 1
#define AUX_SINGLE 0
#define AUX_DOUBLE 2
#define AUX_DIRECT 0
#define AUX_INDIRECT 4
#define AUX_ACCUM 8
#define AUX_ALPHA 16
#define AUX_DEPTH24 32 /* 24-bit depth buffer */
#define AUX_STENCIL 64
#define AUX_AUX 128
#define AUX_DEPTH16 256 /* 16-bit depth buffer */
#define AUX_FIXED_332_PAL 512
#define AUX_DEPTH AUX_DEPTH16 /* default is 16-bit depth buffer */
/*
** Window Masks
*/
#define AUX_WIND_IS_RGB(x) (((x) & AUX_INDEX) == 0)
#define AUX_WIND_IS_INDEX(x) (((x) & AUX_INDEX) != 0)
#define AUX_WIND_IS_SINGLE(x) (((x) & AUX_DOUBLE) == 0)
#define AUX_WIND_IS_DOUBLE(x) (((x) & AUX_DOUBLE) != 0)
#define AUX_WIND_IS_INDIRECT(x) (((x) & AUX_INDIRECT) != 0)
#define AUX_WIND_IS_DIRECT(x) (((x) & AUX_INDIRECT) == 0)
#define AUX_WIND_HAS_ACCUM(x) (((x) & AUX_ACCUM) != 0)
#define AUX_WIND_HAS_ALPHA(x) (((x) & AUX_ALPHA) != 0)
#define AUX_WIND_HAS_DEPTH(x) (((x) & (AUX_DEPTH24 | AUX_DEPTH16)) != 0)
#define AUX_WIND_HAS_STENCIL(x) (((x) & AUX_STENCIL) != 0)
#define AUX_WIND_USES_FIXED_332_PAL(x) (((x) & AUX_FIXED_332_PAL) != 0)
/*
** ToolKit Event Structure
*/
typedef struct _AUX_EVENTREC {
GLint event;
GLint data[4];
} AUX_EVENTREC;
/*
** ToolKit Event Types
*/
#define AUX_EXPOSE 1
#define AUX_CONFIG 2
#define AUX_DRAW 4
#define AUX_KEYEVENT 8
#define AUX_MOUSEDOWN 16
#define AUX_MOUSEUP 32
#define AUX_MOUSELOC 64
/*
** Toolkit Event Data Indices
*/
#define AUX_WINDOWX 0
#define AUX_WINDOWY 1
#define AUX_MOUSEX 0
#define AUX_MOUSEY 1
#define AUX_MOUSESTATUS 3
#define AUX_KEY 0
#define AUX_KEYSTATUS 1
/*
** ToolKit Event Status Messages
*/
#define AUX_LEFTBUTTON 1
#define AUX_RIGHTBUTTON 2
#define AUX_MIDDLEBUTTON 4
#define AUX_SHIFT 1
#define AUX_CONTROL 2
/*
** ToolKit Key Codes
*/
#define AUX_RETURN 0x0D
#define AUX_ESCAPE 0x1B
#define AUX_SPACE 0x20
#define AUX_LEFT 0x25
#define AUX_UP 0x26
#define AUX_RIGHT 0x27
#define AUX_DOWN 0x28
#define AUX_A 'A'
#define AUX_B 'B'
#define AUX_C 'C'
#define AUX_D 'D'
#define AUX_E 'E'
#define AUX_F 'F'
#define AUX_G 'G'
#define AUX_H 'H'
#define AUX_I 'I'
#define AUX_J 'J'
#define AUX_K 'K'
#define AUX_L 'L'
#define AUX_M 'M'
#define AUX_N 'N'
#define AUX_O 'O'
#define AUX_P 'P'
#define AUX_Q 'Q'
#define AUX_R 'R'
#define AUX_S 'S'
#define AUX_T 'T'
#define AUX_U 'U'
#define AUX_V 'V'
#define AUX_W 'W'
#define AUX_X 'X'
#define AUX_Y 'Y'
#define AUX_Z 'Z'
#define AUX_a 'a'
#define AUX_b 'b'
#define AUX_c 'c'
#define AUX_d 'd'
#define AUX_e 'e'
#define AUX_f 'f'
#define AUX_g 'g'
#define AUX_h 'h'
#define AUX_i 'i'
#define AUX_j 'j'
#define AUX_k 'k'
#define AUX_l 'l'
#define AUX_m 'm'
#define AUX_n 'n'
#define AUX_o 'o'
#define AUX_p 'p'
#define AUX_q 'q'
#define AUX_r 'r'
#define AUX_s 's'
#define AUX_t 't'
#define AUX_u 'u'
#define AUX_v 'v'
#define AUX_w 'w'
#define AUX_x 'x'
#define AUX_y 'y'
#define AUX_z 'z'
#define AUX_0 '0'
#define AUX_1 '1'
#define AUX_2 '2'
#define AUX_3 '3'
#define AUX_4 '4'
#define AUX_5 '5'
#define AUX_6 '6'
#define AUX_7 '7'
#define AUX_8 '8'
#define AUX_9 '9'
/*
** ToolKit Gets and Sets
*/
#define AUX_FD 1 /* return fd (long) */
#define AUX_COLORMAP 3 /* pass buf of r, g and b (unsigned char) */
#define AUX_GREYSCALEMAP 4
#define AUX_FOGMAP 5 /* pass fog and color bits (long) */
#define AUX_ONECOLOR 6 /* pass index, r, g, and b (long) */
/*
** Color Macros
*/
#define AUX_BLACK 0
#define AUX_RED 13
#define AUX_GREEN 14
#define AUX_YELLOW 15
#define AUX_BLUE 16
#define AUX_MAGENTA 17
#define AUX_CYAN 18
#define AUX_WHITE 19
extern float auxRGBMap[20][3];
#define AUX_SETCOLOR(x, y) (AUX_WIND_IS_RGB((x)) ? \
glColor3fv(auxRGBMap[(y)]) : glIndexf((y)))
/*
** RGB Image Structure
*/
typedef struct _AUX_RGBImageRec {
GLint sizeX, sizeY;
unsigned char *data;
} AUX_RGBImageRec;
/*
** Prototypes
*/
void APIENTRY auxInitDisplayMode(GLenum);
void APIENTRY auxInitPosition(int, int, int, int);
/* GLenum APIENTRY auxInitWindow(LPCTSTR); */
#ifdef UNICODE
#define auxInitWindow auxInitWindowW
#else
#define auxInitWindow auxInitWindowA
#endif
GLenum APIENTRY auxInitWindowA(LPCSTR);
GLenum APIENTRY auxInitWindowW(LPCWSTR);
void APIENTRY auxCloseWindow(void);
void APIENTRY auxQuit(void);
void APIENTRY auxSwapBuffers(void);
typedef void (CALLBACK* AUXMAINPROC)(void);
void APIENTRY auxMainLoop(AUXMAINPROC);
typedef void (CALLBACK* AUXEXPOSEPROC)(int, int);
void APIENTRY auxExposeFunc(AUXEXPOSEPROC);
typedef void (CALLBACK* AUXRESHAPEPROC)(GLsizei, GLsizei);
void APIENTRY auxReshapeFunc(AUXRESHAPEPROC);
typedef void (CALLBACK* AUXIDLEPROC)(void);
void APIENTRY auxIdleFunc(AUXIDLEPROC);
typedef void (CALLBACK* AUXKEYPROC)(void);
void APIENTRY auxKeyFunc(int, AUXKEYPROC);
typedef void (CALLBACK* AUXMOUSEPROC)(AUX_EVENTREC *);
void APIENTRY auxMouseFunc(int, int, AUXMOUSEPROC);
int APIENTRY auxGetColorMapSize(void);
void APIENTRY auxGetMouseLoc(int *, int *);
void APIENTRY auxSetOneColor(int, float, float, float);
void APIENTRY auxSetFogRamp(int, int);
void APIENTRY auxSetGreyRamp(void);
void APIENTRY auxSetRGBMap(int, float *);
/* AUX_RGBImageRec * APIENTRY auxRGBImageLoad(LPCTSTR); */
#ifdef UNICODE
#define auxRGBImageLoad auxRGBImageLoadW
#else
#define auxRGBImageLoad auxRGBImageLoadA
#endif
AUX_RGBImageRec * APIENTRY auxRGBImageLoadA(LPCSTR);
AUX_RGBImageRec * APIENTRY auxRGBImageLoadW(LPCWSTR);
#ifdef UNICODE
#define auxDIBImageLoad auxDIBImageLoadW
#else
#define auxDIBImageLoad auxDIBImageLoadA
#endif
AUX_RGBImageRec * APIENTRY auxDIBImageLoadA(LPCSTR);
AUX_RGBImageRec * APIENTRY auxDIBImageLoadW(LPCWSTR);
void APIENTRY auxCreateFont(void);
/* void APIENTRY auxDrawStr(LPCTSTR); */
#ifdef UNICODE
#define auxDrawStr auxDrawStrW
#else
#define auxDrawStr auxDrawStrA
#endif
void APIENTRY auxDrawStrA(LPCSTR);
void APIENTRY auxDrawStrW(LPCWSTR);
void APIENTRY auxWireSphere(GLdouble);
void APIENTRY auxSolidSphere(GLdouble);
void APIENTRY auxWireCube(GLdouble);
void APIENTRY auxSolidCube(GLdouble);
void APIENTRY auxWireBox(GLdouble, GLdouble, GLdouble);
void APIENTRY auxSolidBox(GLdouble, GLdouble, GLdouble);
void APIENTRY auxWireTorus(GLdouble, GLdouble);
void APIENTRY auxSolidTorus(GLdouble, GLdouble);
void APIENTRY auxWireCylinder(GLdouble, GLdouble);
void APIENTRY auxSolidCylinder(GLdouble, GLdouble);
void APIENTRY auxWireIcosahedron(GLdouble);
void APIENTRY auxSolidIcosahedron(GLdouble);
void APIENTRY auxWireOctahedron(GLdouble);
void APIENTRY auxSolidOctahedron(GLdouble);
void APIENTRY auxWireTetrahedron(GLdouble);
void APIENTRY auxSolidTetrahedron(GLdouble);
void APIENTRY auxWireDodecahedron(GLdouble);
void APIENTRY auxSolidDodecahedron(GLdouble);
void APIENTRY auxWireCone(GLdouble, GLdouble);
void APIENTRY auxSolidCone(GLdouble, GLdouble);
void APIENTRY auxWireTeapot(GLdouble);
void APIENTRY auxSolidTeapot(GLdouble);
/*
** Window specific functions
** hwnd, hdc, and hglrc valid after auxInitWindow()
*/
HWND APIENTRY auxGetHWND(void);
HDC APIENTRY auxGetHDC(void);
HGLRC APIENTRY auxGetHGLRC(void);
/*
** Viewperf support functions and constants
*/
/* Display Mode Selection Criteria */
enum {
AUX_USE_ID = 1,
AUX_EXACT_MATCH,
AUX_MINIMUM_CRITERIA
};
void APIENTRY auxInitDisplayModePolicy(GLenum);
GLenum APIENTRY auxInitDisplayModeID(GLint);
GLenum APIENTRY auxGetDisplayModePolicy(void);
GLint APIENTRY auxGetDisplayModeID(void);
GLenum APIENTRY auxGetDisplayMode(void);
#ifdef __cplusplus
}
#endif
#endif /* __GLAUX_H__ */
+584
View File
@@ -0,0 +1,584 @@
/*++ BUILD Version: 0004 // Increment this if a change has global effects
Copyright (c) 1985-95, Microsoft Corporation
Module Name:
glu.h
Abstract:
Procedure declarations, constant definitions and macros for the OpenGL
Utility Library.
--*/
#ifndef __glu_h__
#ifndef __GLU_H__
#define __glu_h__
#define __GLU_H__
#include <GL/gl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright 1991-1993, Silicon Graphics, Inc.
** All Rights Reserved.
**
** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
** the contents of this file may not be disclosed to third parties, copied or
** duplicated in any form, in whole or in part, without the prior written
** permission of Silicon Graphics, Inc.
**
** RESTRICTED RIGHTS LEGEND:
** Use, duplication or disclosure by the Government is subject to restrictions
** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
** rights reserved under the Copyright Laws of the United States.
*/
/*
** Return the error string associated with a particular error code.
** This will return 0 for an invalid error code.
**
** The generic function prototype that can be compiled for ANSI or Unicode
** is defined as follows:
**
** LPCTSTR APIENTRY gluErrorStringWIN (GLenum errCode);
*/
#ifdef UNICODE
#define gluErrorStringWIN(errCode) ((LPCSTR) gluErrorUnicodeStringEXT(errCode))
#else
#define gluErrorStringWIN(errCode) ((LPCWSTR) gluErrorString(errCode))
#endif
const GLubyte* APIENTRY gluErrorString (
GLenum errCode);
const wchar_t* APIENTRY gluErrorUnicodeStringEXT (
GLenum errCode);
const GLubyte* APIENTRY gluGetString (
GLenum name);
void APIENTRY gluOrtho2D (
GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top);
void APIENTRY gluPerspective (
GLdouble fovy,
GLdouble aspect,
GLdouble zNear,
GLdouble zFar);
void APIENTRY gluPickMatrix (
GLdouble x,
GLdouble y,
GLdouble width,
GLdouble height,
GLint viewport[4]);
void APIENTRY gluLookAt (
GLdouble eyex,
GLdouble eyey,
GLdouble eyez,
GLdouble centerx,
GLdouble centery,
GLdouble centerz,
GLdouble upx,
GLdouble upy,
GLdouble upz);
int APIENTRY gluProject (
GLdouble objx,
GLdouble objy,
GLdouble objz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *winx,
GLdouble *winy,
GLdouble *winz);
int APIENTRY gluUnProject (
GLdouble winx,
GLdouble winy,
GLdouble winz,
const GLdouble modelMatrix[16],
const GLdouble projMatrix[16],
const GLint viewport[4],
GLdouble *objx,
GLdouble *objy,
GLdouble *objz);
int APIENTRY gluScaleImage (
GLenum format,
GLint widthin,
GLint heightin,
GLenum typein,
const void *datain,
GLint widthout,
GLint heightout,
GLenum typeout,
void *dataout);
int APIENTRY gluBuild1DMipmaps (
GLenum target,
GLint components,
GLint width,
GLenum format,
GLenum type,
const void *data);
int APIENTRY gluBuild2DMipmaps (
GLenum target,
GLint components,
GLint width,
GLint height,
GLenum format,
GLenum type,
const void *data);
#ifdef __cplusplus
class GLUnurbs;
class GLUquadric;
class GLUtesselator;
/* backwards compatibility: */
typedef class GLUnurbs GLUnurbsObj;
typedef class GLUquadric GLUquadricObj;
typedef class GLUtesselator GLUtesselatorObj;
typedef class GLUtesselator GLUtriangulatorObj;
#else
typedef struct GLUnurbs GLUnurbs;
typedef struct GLUquadric GLUquadric;
typedef struct GLUtesselator GLUtesselator;
/* backwards compatibility: */
typedef struct GLUnurbs GLUnurbsObj;
typedef struct GLUquadric GLUquadricObj;
typedef struct GLUtesselator GLUtesselatorObj;
typedef struct GLUtesselator GLUtriangulatorObj;
#endif
GLUquadric* APIENTRY gluNewQuadric (void);
void APIENTRY gluDeleteQuadric (
GLUquadric *state);
void APIENTRY gluQuadricNormals (
GLUquadric *quadObject,
GLenum normals);
void APIENTRY gluQuadricTexture (
GLUquadric *quadObject,
GLboolean textureCoords);
void APIENTRY gluQuadricOrientation (
GLUquadric *quadObject,
GLenum orientation);
void APIENTRY gluQuadricDrawStyle (
GLUquadric *quadObject,
GLenum drawStyle);
void APIENTRY gluCylinder (
GLUquadric *qobj,
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices,
GLint stacks);
void APIENTRY gluDisk (
GLUquadric *qobj,
GLdouble innerRadius,
GLdouble outerRadius,
GLint slices,
GLint loops);
void APIENTRY gluPartialDisk (
GLUquadric *qobj,
GLdouble innerRadius,
GLdouble outerRadius,
GLint slices,
GLint loops,
GLdouble startAngle,
GLdouble sweepAngle);
void APIENTRY gluSphere (
GLUquadric *qobj,
GLdouble radius,
GLint slices,
GLint stacks);
void APIENTRY gluQuadricCallback (
GLUquadric *qobj,
GLenum which,
void (CALLBACK* fn)());
GLUtesselator* APIENTRY gluNewTess(
void );
void APIENTRY gluDeleteTess(
GLUtesselator *tess );
void APIENTRY gluTessBeginPolygon(
GLUtesselator *tess,
void *polygon_data );
void APIENTRY gluTessBeginContour(
GLUtesselator *tess );
void APIENTRY gluTessVertex(
GLUtesselator *tess,
GLdouble coords[3],
void *data );
void APIENTRY gluTessEndContour(
GLUtesselator *tess );
void APIENTRY gluTessEndPolygon(
GLUtesselator *tess );
void APIENTRY gluTessProperty(
GLUtesselator *tess,
GLenum which,
GLdouble value );
void APIENTRY gluTessNormal(
GLUtesselator *tess,
GLdouble x,
GLdouble y,
GLdouble z );
void APIENTRY gluTessCallback(
GLUtesselator *tess,
GLenum which,
void (CALLBACK *fn)());
void APIENTRY gluGetTessProperty(
GLUtesselator *tess,
GLenum which,
GLdouble *value );
GLUnurbs* APIENTRY gluNewNurbsRenderer (void);
void APIENTRY gluDeleteNurbsRenderer (
GLUnurbs *nobj);
void APIENTRY gluBeginSurface (
GLUnurbs *nobj);
void APIENTRY gluBeginCurve (
GLUnurbs *nobj);
void APIENTRY gluEndCurve (
GLUnurbs *nobj);
void APIENTRY gluEndSurface (
GLUnurbs *nobj);
void APIENTRY gluBeginTrim (
GLUnurbs *nobj);
void APIENTRY gluEndTrim (
GLUnurbs *nobj);
void APIENTRY gluPwlCurve (
GLUnurbs *nobj,
GLint count,
GLfloat *array,
GLint stride,
GLenum type);
void APIENTRY gluNurbsCurve (
GLUnurbs *nobj,
GLint nknots,
GLfloat *knot,
GLint stride,
GLfloat *ctlarray,
GLint order,
GLenum type);
void APIENTRY
gluNurbsSurface(
GLUnurbs *nobj,
GLint sknot_count,
float *sknot,
GLint tknot_count,
GLfloat *tknot,
GLint s_stride,
GLint t_stride,
GLfloat *ctlarray,
GLint sorder,
GLint torder,
GLenum type);
void APIENTRY
gluLoadSamplingMatrices (
GLUnurbs *nobj,
const GLfloat modelMatrix[16],
const GLfloat projMatrix[16],
const GLint viewport[4] );
void APIENTRY
gluNurbsProperty (
GLUnurbs *nobj,
GLenum property,
GLfloat value );
void APIENTRY
gluGetNurbsProperty (
GLUnurbs *nobj,
GLenum property,
GLfloat *value );
void APIENTRY
gluNurbsCallback (
GLUnurbs *nobj,
GLenum which,
void (CALLBACK* fn)() );
/**** Callback function prototypes ****/
/* gluQuadricCallback */
typedef void (CALLBACK* GLUquadricErrorProc) (GLenum);
/* gluTessCallback */
typedef void (CALLBACK* GLUtessBeginProc) (GLenum);
typedef void (CALLBACK* GLUtessEdgeFlagProc) (GLboolean);
typedef void (CALLBACK* GLUtessVertexProc) (void *);
typedef void (CALLBACK* GLUtessEndProc) (void);
typedef void (CALLBACK* GLUtessErrorProc) (GLenum);
typedef void (CALLBACK* GLUtessCombineProc) (GLdouble[3],
void*[4],
GLfloat[4],
void** );
typedef void (CALLBACK* GLUtessBeginDataProc) (GLenum, void *);
typedef void (CALLBACK* GLUtessEdgeFlagDataProc) (GLboolean, void *);
typedef void (CALLBACK* GLUtessVertexDataProc) (void *, void *);
typedef void (CALLBACK* GLUtessEndDataProc) (void *);
typedef void (CALLBACK* GLUtessErrorDataProc) (GLenum, void *);
typedef void (CALLBACK* GLUtessCombineDataProc) (GLdouble[3],
void*[4],
GLfloat[4],
void**,
void* );
/* gluNurbsCallback */
typedef void (CALLBACK* GLUnurbsErrorProc) (GLenum);
/**** Generic constants ****/
/* Version */
#define GLU_VERSION_1_1 1
#define GLU_VERSION_1_2 1
/* Errors: (return value 0 = no error) */
#define GLU_INVALID_ENUM 100900
#define GLU_INVALID_VALUE 100901
#define GLU_OUT_OF_MEMORY 100902
#define GLU_INCOMPATIBLE_GL_VERSION 100903
/* StringName */
#define GLU_VERSION 100800
#define GLU_EXTENSIONS 100801
/* Boolean */
#define GLU_TRUE GL_TRUE
#define GLU_FALSE GL_FALSE
/**** Quadric constants ****/
/* QuadricNormal */
#define GLU_SMOOTH 100000
#define GLU_FLAT 100001
#define GLU_NONE 100002
/* QuadricDrawStyle */
#define GLU_POINT 100010
#define GLU_LINE 100011
#define GLU_FILL 100012
#define GLU_SILHOUETTE 100013
/* QuadricOrientation */
#define GLU_OUTSIDE 100020
#define GLU_INSIDE 100021
/* Callback types: */
/* GLU_ERROR 100103 */
/**** Tesselation constants ****/
#define GLU_TESS_MAX_COORD 1.0e150
/* TessProperty */
#define GLU_TESS_WINDING_RULE 100140
#define GLU_TESS_BOUNDARY_ONLY 100141
#define GLU_TESS_TOLERANCE 100142
/* TessWinding */
#define GLU_TESS_WINDING_ODD 100130
#define GLU_TESS_WINDING_NONZERO 100131
#define GLU_TESS_WINDING_POSITIVE 100132
#define GLU_TESS_WINDING_NEGATIVE 100133
#define GLU_TESS_WINDING_ABS_GEQ_TWO 100134
/* TessCallback */
#define GLU_TESS_BEGIN 100100 /* void (CALLBACK*)(GLenum type) */
#define GLU_TESS_VERTEX 100101 /* void (CALLBACK*)(void *data) */
#define GLU_TESS_END 100102 /* void (CALLBACK*)(void) */
#define GLU_TESS_ERROR 100103 /* void (CALLBACK*)(GLenum errno) */
#define GLU_TESS_EDGE_FLAG 100104 /* void (CALLBACK*)(GLboolean boundaryEdge) */
#define GLU_TESS_COMBINE 100105 /* void (CALLBACK*)(GLdouble coords[3],
void *data[4],
GLfloat weight[4],
void **dataOut) */
#define GLU_TESS_BEGIN_DATA 100106 /* void (CALLBACK*)(GLenum type,
void *polygon_data) */
#define GLU_TESS_VERTEX_DATA 100107 /* void (CALLBACK*)(void *data,
void *polygon_data) */
#define GLU_TESS_END_DATA 100108 /* void (CALLBACK*)(void *polygon_data) */
#define GLU_TESS_ERROR_DATA 100109 /* void (CALLBACK*)(GLenum errno,
void *polygon_data) */
#define GLU_TESS_EDGE_FLAG_DATA 100110 /* void (CALLBACK*)(GLboolean boundaryEdge,
void *polygon_data) */
#define GLU_TESS_COMBINE_DATA 100111 /* void (CALLBACK*)(GLdouble coords[3],
void *data[4],
GLfloat weight[4],
void **dataOut,
void *polygon_data) */
/* TessError */
#define GLU_TESS_ERROR1 100151
#define GLU_TESS_ERROR2 100152
#define GLU_TESS_ERROR3 100153
#define GLU_TESS_ERROR4 100154
#define GLU_TESS_ERROR5 100155
#define GLU_TESS_ERROR6 100156
#define GLU_TESS_ERROR7 100157
#define GLU_TESS_ERROR8 100158
#define GLU_TESS_MISSING_BEGIN_POLYGON GLU_TESS_ERROR1
#define GLU_TESS_MISSING_BEGIN_CONTOUR GLU_TESS_ERROR2
#define GLU_TESS_MISSING_END_POLYGON GLU_TESS_ERROR3
#define GLU_TESS_MISSING_END_CONTOUR GLU_TESS_ERROR4
#define GLU_TESS_COORD_TOO_LARGE GLU_TESS_ERROR5
#define GLU_TESS_NEED_COMBINE_CALLBACK GLU_TESS_ERROR6
/**** NURBS constants ****/
/* NurbsProperty */
#define GLU_AUTO_LOAD_MATRIX 100200
#define GLU_CULLING 100201
#define GLU_SAMPLING_TOLERANCE 100203
#define GLU_DISPLAY_MODE 100204
#define GLU_PARAMETRIC_TOLERANCE 100202
#define GLU_SAMPLING_METHOD 100205
#define GLU_U_STEP 100206
#define GLU_V_STEP 100207
/* NurbsSampling */
#define GLU_PATH_LENGTH 100215
#define GLU_PARAMETRIC_ERROR 100216
#define GLU_DOMAIN_DISTANCE 100217
/* NurbsTrim */
#define GLU_MAP1_TRIM_2 100210
#define GLU_MAP1_TRIM_3 100211
/* NurbsDisplay */
/* GLU_FILL 100012 */
#define GLU_OUTLINE_POLYGON 100240
#define GLU_OUTLINE_PATCH 100241
/* NurbsCallback */
/* GLU_ERROR 100103 */
/* NurbsErrors */
#define GLU_NURBS_ERROR1 100251
#define GLU_NURBS_ERROR2 100252
#define GLU_NURBS_ERROR3 100253
#define GLU_NURBS_ERROR4 100254
#define GLU_NURBS_ERROR5 100255
#define GLU_NURBS_ERROR6 100256
#define GLU_NURBS_ERROR7 100257
#define GLU_NURBS_ERROR8 100258
#define GLU_NURBS_ERROR9 100259
#define GLU_NURBS_ERROR10 100260
#define GLU_NURBS_ERROR11 100261
#define GLU_NURBS_ERROR12 100262
#define GLU_NURBS_ERROR13 100263
#define GLU_NURBS_ERROR14 100264
#define GLU_NURBS_ERROR15 100265
#define GLU_NURBS_ERROR16 100266
#define GLU_NURBS_ERROR17 100267
#define GLU_NURBS_ERROR18 100268
#define GLU_NURBS_ERROR19 100269
#define GLU_NURBS_ERROR20 100270
#define GLU_NURBS_ERROR21 100271
#define GLU_NURBS_ERROR22 100272
#define GLU_NURBS_ERROR23 100273
#define GLU_NURBS_ERROR24 100274
#define GLU_NURBS_ERROR25 100275
#define GLU_NURBS_ERROR26 100276
#define GLU_NURBS_ERROR27 100277
#define GLU_NURBS_ERROR28 100278
#define GLU_NURBS_ERROR29 100279
#define GLU_NURBS_ERROR30 100280
#define GLU_NURBS_ERROR31 100281
#define GLU_NURBS_ERROR32 100282
#define GLU_NURBS_ERROR33 100283
#define GLU_NURBS_ERROR34 100284
#define GLU_NURBS_ERROR35 100285
#define GLU_NURBS_ERROR36 100286
#define GLU_NURBS_ERROR37 100287
/**** Backwards compatibility for old tesselator ****/
void APIENTRY gluBeginPolygon( GLUtesselator *tess );
void APIENTRY gluNextContour( GLUtesselator *tess,
GLenum type );
void APIENTRY gluEndPolygon( GLUtesselator *tess );
/* Contours types -- obsolete! */
#define GLU_CW 100120
#define GLU_CCW 100121
#define GLU_INTERIOR 100122
#define GLU_EXTERIOR 100123
#define GLU_UNKNOWN 100124
/* Names without "TESS_" prefix */
#define GLU_BEGIN GLU_TESS_BEGIN
#define GLU_VERTEX GLU_TESS_VERTEX
#define GLU_END GLU_TESS_END
#define GLU_ERROR GLU_TESS_ERROR
#define GLU_EDGE_FLAG GLU_TESS_EDGE_FLAG
#ifdef __cplusplus
}
#endif
#endif /* __GLU_H__ */
#endif /* __glu_h__ */
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+582
View File
@@ -0,0 +1,582 @@
#ifndef __wglext_h_
#define __wglext_h_
#ifdef __cplusplus
extern "C" {
#endif
/*
** License Applicability. Except to the extent portions of this file are
** made subject to an alternative license as permitted in the SGI Free
** Software License B, Version 1.1 (the "License"), the contents of this
** file are subject only to the provisions of the License. You may not use
** this file except in compliance with the License. You may obtain a copy
** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
**
** http://oss.sgi.com/projects/FreeB
**
** Note that, as provided in the License, the Software is distributed on an
** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
**
** Original Code. The Original Code is: OpenGL Sample Implementation,
** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc.
** Copyright in any portions created by third parties is as indicated
** elsewhere herein. All Rights Reserved.
**
** Additional Notice Provisions: This software was created using the
** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
** not been independently verified as being compliant with the OpenGL(R)
** version 1.2.1 Specification.
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef GLAPI
#define GLAPI extern
#endif
/*************************************************************/
/* Header file version number */
/* wglext.h last updated 2002/03/22 */
/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
#define WGL_WGLEXT_VERSION 4
#ifndef WGL_ARB_buffer_region
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
#endif
#ifndef WGL_ARB_multisample
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif
#ifndef WGL_ARB_extensions_string
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#endif
#ifndef WGL_ARB_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
#endif
#ifndef WGL_ARB_render_texture
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
#endif
#ifndef WGL_EXT_make_current_read
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
#endif
#ifndef WGL_EXT_depth_float
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif
#ifndef WGL_3DFX_multisample
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif
#ifndef WGL_EXT_multisample
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
#endif
#ifndef WGL_I3D_gamma
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
#endif
#ifndef WGL_I3D_genlock
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTENAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTENAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTENAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
#endif
#ifndef WGL_I3D_swap_frame_lock
#endif
/*************************************************************/
#ifndef WGL_ARB_pbuffer
DECLARE_HANDLE(HPBUFFERARB);
#endif
#ifndef WGL_EXT_pbuffer
DECLARE_HANDLE(HPBUFFEREXT);
#endif
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HANDLE WINAPI wglCreateBufferRegionARB (HDC, int, UINT);
extern VOID WINAPI wglDeleteBufferRegionARB (HANDLE);
extern BOOL WINAPI wglSaveBufferRegionARB (HANDLE, int, int, int, int);
extern BOOL WINAPI wglRestoreBufferRegionARB (HANDLE, int, int, int, int, int, int);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringARB (HDC);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivARB (HDC, int, int, UINT, const int *, int *);
extern BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC, int, int, UINT, const int *, FLOAT *);
extern BOOL WINAPI wglChoosePixelFormatARB (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentARB (HDC, HDC, HGLRC);
extern HDC WINAPI wglGetCurrentReadDCARB (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#endif
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFERARB WINAPI wglCreatePbufferARB (HDC, int, int, int, const int *);
extern HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB);
extern int WINAPI wglReleasePbufferDCARB (HPBUFFERARB, HDC);
extern BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB);
extern BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB, int, int *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglBindTexImageARB (HPBUFFERARB, int);
extern BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB, int);
extern BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB, const int *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort);
extern GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *, GLuint);
extern GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort);
extern VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#endif
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern const char * WINAPI wglGetExtensionsStringEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef const char * (WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#endif
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglMakeContextCurrentEXT (HDC, HDC, HGLRC);
extern HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#endif
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC, int, int, int, const int *);
extern HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT);
extern int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT, HDC);
extern BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT);
extern BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT, int, int *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC, int, int, UINT, int *, int *);
extern BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC, int, int, UINT, int *, FLOAT *);
extern BOOL WINAPI wglChoosePixelFormatEXT (HDC, const int *, const FLOAT *, UINT, int *, UINT *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglSwapIntervalEXT (int);
extern int WINAPI wglGetSwapIntervalEXT (void);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#endif
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#endif
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern void* WINAPI wglAllocateMemoryNV (GLsizei, GLfloat, GLfloat, GLfloat);
extern void WINAPI wglFreeMemoryNV (void *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef void* (WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#endif
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#endif
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#endif
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetSyncValuesOML (HDC, INT64 *, INT64 *, INT64 *);
extern BOOL WINAPI wglGetMscRateOML (HDC, INT32 *, INT32 *);
extern INT64 WINAPI wglSwapBuffersMscOML (HDC, INT64, INT64, INT64);
extern INT64 WINAPI wglSwapLayerBuffersMscOML (HDC, int, INT64, INT64, INT64);
extern BOOL WINAPI wglWaitForMscOML (HDC, INT64, INT64, INT64, INT64 *, INT64 *, INT64 *);
extern BOOL WINAPI wglWaitForSbcOML (HDC, INT64, INT64 *, INT64 *, INT64 *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC, int, int *);
extern BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC, int, const int *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#endif
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetGammaTableParametersI3D (HDC, int, int *);
extern BOOL WINAPI wglSetGammaTableParametersI3D (HDC, int, const int *);
extern BOOL WINAPI wglGetGammaTableI3D (HDC, int, USHORT *, USHORT *, USHORT *);
extern BOOL WINAPI wglSetGammaTableI3D (HDC, int, const USHORT *, const USHORT *, const USHORT *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableGenlockI3D (HDC);
extern BOOL WINAPI wglDisableGenlockI3D (HDC);
extern BOOL WINAPI wglIsEnabledGenlockI3D (HDC, BOOL *);
extern BOOL WINAPI wglGenlockSourceI3D (HDC, UINT);
extern BOOL WINAPI wglGetGenlockSourceI3D (HDC, UINT *);
extern BOOL WINAPI wglGenlockSourceEdgeI3D (HDC, UINT);
extern BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC, UINT *);
extern BOOL WINAPI wglGenlockSampleRateI3D (HDC, UINT);
extern BOOL WINAPI wglGetGenlockSampleRateI3D (HDC, UINT *);
extern BOOL WINAPI wglGenlockSourceDelayI3D (HDC, UINT);
extern BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC, UINT *);
extern BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC, UINT *, UINT *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern LPVOID WINAPI wglCreateImageBufferI3D (HDC, DWORD, UINT);
extern BOOL WINAPI wglDestroyImageBufferI3D (HDC, LPVOID);
extern BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC, const HANDLE *, const LPVOID *, const DWORD *, UINT);
extern BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC, const LPVOID *, UINT);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglEnableFrameLockI3D (void);
extern BOOL WINAPI wglDisableFrameLockI3D (void);
extern BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *);
extern BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#endif
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
#ifdef WGL_WGLEXT_PROTOTYPES
extern BOOL WINAPI wglGetFrameUsageI3D (float *);
extern BOOL WINAPI wglBeginFrameTrackingI3D (void);
extern BOOL WINAPI wglEndFrameTrackingI3D (void);
extern BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *, DWORD *, float *);
#endif /* WGL_WGLEXT_PROTOTYPES */
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#ifdef __cplusplus
}
#endif
#endif
+10 -4
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrD3D.cpp $
* $Revision: 2.3 $
* $Date: 2002-10-05 16:46:09 $
* $Author: randomtiger $
* $Revision: 2.4 $
* $Date: 2003-01-14 05:53:58 $
* $Author: Goober5000 $
*
* Code for our Direct3D renderer
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/10/05 16:46:09 randomtiger
* Added us fs2_open people to the credits. Worth looking at just for that.
* Added timer bar code, by default its not compiled in.
* Use TIMEBAR_ACTIVE in project and dependancy code settings to activate.
* Added the new timebar files with the new code.
*
* Revision 2.2 2002/08/01 01:41:05 penguin
* The big include file move
*
@@ -1811,7 +1817,7 @@ void gr_d3d_flip()
}
ddrval = lpFrontBuffer->Flip( NULL, DDFLIP_WAIT );
if ( ddrval == DDERR_SURFACELOST ) {
mprintf(( "Front surface lost... attempting to restore...\n" ));
// mprintf(( "Front surface lost... attempting to restore...\n" ));
os_sleep(1000); // Wait a second
// os poll?
+46 -8
View File
@@ -9,13 +9,33 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrD3DRender.cpp $
* $Revision: 2.4 $
* $Date: 2002-10-05 16:46:09 $
* $Author: randomtiger $
* $Revision: 2.9 $
* $Date: 2003-02-16 05:14:28 $
* $Author: bobboau $
*
* Code to actually render stuff using Direct3D
*
* $Log: not supported by cvs2svn $
* Revision 2.8 2003/01/20 05:40:49 bobboau
* added several sExps for turning glow points and glow maps on and off
*
* Revision 2.7 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.6 2003/01/09 21:20:21 phreak
* fixed a small error in bob's code
*
* Revision 2.5 2003/01/05 23:41:50 bobboau
* disabled decals (for now), removed the warp ray thingys,
* made some better error mesages while parseing weapons and ships tbls,
* and... oh ya, added glow mapping
*
* Revision 2.4 2002/10/05 16:46:09 randomtiger
* Added us fs2_open people to the credits. Worth looking at just for that.
* Added timer bar code, by default its not compiled in.
* Use TIMEBAR_ACTIVE in project and dependancy code settings to activate.
* Added the new timebar files with the new code.
*
* Revision 2.3 2002/08/07 00:45:25 DTP
* Implented -GF4FIX commandline switch & #include "cmdline/cmdline.h"
*
@@ -711,6 +731,7 @@ float flCAP( float x, float minx, float maxx)
}
#define NEBULA_COLORS 20
static float Interp_fog_level;
void gr_d3d_tmapper_internal( int nverts, vertex **verts, uint flags, int is_scaler )
{
@@ -975,10 +996,11 @@ void gr_d3d_tmapper_internal( int nverts, vertex **verts, uint flags, int is_sca
src_v++;
}
int ra = 0, ga = 0, ba = 0;
// if we're rendering against a fullneb background
if(flags & TMAP_FLAG_PIXEL_FOG){
int r, g, b;
int ra, ga, ba;
// int ra, ga, ba;
ra = ga = ba = 0;
// get the average pixel color behind the vertices
@@ -998,10 +1020,26 @@ void gr_d3d_tmapper_internal( int nverts, vertex **verts, uint flags, int is_sca
d3d_DrawPrimitive(D3DPT_TRIANGLEFAN, D3DVT_TLVERTEX, (LPVOID)d3d_verts, nverts, NULL);
// turn off fog
// if(flags & TMAP_FLAG_PIXEL_FOG){
// gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
// }
//this is my hack to get some sort of luminence mapping-Bobboau
if(GLOWMAP > 0){
gr_screen.gf_set_bitmap(GLOWMAP, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 0.0);
if ( !gr_tcache_set(gr_screen.current_bitmap, tmap_type, &u_scale, &v_scale, 0, gr_screen.current_bitmap_sx, gr_screen.current_bitmap_sy )) {
mprintf(( "Not rendering a texture because it didn't fit in VRAM!\n" ));
return;
}
gr_d3d_set_state( TEXTURE_SOURCE_DECAL, ALPHA_BLEND_ALPHA_ADDITIVE, zbuffer_type );
for (i=0; i<nverts; i++ ) {
if(flags & TMAP_FLAG_PIXEL_FOG)d3d_verts[i].color = RGBA_MAKE((255 - ra), (255 - ga), (255 - ba), ((ba + ga + ra)/2));
else d3d_verts[i].color = RGBA_MAKE(255, 255, 255, 0);
}
if(flags & TMAP_FLAG_PIXEL_FOG)gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
d3d_DrawPrimitive(D3DPT_TRIANGLEFAN, D3DVT_TLVERTEX, (LPVOID)d3d_verts, nverts, NULL);
if(flags & TMAP_FLAG_PIXEL_FOG)gr_fog_set(GR_FOGMODE_FOG, ra, ga, ba);
}
}
void gr_d3d_tmapper( int nverts, vertex **verts, uint flags )
+7 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrD3DTexture.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-19 01:07:41 $
* $Author: bobboau $
*
* Code to manage loading textures into VRAM for Direct3D
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -963,6 +966,7 @@ int d3d_tcache_set(int bitmap_id, int bitmap_type, float *u_scale, float *v_scal
}
int n = bm_get_cache_slot( bitmap_id, 1 );
// if(n == -1)return -1;//for a bad handel, this was triping some assertion errors in the glowmap code
tcache_slot_d3d * t = &Textures[n];
if ( (D3D_last_bitmap_id == bitmap_id) && (D3D_last_bitmap_type==bitmap_type) && (t->bitmap_id == bitmap_id) && (D3D_last_section_x == sx) && (D3D_last_section_y == sy)) {
+8 -5
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrDirectDraw.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-14 05:53:58 $
* $Author: Goober5000 $
*
* Code for software 8-bpp rendering using DirectDraw
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -419,7 +422,7 @@ TryFlipAgain:
HRESULT ddrval = lpFrontBuffer->Flip( NULL, DDFLIP_WAIT );
if ( ddrval == DDERR_SURFACELOST ) {
mprintf(( "Front surface lost... attempting to restore...\n" ));
// mprintf(( "Front surface lost... attempting to restore...\n" ));
os_sleep(1000); // Wait a second
goto TryFlipAgain;
} else if (ddrval != DD_OK ) {
@@ -463,7 +466,7 @@ TryFlipAgain:
}
ddrval = lpFrontBuffer->Blt( &dst_rect, lpBackBuffer, &src_rect, DDBLT_WAIT, 0 );
if ( ddrval == DDERR_SURFACELOST ) {
mprintf(( "Front surface lost... attempting to restore...\n" ));
// mprintf(( "Front surface lost... attempting to restore...\n" ));
os_sleep(1000); // Wait a second
goto TryFlipAgain;
} else if (ddrval != DD_OK ) {
+7 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Graphics/GrInternal.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-18 19:49:02 $
* $Author: phreak $
*
* Include file for our Graphics directory
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:22 penguin
* Warpcore CVS sync
*
@@ -217,6 +220,7 @@ extern int Gr_gamma_lookup[256];
#define TCACHE_TYPE_XPARENT 2 // Bitmap with 0,255,0 = transparent. Alpha=0 if transparent, 1 if not.
#define TCACHE_TYPE_NONDARKENING 3 // Bitmap with 255,255,255 = non-darkening. Alpha=1 if non-darkening, 0 if not.
#define TCACHE_TYPE_BITMAP_SECTION 4 // section of a bitmap
#define TCACHE_TYPE_COMPRESSED (1<<31)
#endif
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
+20 -16
View File
@@ -9,13 +9,22 @@
/*
* $Logfile: /Freespace2/code/Hud/HUD.cpp $
* $Revision: 2.2 $
* $Date: 2002-10-17 20:40:50 $
* $Author: randomtiger $
* $Revision: 2.4 $
* $Date: 2003-01-19 07:02:15 $
* $Author: Goober5000 $
*
* C module that contains all the HUD functions at a high level
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2003/01/17 07:59:09 Goober5000
* fixed some really strange behavior with strings not being truncated at the
* # symbol
* --Goober5000
*
* Revision 2.2 2002/10/17 20:40:50 randomtiger
* Added ability to remove HUD ingame on keypress shift O
* So I've added a new key to the bind list and made use of already existing hud removal code.
*
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
@@ -2472,7 +2481,14 @@ void hud_support_view_blit()
gr_string(0x8000, Support_text_val_coords[gr_screen.res][1], outstr);
} else {
if ( Hud_support_objnum == -1 ) {
sprintf(outstr, XSTR( "warping in", 230));
if (The_mission.support_ships.arrival_location == ARRIVE_FROM_DOCK_BAY)
{
sprintf(outstr, XSTR( "exiting hangar", -1));
}
else
{
sprintf(outstr, XSTR( "warping in", 230));
}
gr_string(0x8000, Support_text_val_coords[gr_screen.res][1], outstr);
} else {
ai_info *aip;
@@ -3101,18 +3117,6 @@ void hud_maybe_render_multi_text()
}
#endif
// cut any text off after (and including) '#' char
void hud_end_string_at_first_hash_symbol(char *src)
{
char *pointer_to_last_char;
pointer_to_last_char = strstr(src, NOX("#"));
if ( pointer_to_last_char ) {
*pointer_to_last_char = 0;
}
}
// set the offset values for this render frame
void HUD_set_offsets(object *viewer_obj, int wiggedy_wack)
{
+7 -6
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUD.h $
* $Revision: 2.2 $
* $Date: 2002-10-17 20:40:50 $
* $Author: randomtiger $
* $Revision: 2.3 $
* $Date: 2003-01-17 07:59:09 $
* $Author: Goober5000 $
*
* Header file for functions that contain HUD functions at a high level
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/10/17 20:40:50 randomtiger
* Added ability to remove HUD ingame on keypress shift O
* So I've added a new key to the bind list and made use of already existing hud removal code.
*
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
@@ -347,9 +351,6 @@ void hud_start_text_flash(char *txt, int t);
// convert a string to use mono spaced numbers
void hud_num_make_mono(char *num_str);
// cut any text off after (and including) '#' char
void hud_end_string_at_first_hash_symbol(char *src);
// functions for handling hud animations
void hud_anim_init(hud_anim *ha, int sx, int sy, char *filename);
int hud_anim_render(hud_anim *ha, float frametime, int draw_alpha=0, int loop=1, int hold_last=0, int reverse=0);
+22 -15
View File
@@ -9,13 +9,24 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDbrackets.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2003-01-27 07:46:33 $
* $Author: Goober5000 $
*
* C file that contains functions for drawing target brackets on the HUD
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/12/14 17:09:28 Goober5000
* removed mission flag for fighterbay damage; instead made damage display contingent on whether the fighterbay subsystem is assigned a damage percentage in ships.tbl
* --Goober5000
*
* Revision 2.2 2002/12/14 01:55:04 Goober5000
* added mission flag to show subsystem damage for fighterbays
* ~Goober5000~
*
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
@@ -227,6 +238,7 @@
#include "bmpman/bmpman.h"
#include "globalincs/linklist.h"
#include "weapon/emp.h"
#include "mission/missionparse.h"
#define FADE_FACTOR 2 // how much the bounding brackets get faded
#define LOWEST_RED 50 // lowest r value for bounding bracket
@@ -533,16 +545,6 @@ void draw_brackets_diamond_quick(int x1, int y1, int x2, int y2, int thick)
gr_line(center_x-x_delta, center_y+y_delta, center_x+x_delta, center_y-y_delta);
}
int subsys_is_fighterbay(ship_subsys *ss)
{
if ( !strnicmp(NOX("fighter"), ss->system_info->name, 7) ) {
return 1;
}
return 0;
}
// Draw bounding brackets for a subobject.
void draw_bounding_brackets_subobject()
{
@@ -608,8 +610,13 @@ void draw_bounding_brackets_subobject()
// determine if subsystem is on far or near side of the ship
Player->subsys_in_view = ship_subsystem_in_sight(targetp, subsys, &View_position, &subobj_pos, 0);
// AL 29-3-98: If subsystem is destroyed, draw gray brackets
if ( (Player_ai->targeted_subsys->current_hits <= 0) && (!subsys_is_fighterbay(Player_ai->targeted_subsys)) ) {
// AL 29-3-98: If subsystem is destroyed, draw gray brackets
// Goober5000: this will now execute for fighterbays if the bay has been given a
// percentage subsystem strength in ships.tbl
// Goober5000: this will now execute for any subsys that takes damage and will not
// execute for any subsys that doesn't take damage
if ( (Player_ai->targeted_subsys->current_hits <= 0) && ( ship_subsys_takes_damage(Player_ai->targeted_subsys) ) )
{
gr_set_color_fast(&IFF_colors[IFF_COLOR_MESSAGE][1]);
} else {
hud_set_iff_color( targetp, 1 );
+10 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDconfig.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-01-15 21:29:04 $
* $Author: anonymous $
*
* C module to handle HUD configuration
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.1 2002/07/18 20:07:49 penguin
* Fixed bug (potential access of unitialized pointer) in hud_config_render_gauges() -- thanks to DTP for finding it!
*
@@ -503,8 +506,10 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] =
HC_gauge_region("none", 1, 1, -1, 0, 0, -1, 0, 0), // attacking target count
HC_gauge_region("HCB_38", 342, 138, 38, 0, 0, -1, 0, 0), // text flash gauge
HC_gauge_region("HCB_52", 465, 8, 52, 0, 0, -1, 0, 0), // comm menu
#ifndef FS2_DEMO
HC_gauge_region("HCB_46", 324, 264, 46, 0, 0, -1, 0, 0), // support view gauge
HC_gauge_region("HCB_47", 418, 262, 47, 0, 0, -1, 0, 0), // netlag icon gauge
#endif
//XSTR:ON
},
{ // GR_1024
@@ -546,8 +551,10 @@ struct HC_gauge_region HC_gauge_regions[GR_NUM_RESOLUTIONS][NUM_HUD_GAUGES] =
HC_gauge_region("none", 1, 1, -1, 0, 0, -1, 0, 0), // attacking target count
HC_gauge_region("2_HCB_38", 548, 222, 38, 0, 0, -1, 0, 0), // text flash gauge
HC_gauge_region("2_HCB_52", 744, 14, 52, 0, 0, -1, 0, 0), // comm menu
#ifndef FS2_DEMO
HC_gauge_region("2_HCB_46", 520, 422, 46, 0, 0, -1, 0, 0), // support view gauge
HC_gauge_region("2_HCB_47", 670, 419, 47, 0, 0, -1, 0, 0), // netlag icon gauge
#endif
//XSTR:ON
}
};
+32 -6
View File
@@ -9,13 +9,24 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDescort.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2003-01-18 09:25:41 $
* $Author: Goober5000 $
*
* C module for managing and displaying ships that are in an escort
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/12/31 07:26:40 Goober5000
* added damaged-escort-priority-all sexp
* --Goober5000
*
* Revision 2.2 2002/12/31 05:17:13 Goober5000
* fixed escort list behavior for stealthy ships
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
@@ -125,9 +136,6 @@ escort_info Escort_ships[MAX_ESCORT_SHIPS];
int Num_escort_ships;
// size of complete escort list, including all those wanting to get onto list but without space
#define MAX_COMPLETE_ESCORT_LIST 20
#define NUM_ESCORT_FRAMES 3
hud_frames Escort_gauges[NUM_ESCORT_FRAMES];
@@ -374,6 +382,24 @@ void hud_create_complete_escort_list(escort_info *escorts, int *num_escorts)
continue;
}
// don't process most stealth ships
if ( (Ships[objp->instance].flags2 & SF2_STEALTH) )
{
if ( Ships[objp->instance].team == TEAM_FRIENDLY )
{
// friendly stealths are only not seen when explicitly specified
if ( Ships[objp->instance].flags2 & SF2_FRIENDLY_STEALTH_INVIS )
{
continue;
}
}
// non-friendly stealths are never seen
else
{
continue;
}
}
// don't process ships that are dying, or objects that should be dead
if ( (Ships[objp->instance].flags & (SF_DYING|SF_DEPARTING)) || (objp->flags & OF_SHOULD_BE_DEAD) ){
continue;
+129 -37
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDets.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-10 05:43:34 $
* $Author: Goober5000 $
*
* C file that contains code to manage and display the Energy Transfer System (ETS)
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
@@ -502,12 +505,29 @@ void hud_show_ets()
return;
}
// if at least two gauges are not shown, don't show any
i = 0;
if (Player_obj->flags & OF_NO_LASERS) i++;
if (Player_obj->flags & OF_NO_SHIELDS) i++;
if (Player_obj->flags & OF_NO_ENGINES) i++;
if (i >= 2) return;
hud_set_gauge_color(HUD_ETS_GAUGE);
// draw the letters for the gauges first, before any clipping occurs
i = 0;
for ( j = 0; j < 3; j++ ) {
if ( j == 1 && Player_obj->flags & OF_NO_SHIELDS ) {
for ( j = 0; j < 3; j++ )
{
if (j == 0 && Player_obj->flags & OF_NO_LASERS)
{
continue;
}
if (j == 1 && Player_obj->flags & OF_NO_SHIELDS)
{
continue;
}
if (j == 2 && Player_obj->flags & OF_NO_ENGINES)
{
continue;
}
Assert(Ets_gauge_info != NULL);
@@ -522,15 +542,24 @@ void hud_show_ets()
switch (j) {
case 0:
index = ship_p->weapon_recharge_index;
if ( Player_obj->flags & OF_NO_LASERS )
{
continue;
}
break;
case 1:
index = ship_p->shield_recharge_index;
if ( Player_obj->flags & OF_NO_SHIELDS ) {
if ( Player_obj->flags & OF_NO_SHIELDS )
{
continue;
}
break;
case 2:
index = ship_p->engine_recharge_index;
if ( Player_obj->flags & OF_NO_ENGINES )
{
continue;
}
break;
}
@@ -609,13 +638,13 @@ void set_default_recharge_rates(object* obj)
return;
ship_properties = 0;
if ( ship_info_p->max_weapon_reserve )
if (!(obj->flags & OF_NO_LASERS))
ship_properties |= HAS_WEAPONS;
if (!(obj->flags & OF_NO_SHIELDS))
ship_properties |= HAS_SHIELDS;
if ( ship_info_p->max_speed )
if (!(obj->flags & OF_NO_ENGINES))
ship_properties |= HAS_ENGINES;
// the default charge rate depends on what systems are on each ship
@@ -680,43 +709,74 @@ void increase_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
switch ( ship_system ) {
case WEAPONS:
if ( obj->flags & OF_NO_LASERS )
return;
gain_index = &ship_p->weapon_recharge_index;
lose_index1 = &ship_p->engine_recharge_index;
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_SHIELDS )
lose_index1 = NULL;
else
lose_index1 = &ship_p->shield_recharge_index;
if ( obj->flags & OF_NO_ENGINES )
lose_index2 = NULL;
} else {
lose_index2 = &ship_p->shield_recharge_index;
}
else
lose_index2 = &ship_p->engine_recharge_index;
break;
case SHIELDS:
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_SHIELDS )
return;
}
gain_index = &ship_p->shield_recharge_index;
lose_index1 = &ship_p->weapon_recharge_index;
lose_index2 = &ship_p->engine_recharge_index;
if ( obj->flags & OF_NO_LASERS )
lose_index1 = NULL;
else
lose_index1 = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_ENGINES )
lose_index2 = NULL;
else
lose_index2 = &ship_p->engine_recharge_index;
break;
case ENGINES:
if ( obj->flags & OF_NO_ENGINES )
return;
gain_index = &ship_p->engine_recharge_index;
lose_index1 = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_LASERS )
lose_index1 = NULL;
else
lose_index1 = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_SHIELDS )
lose_index2 = NULL;
} else {
else
lose_index2 = &ship_p->shield_recharge_index;
}
break;
} // end switch
// return if we can't transfer energy
if (!lose_index1 && !lose_index2)
return;
// already full, nothing to do
count = MAX_ENERGY_INDEX - *gain_index;
if ( count > 2 )
count = 2;
if ( count <= 0 ) {
if ( obj == Player_obj ) {
if ( count <= 0 )
{
if ( obj == Player_obj )
{
snd_play( &Snds[SND_ENERGY_TRANS_FAIL], 0.0f );
}
return;
@@ -770,39 +830,65 @@ void decrease_recharge_rate(object* obj, SYSTEM_TYPE ship_system)
switch ( ship_system ) {
case WEAPONS:
if ( obj->flags & OF_NO_LASERS )
return;
lose_index = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_SHIELDS )
gain_index1 = NULL;
} else {
else
gain_index1 = &ship_p->shield_recharge_index;
}
gain_index2 = &ship_p->engine_recharge_index;
if ( obj->flags & OF_NO_ENGINES )
gain_index2 = NULL;
else
gain_index2 = &ship_p->engine_recharge_index;
break;
case SHIELDS:
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_SHIELDS )
return;
}
lose_index = &ship_p->shield_recharge_index;
gain_index1 = &ship_p->weapon_recharge_index;
gain_index2 = &ship_p->engine_recharge_index;
if ( obj->flags & OF_NO_LASERS )
gain_index1 = NULL;
else
gain_index1 = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_ENGINES )
gain_index2 = NULL;
else
gain_index2 = &ship_p->engine_recharge_index;
break;
case ENGINES:
if ( obj->flags & OF_NO_ENGINES )
return;
lose_index = &ship_p->engine_recharge_index;
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_LASERS )
gain_index1 = NULL;
} else {
gain_index1 = &ship_p->shield_recharge_index;
}
else
gain_index1 = &ship_p->weapon_recharge_index;
if ( obj->flags & OF_NO_SHIELDS )
gain_index2 = NULL;
else
gain_index2 = &ship_p->shield_recharge_index;
gain_index2 = &ship_p->weapon_recharge_index;
break;
} // end switch
// return if we can't transfer energy
if (!gain_index1 && !gain_index2)
return;
// check how much there is to lose
count = min(2, *lose_index);
if ( count <= 0 ) {
@@ -882,7 +968,8 @@ void transfer_energy_to_shields(object* obj)
if (ship_p->flags & SF_DYING)
return;
if ( obj->flags & OF_NO_SHIELDS ) {
if ( obj->flags & OF_NO_LASERS || obj->flags & OF_NO_SHIELDS )
{
return;
}
@@ -900,6 +987,11 @@ void transfer_energy_to_weapons(object* obj)
if (ship_p->flags & SF_DYING)
return;
if ( obj->flags & OF_NO_LASERS || obj->flags & OF_NO_SHIELDS )
{
return;
}
transfer_energy_weapon_common(obj, get_shield_strength(obj), ship_p->weapon_energy, &ship_p->target_shields_delta, &ship_p->target_weapon_energy_delta, sinfo_p->max_weapon_reserve, 1.0f);
}
+10 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDgauges.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:23 $
* $Author: penguin $
* $Revision: 2.1 $
* $Date: 2003-01-15 21:29:04 $
* $Author: anonymous $
*
* HUD data common to FRED and FreeSpace
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:08 mharris
* Initial checkin - converted filenames and includes to lower case
*
@@ -80,7 +83,11 @@
#define __HUD_COMMON_H__
// HUD gauge types
#ifdef FS2_DEMO
#define NUM_HUD_GAUGES 37
#else
#define NUM_HUD_GAUGES 39
#endif
#define HUD_LEAD_INDICATOR 0
#define HUD_ORIENTATION_TEE 1
+10 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDshield.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:23 $
* $Author: penguin $
* $Revision: 2.1 $
* $Date: 2003-01-06 17:14:52 $
* $Author: Goober5000 $
*
* Header file for the display and management of the HUD shield
*
* $Log: not supported by cvs2svn $
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:08 mharris
* Initial checkin - converted filenames and includes to lower case
*
@@ -89,4 +92,8 @@ void hud_shield_hit_reset(int player=0);
void shield_info_reset(shield_hit_info *shi);
// random page in stuff - moved here by Goober5000
extern void hud_ship_icon_page_in(ship_info *sip);
#endif /* __FREESPACE_HUDSHIELDBOX_H__ */
+23 -6
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDsquadmsg.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:05 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-19 22:20:23 $
* $Author: Goober5000 $
*
* File to control sqaudmate messaging
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:23 penguin
* Warpcore CVS sync
*
@@ -1174,13 +1177,27 @@ void hud_squadmsg_repair_rearm_abort( int toggle_state, object *obj)
hud_squadmsg_toggle(); // take us out of message mode
}
// Goober5000 - redone and added a bit
// returns 1 if an order is valid for a ship. Applies to things like departure when engines are blown, etc.
int hud_squadmsg_ship_order_valid( int shipnum, int order )
{
// disabled ships can't depart.
if ( (order == DEPART_ITEM) && (Ships[shipnum].flags & SF_DISABLED) )
return 0;
switch ( order )
{
case DEPART_ITEM:
// disabled ships can't depart.
if (Ships[shipnum].flags & SF_DISABLED)
return 0;
// Goober5000: also can't depart if no subspace drives and no capships in the area
if (Ships[shipnum].flags2 & SF2_NO_SUBSPACE_DRIVE)
{
// locate a capital ship on the same team:
if (ship_get_ship_with_dock_bay(Ships[shipnum].team) < 0)
return 0;
}
break;
}
return 1;
}
+359 -93
View File
@@ -9,13 +9,52 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDtarget.cpp $
* $Revision: 2.2 $
* $Date: 2002-09-20 20:02:00 $
* $Author: phreak $
* $Revision: 2.12 $
* $Date: 2003-01-17 07:59:09 $
* $Author: Goober5000 $
*
* C module to provide HUD targeting functions
*
* $Log: not supported by cvs2svn $
* Revision 2.11 2003/01/03 21:58:08 Goober5000
* Fixed some minor bugs, and added a primitive-sensors flag, where if a ship
* has primitive sensors it can't target anything and objects don't appear
* on radar if they're outside a certain range. This range can be modified
* via the sexp primitive-sensors-set-range.
* --Goober5000
*
* Revision 2.10 2002/12/31 19:18:41 Goober5000
* if it ain't broke, don't fix it
* --Goober5000
*
* Revision 2.8 2002/12/22 21:31:01 Goober5000
* tweaked positioning of the new HUD graphics
* --Goober5000
*
* Revision 2.7 2002/12/21 18:03:49 Goober5000
* commented out the warning if you don't have the new ballistic HUD graphics - it would probably get annoying (just use the old ones without comment)
* --Goober5000
*
* Revision 2.6 2002/12/19 10:54:37 Goober5000
* oops - squashed a bug :)
* --Goober5000
*
* Revision 2.5 2002/12/19 10:46:14 Goober5000
* implemented the revised HUD weapon display for ballistic primaries
* --Goober5000
*
* Revision 2.4 2002/12/13 08:13:30 Goober5000
* small tweaks and bug fixes for the ballistic primary conversion
* ~Goober5000~
*
* Revision 2.3 2002/12/10 05:42:42 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Fixed lead indicator behavior; Phreak's version didn't work properly.
*
* Revision 2.2 2002/09/20 20:02:00 phreak
* lead indicator for dumbfire missiles
*
* Revision 2.1 2002/08/01 01:41:05 penguin
* The big include file move
*
@@ -285,6 +324,8 @@ float Max_front_seperation[GR_NUM_RESOLUTIONS] = {
// This means the variables are not player-specific
static int Target_in_reticle = 0;
static int ballistic_hud_index = 0; // Goober5000
extern object obj_used_list; // dummy node in linked list of active objects
extern char *Cargo_names[];
@@ -483,47 +524,97 @@ static int Toggle_text_alpha = 255;
// animation files for the weapons gauge
#define NUM_WEAPON_GAUGES 5
hud_frames Weapon_gauges[NUM_WEAPON_GAUGES];
#define NUM_HUD_SETTINGS 2
hud_frames Weapon_gauges[NUM_HUD_SETTINGS][NUM_WEAPON_GAUGES];
int Weapon_gauges_loaded = 0;
// for primaries
int Weapon_gauge_primary_coords[GR_NUM_RESOLUTIONS][3][2] = {
{ // GR_640
// based on the # of primaries
{509, 273}, // top of weapon gauge, first frame, always
{497, 293}, // for the first primary
{497, 305} // for the second primary
int Weapon_gauge_primary_coords[NUM_HUD_SETTINGS][GR_NUM_RESOLUTIONS][3][2] =
{
{ // normal HUD
{ // GR_640
// based on the # of primaries
{509, 273}, // top of weapon gauge, first frame, always
{497, 293}, // for the first primary
{497, 305} // for the second primary
},
{ // GR_1024
// based on the # of primaries
{892, 525}, // top of weapon gauge, first frame, always
{880, 545}, // for the first primary
{880, 557} // for the second primary
}
},
{ // GR_1024
// based on the # of primaries
{892, 525}, // top of weapon gauge, first frame, always
{880, 545}, // for the first primary
{880, 557} // for the second primary
{ // ballistic HUD - slightly different alignment
{ // GR_640
// based on the # of primaries
{485, 273}, // top of weapon gauge, first frame, always
{485, 293}, // for the first primary
{485, 305} // for the second primary
},
{ // GR_1024
// based on the # of primaries
{868, 525}, // top of weapon gauge, first frame, always
{868, 545}, // for the first primary
{868, 557} // for the second primary
}
}
};
int Weapon_gauge_secondary_coords[GR_NUM_RESOLUTIONS][5][2] = {
{ // GR_640
// based on the # of secondaries
{497, 318}, // bottom of gauge, 0 secondaries
{497, 318}, // bottom of gauge, 1 secondaries
{497, 317}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{497, 326}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{497, 335} // bottom of gauge, 3 secondaries
int Weapon_gauge_secondary_coords[NUM_HUD_SETTINGS][GR_NUM_RESOLUTIONS][5][2] =
{
{ // normal HUD
{ // GR_640
// based on the # of secondaries
{497, 318}, // bottom of gauge, 0 secondaries
{497, 318}, // bottom of gauge, 1 secondaries
{497, 317}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{497, 326}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{497, 335} // bottom of gauge, 3 secondaries
},
{ // GR_1024
// based on the # of secondaries
{880, 570}, // bottom of gauge, 0 secondaries
{880, 570}, // bottom of gauge, 1 secondaries
{880, 569}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{880, 578}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{880, 587} // bottom of gauge, 3 secondaries
}
},
{ // GR_1024
// based on the # of secondaries
{880, 570}, // bottom of gauge, 0 secondaries
{880, 570}, // bottom of gauge, 1 secondaries
{880, 569}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{880, 578}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{880, 587} // bottom of gauge, 3 secondaries
{ // ballistic HUD - slightly different alignment
{ // GR_640
// based on the # of secondaries
{485, 318}, // bottom of gauge, 0 secondaries
{485, 318}, // bottom of gauge, 1 secondaries
{485, 317}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{485, 326}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{485, 335} // bottom of gauge, 3 secondaries
},
{ // GR_1024
// based on the # of secondaries
{868, 570}, // bottom of gauge, 0 secondaries
{868, 570}, // bottom of gauge, 1 secondaries
{868, 569}, // middle of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{868, 578}, // bottom of gauge, 2 secondaries AND middle of gauge, 3 secondaries
{868, 587} // bottom of gauge, 3 secondaries
}
}
};
int Weapon_title_coords[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
518, 275
int Weapon_title_coords[NUM_HUD_SETTINGS][GR_NUM_RESOLUTIONS][2] =
{
{ // normal HUD
{ // GR_640
518, 274
},
{ // GR_1024
901, 527
}
},
{ // GR_1024
901, 527
{ // ballistic HUD - slightly different alignment
{ // GR_640
487, 274
},
{ // GR_1024
870, 527
}
}
};
int Weapon_plink_coords[GR_NUM_RESOLUTIONS][2][2] = {
@@ -566,6 +657,16 @@ int Weapon_secondary_y[GR_NUM_RESOLUTIONS][3] = {
579 // y location of where to draw text for the third secondary
}
};
int Weapon_primary_y[GR_NUM_RESOLUTIONS][2] = {
{ // GR_640
285, // y location of where to draw text for the first primary
295 // y location of where to draw text for the second primary
},
{ // GR_1024
537, // y location of where to draw text for the first primary
547 // y location of where to draw text for the second primary
}
};
int Weapon_secondary_name_x[GR_NUM_RESOLUTIONS] = {
536, // x location of where to draw weapon name
919
@@ -574,26 +675,48 @@ int Weapon_secondary_ammo_x[GR_NUM_RESOLUTIONS] = {
525, // x location of where to draw weapon ammo count
908
};
int Weapon_primary_ammo_x[GR_NUM_RESOLUTIONS] = {
525, // x location of where to draw primary weapon ammo count
908
};
int Weapon_secondary_reload_x[GR_NUM_RESOLUTIONS] = {
615, // x location of where to draw the weapon reload time
998
};
char *Weapon_gauge_fnames[GR_NUM_RESOLUTIONS][NUM_WEAPON_GAUGES] =
char *Weapon_gauge_fnames[NUM_HUD_SETTINGS][GR_NUM_RESOLUTIONS][NUM_WEAPON_GAUGES] =
{
//XSTR:OFF
{ // GR_640
"weapons1",
"weapons2",
"weapons3",
"weapons4",
"weapons5"
},
{ // GR_1024
"weapons1",
"weapons2",
"weapons3",
"weapons4",
"weapons5"
{ // normal HUD
{ // GR_640
"weapons1",
"weapons2",
"weapons3",
"weapons4",
"weapons5"
},
{ // GR_1024
"weapons1",
"weapons2",
"weapons3",
"weapons4",
"weapons5"
}
},
{ // ballistic HUD - slightly different alignment
{ // GR_640
"weapons1_b",
"weapons2_b",
"weapons3_b",
"weapons4_b",
"weapons5_b"
},
{ // GR_1024
"weapons1_b",
"weapons2_b",
"weapons3_b",
"weapons4_b",
"weapons5_b"
}
}
//XSTR:ON
};
@@ -635,7 +758,7 @@ int hud_target_invalid_awacs(object *objp)
// if objp is ship object, first check if can be targeted with team info
if (objp->type == OBJ_SHIP) {
if (Player_ship != NULL) {
if (ship_is_visible_by_team(objp->instance, Player_ship->team)) {
if (ship_is_visible_by_team_new(objp, Player_ship)) {
return 0;
}
}
@@ -927,8 +1050,8 @@ object *hud_reticle_pick_target()
return return_objp;
}
// hud_target_hotkey_add_remove takes as it's parameter which hotkey (1-0) to add/remove the current
// target from. This functio behaves like the Shift-<selection> does in Windows -- using shift # will toggle
// hud_target_hotkey_add_remove takes as its parameter which hotkey (1-0) to add/remove the current
// target from. This function behaves like the Shift-<selection> does in Windows -- using shift # will toggle
// the current target in and out of the selection set.
void hud_target_hotkey_add_remove( int k, object *ctarget, int how_to_add )
{
@@ -1157,7 +1280,7 @@ void hud_keyed_targets_clear()
// Init data used for the weapons display on the HUD
void hud_weapons_init()
{
int i;
int i, j, k, hud_index, gauge_index, hud_warned;
Weapon_flash_info.is_bright = 0;
for ( i = 0; i < MAX_WEAPON_FLASH_LINES; i++ ) {
@@ -1165,13 +1288,71 @@ void hud_weapons_init()
Weapon_flash_info.flash_next[i] = 1;
}
if ( !Weapon_gauges_loaded ) {
for ( i = 0; i < NUM_WEAPON_GAUGES; i++ ) {
Weapon_gauges[i].first_frame = bm_load_animation(Weapon_gauge_fnames[gr_screen.res][i], &Weapon_gauges[i].num_frames);
if ( Weapon_gauges[i].first_frame < 0 ) {
Warning(LOCATION,"Cannot load hud ani: %s\n",Weapon_gauge_fnames[gr_screen.res][i]);
if ( !Weapon_gauges_loaded )
{
hud_warned = 0;
for (hud_index = 0; hud_index < NUM_HUD_SETTINGS; hud_index++)
{
for ( gauge_index = 0; gauge_index < NUM_WEAPON_GAUGES; gauge_index++ )
{
Weapon_gauges[hud_index][gauge_index].first_frame = bm_load_animation(Weapon_gauge_fnames[hud_index][gr_screen.res][gauge_index], &Weapon_gauges[hud_index][gauge_index].num_frames);
// file not found?
if ( Weapon_gauges[hud_index][gauge_index].first_frame < 0 )
{
// if this is the ballistic hud setting, load the conventional ani
if (hud_index)
{
// give a single warning
if (!hud_warned)
{
// commented because it gets annoying, and the warning really isn't needed anyway - Goober5000
//Warning(LOCATION, "Warning: Ballistic HUD graphics not found. Defaulting to original graphics.\n");
hud_warned = 1;
}
Weapon_gauges[hud_index][gauge_index].first_frame = bm_load_animation(Weapon_gauge_fnames[0][gr_screen.res][gauge_index], &Weapon_gauges[hud_index][gauge_index].num_frames);
// and test again
if ( Weapon_gauges[hud_index][gauge_index].first_frame < 0 )
{
Warning(LOCATION,"Cannot load hud ani: %s\n",Weapon_gauge_fnames[hud_index][gr_screen.res][gauge_index]);
}
}
// otherwise, display the regular warning
else
{
Warning(LOCATION,"Cannot load hud ani: %s\n",Weapon_gauge_fnames[hud_index][gr_screen.res][gauge_index]);
}
}
}
}
// reset the old coordinates if hud_warned
if (hud_warned)
{
// don't reset the first one, but reset all others
for (hud_index = 1; hud_index < NUM_HUD_SETTINGS; hud_index++)
{
for (i = 0; i < GR_NUM_RESOLUTIONS; i++)
{
for (k = 0; k < 2; k++)
{
for (j = 0; j < 3; j++)
{
Weapon_gauge_primary_coords[hud_index][i][j][k] = Weapon_gauge_primary_coords[0][i][j][k];
}
for (j = 0; j < 5; j++)
{
Weapon_gauge_secondary_coords[hud_index][i][j][k] = Weapon_gauge_secondary_coords[0][i][j][k];
}
Weapon_title_coords[hud_index][i][k] = Weapon_title_coords[0][i][k];
}
}
}
}
Weapon_gauges_loaded = 1;
}
}
@@ -1191,6 +1372,19 @@ void hud_init_targeting()
{
Assert(Player_ai != NULL);
int i;
// decide whether to realign HUD for ballistic primaries
ballistic_hud_index = 0;
for (i = 0; i < Player_ship->weapons.num_primary_banks; i++)
{
if (Weapon_info[Player_ship->weapons.primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC)
{
ballistic_hud_index = 1;
break;
}
}
// make sure there is no current target
set_target_objnum( Player_ai, -1 );
Player_ai->last_target = -1;
@@ -1256,8 +1450,6 @@ void hud_init_targeting()
} else {
Toggle_text_alpha = 160;
}
}
// Target the next or previous subobject on the currently selected ship, based on next_flag.
@@ -3188,7 +3380,7 @@ void hud_show_remote_detonate_missile()
}
}
// routine to possibly draw a bouding box around a ship sending a message to the player
// routine to possibly draw a bounding box around a ship sending a message to the player
void hud_show_message_sender()
{
object *targetp;
@@ -3814,18 +4006,28 @@ int hud_get_best_primary_bank(float *range)
num_to_test = min(1, swp->num_primary_banks);
}
for ( i = 0; i < num_to_test; i++ ) {
bank_to_fire = (swp->current_primary_bank+i)%2; // Max supported banks is 2
for ( i = 0; i < num_to_test; i++ )
{
bank_to_fire = (swp->current_primary_bank+i)%MAX_SUPPORTED_PRIMARY_BANKS; // Max supported banks is 2
// calculate the range of the weapon, and only display the lead target indicator when
// calculate the range of the weapon, and only display the lead target indicator
// if the weapon can actually hit the target
Assert(bank_to_fire >= 0);
Assert(swp->primary_bank_weapons[bank_to_fire] >= 0);
wip = &Weapon_info[swp->primary_bank_weapons[bank_to_fire]];
weapon_range = wip->max_speed * wip->lifetime;
if ( weapon_range > farthest_weapon_range ) {
// don't consider this primary if it's a ballistic that's out of ammo - Goober5000
if ( wip->wi_flags2 & WIF2_BALLISTIC )
{
if ( swp->primary_bank_ammo[bank_to_fire] <= 0)
{
continue;
}
}
if ( weapon_range > farthest_weapon_range )
{
best_bank = bank_to_fire;
farthest_weapon_range = weapon_range;
}
@@ -3975,17 +4177,24 @@ void hud_show_lead_indicator(vector *target_world_pos)
srange = ship_get_secondary_weapon_range(Player_ship);
if ( swp->current_secondary_bank >= 0 ) {
if ( swp->current_secondary_bank >= 0 )
{
int bank = swp->current_secondary_bank;
tmp = &Weapon_info[swp->secondary_bank_weapons[bank]];
if ( tmp->wi_flags & WIF_HOMING_ASPECT ) {
if ( !Player->target_in_lock_cone ) {
if ( tmp->wi_flags & WIF_HOMING_ASPECT )
{
if ( !Player->target_in_lock_cone )
{
srange = -1.0f;
}
}
}
//frame_offset=hudtarget_lead_indicator_pick_frame(prange, srange, dist_to_target);
frame_offset = hudtarget_lead_indicator_pick_frame(prange, srange, dist_to_target);
/* Commented out by Goober5000, because it's a bit buggy. The original Volition code
// is A-1 SUPAR and ought to work for dumbfires as well. O_o
--------------- Phreak's Non-Working Code (TM) ------------
if (dist_to_target < prange)
{
frame_offset=2;
@@ -4006,10 +4215,11 @@ void hud_show_lead_indicator(vector *target_world_pos)
{
if((dist_to_target < srange) && (tmp->wi_flags & WIF_HOMING_HEAT))
{
frame_offset=0;
frame_offset=0; // and this probably should be 2 - Goober5000
}
}
}
----------------------------------------------------------- */
if ( frame_offset < 0 ) {
return;
@@ -4617,16 +4827,26 @@ void hud_show_weapon_energy_gauge()
float percent_left;
int clip_h, i, w, h;
if ( Energy_bar_gauges.first_frame == -1 ){
if ( Energy_bar_gauges.first_frame == -1 )
{
return;
}
if ( Player_ship->weapons.num_primary_banks <= 0 ){
if ( Player_ship->weapons.num_primary_banks <= 0 )
{
return;
}
// also leave if no energy can be stored for weapons
if (Objects[Player_ship->objnum].flags & OF_NO_LASERS)
{
return;
}
percent_left = Player_ship->weapon_energy/Ship_info[Player_ship->ship_info_index].max_weapon_reserve;
if ( percent_left > 1 ) {
if ( percent_left > 1 )
{
percent_left = 1.0f;
}
@@ -4641,9 +4861,12 @@ void hud_show_weapon_energy_gauge()
}
hud_set_gauge_color(HUD_WEAPONS_ENERGY);
for ( i = 0; i < Player_ship->weapons.num_primary_banks; i++ ) {
if ( !timestamp_elapsed(Weapon_flash_info.flash_duration[i]) ) {
if ( Weapon_flash_info.is_bright & (1<<i) ) {
for ( i = 0; i < Player_ship->weapons.num_primary_banks; i++ )
{
if ( !timestamp_elapsed(Weapon_flash_info.flash_duration[i]) )
{
if ( Weapon_flash_info.is_bright & (1<<i) )
{
// hud_set_bright_color();
hud_set_gauge_color(HUD_WEAPONS_ENERGY, HUD_C_BRIGHT);
break;
@@ -4708,7 +4931,7 @@ void hud_show_target_triangle_indicator(vertex *projected_v)
}
}
// called from hud_show_weapons() to plot out the secondary weapon name and amo
// called from hud_show_weapons() to plot out the secondary weapon name and ammo
void hud_show_secondary_weapon(int count, ship_weapon *sw, int dual_fire)
{
char ammo_str[32];
@@ -4732,7 +4955,7 @@ void hud_show_secondary_weapon(int count, ship_weapon *sw, int dual_fire)
strcpy(weapon_name, wip->name);
}
hud_end_string_at_first_hash_symbol(weapon_name);
end_string_at_first_hash_symbol(weapon_name);
if ( sw->current_secondary_bank == i ) {
emp_hud_printf(Weapon_sunlinked_x[gr_screen.res], Weapon_secondary_y[gr_screen.res][i] - np*12, EG_NULL, "%c", Lcl_special_chars + 2);
@@ -4764,6 +4987,29 @@ void hud_show_secondary_weapon(int count, ship_weapon *sw, int dual_fire)
}
}
// called from hud_show_weapons() to plot out the primary weapon ammo - Goober5000
void hud_show_primary_weapon_ammo(int count, ship_weapon *sw)
{
char ammo_str[32];
int i, w, h;
for ( i = 0; i < count; i++ )
{
// for all ballistic weapons
if (Weapon_info[sw->primary_bank_weapons[i]].wi_flags2 & WIF2_BALLISTIC)
{
// print out the ammo right justified
sprintf(ammo_str, "%d", sw->primary_bank_ammo[i]);
hud_num_make_mono(ammo_str);
gr_get_string_size(&w, &h, ammo_str);
emp_hud_string(Weapon_primary_ammo_x[gr_screen.res] - w, Weapon_primary_y[gr_screen.res][i], EG_NULL, ammo_str);
hud_set_gauge_color(HUD_WEAPONS_GAUGE);
}
}
}
// start the weapon line (on the HUD) flashing
void hud_start_flash_weapon(int index)
{
@@ -4838,6 +5084,8 @@ void hud_show_cmeasure_gague()
void hud_show_weapons()
{
ship_weapon *sw;
int ship_is_ballistic;
int np, ns; // np == num primary, ns == num secondary
char name[NAME_LENGTH];
@@ -4848,6 +5096,7 @@ void hud_show_weapons()
Assert(Player_obj->instance >= 0 && Player_obj->instance < MAX_SHIPS);
sw = &Ships[Player_obj->instance].weapons;
ship_is_ballistic = (Ship_info[Ships[Player_obj->instance].ship_info_index].flags & SIF_BALLISTIC_PRIMARIES);
np = sw->num_primary_banks;
ns = sw->num_secondary_banks;
@@ -4860,14 +5109,14 @@ void hud_show_weapons()
hud_set_gauge_color(HUD_WEAPONS_GAUGE);
// draw top of primary display
GR_AABITMAP(Weapon_gauges[0].first_frame, Weapon_gauge_primary_coords[gr_screen.res][0][0], Weapon_gauge_primary_coords[gr_screen.res][0][1]);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][0].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][0][0], Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][0][1]);
emp_hud_string(Weapon_title_coords[gr_screen.res][0], Weapon_title_coords[gr_screen.res][1], EG_WEAPON_TITLE, XSTR( "weapons", 328));
emp_hud_string(Weapon_title_coords[ballistic_hud_index][gr_screen.res][0], Weapon_title_coords[ballistic_hud_index][gr_screen.res][1], EG_WEAPON_TITLE, XSTR( "weapons", 328));
switch ( np ) {
case 0:
// draw bottom of border
GR_AABITMAP(Weapon_gauges[2].first_frame, Weapon_gauge_primary_coords[gr_screen.res][1][0], Weapon_gauge_primary_coords[gr_screen.res][1][1]);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][2].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][0], Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][1]);
emp_hud_string(Weapon_pname_coords[gr_screen.res][0][0], Weapon_pname_coords[gr_screen.res][0][1], EG_WEAPON_P1, XSTR( "<none>", 329));
@@ -4876,7 +5125,7 @@ void hud_show_weapons()
case 1:
// draw bottom of border
GR_AABITMAP(Weapon_gauges[2].first_frame, Weapon_gauge_primary_coords[gr_screen.res][1][0], Weapon_gauge_primary_coords[gr_screen.res][1][1]);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][2].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][0], Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][1]);
strcpy(name, Weapon_info[sw->primary_bank_weapons[0]].name);
if (Lcl_gr) {
@@ -4893,14 +5142,20 @@ void hud_show_weapons()
emp_hud_printf(Weapon_plink_coords[gr_screen.res][0][0], Weapon_plink_coords[gr_screen.res][0][1], EG_NULL, "%c", Lcl_special_chars + 2);
emp_hud_printf(Weapon_pname_coords[gr_screen.res][0][0], Weapon_pname_coords[gr_screen.res][0][1], EG_WEAPON_P2, "%s", name);
// check ballistic - Goober5000
if (ship_is_ballistic)
{
hud_show_primary_weapon_ammo(1, sw);
}
break;
case 2:
// draw border to accomodate second primary weapon
GR_AABITMAP(Weapon_gauges[1].first_frame, Weapon_gauge_primary_coords[gr_screen.res][1][0], Weapon_gauge_primary_coords[gr_screen.res][1][1]);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][1].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][0], Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][1][1]);
// draw bottom of border
GR_AABITMAP(Weapon_gauges[2].first_frame, Weapon_gauge_primary_coords[gr_screen.res][2][0], Weapon_gauge_primary_coords[gr_screen.res][2][1]);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][2].first_frame, Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][2][0], Weapon_gauge_primary_coords[ballistic_hud_index][gr_screen.res][2][1]);
strcpy(name, Weapon_info[sw->primary_bank_weapons[0]].name);
if (Lcl_gr) {
@@ -4935,6 +5190,13 @@ void hud_show_weapons()
}
emp_hud_printf(Weapon_pname_coords[gr_screen.res][1][0], Weapon_pname_coords[gr_screen.res][1][1], EG_WEAPON_P2, "%s", name);
np = 0;
// check ballistic - Goober5000
if (ship_is_ballistic)
{
hud_show_primary_weapon_ammo(2, sw);
}
break;
default:
@@ -4948,37 +5210,37 @@ void hud_show_weapons()
switch ( ns ) {
case 0:
// draw the bottom of the secondary weapons
GR_AABITMAP(Weapon_gauges[4].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][0][0], Weapon_gauge_secondary_coords[gr_screen.res][0][1] - 12*np - 1);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][4].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][0][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][0][1] - 12*np - 1);
emp_hud_string(Weapon_pname_coords[gr_screen.res][0][0], Weapon_secondary_y[gr_screen.res][0] - np*12, EG_WEAPON_S1, XSTR( "<none>", 329));
break;
case 1:
// draw the bottom of the secondary weapons
GR_AABITMAP(Weapon_gauges[4].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][1][0], Weapon_gauge_secondary_coords[gr_screen.res][1][1] - 12*np - 1);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][4].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][1][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][1][1] - 12*np - 1);
hud_show_secondary_weapon(1, sw, Player_ship->flags & SF_SECONDARY_DUAL_FIRE);
break;
case 2:
// draw the middle border, only present when there are 2 or more secondaries
GR_AABITMAP(Weapon_gauges[3].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][2][0], Weapon_gauge_secondary_coords[gr_screen.res][2][1] - np*12);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][3].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][2][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][2][1] - np*12);
// draw the bottom of the secondary weapons
GR_AABITMAP(Weapon_gauges[4].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][3][0], Weapon_gauge_secondary_coords[gr_screen.res][3][1] - 12*np);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][4].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][3][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][3][1] - 12*np);
hud_show_secondary_weapon(2, sw, Player_ship->flags & SF_SECONDARY_DUAL_FIRE);
break;
case 3:
// draw the middle border, only present when there are 2 or more secondaries
GR_AABITMAP(Weapon_gauges[3].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][2][0], Weapon_gauge_secondary_coords[gr_screen.res][2][1] - np*12);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][3].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][2][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][2][1] - np*12);
// draw the bottm border, only present when there are 3 secondaries
GR_AABITMAP(Weapon_gauges[3].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][3][0], Weapon_gauge_secondary_coords[gr_screen.res][3][1] - np*12);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][3].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][3][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][3][1] - np*12);
// draw the bottom of the secondary weapons
GR_AABITMAP(Weapon_gauges[4].first_frame, Weapon_gauge_secondary_coords[gr_screen.res][4][0], Weapon_gauge_secondary_coords[gr_screen.res][4][1] - 12*np);
GR_AABITMAP(Weapon_gauges[ballistic_hud_index][4].first_frame, Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][4][0], Weapon_gauge_secondary_coords[ballistic_hud_index][gr_screen.res][4][1] - 12*np);
hud_show_secondary_weapon(3, sw, Player_ship->flags & SF_SECONDARY_DUAL_FIRE);
break;
@@ -5235,6 +5497,10 @@ void hud_show_auto_icons()
if ( Toggle_gauge.first_frame == -1 )
return;
// don't draw auto icons if we have primitive sensors - Goober5000
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
return;
// display auto target icon
if ( hud_gauge_active(HUD_AUTO_TARGET) ) {
show_flag=1;
@@ -5662,7 +5928,7 @@ void hudtarget_page_in()
int i;
for ( i = 0; i < NUM_WEAPON_GAUGES; i++ ) {
bm_page_in_aabitmap( Weapon_gauges[i].first_frame, Weapon_gauges[i].num_frames);
bm_page_in_aabitmap( Weapon_gauges[ballistic_hud_index][i].first_frame, Weapon_gauges[ballistic_hud_index][i].num_frames);
}
bm_page_in_aabitmap( Lead_indicator_gauge.first_frame, Lead_indicator_gauge.num_frames);
bm_page_in_aabitmap( Energy_bar_gauges.first_frame, Energy_bar_gauges.num_frames);
+69 -23
View File
@@ -9,13 +9,54 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDtargetbox.cpp $
* $Revision: 2.4 $
* $Date: 2002-10-22 23:02:40 $
* $Author: randomtiger $
* $Revision: 2.13 $
* $Date: 2003-01-27 07:46:33 $
* $Author: Goober5000 $
*
* C module for drawing the target monitor box on the HUD
*
* $Log: not supported by cvs2svn $
* Revision 2.12 2003/01/17 07:59:09 Goober5000
* fixed some really strange behavior with strings not being truncated at the
* # symbol
* --Goober5000
*
* Revision 2.11 2003/01/17 01:48:50 Goober5000
* added capability to the $Texture replace code to substitute the textures
* without needing and extra model, however, this way you can't substitute
* transparent or animated textures
* --Goober5000
*
* Revision 2.10 2003/01/15 20:49:10 Goober5000
* did the XSTR for the turret thing
* --Goober5000
*
* Revision 2.9 2003/01/15 16:52:27 Goober5000
* oops, that'll introduce a bug - naming it just plain "Turret" instead
* --Goober5000
*
* Revision 2.8 2003/01/15 16:48:59 Goober5000
* capship ballistic weapon displays "Cannon" on HUD instead of "Laser Turret"
* --Goober5000
*
* Revision 2.7 2003/01/15 07:09:09 Goober5000
* changed most references to modelnum to use ship instead of ship_info --
* this will help with the change-model sexp and any other instances of model
* changing
* --Goober5000
*
* Revision 2.6 2002/12/14 17:09:28 Goober5000
* removed mission flag for fighterbay damage; instead made damage display contingent on whether the fighterbay subsystem is assigned a damage percentage in ships.tbl
* --Goober5000
*
* Revision 2.5 2002/12/14 01:55:04 Goober5000
* added mission flag to show subsystem damage for fighterbays
* ~Goober5000~
*
* Revision 2.4 2002/10/22 23:02:40 randomtiger
* Made Phreaks alternative scanning style optional under the command line tag "-phreak"
* Fixed bug that changes HUD colour when targetting debris in a full nebula. - RT
*
* Revision 2.3 2002/09/20 20:01:30 phreak
* extra effects during cargo scan
*
@@ -914,13 +955,21 @@ void get_turret_subsys_name(model_subsystem *system_info, char *outstr)
} else {
if (Weapon_info[system_info->turret_weapon_type].subtype == WP_LASER) {
sprintf(outstr, "%s", XSTR("Laser turret", 1568));
// ballistic too! - Goober5000
if (Weapon_info[system_info->turret_weapon_type].wi_flags2 & WIF2_BALLISTIC)
{
sprintf(outstr, "%s", XSTR("Turret", 1487));
}
else
{
sprintf(outstr, "%s", XSTR("Laser turret", 1568));
}
} else if (Weapon_info[system_info->turret_weapon_type].subtype == WP_MISSILE) {
sprintf(outstr, "%s", XSTR("Missile lnchr", 1569));
} else {
// Illegal subtype
Int3();
sprintf(outstr, "%s", NOX("Turret"));
sprintf(outstr, "%s", XSTR("Turret", 1487));
}
}
} else {
@@ -980,10 +1029,7 @@ void hud_render_target_ship_info(object *target_objp)
mission_parse_lookup_alt_index(target_shipp->alt_type_index, temp_name);
} else {
strcpy(temp_name, Ship_info[base_index].name);
if ( strstr(Ship_info[base_index].name, NOX("#")) ) {
strcpy(temp_name, Ship_info[base_index].name);
hud_end_string_at_first_hash_symbol(temp_name);
}
end_string_at_first_hash_symbol(temp_name);
}
if (Lcl_gr) {
@@ -1051,7 +1097,10 @@ void hud_render_target_ship_info(object *target_objp)
// AL 23-3-98: Fighter bays are a special case. Player cannot destroy them, so don't
// show the subsystem strength
if ( strnicmp(NOX("fighter"), Player_ai->targeted_subsys->system_info->name, 7) ) {
// Goober5000: don't display any strength if we can't destroy this subsystem - but sometimes
// fighterbays can be destroyed
if ( ship_subsys_takes_damage(Player_ai->targeted_subsys) )
{
sprintf(outstr,XSTR( "%d%%", 341),screen_integrity);
gr_get_string_size(&w,&h,outstr);
gr_printf(Target_window_coords[gr_screen.res][0]+Target_window_coords[gr_screen.res][2]-w-1, Target_window_coords[gr_screen.res][1]+Target_window_coords[gr_screen.res][3] - h, "%s", outstr);
@@ -1299,7 +1348,7 @@ void hud_render_target_ship(object *target_objp)
// hud_targetbox_get_eye(&camera_eye, &camera_orient, Player_obj->instance);
hud_render_target_setup(&camera_eye, &camera_orient, target_sip->closeup_zoom);
// model_clear_instance(target_sip->modelnum);
// model_clear_instance(target_shipp->modelnum);
ship_model_start( target_objp );
if (Targetbox_wire!=0)
@@ -1336,7 +1385,7 @@ void hud_render_target_ship(object *target_objp)
if(target_sip->modelnum_hud >= 0){
model_render( target_sip->modelnum_hud, &target_objp->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER);
} else {
model_render( target_sip->modelnum, &target_objp->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER);
model_render( target_shipp->modelnum, &target_objp->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER, -1, -1, target_shipp->replacement_textures);
}
ship_model_stop( target_objp );
@@ -1439,13 +1488,9 @@ void hud_render_target_debris(object *target_objp)
base_index = ship_info_base_lookup( debrisp->ship_info_index );
// print out ship class that debris came from
char *printable_ship_class = Ship_info[base_index].name;
if ( strstr(Ship_info[base_index].name, NOX("#")) ) {
char temp_name[NAME_LENGTH];
strcpy(temp_name, Ship_info[base_index].name);
hud_end_string_at_first_hash_symbol(temp_name);
printable_ship_class = temp_name;
}
char printable_ship_class[NAME_LENGTH];
strcpy(printable_ship_class, Ship_info[base_index].name);
end_string_at_first_hash_symbol(printable_ship_class);
emp_hud_string(Targetbox_coords[gr_screen.res][TBOX_CLASS][0], Targetbox_coords[gr_screen.res][TBOX_CLASS][1], EG_TBOX_CLASS, printable_ship_class);
emp_hud_string(Targetbox_coords[gr_screen.res][TBOX_NAME][0], Targetbox_coords[gr_screen.res][TBOX_NAME][1], EG_TBOX_NAME, XSTR( "debris", 348));
@@ -1465,6 +1510,7 @@ void hud_render_target_weapon(object *target_objp)
weapon_info *target_wip = NULL;
weapon *wp = NULL;
object *viewer_obj, *viewed_obj;
int *replacement_textures = NULL;
int target_team, is_homing, is_player_missile, missile_view, viewed_model_num, w, h;
float factor;
char outstr[100]; // temp buffer
@@ -1495,6 +1541,7 @@ void hud_render_target_weapon(object *target_objp)
viewed_obj = wp->homing_object;
missile_view = TRUE;
viewed_model_num = Ships[wp->homing_object->instance].modelnum;
replacement_textures = Ships[wp->homing_object->instance].replacement_textures;
}
if (Targetbox_wire!=0)
@@ -1542,7 +1589,7 @@ void hud_render_target_weapon(object *target_objp)
hud_render_target_setup(&camera_eye, &camera_orient, View_zoom/3);
model_clear_instance(viewed_model_num);
model_render( viewed_model_num, &viewed_obj->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER);
model_render( viewed_model_num, &viewed_obj->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER, -1, -1, replacement_textures);
hud_render_target_close();
}
@@ -1562,9 +1609,8 @@ void hud_render_target_weapon(object *target_objp)
gr_get_string_size(&w,&h,outstr);
// drop name past the # sign
if ( strstr(outstr, NOX("#")) ) {
hud_end_string_at_first_hash_symbol(outstr);
}
end_string_at_first_hash_symbol(outstr);
emp_hud_string(Targetbox_coords[gr_screen.res][TBOX_NAME][0], Targetbox_coords[gr_screen.res][TBOX_NAME][1], EG_TBOX_NAME, outstr);
// If a homing weapon, show time to impact
+102 -7
View File
@@ -9,13 +9,31 @@
/*
* $Logfile: /Freespace2/code/Io/KeyControl.cpp $
* $Revision: 2.4 $
* $Date: 2002-10-19 03:50:29 $
* $Author: randomtiger $
* $Revision: 2.9 $
* $Date: 2003-01-18 10:00:43 $
* $Author: Goober5000 $
*
* Routines to read and deal with keyboard input.
*
* $Log: not supported by cvs2svn $
* Revision 2.8 2003/01/03 21:58:08 Goober5000
* Fixed some minor bugs, and added a primitive-sensors flag, where if a ship
* has primitive sensors it can't target anything and objects don't appear
* on radar if they're outside a certain range. This range can be modified
* via the sexp primitive-sensors-set-range.
* --Goober5000
*
* Revision 2.7 2002/12/31 18:59:43 Goober5000
* if it ain't broke, don't fix it
* --Goober5000
*
* Revision 2.5 2002/12/10 05:43:34 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Revision 2.4 2002/10/19 03:50:29 randomtiger
* Added special pause mode for easier action screenshots.
* Added new command line parameter for accessing all single missions in tech room. - RT
*
* Revision 2.3 2002/10/17 20:40:51 randomtiger
* Added ability to remove HUD ingame on keypress shift O
* So I've added a new key to the bind list and made use of already existing hud removal code.
@@ -759,9 +777,32 @@ void debug_max_secondary_weapons(object *objp)
int index;
ship *shipp = &Ships[objp->instance];
ship_info *sip = &Ship_info[shipp->ship_info_index];
ship_weapon *swp = &shipp->weapons;
for ( index = 0; index < MAX_SECONDARY_BANKS; index++ ) {
shipp->weapons.secondary_bank_ammo[index] = sip->secondary_bank_ammo_capacity[index];
for ( index = 0; index < MAX_SECONDARY_BANKS; index++ )
{
swp->secondary_bank_ammo[index] = sip->secondary_bank_ammo_capacity[index];
}
}
void debug_max_primary_weapons(object *objp) // Goober5000
{
int index;
ship *shipp = &Ships[objp->instance];
ship_info *sip = &Ship_info[shipp->ship_info_index];
ship_weapon *swp = &shipp->weapons;
weapon_info *wip;
if (sip->flags & SIF_BALLISTIC_PRIMARIES)
{
for ( index = 0; index < MAX_PRIMARY_BANKS; index++ )
{
wip = &Weapon_info[swp->primary_bank_weapons[index]];
if (wip->wi_flags2 & WIF2_BALLISTIC)
{
swp->primary_bank_ammo[index] = sip->primary_bank_ammo_capacity[index];
}
}
}
}
@@ -1047,12 +1088,14 @@ void process_debug_keys(int k)
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Weapon energy and missile count will always be at full for player", 16));
debug_max_secondary_weapons(Player_obj);
debug_max_primary_weapons(Player_obj);
if (k & KEY_SHIFTED) {
object *objp;
for ( objp = GET_FIRST(&obj_used_list); objp !=END_OF_LIST(&obj_used_list); objp = GET_NEXT(objp) )
if (objp->type == OBJ_SHIP)
debug_max_secondary_weapons(objp);
debug_max_primary_weapons(objp);
}
} else
@@ -2323,6 +2366,7 @@ int button_function_demo_valid(int n)
}
// execute function corresponding to action n (BUTTON_ #define from KeyControl.h)
// Goober5000: function returns 1 when action was taken
int button_function(int n)
{
Assert(n >= 0);
@@ -2337,7 +2381,58 @@ int button_function(int n)
if (Game_mode & GM_DEAD_DIED){
return 0;
}
// Goober5000 - if the ship doesn't have subspace drive, jump key doesn't work: so test and exit early
if (Player_ship->flags2 & SF2_NO_SUBSPACE_DRIVE)
{
switch(n)
{
case END_MISSION:
control_used(n); // set the timestamp for when we used the control, in case we need it
return 1; // pretend we took the action: if we return 0, strange stuff may happen
}
}
// Goober5000 - if we have primitive sensors, some keys don't work: so test and exit early
if (Player_ship->flags2 & SF2_PRIMITIVE_SENSORS)
{
switch (n)
{
case MATCH_TARGET_SPEED:
case TOGGLE_AUTO_MATCH_TARGET_SPEED:
case TOGGLE_AUTO_TARGETING:
case TARGET_NEXT:
case TARGET_PREV:
case TARGET_NEXT_CLOSEST_HOSTILE:
case TARGET_PREV_CLOSEST_HOSTILE:
case TARGET_NEXT_CLOSEST_FRIENDLY:
case TARGET_PREV_CLOSEST_FRIENDLY:
case TARGET_SHIP_IN_RETICLE:
case TARGET_LAST_TRANMISSION_SENDER:
case TARGET_CLOSEST_REPAIR_SHIP:
case TARGET_CLOSEST_SHIP_ATTACKING_TARGET:
case STOP_TARGETING_SHIP:
case TARGET_CLOSEST_SHIP_ATTACKING_SELF:
case TARGET_TARGETS_TARGET:
case TARGET_SUBOBJECT_IN_RETICLE:
case TARGET_NEXT_SUBOBJECT:
case TARGET_PREV_SUBOBJECT:
case STOP_TARGETING_SUBSYSTEM:
case TARGET_NEXT_BOMB:
case TARGET_PREV_BOMB:
case TARGET_NEXT_UNINSPECTED_CARGO:
case TARGET_PREV_UNINSPECTED_CARGO:
case TARGET_NEWEST_SHIP:
case TARGET_NEXT_LIVE_TURRET:
case TARGET_PREV_LIVE_TURRET:
case TARGET_NEXT_ESCORT_SHIP:
control_used(n); // set the timestamp for when we used the control, in case we need it
return 1; // pretend we took the action: if we return 0, strange stuff may happen
}
}
// now handle keys the regular way
switch (n) {
// cycle to next primary weapon
case CYCLE_NEXT_PRIMARY:
@@ -2390,7 +2485,7 @@ int button_function(int n)
// undefined in multiplayer for clients right now
// match target speed
case MATCH_TARGET_SPEED:
case MATCH_TARGET_SPEED:
control_used(MATCH_TARGET_SPEED);
// If player is auto-matching, break auto-match speed
if ( Player->flags & PLAYER_FLAGS_AUTO_MATCH_SPEED ) {
+2 -2
View File
@@ -778,8 +778,8 @@ BOOL SWFF_WriteRegString(
// close the key
RegCloseKey(hKey);
if(lRet != ERROR_SUCCESS)
return FALSE;
/* if(lRet != ERROR_SUCCESS) // eh, this is unreachable code
return FALSE;*/
// if we have reached this point, then it was a success
return TRUE;
+7 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/JumpNode/JumpNode.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-17 01:56:36 $
* $Author: DTP $
*
* Header for everything to do with jump nodes
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -41,7 +44,7 @@
#include "parse/parselo.h"
#define MAX_JUMP_NODES 3
#define MAX_JUMP_NODES 50
typedef struct {
int modelnum;
+21 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Math/Fvi.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-07 01:37:41 $
* $Author: bobboau $
*
* Routines to find intersections of various 3d things.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -204,6 +207,21 @@ void fvi_two_lines_in_3space(vector *p1, vector *v1, vector *p2, vector *v2, flo
}
}
//tells distance from a plain to a point-Bobboau
float fvi_point_dist_plane( vector *plane_pnt, vector *plane_norm, // Plane description, a point and a normal
vector *point //a point to test
)
{
float dist,D;
D = -vm_vec_dot(plane_norm,plane_pnt);
dist = vm_vec_dot(plane_norm, point) + D;
return dist;
}
//--------------------------------------------------------------------
// fvi_ray_plane - Finds the point on the specified plane where the
+9 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Math/Fvi.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-07 01:37:41 $
* $Author: bobboau $
*
* Prototypes for fvi stuff
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -81,6 +84,9 @@
#include "globalincs/pstypes.h"
//finds distance from point to plane
float fvi_point_dist_plane( vector *plane_pnt,vector *plane_norm, vector *point);
// fvi functions - fvi stands for Find Vector Intersection
// fvi_a_b - means find the intersection of something of type a with something of type b
// type can be:
+61 -4
View File
@@ -9,13 +9,22 @@
/*
* $Logfile: /Freespace2/code/Math/VecMat.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-02-25 06:22:48 $
* $Author: bobboau $
*
* C module containg functions for manipulating vectors and matricies
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/12/07 01:37:41 bobboau
* inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
* collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
* it needs a better renderer, but is in prety good shape for now,
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -392,6 +401,41 @@ void vm_vec_sub2(vector *dest,vector *src)
}
#endif
void vm_vert2vec(vertex *vert, vector *vec) //takes a vertex and makes it into a vector-Bobboau
{
vec->xyz.x = vert->x;
vec->xyz.y = vert->y;
vec->xyz.z = vert->z;
}
void vm_vec2vert(vector *vec, vertex *vert) //takes a vector and makes it into a vertex-Bobboau
{
vert->x = vec->xyz.x;
vert->y = vec->xyz.y;
vert->z = vec->xyz.z;
}
//averages n vectors. returns ptr to dest
//dest can equal either source
vector *vm_vec_avg_n(vector *dest, int n, vector src[])
{
float x=0,y=0,z=0;
for(int i = 0; i<n; i++){
x += src[i].xyz.x;
y += src[i].xyz.y;
z += src[i].xyz.z;
}
dest->xyz.x = x / n;
dest->xyz.y = y / n;
dest->xyz.z = z / n;
return dest;
}
//averages two vectors. returns ptr to dest
//dest can equal either source
vector *vm_vec_avg(vector *dest,vector *src0,vector *src1)
@@ -403,6 +447,15 @@ vector *vm_vec_avg(vector *dest,vector *src0,vector *src1)
return dest;
}
//averages four vectors. returns ptr to dest
//dest can equal any source
vector *vm_vec_avg3(vector *dest,vector *src0,vector *src1,vector *src2)
{
dest->xyz.x = (src0->xyz.x + src1->xyz.x + src2->xyz.x) * 0.333333333f;
dest->xyz.y = (src0->xyz.y + src1->xyz.y + src2->xyz.y) * 0.333333333f;
dest->xyz.z = (src0->xyz.z + src1->xyz.z + src2->xyz.z) * 0.333333333f;
return dest;
}
//averages four vectors. returns ptr to dest
//dest can equal any source
@@ -605,14 +658,18 @@ float vm_vec_dist_quick(vector *v0,vector *v1)
//normalize a vector. returns mag of source vec
float vm_vec_copy_normalize(vector *dest,vector *src)
{
static ben_warned = false;//added this so the warning could be sounded and you can still get on with playing-Bobboau
float m;
m = vm_vec_mag(src);
// Mainly here to trap attempts to normalize a null vector.
if (m <= 0.0f) {
Warning(LOCATION, "Null vector in vector normalize.\n"
if(!ben_warned){
Warning(LOCATION, "Null vector in vector normalize.\n"
"Trace out of vecmat.cpp and find offending code.\n");
ben_warned = true;
}
dest->xyz.x = 1.0f;
dest->xyz.y = 0.0f;
dest->xyz.z = 0.0f;
+15 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Math/VecMat.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-07 01:37:42 $
* $Author: bobboau $
*
* Header file for functions that manipulate vectors and matricies
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -296,11 +299,16 @@ void vm_vec_sub(vector *dest,vector *src0,vector *src1);
void vm_vec_sub2(vector *dest,vector *src);
#endif
//averages n vectors
vector *vm_vec_avg_n(vector *dest, int n, vector src[]);
//averages two vectors. returns ptr to dest
//dest can equal either source
vector *vm_vec_avg(vector *dest,vector *src0,vector *src1);
vector *vm_vec_avg3(vector *dest,vector *src0,vector *src1,vector *src2);
//averages four vectors. returns ptr to dest
//dest can equal any source
vector *vm_vec_avg4(vector *dest,vector *src0,vector *src1,vector *src2,vector *src3);
@@ -651,5 +659,9 @@ void vm_vec_random_in_circle(vector *out, vector *in, matrix *orient, float radi
// returns 0 if the point is inside the line segment, -1 if "before" the line segment and 1 ir "after" the line segment
int vm_vec_dist_to_line(vector *p, vector *l0, vector *l1, vector *nearest, float *dist);
void vm_vert2vec(vertex *vert, vector *vec);
void vm_vec2vert(vector *vec, vertex *vert);
#endif
+7 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MenuUI/Credits.cpp $
* $Revision: 2.6 $
* $Date: 2002-11-02 22:25:26 $
* $Author: inquisitor $
* $Revision: 2.7 $
* $Date: 2002-12-03 22:14:06 $
* $Author: Goober5000 $
*
* C source file for displaying game credits
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2002/11/02 22:25:26 inquisitor
* Cleaned up the presentation a little, added HLP and VW, and, no offense to Kazan, removed Kazan.
*
* Revision 2.5 2002/11/02 22:11:35 DTP
* DOH forgot \n
*
@@ -199,6 +202,7 @@ char *fs2_open_credit_text =
"\n"
"\"Bobboau\"\n"
"Dennis \"DTP\" Pedersen\n"
"Ian \"Goober5000\" Warfield\n"
"Joe \"Righteous1\" Dowd\n"
"Mike \"penguin\" Harris\n"
"\"Mysterial\"\n"
+8 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MenuUI/MainHallMenu.cpp $
* $Revision: 2.5 $
* $Date: 2002-08-27 13:38:58 $
* $Author: penguin $
* $Revision: 2.6 $
* $Date: 2003-01-15 21:29:04 $
* $Author: anonymous $
*
* Header file for main-hall menu code
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2002/08/27 13:38:58 penguin
* Moved DirectX8 stuff to directx8 branch; reverted to previous
*
* Revision 2.3 2002/08/04 05:12:10 penguin
* Change version display location
*
@@ -2036,8 +2039,10 @@ void main_hall_read_table()
stuff_string(m->bitmap, F_NAME, NULL, MAX_FILENAME_LEN);
required_string("+Mask:");
stuff_string(m->mask, F_NAME, NULL, MAX_FILENAME_LEN);
#ifndef FS2_DEMO
required_string("+Music:");
stuff_string(m->music, F_NAME, NULL, MAX_FILENAME_LEN);
#endif
// intercom sounds
required_string("+Num Intercom Sounds:");
+11 -4
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/MenuUI/MainHallMenu.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:24 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-15 05:19:07 $
* $Author: Goober5000 $
*
* Header file for main-hall menu code
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2003/01/14 04:00:15 Goober5000
* allowed for up to 256 main halls
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:09 mharris
* Initial checkin - converted filenames and includes to lower case
*
@@ -63,7 +70,7 @@
#define _MAIN_HALL_MENU_HEADER_FILE
// the # of main halls we're supporting
#define NUM_MAIN_HALLS 2
#define NUM_MAIN_HALLS 10 // Goober5000 - bumped down to 10; don't go above 256 (size of ubyte)
// initialize the main hall proper
void main_hall_init(int main_hall_num);
+11 -8
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MenuUI/PlayerMenu.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-04 05:12:42 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-01-14 04:00:15 $
* $Author: Goober5000 $
*
* Code to drive the Player Select initial screen
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/08/04 05:12:42 penguin
* Display fs2_open version instead of "Freespace 2"
*
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
@@ -342,7 +345,7 @@ int Player_select_clone_flag; // clone the currently selected pilot
char Player_select_last_pilot[CALLSIGN_LEN + 10]; // callsign of the last used pilot, or none if there wasn't one
int Player_select_last_is_multi;
int Player_select_force_bastion = 0;
int Player_select_force_main_hall = 0;
// notification text areas
@@ -408,7 +411,7 @@ void player_select_init()
// start a looping ambient sound
main_hall_start_ambient();
Player_select_force_bastion = 0;
Player_select_force_main_hall = 0;
#ifdef FS2_DEMO
/*
@@ -723,8 +726,8 @@ void player_select_close()
Player = NULL;
}
if (Player_select_force_bastion) {
Player->on_bastion = 1;
if (Player_select_force_main_hall) {
Player->main_hall = 1;
}
}
@@ -1462,7 +1465,7 @@ void player_select_cancel_create()
DCF(bastion,"Sets the player to be on the bastion")
{
if(gameseq_get_state() == GS_STATE_INITIAL_PLAYER_SELECT){
Player_select_force_bastion = 1;
Player_select_force_main_hall = 1;
dc_printf("Player is now in the Bastion\n");
}
}
+14 -6
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/MenuUI/TechMenu.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2002-12-07 01:37:42 $
* $Author: bobboau $
*
* C module that contains functions to drive the Tech Menu user interface
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/11/27 01:20:51 sesquipedalian
* Added Phreak's fix for the weapons room bug. Can now view a modified weapons.tbl in the tech room without crashing
*
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -1043,10 +1049,11 @@ void techroom_change_tab(int num)
for (i=0; i<MAX_WEAPON_TYPES; i++) {
if (Weapon_info[i].wi_flags & mask) {
//following was commented out to fix the tech room crash bug when modified weapons.tbl is used. Fix by Phreak, implemented by Sesquipedalian.
// note: hack here to exclude dogfight weapons -- dont put weapon in if it has same description as pvs weapon
if ((Weapon_list_size > 0) && (!strcmp(Weapon_info[i].tech_desc, Weapon_list[Weapon_list_size-1].desc))) {
continue;
}
//if ((Weapon_list_size > 0) && (!strcmp(Weapon_info[i].tech_desc, Weapon_list[Weapon_list_size-1].desc))) {
// continue;
//}
// we have a weapon that should be in the tech db, so fill out the entry struct
Weapon_list[Weapon_list_size].index = i;
@@ -1502,6 +1509,7 @@ void techroom_close()
void techroom_do_frame(float frametime)
{
int i, k;
// turn off controls when overlay is on
+25 -11
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionCampaign.cpp $
* $Revision: 2.5 $
* $Date: 2002-08-27 13:38:58 $
* $Author: penguin $
* $Revision: 2.7 $
* $Date: 2003-02-23 03:13:03 $
* $Author: wmcoolmon $
*
* source for dealing with campaigns
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2003/01/14 04:00:16 Goober5000
* allowed for up to 256 main halls
* --Goober5000
*
* Revision 2.5 2002/08/27 13:38:58 penguin
* Moved DirectX8 stuff to directx8 branch; reverted to previous
*
* Revision 2.3 2002/08/01 01:41:06 penguin
* The big include file move
*
@@ -210,7 +217,7 @@
#include "cfile/cfile.h"
#include "playerman/player.h"
#include "mission/missiongoals.h"
// #include "movie.h"
#include "cutscene/movie.h"
#include "network/multi.h"
#include "menuui/techmenu.h"
#include "gamesnd/eventmusic.h"
@@ -601,6 +608,17 @@ int mission_campaign_load( char *filename, int load_savefile )
if (optional_string("+Flags:"))
stuff_int(&cm->flags);
// Goober5000 - new main hall stuff!
cm->main_hall = 0;
// deal with previous campaign versions
if (cm->flags & CMISSION_FLAG_BASTION)
cm->main_hall = 1;
// specify up to 256 main halls :)
if (optional_string("+Main Hall:"))
stuff_byte(&cm->main_hall);
cm->formula = -1;
if ( optional_string("+Formula:") ) {
cm->formula = get_sexp_main();
@@ -1513,12 +1531,9 @@ void mission_campaign_mission_over()
Sexp_nodes[mission->formula].value = SEXP_UNKNOWN;
}
// new main hall behavior - Goober5000
Assert(Player);
if (Campaign.missions[Campaign.next_mission].flags & CMISSION_FLAG_BASTION){
Player->on_bastion = 1;
} else {
Player->on_bastion = 0;
}
Player->main_hall = Campaign.missions[Campaign.next_mission].main_hall;
mission_campaign_next_mission(); // sets up whatever needs to be set to actually play next mission
}
@@ -1758,8 +1773,7 @@ void mission_campaign_maybe_play_movie(int type)
if ( !filename )
return;
// no soup for you!
// movie_play( filename );
movie_play( filename ); //Play the movie!
}
// return nonzero if the passed filename is a multiplayer campaign, 0 otherwise
+10 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionCampaign.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-14 04:00:16 $
* $Author: Goober5000 $
*
* header file for dealing with campaigns
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -307,7 +310,10 @@
#define CAMPAIGN_PERSISTENT_SHIP 1
#define CAMPAIGN_PERSISTENT_WEAPON 2
// Goober5000 - Bastion flag is not needed anymore; there can now be more than two main halls;
// but the flag is kept in order to maintain compatibility with older campaigns
#define CMISSION_FLAG_BASTION (1<<0) // set if stationed on Bastion, else Galatea
#define CMISSION_FLAG_SKIPPED (1<<1) // set if skipped, else not
#define CAMPAIGN_LOOP_MISSION_UNINITIALIZED -2
@@ -345,6 +351,7 @@ typedef struct cmission {
int level; // what level of the tree it's on (Fred)
int pos; // what x position on level it's on (Fred)
int flags;
ubyte main_hall; // which main hall the player is in - Goober5000
scoring_struct stats;
} cmission;
+7 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionHotKey.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-02 23:24:35 $
* $Author: Goober5000 $
*
* C module for the Hotkey selection screen
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:24 penguin
* Warpcore CVS sync
*
@@ -73,7 +76,7 @@
* to hide the ship/wing until the mission is entered.
*
* 45 3/11/98 11:20a Hoffoss
* Changed hotkey screen to only show friendly and hostile catagories
* Changed hotkey screen to only show friendly and hostile categories
* (everything non-friendly is hostile).
*
* 44 3/10/98 9:51a Allender
+7 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionLoad.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:06 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-02 23:53:49 $
* $Author: Goober5000 $
*
* C source module for mission loading
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:06 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -92,7 +95,7 @@
* appended path for j:\tmp missions
*
* 89 10/31/97 11:19a John
* added filter catagory for j:\tmp\*.fsm
* added filter category for j:\tmp\*.fsm
*
* 88 10/12/97 5:22p Lawrance
* have ESC back out of mission load screen
File diff suppressed because it is too large. Load diff
+148 -16
View File
@@ -9,13 +9,102 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/mission/missionparse.h,v $
* $Revision: 2.3 $
* $Author: penguin $
* $Date: 2002-08-01 01:41:07 $
* $Revision: 2.21 $
* $Author: Goober5000 $
* $Date: 2003-01-19 07:02:16 $
*
* main header file for parsing code
*
* $Log: not supported by cvs2svn $
* Revision 2.20 2003/01/18 23:25:39 Goober5000
* made "no-subspace-drive" applicable to all ships and fixed a really *STUPID*
* bug that made FRED keep crashing (missing comma, bleagh!)
* --Goober5000
*
* Revision 2.19 2003/01/18 09:25:41 Goober5000
* fixed bug I inadvertently introduced by modifying SIF_ flags with sexps rather
* than SF_ flags
* --Goober5000
*
* Revision 2.18 2003/01/17 01:48:50 Goober5000
* added capability to the $Texture replace code to substitute the textures
* without needing and extra model, however, this way you can't substitute
* transparent or animated textures
* --Goober5000
*
* Revision 2.17 2003/01/15 05:24:23 Goober5000
* added texture replacement parse - will be implemented later
* --Goober5000
*
* Revision 2.16 2003/01/13 02:09:12 wmcoolmon
* Added MISSION_FLAG_NO_NEB_TRAILS and removed MISSION_FLAG_ST_OVERRIDE_NEB. Also changed code to set flags as necessary
*
* Revision 2.15 2003/01/11 01:00:25 wmcoolmon
* Added code for "Ship Trails override Nebula"
*
* Revision 2.14 2003/01/03 21:58:08 Goober5000
* Fixed some minor bugs, and added a primitive-sensors flag, where if a ship
* has primitive sensors it can't target anything and objects don't appear
* on radar if they're outside a certain range. This range can be modified
* via the sexp primitive-sensors-set-range.
* --Goober5000
*
* Revision 2.13 2003/01/02 00:35:21 Goober5000
* added don't-collide-invisible and collide-invisible sexps
* --Goober5000
*
* Revision 2.12 2003/01/01 23:33:33 Goober5000
* added ship-vaporize and ship-no-vaporize sexps
* --Goober5000
*
* Revision 2.11 2002/12/27 02:57:51 Goober5000
* removed the existing stealth sexps and replaced them with the following...
* ship-stealthy
* ship-unstealthy
* is-ship-stealthy
* friendly-stealth-invisible
* friendly-stealth-visible
* is-friendly-stealth-visible
* --Goober5000
*
* Revision 2.10 2002/12/24 07:38:59 Goober5000
* added a wee cautionary note
* --Goober5000
*
* Revision 2.9 2002/12/23 05:18:52 Goober5000
* Squashed some Volition bugs! :O Some of the sexps for dealing with more than
* one ship would return after only dealing with the first ship.
*
* Also added the following sexps:
* is-ship-stealthed
* ship-force-stealth
* ship-force-nostealth
* ship-remove-stealth-forcing
*
* They toggle the stealth flag on and off. If a ship is forced stealthy, it won't even
* show up for friendly ships.
* --Goober5000
*
* Revision 2.8 2002/12/14 17:09:28 Goober5000
* removed mission flag for fighterbay damage; instead made damage display contingent on whether the fighterbay subsystem is assigned a damage percentage in ships.tbl
* --Goober5000
*
* Revision 2.7 2002/12/14 01:55:04 Goober5000
* added mission flag to show subsystem damage for fighterbays
* ~Goober5000~
*
* Revision 2.6 2002/12/10 05:43:34 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Revision 2.5 2002/12/03 23:05:13 Goober5000
* implemented beam-free-all-by-default mission flag
*
* Revision 2.4 2002/11/14 06:15:02 bobboau
* added nameplate code
*
* Revision 2.3 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.2 2002/07/30 17:35:22 wmcoolmon
* Added mission flag "MISSION_FLAG_SUPPORT_REPAIRS_HULL" for toggling Support Ship hull repair on and off
*
@@ -232,6 +321,8 @@ extern char *Starting_wing_names[MAX_STARTING_WINGS+1];
#define MISSION_FLAG_NO_TRAITOR (1<<4) // player cannot become a traitor
#define MISSION_FLAG_SHIP_TRAILS (1<<5) // Enables ship trails
#define MISSION_FLAG_SUPPORT_REPAIRS_HULL (1<<6) // Toggles support ship repair of ship hulls
#define MISSION_FLAG_BEAM_FREE_ALL_BY_DEFAULT (1<<7) // Beam-free-all by default - Goober5000
#define MISSION_FLAG_NO_NEB_TRAILS (1<<8) //Disables ship trails in nebula -C
// some mice macros for mission type
#define IS_MISSION_MULTI_COOP (The_mission.game_type & MISSION_TYPE_MULTI_COOP)
@@ -240,6 +331,17 @@ extern char *Starting_wing_names[MAX_STARTING_WINGS+1];
#define MISSION_DESC_LENGTH 512
// Goober5000
typedef struct support_ship_info {
int arrival_location; // arrival location
int arrival_anchor; // arrival anchor
int departure_location; // departure location
int departure_anchor; // departure anchor
int max_support_ships; // max number of support ships
int ship_class; // ship class of support ship
int tally; // number of support ships so far
} support_ship_info;
typedef struct mission {
char name[NAME_LENGTH];
char author[NAME_LENGTH];
@@ -254,7 +356,7 @@ typedef struct mission {
uint num_respawns; // valid in multiplayer missions -- number of respawns allowed
int red_alert;
int scramble;
int disallow_support; // should support ships be disallowed.
support_ship_info support_ships; // Goober5000
char tour_name[NAME_LENGTH];
char pre_briefing_cutscene[FILESPEC_LENGTH];
char pre_mission_cutscene[FILESPEC_LENGTH];
@@ -268,7 +370,7 @@ typedef struct mission {
// cargo defines
// NOTE: MAX_CARGO MUST REMAIN <= 64 (CARGO_NO_DEPLETE) for NO_DEPLETE to work.
#define CARGO_INDEX_MASK 0xBF
#define CARGO_NO_DEPLETE 0x40
#define CARGO_NO_DEPLETE 0x40 // CARGO_NO_DEPLETE + CARGO_INDEX_MASK must == FF
#define MAX_CARGO 30
extern mission The_mission;
@@ -326,12 +428,13 @@ extern char *Status_desc_names[MAX_STATUS_NAMES];
extern char *Status_type_names[MAX_STATUS_NAMES];
extern char *Status_target_names[MAX_STATUS_NAMES];
extern char *Arrival_location_names[MAX_ARRIVAL_NAMES];
extern char *Departure_location_names[MAX_ARRIVAL_NAMES];
extern char *Departure_location_names[MAX_DEPARTURE_NAMES];
extern char *Goal_type_names[MAX_GOAL_TYPE_NAMES];
extern char *Species_names[MAX_SPECIES_NAMES];
extern char *Reinforcement_type_names[];
extern char *Object_flags[];
extern char *Parse_object_flags[];
extern char *Parse_object_flags_2[];
extern char *Icon_names[];
extern char *Cargo_names[MAX_CARGO];
@@ -361,6 +464,7 @@ typedef struct subsys_status {
char name[NAME_LENGTH];
float percent; // percent damaged
int primary_banks[MAX_PRIMARY_BANKS];
int primary_ammo[MAX_PRIMARY_BANKS];
int secondary_banks[MAX_SECONDARY_BANKS];
int secondary_ammo[MAX_SECONDARY_BANKS];
int ai_class;
@@ -405,6 +509,7 @@ typedef struct p_object {
int determination;
int wingnum; // set to -1 if not in a wing -- Wing array index otherwise
int flags; // mission savable flags
int flags2; // Goober5000
int escort_priority; // priority in escort list
int ai_class;
int hotkey; // hotkey number (between 0 and 9) -1 means no hotkey
@@ -426,13 +531,17 @@ typedef struct p_object {
int respawn_priority; // priority this ship has for controlling respawn points
char alt_type_index; // optional alt type index
// Goober5000
int num_texture_replacements;
texture_replace replacement_textures[MAX_MODEL_TEXTURES]; // replacement textures - Goober5000
} p_object;
// defines for flags used for p_objects when they are created. Used to help create
// special circumstances for those ships. The order that these bitfields appear
// in this list MUST match the order that they appear in the flags array in MissionParse.cpp!!!!
// defines for flags used for p_objects when they are created. Used to help create special
// circumstances for those ships. This list of bitfield indicators MUST correspond EXACTLY
// (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!!
#define MAX_PARSE_OBJECT_FLAGS 20
#define MAX_PARSE_OBJECT_FLAGS 22
#define P_OF_CARGO_KNOWN (1<<0)
#define P_SF_IGNORE_COUNT (1<<1)
@@ -451,18 +560,41 @@ typedef struct p_object {
#define P_AIF_KAMIKAZE (1<<14)
#define P_AIF_NO_DYNAMIC (1<<15)
#define P_SF_RED_ALERT_STORE_STATUS (1<<16)
#define P_OF_BEAM_PROTECTED (1<<17)
#define P_OF_BEAM_PROTECTED (1<<17)
#define P_SF_GUARDIAN (1<<18)
#define P_KNOSSOS_WARP_IN (1<<19)
// these flags do not appear in the array; we may want to add them
// in the future though
#define P_OF_NO_LASERS (1<<20)
#define P_OF_NO_ENGINES (1<<21)
#define P_SF_VAPORIZE (1<<22)
#define P_SF2_STEALTH (1<<23)
#define P_SF2_FRIENDLY_STEALTH_INVIS (1<<24)
#define P_SF2_DONT_COLLIDE_INVIS (1<<25)
// the following parse object flags are used internally by Freespace
#define P_SF_USE_UNIQUE_ORDERS (1<<26) // tells a newly created ship to use the default orders for that ship
#define P_SF_USE_UNIQUE_ORDERS (1<<26) // tells a newly created ship to use the default orders for that ship
#define P_SF_INITIALLY_DOCKED (1<<27) // is this parse object initially docked with something else
#define P_SF_CANNOT_ARRIVE (1<<28) // used to indicate that this ship's arrival cue will never be true
#define P_SF_WARP_BROKEN (1<<29) // warp engine should be broken for this ship
#define P_SF_WARP_NEVER (1<<30) // warp drive is destroyed
#define P_SF_PLAYER_START_VALID (1<<31) // this is a valid player start object
#define P_SF_PLAYER_START_VALID (1<<31) // this is a valid player start object
// more parse flags! -- Goober5000
// same caveat: This list of bitfield indicators MUST correspond EXACTLY
// (i.e., order and position must be the same) to its counterpart in MissionParse.cpp!!!!
#define MAX_PARSE_OBJECT_FLAGS_2 5
#define P2_SF2_PRIMITIVE_SENSORS (1<<0)
#define P2_SF2_NO_SUBSPACE_DRIVE (1<<1)
// and again: these flags do not appear in the array
//#define blah (1<<29)
//#define blah (1<<30)
//#define blah (1<<31)
extern p_object ship_arrival_list; // used by sexpression parser
@@ -534,7 +666,7 @@ int mission_parse_is_multi(char *filename, char *mission_name );
int mission_parse_get_multi_mission_info(char *filename);
// called externally from multiplayer code
void mission_do_departure(object *objp);
int mission_do_departure(object *objp);
// called externally from Freespace.cpp
void mission_parse_fixup_players(void);
@@ -548,8 +680,8 @@ void mission_parse_eval_stuff();
// function to set the ramaing time left in the mission
void mission_parse_set_end_time( int seconds );
// code to warp in a repair ship.
void mission_warp_in_support_ship( object *requester_objp );
// code to bring in a repair ship.
void mission_bring_in_support_ship( object *requester_objp );
int mission_is_support_ship_arriving( void );
void mission_add_to_arriving_support( object *requester_objp );
int mission_is_repair_scheduled( object *objp );
+12 -7
View File
@@ -9,14 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionTraining.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-23 01:47:17 $
* $Author: Goober5000 $
*
* Special code for training missions. Stuff like displaying training messages in
* the special training window, listing the training objectives, etc.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -1037,18 +1040,20 @@ void message_training_que(char *text, int timestamp, int length)
}
// check the training message que to see if we should play a new message yet or not.
// Goober5000: removed stipulation of instructor being present
void message_training_que_check()
{
int i, j, iship_num;
// get the instructor's ship.
iship_num = ship_name_lookup(NOX("instructor"));
if ( iship_num == -1 )
return;
// if ( iship_num == -1 ) // commented out by Goober5000
// return;
// if the instructor is dying or departing, do nothing
if (Ships[iship_num].flags & (SF_DYING | SF_DEPARTING))
return;
if ( iship_num != -1 ) // added by Goober5000
if (Ships[iship_num].flags & (SF_DYING | SF_DEPARTING))
return;
if (Training_failure)
return;
+7 -16
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionBrief.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-01-17 07:59:08 $
* $Author: Goober5000 $
*
* C module that contains code to display the mission briefing to the player
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -1535,18 +1538,6 @@ void brief_get_closeup_ship_modelnum(brief_icon *ci)
}
}
// cut any text off after (and including) '#' char
void brief_truncate_label(char *src)
{
char *pointer_to_last_char;
pointer_to_last_char = strstr(src, NOX("#"));
if ( pointer_to_last_char ) {
*pointer_to_last_char = 0;
}
}
// -------------------------------------------------------------------------------------
// brief_setup_closeup()
//
@@ -1606,7 +1597,7 @@ int brief_setup_closeup(brief_icon *bi)
strcpy(Closeup_icon->closeup_label,sip->name);
// cut any text off after (and including) '#' char
brief_truncate_label(Closeup_icon->closeup_label);
end_string_at_first_hash_symbol(Closeup_icon->closeup_label);
if ( sip->flags & (SIF_SMALL_SHIP|SIF_BIG_SHIP|SIF_HUGE_SHIP|SIF_SENTRYGUN) ) {
strcat(Closeup_icon->closeup_label, XSTR( " class", 434));
+32 -10
View File
@@ -9,13 +9,27 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionDebrief.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.6 $
* $Date: 2003-01-27 00:51:46 $
* $Author: DTP $
*
* C module for running the debriefing
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2003/01/14 04:00:16 Goober5000
* allowed for up to 256 main halls
* --Goober5000
*
* Revision 2.4 2003/01/08 19:49:15 Goober5000
* fixed debriefing music in non-campaign missions
* --Goober5000
*
* Revision 2.3 2002/12/09 08:37:31 Goober5000
* fixed misspelling
*
* Revision 2.2 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.1 2002/07/20 23:50:53 DTP
* Fixed multiplayer music. succes music on all Primary goals complete, fail music
* if otherwise
@@ -1382,7 +1396,7 @@ void debrief_traitor_init()
stuff_string(traitor_voice_file, F_FILESPEC, NULL);
// DKA 9/13/99 Only 1 traitor msg for FS2
// if ( Player->on_bastion ) {
// if ( Player->main_hall ) {
// strcpy(stagep->voice, NOX("3_"));
// } else {
// strcpy(stagep->voice, NOX("1_"));
@@ -2077,7 +2091,8 @@ void debrief_button_pressed(int num)
void debrief_setup_ship_kill_stats(int stage_num)
{
int i;
ushort *kill_arr;
//ushort *kill_arr;
int *kill_arr; //DTP max ships
debrief_stats_kill_info *kill_info;
Assert(Current_stage < DEBRIEF_NUM_STATS_PAGES);
@@ -2335,9 +2350,13 @@ void debrief_init()
common_music_init(SCORE_DEBRIEF_FAIL);
}
*/
/* 21-07-02 01:12 Commented out DTP, so we have the original source here
// Goober5000 - restored original source, because we can have multiplayer campaigns
// also, added flag (Game_mode & GM_CAMPAIGN_MODE) to check if in campaign
// /* 21-07-02 01:12 Commented out DTP, so we have the original source here
// start up the appropriate music
if (Campaign.next_mission == Campaign.current_mission) {
if ((Game_mode & GM_CAMPAIGN_MODE) && (Campaign.next_mission == Campaign.current_mission)) {
// you failed the mission because you suck, so you get the suck music
common_music_init(SCORE_DEBRIEF_FAIL);
} else if (mission_goals_met()) {
@@ -2348,15 +2367,16 @@ void debrief_init()
common_music_init(SCORE_DEBRIEF_AVERAGE);
}
if (Campaign.next_mission == Campaign.current_mission) {
if ((Game_mode & GM_CAMPAIGN_MODE) && (Campaign.next_mission == Campaign.current_mission)) {
// better luck next time, increase his retries
Player->failures_this_session++;
} else {
// clear his retries info regardless of whether or not he accepts
Player->failures_this_session = 0;
}
*/ //commented out stop
// 21-07-02 01:12 DTP; New checks for setting debreifing music. at lot like the old.
// */ //commented out stop
/* // 21-07-02 01:12 DTP; New checks for setting debriefing music. at lot like the old.
// this is for single player
if (Campaign.next_mission == Campaign.current_mission && (Game_mode & GM_NORMAL)) { //DTP
common_music_init(SCORE_DEBRIEF_FAIL); //DTP
@@ -2387,6 +2407,8 @@ void debrief_init()
}
}
*/
#ifndef NO_NETWORK
if (Game_mode & GM_MULTIPLAYER) {
multi_debrief_init();
+20 -9
View File
@@ -9,13 +9,19 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionShipChoice.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.3 $
* $Date: 2003-02-25 06:22:48 $
* $Author: bobboau $
*
* C module to allow player ship selection for the mission
*
* $Log: not supported by cvs2svn $
* Revision 2.2 2002/12/15 06:50:49 DTP
* FIX; player can now have all ships set in FRED2 as allowed playerships in singleplayer
*
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -579,7 +585,8 @@ typedef struct ss_active_item
} ss_active_item;
static ss_active_item SS_active_head;
static ss_active_item SS_active_items[MAX_WSS_SLOTS];
//static ss_active_item SS_active_items[MAX_WSS_SLOTS];//DTP commented out or else singleplayer will only have a max of 12 ships
static ss_active_item SS_active_items[MAX_SHIP_TYPES];//DTP, now we have all ships in the TBL, as they can all be playerships
static int SS_active_list_start;
static int SS_active_list_size;
@@ -793,7 +800,8 @@ void ss_set_carried_icon(int from_slot, int ship_class)
void clear_active_list()
{
int i;
for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) { //DTP singleplayer ship choice fix
//for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
SS_active_items[i].flags = 0;
SS_active_items[i].ship_class = -1;
}
@@ -803,12 +811,14 @@ void clear_active_list()
SS_active_list_size = 0;
}
// get a free element from SS_active_items[]
ss_active_item *get_free_active_list_node()
{
int i;
for ( i = 0; i < MAX_WSS_SLOTS; i++ ) {
if ( SS_active_items[i].flags == 0 ) {
for ( i = 0; i < MAX_SHIP_TYPES; i++ ) {
//for ( i = 0; i < MAX_WSS_SLOTS; i++ ) { //DTP, ONLY 12 SHIPS ???, as MAX_WSS_SLOTS will be 12.
if ( SS_active_items[i].flags == 0 ) {
SS_active_items[i].flags |= SS_ACTIVE_ITEM_USED;
return &SS_active_items[i];
}
@@ -816,6 +826,7 @@ ss_active_item *get_free_active_list_node()
return NULL;
}
// add a ship into the active list
void active_list_add(int ship_class)
{
@@ -3278,7 +3289,7 @@ int ss_grab_from_list(int from_list, int to_slot, int *sound)
// take weapons from list->slot
wl_get_default_weapons(from_list, to_slot, wep, wep_count);
wl_remove_weps_from_pool(wep, wep_count, slot->ship_class);
wl_remove_weps_from_pool(wep, wep_count, slot->ship_class, to_slot);
for ( i = 0; i < MAX_WL_WEAPONS; i++ ) {
slot->wep[i] = wep[i];
slot->wep_count[i] = wep_count[i];
@@ -3321,7 +3332,7 @@ int ss_swap_list_slot(int from_list, int to_slot, int *sound)
// take weapons from list->slot
wl_get_default_weapons(from_list, to_slot, wep, wep_count);
wl_remove_weps_from_pool(wep, wep_count, slot->ship_class);
wl_remove_weps_from_pool(wep, wep_count, slot->ship_class, to_slot);
for ( i = 0; i < MAX_WL_WEAPONS; i++ ) {
slot->wep[i] = wep[i];
slot->wep_count[i] = wep_count[i];
+167 -42
View File
@@ -9,13 +9,30 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionWeaponChoice.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.7 $
* $Date: 2003-02-25 06:22:48 $
* $Author: bobboau $
*
* C module for the weapon loadout screen
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2003/01/15 21:29:05 anonymous
* fixed the demo compilation. Define FS2_DEMO globally to compile as a demo. Make sure warp.pof is in your data/models directory.
*
* Revision 2.5 2002/12/31 18:59:43 Goober5000
* if it ain't broke, don't fix it
* --Goober5000
*
* Revision 2.3 2002/12/13 08:13:28 Goober5000
* small tweaks and bug fixes for the ballistic primary conversion
* ~Goober5000~
*
* Revision 2.2 2002/12/10 05:43:33 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -1226,7 +1243,7 @@ int weapon_allowed_for_game_type(int weapon_flags)
{
int rval = 0;
#ifndef NO_NETWORK
#if !defined NO_NETWORK && !defined FS2_DEMO
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.type_flags & NG_TYPE_DOGFIGHT)) {
if (weapon_flags & (1 << 1))
rval = 1;
@@ -1254,10 +1271,25 @@ void wl_set_disabled_weapons(int ship_class)
sip = &Ship_info[ship_class];
for ( i = 0; i < MAX_WEAPON_TYPES; i++ ) {
for ( i = 0; i < MAX_WEAPON_TYPES; i++ )
{
// Determine whether weapon #i is allowed on this ship class in the current type of mission.
// As of 9/6/99, the only difference is dogfight missions have a different list of legal weapons.
Wl_icons[i].can_use = weapon_allowed_for_game_type(sip->allowed_weapons[i]);
for ( int k = 0; k < MAX_SECONDARY_BANKS; k++ ){//bank specific loadouts-Bobboau
Wl_icons[i].can_use = weapon_allowed_for_game_type(sip->allowed_weapons[i][k]);
// Goober5000: ballistic primaries
if (Weapon_info[i].wi_flags2 & WIF2_BALLISTIC)
{
// not allowed if this ship is not ballistic
if (!(sip->flags & SIF_BALLISTIC_PRIMARIES))
{
Wl_icons[i].can_use = 0;
}
}
if(Wl_icons[i].can_use != 0)break;
}
}
}
@@ -1680,7 +1712,7 @@ void wl_start_slot_animation(int n)
// should prolly scrub out the 1e06 lines of dead code this leaves
return;
/*
/*
int ship_class;
wl_ship_class_info *wl_ship;
@@ -1742,6 +1774,20 @@ void wl_set_selected_slot(int slot_num)
}
}
// determine how many ballistics of type 'wi_index' will fit into capacity - Goober5000
int wl_calc_ballistic_fit(int wi_index, int capacity)
{
if ( wi_index < 0 ) {
return 0;
}
Assert(Weapon_info[wi_index].subtype == WP_LASER);
Assert(Weapon_info[wi_index].wi_flags2 & WIF2_BALLISTIC);
return fl2i( capacity / Weapon_info[wi_index].cargo_size + 0.5f );
}
// determine how many missiles of type 'wi_index' will fit into capacity
int wl_calc_missile_fit(int wi_index, int capacity)
{
@@ -1768,12 +1814,14 @@ void wl_get_ship_class_weapons(int ship_class, int *wep, int *wep_count)
wep_count[i] = -1; // -1 means weapon bank doesn't exist.. 0 just means it is empty
}
for ( i = 0; i < sip->num_primary_banks; i++ ) {
for ( i = 0; i < sip->num_primary_banks; i++ )
{
wep[i] = sip->primary_bank_weapons[i];
wep_count[i] = 1;
}
for ( i = 0; i < sip->num_secondary_banks; i++ ) {
for ( i = 0; i < sip->num_secondary_banks; i++ )
{
wep[i+MAX_WL_PRIMARY] = sip->secondary_bank_weapons[i];
wep_count[i+MAX_WL_PRIMARY] = wl_calc_missile_fit(sip->secondary_bank_weapons[i], sip->secondary_bank_ammo_capacity[i]);
}
@@ -1792,17 +1840,21 @@ void wl_get_ship_weapons(int ship_index, int *wep, int *wep_count)
wp = &Wings[Ships[ship_index].wingnum];
swp = &Ships[ship_index].weapons;
for ( i = 0; i < swp->num_primary_banks; i++ ) {
for ( i = 0; i < swp->num_primary_banks; i++ )
{
wep[i] = swp->primary_bank_weapons[i];
wep_count[i] = 1;
if ( wep[i] == -1 ) {
wep_count[i] = 0;
}
}
for ( i = 0; i < swp->num_secondary_banks; i++ ) {
for ( i = 0; i < swp->num_secondary_banks; i++ )
{
wep[i+MAX_WL_PRIMARY] = swp->secondary_bank_weapons[i];
wep_count[i+MAX_WL_PRIMARY] = swp->secondary_bank_ammo[i];
if ( wep[i+MAX_WL_PRIMARY] == -1 ) {
wep_count[i+MAX_WL_PRIMARY] = 0;
}
@@ -1840,15 +1892,17 @@ void wl_get_parseobj_weapons(int sa_index, int ship_class, int *wep, int *wep_co
}
// ammo counts could still be modified
for ( i=0; i < MAX_SECONDARY_BANKS; i++ ) {
if ( wep[i+MAX_WL_PRIMARY] >= 0 ) {
for ( i=0; i < MAX_SECONDARY_BANKS; i++ )
{
if ( wep[i+MAX_WL_PRIMARY] >= 0 )
{
wep_count[i+MAX_WL_PRIMARY] = wl_calc_missile_fit(wep[i+MAX_WL_PRIMARY], fl2i(ss->secondary_ammo[i]/100.0f * sip->secondary_bank_ammo_capacity[i] + 0.5f));
}
}
}
// ensure that there aren't any bogus weapons assigned by default
void wl_cull_illegal_weapons(int ship_class, int *wep, int *wep_count)
void wl_cull_illegal_weapons(int ship_class, int *wep, int *wep_count, int bank)
{
int i;
for ( i=0; i < MAX_WL_WEAPONS; i++ ) {
@@ -1856,7 +1910,7 @@ void wl_cull_illegal_weapons(int ship_class, int *wep, int *wep_count)
continue;
}
if ( !weapon_allowed_for_game_type(Ship_info[ship_class].allowed_weapons[wep[i]]) ) {
if ( !weapon_allowed_for_game_type(Ship_info[ship_class].allowed_weapons[wep[i]][bank]) ) {
// wep[i] = -1;
wep_count[i] = 0;
}
@@ -1903,7 +1957,7 @@ void wl_get_default_weapons(int ship_class, int slot_num, int *wep, int *wep_cou
}
// ensure that there aren't any bogus weapons assigned by default
wl_cull_illegal_weapons(ship_class, wep, wep_count);
wl_cull_illegal_weapons(ship_class, wep, wep_count, slot_num);
}
// function to add a weapon_class to ui lists
@@ -1931,8 +1985,8 @@ void wl_add_index_to_list(int wi_index)
}
}
// remove the weapons specificed by wep[] and wep_count[] from Wl_pool[].
void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class)
// remove the weapons specified by wep[] and wep_count[] from Wl_pool[].
void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class, int bank)
{
int i, wi_index;
@@ -1963,7 +2017,7 @@ void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class)
continue;
}
if ( !weapon_allowed_for_game_type(Ship_info[ship_class].allowed_weapons[wep_pool_index]) ) {
if ( !weapon_allowed_for_game_type(Ship_info[ship_class].allowed_weapons[wep_pool_index][bank]) ) {
continue;
}
@@ -1987,7 +2041,8 @@ void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class)
}
int new_wep_count = wep_count[i];
if ( Weapon_info[wi_index].subtype == WP_MISSILE ) {
if ( Weapon_info[wi_index].subtype == WP_MISSILE )
{
int secondary_bank_index;
secondary_bank_index = i-3;
if ( secondary_bank_index < 0 ) {
@@ -2024,7 +2079,7 @@ void wl_fill_slots()
// get the weapons info that should be on ship by default
wl_get_default_weapons(Wss_slots[i].ship_class, i, wep, wep_count);
wl_remove_weps_from_pool(wep, wep_count, Wss_slots[i].ship_class);
wl_remove_weps_from_pool(wep, wep_count, Wss_slots[i].ship_class, i);
// copy to Wss_slots[]
for ( j = 0; j < MAX_WL_WEAPONS; j++ ) {
@@ -2933,20 +2988,24 @@ void weapon_select_do(float frametime)
}
// check so see if this is really a legal weapon to carry away
if ( !Wl_icons[Carried_wl_icon.weapon_class].can_use ) {
if ( !Wl_icons[Carried_wl_icon.weapon_class].can_use )
{
int diffx, diffy;
diffx = abs(Carried_wl_icon.from_x-mx);
diffy = abs(Carried_wl_icon.from_y-my);
if ( (diffx > 2) || (diffy > 2) ) {
int ship_class = Wss_slots[Selected_wl_slot].ship_class;
wl_pause_anim();
if (Lcl_gr) {
if (Lcl_gr)
{
// might have to get weapon name translation
char display_name[128];
strncpy(display_name, Weapon_info[Carried_wl_icon.weapon_class].name, 128);
lcl_translate_wep_name(display_name);
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "A %s is unable to carry %s weaponry", 633), Ship_info[ship_class].name, display_name);
} else {
}
else
{
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR( "A %s is unable to carry %s weaponry", 633), Ship_info[ship_class].name, Weapon_info[Carried_wl_icon.weapon_class].name);
}
wl_unpause_anim();
@@ -3155,9 +3214,10 @@ void wl_draw_ship_weapons(int index)
continue;
}
if ( (wep[i] != -1) && (wep_count[i] > 0) ) {
if ( (wep[i] != -1) && (wep_count[i] > 0) )
{
int x_offset = wl_fury_missile_offset_hack(wep[i], wep_count[i]);
x_offset =0;
x_offset = 0;
wl_render_icon( wep[i], Wl_bank_coords[gr_screen.res][i][0]+x_offset, Wl_bank_coords[gr_screen.res][i][1], wep_count[i], Wl_bank_count_draw_flags[i], -1, i, wep[i]);
}
}
@@ -3370,21 +3430,41 @@ void wl_update_parse_object_weapons(p_object *pobjp, wss_unit *slot)
}
j = 0;
for ( i = 0; i < MAX_WL_PRIMARY; i++ ) {
if ( (slot->wep_count[i] > 0) && (slot->wep[i] >= 0) ) {
for ( i = 0; i < MAX_WL_PRIMARY; i++ )
{
if ( (slot->wep_count[i] > 0) && (slot->wep[i] >= 0) )
{
ss->primary_banks[j] = slot->wep[i];
// ballistic primaries - Goober5000
if (Weapon_info[slot->wep[i]].wi_flags2 & WIF2_BALLISTIC)
{
// Important: the primary_ammo[] value is a percentage of max capacity!
// which means that it's always 100%, since ballistic primaries are completely
// full upon launch - Goober5000
ss->primary_ammo[j] = 100;
}
else
{
ss->primary_ammo[j] = 0;
}
j++;
}
}
j = 0;
for ( i = 0; i < MAX_WL_SECONDARY; i++ ) {
for ( i = 0; i < MAX_WL_SECONDARY; i++ )
{
sidx = i+MAX_WL_PRIMARY;
if ( (slot->wep_count[sidx] > 0) && (slot->wep[sidx] >= 0) ) {
if ( (slot->wep_count[sidx] > 0) && (slot->wep[sidx] >= 0) )
{
ss->secondary_banks[j] = slot->wep[sidx];
// Important: the secondary_ammo[] value is a percentage of max capacity!
max_count = wl_calc_missile_fit(slot->wep[sidx], Ship_info[slot->ship_class].secondary_bank_ammo_capacity[j]);
ss->secondary_ammo[j] = fl2i( i2fl(slot->wep_count[sidx]) / max_count * 100.0f + 0.5f);
j++;
}
}
@@ -3498,7 +3578,21 @@ void wl_bash_ship_weapons(ship_weapon *swp, wss_unit *slot)
j = 0;
for ( i = 0; i < MAX_WL_PRIMARY; i++ ) {
if ( (slot->wep_count[i] > 0) && (slot->wep[i] >= 0) ) {
swp->primary_bank_weapons[j] = slot->wep[i];
swp->primary_bank_weapons[j] = slot->wep[i];
// ballistic primaries - Goober5000
if (Weapon_info[swp->primary_bank_weapons[j]].wi_flags2 & WIF2_BALLISTIC)
{
// this is a bit tricky: we must recalculate ammo for full capacity
// since wep_count for primaries does not store the ammo; ballistic
// primaries always come with a full magazine
swp->primary_bank_ammo[j] = wl_calc_ballistic_fit(swp->primary_bank_weapons[j], Ship_info[slot->ship_class].primary_bank_ammo_capacity[i]);
}
else
{
swp->primary_bank_ammo[j] = 0;
}
j++;
}
}
@@ -3588,6 +3682,17 @@ int wl_swap_slot_slot(int from_bank, int to_bank, int ship_slot, int *sound)
return 0;
}
//ensure that the two banks are both compatable types-Bobboau
if(!weapon_allowed_for_game_type(Ship_info[slot->ship_class].allowed_weapons[Carried_wl_icon.weapon_class][to_bank])){
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "A %s can not carry %s weaponry in bank %d", Ship_info[slot->ship_class].name, Weapon_info[Carried_wl_icon.weapon_class].name, to_bank+1);
return 0;
}
if(!weapon_allowed_for_game_type(Ship_info[slot->ship_class].allowed_weapons[slot->wep[to_bank]][from_bank])){
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "A %s can not carry %s weaponry in bank %d", Ship_info[slot->ship_class].name, Weapon_info[Carried_wl_icon.weapon_class].name, from_bank+1);
return 0;
}
//Warning(LOCATION,"slot slot");
// ensure that the banks are both of the same class
if ( (IS_BANK_PRIMARY(from_bank) && IS_BANK_SECONDARY(to_bank)) || (IS_BANK_SECONDARY(from_bank) && IS_BANK_PRIMARY(to_bank)) ) {
// put from_bank back into list
@@ -3598,16 +3703,17 @@ int wl_swap_slot_slot(int from_bank, int to_bank, int ship_slot, int *sound)
return 1;
}
// case 1: primaries (easy)
if ( IS_BANK_PRIMARY(from_bank) && IS_BANK_PRIMARY(to_bank) ) {
// case 1: primaries (easy, even with ballistics, because ammo is always maximized)
if ( IS_BANK_PRIMARY(from_bank) && IS_BANK_PRIMARY(to_bank) )
{
wl_swap_weapons(ship_slot, from_bank, to_bank);
*sound=SND_ICON_DROP_ON_WING;
return 1;
}
// case 2: secondaries (harder)
if ( IS_BANK_SECONDARY(from_bank) && IS_BANK_SECONDARY(to_bank) ) {
if ( IS_BANK_SECONDARY(from_bank) && IS_BANK_SECONDARY(to_bank) )
{
// case 2a: secondaries are the same type
if ( slot->wep[from_bank] == slot->wep[to_bank] ) {
int dest_max, dest_can_fit, source_can_give;
@@ -3634,8 +3740,8 @@ int wl_swap_slot_slot(int from_bank, int to_bank, int ship_slot, int *sound)
}
// case 2b: secondaries are different types
if ( slot->wep[from_bank] != slot->wep[to_bank] ) {
if ( slot->wep[from_bank] != slot->wep[to_bank] )
{
// swap 'em
wl_swap_weapons(ship_slot, from_bank, to_bank);
@@ -3683,7 +3789,8 @@ int wl_grab_from_list(int from_list, int to_bank, int ship_slot, int *sound)
int max_fit;
// ensure that the banks are both of the same class
if ( (IS_LIST_PRIMARY(from_list) && IS_BANK_SECONDARY(to_bank)) || (IS_LIST_SECONDARY(from_list) && IS_BANK_PRIMARY(to_bank)) ) {
if ( (IS_LIST_PRIMARY(from_list) && IS_BANK_SECONDARY(to_bank)) || (IS_LIST_SECONDARY(from_list) && IS_BANK_PRIMARY(to_bank)) )
{
// do nothing
*sound=SND_ICON_DROP;
return 0;
@@ -3704,10 +3811,19 @@ int wl_grab_from_list(int from_list, int to_bank, int ship_slot, int *sound)
return 0;
}
//ensure that this bank can have this weapon-Bobboau
if(!weapon_allowed_for_game_type(Ship_info[slot->ship_class].allowed_weapons[Carried_wl_icon.weapon_class][to_bank])){
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "A %s can not carry %s weaponry in bank %d", Ship_info[slot->ship_class].name, Weapon_info[Carried_wl_icon.weapon_class].name, to_bank+1);
return 0;
}
//Warning(LOCATION,"list");
// find how much dest bank can fit
if ( to_bank < MAX_WL_PRIMARY ) {
if ( to_bank < MAX_WL_PRIMARY )
{
max_fit = 1;
} else {
}
else
{
max_fit = wl_calc_missile_fit(from_list, Ship_info[slot->ship_class].secondary_bank_ammo_capacity[to_bank-MAX_WL_PRIMARY]);
}
@@ -3755,6 +3871,12 @@ int wl_swap_list_slot(int from_list, int to_bank, int ship_slot, int *sound)
return 0;
}
//ensure that this bank can have this weapon-Bobboau
if(!weapon_allowed_for_game_type(Ship_info[slot->ship_class].allowed_weapons[Carried_wl_icon.weapon_class][to_bank])){
popup(PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, "A %s can not carry %s weaponry in bank %d", Ship_info[slot->ship_class].name, Weapon_info[Carried_wl_icon.weapon_class].name, to_bank+1);
return 0;
}
//Warning(LOCATION,"list slot");
// dump slot weapon back into list
Wl_pool[slot->wep[to_bank]] += slot->wep_count[to_bank];
slot->wep_count[to_bank] = 0;
@@ -3763,9 +3885,12 @@ int wl_swap_list_slot(int from_list, int to_bank, int ship_slot, int *sound)
// put weapon on ship from list
// find how much dest bank can fit
if ( to_bank < MAX_WL_PRIMARY ) {
if ( to_bank < MAX_WL_PRIMARY )
{
max_fit = 1;
} else {
}
else
{
max_fit = wl_calc_missile_fit(from_list, Ship_info[slot->ship_class].secondary_bank_ammo_capacity[to_bank-MAX_WL_PRIMARY]);
}
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionWeaponChoice.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2003-02-25 06:22:49 $
* $Author: bobboau $
*
* Header file for the weapon loadout screen
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -171,7 +174,7 @@ void wl_reset_to_defaults();
// Set selected slot to first placed ship
void wl_reset_selected_slot();
void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class);
void wl_remove_weps_from_pool(int *wep, int *wep_count, int ship_class, int bank);
void wl_get_ship_class_weapons(int ship_class, int *wep, int *wep_count);
void wl_get_default_weapons(int ship_class, int slot_num, int *wep, int *wep_count);
+54 -14
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/MissionUI/RedAlert.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-10 05:43:33 $
* $Author: Goober5000 $
*
* Module for Red Alert mission interface and code
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -545,16 +548,34 @@ void red_alert_set_status(int status)
void red_alert_store_weapons(red_alert_ship_status *ras, ship_weapon *swp)
{
int i, sidx;
weapon_info *wip;
if (swp == NULL) {
return;
}
for ( i = 0; i < MAX_WL_PRIMARY; i++ ) {
// edited to accommodate ballistics - Goober5000
for ( i = 0; i < MAX_WL_PRIMARY; i++ )
{
wip = &Weapon_info[swp->primary_bank_weapons[i]];
ras->wep[i] = swp->primary_bank_weapons[i];
if ( ras->wep[i] >= 0 ) {
ras->wep_count[i] = 1;
} else {
if ( ras->wep[i] >= 0 )
{
if (wip->wi_flags2 & WIF2_BALLISTIC)
{
// to avoid triggering the below condition: this way, minimum ammo will be 2...
// since the red-alert representation of a conventional primary is 0 -> not used,
// 1 -> used, I added the representation 2 and above -> ballistic primary
ras->wep_count[i] = swp->primary_bank_ammo[i] + 2;
}
else
{
ras->wep_count[i] = 1;
}
}
else
{
ras->wep_count[i] = -1;
}
}
@@ -562,9 +583,12 @@ void red_alert_store_weapons(red_alert_ship_status *ras, ship_weapon *swp)
for ( i = 0; i < MAX_WL_SECONDARY; i++ ) {
sidx = i+MAX_WL_PRIMARY;
ras->wep[sidx] = swp->secondary_bank_weapons[i];
if ( ras->wep[sidx] >= 0 ) {
if ( ras->wep[sidx] >= 0 )
{
ras->wep_count[sidx] = swp->secondary_bank_ammo[i];
} else {
}
else
{
ras->wep_count[sidx] = -1;
}
}
@@ -580,19 +604,35 @@ void red_alert_bash_weapons(red_alert_ship_status *ras, ship_weapon *swp)
return;
}
// modified to accommodate ballistics - Goober5000
j = 0;
for ( i = 0; i < MAX_WL_PRIMARY; i++ ) {
if ( (ras->wep_count[i] > 0) && (ras->wep[i] >= 0) ) {
swp->primary_bank_weapons[j] = ras->wep[i];
for ( i = 0; i < MAX_WL_PRIMARY; i++ )
{
if ( (ras->wep_count[i] > 0) && (ras->wep[i] >= 0) )
{
swp->primary_bank_weapons[j] = ras->wep[i];
if (ras->wep_count[i] > 1) // this is a ballistic primary (!!!)
{
swp->primary_bank_ammo[j] = ras->wep_count[i] - 2; // to compensate for storage
}
else
{
swp->primary_bank_ammo[i] = 0;
}
j++;
}
}
swp->num_primary_banks = j;
j = 0;
for ( i = 0; i < MAX_WL_SECONDARY; i++ ) {
for ( i = 0; i < MAX_WL_SECONDARY; i++ )
{
sidx = i+MAX_WL_PRIMARY;
if ( ras->wep[sidx] >= 0 ) {
if ( ras->wep[sidx] >= 0 )
{
swp->secondary_bank_weapons[j] = ras->wep[sidx];
swp->secondary_bank_ammo[j] = ras->wep_count[sidx];
j++;
+133 -18
View File
@@ -9,13 +9,78 @@
/*
* $Logfile: /Freespace2/code/Model/MODEL.H $
* $Revision: 2.5 $
* $Date: 2002-10-19 19:29:27 $
* $Revision: 2.20 $
* $Date: 2003-01-20 05:40:49 $
* $Author: bobboau $
*
* header file for information about polygon models
*
* $Log: not supported by cvs2svn $
* Revision 2.19 2003/01/19 06:44:39 Goober5000
* got rid of nameplate stuff (superceded by texture replacement)
* --Goober5000
*
* Revision 2.18 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.17 2003/01/17 04:57:17 Goober5000
* Allowed selection of either $Texture Replace, which keeps track of individual
* replacement textures for a ship, or $Duplicate Model Texture Replace, which
* duplicates a model and reskins it. Use $Duplicate Model Texture Replace
* if you want to substitute an animated texture or a transparent texture.
* --Goober5000
*
* Revision 2.16 2003/01/17 01:48:49 Goober5000
* added capability to the $Texture replace code to substitute the textures
* without needing and extra model, however, this way you can't substitute
* transparent or animated textures
* --Goober5000
*
* Revision 2.15 2003/01/16 06:49:11 Goober5000
* yay! got texture replacement to work!!!
* --Goober5000
*
* Revision 2.14 2003/01/15 08:57:23 Goober5000
* assigning duplicate models to ships now works; committing so I have a base
* to fall back to as I work on texture replacement
* --Goober5000
*
* Revision 2.13 2003/01/15 05:18:13 Goober5000
* moved texture loading around a bit; added Texture_replace in preparation
* for some cool stuff
* --Goober5000
*
* Revision 2.12 2003/01/06 19:33:22 Goober5000
* cleaned up some stuff with model_set_thrust and a commented Assert that
* shouldn't have been
* --Goober5000
*
* Revision 2.11 2002/12/10 05:43:34 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Revision 2.10 2002/12/07 01:37:42 bobboau
* inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
* collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
* it needs a better renderer, but is in prety good shape for now,
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.9 2002/12/04 09:44:34 DTP
* lowered MAX_POLYGON_MODELS FROM 198 to 128 for safety reasons since we bumped back MAX_SHIP_TYPES to 130
*
* Revision 2.8 2002/12/02 23:55:31 Goober5000
* fixed misspelling
*
* Revision 2.7 2002/12/02 23:14:17 Goober5000
* fixed misspelling of "category" as "catagory"
*
* Revision 2.6 2002/11/14 04:18:16 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.5 2002/10/19 19:29:27 bobboau
* inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry
*
* Revision 2.4 2002/08/01 01:41:07 penguin
* The big include file move
*
@@ -288,13 +353,14 @@
#define _MODEL_H
#include "globalincs/pstypes.h"
#include "decals/decals.h"
#include "parse/parselo.h" // for NAME_LENGTH
struct object;
#define MAX_PRIMARY_BANKS 3
#define MAX_SECONDARY_BANKS 4 // Lowered from 5 to 4 by MK on 3/25/98. This needs to be <= MAX_WL_SECONDARY or you'll get stack overwrites.
#define MAX_POLYGON_MODELS 198 //DTP bumped from 128 to 198 MAX_SHIP_TYPES - 2 = 198
#define MAX_POLYGON_MODELS 128 //DTP reset from 198 to original value of 128
#define MAX_DEBRIS_OBJECTS 32
#define MAX_MODEL_TEXTURES 64
#define FILENAME_LEN 64
@@ -376,11 +442,17 @@ typedef struct stepped_rotation {
} stepped_rotation_t;
typedef struct ai_rotation {
void *p_rotation;
int type;
float dist;
float speed;
} ai_rotation_t;
// void *p_rotation;
uint type; //flags for what animation type
float max;
float min;
int time;
} ai_rotation;
#define MSS_AI_DOCK (1<<0) //model that animates when docking
#define MSS_AI_ENGINE (1<<1) //model that animates baised on wich direction you're turning
#define MSS_AI_GUN (1<<2) //model that animates when you're fireing
// definition for model subsystems.
typedef struct model_subsystem { /* contains rotation rate info */
@@ -412,13 +484,14 @@ typedef struct model_subsystem { /* contains rotation rate info */
// Rotation specific info
float turn_rate; // The turning rate of this subobject, if MSS_FLAG_ROTATES is set.
stepped_rotation_t *stepped_rotation; // turn rotation struct
ai_rotation_t *ai_rotation; // ai controlled rotation struct
ai_rotation ai_rotation; // ai controlled rotation struct
// AWACS specific information
float awacs_intensity; // awacs intensity of this subsystem
float awacs_radius; // radius of effect of the AWACS
int primary_banks[MAX_PRIMARY_BANKS]; // default primary weapons -hoffoss
int primary_bank_capacity[MAX_PRIMARY_BANKS]; // capacity of a bank - Goober5000
int secondary_banks[MAX_SECONDARY_BANKS]; // default secondary weapons -hoffoss
int secondary_bank_capacity[MAX_SECONDARY_BANKS]; // capacity of a bank -hoffoss
int path_num; // path index into polymodel .paths array. -2 if none exists, -1 if not defined
@@ -484,6 +557,7 @@ typedef struct bsp_info {
int num_arcs; // See model_add_arc for more info
vector arc_pts[MAX_ARC_EFFECTS][2];
ubyte arc_type[MAX_ARC_EFFECTS]; // see MARC_TYPE_* defines
} bsp_info;
@@ -547,6 +621,7 @@ typedef struct glow_bank { // glow bank struckture -Bobboau
int off_time;
int disp_time;
int is_on;
int is_active;
int submodel_parent;
int LOD;
int num_slots;
@@ -554,6 +629,7 @@ typedef struct glow_bank { // glow bank struckture -Bobboau
vector norm[MAX_THRUSTER_SLOTS];
float radius[MAX_THRUSTER_SLOTS];
int glow_bitmap;
int glow_neb_bitmap;
} glow_bank;
// defines for docking bay things. The types are essentially flags since docking bays can probably
@@ -622,7 +698,7 @@ typedef struct bsp_light {
float value; // How much to light up this light. 0-1.
} bsp_light;
// model_octant - There are 8 of these per model. They are a handy way to catagorize
// model_octant - There are 8 of these per model. They are a handy way to categorize
// a lot of model properties to get some easy 8x optimizations for model stuff.
typedef struct model_octant {
vector min, max; // The bounding box that makes up this octant defined as 2 points.
@@ -656,7 +732,8 @@ typedef struct insignia {
float u[MAX_INS_FACES][MAX_INS_FACE_VECS]; // u tex coords on a per-face-per-vertex basis
float v[MAX_INS_FACES][MAX_INS_FACE_VECS]; // v tex coords on a per-face-per-vertex bases
vector vecs[MAX_INS_VECS]; // vertex list
vector offset; // global position offset for this insignia
vector offset; // global position offset for this insignia
vector norm[MAX_INS_VECS] ; //normal of the insignia-Bobboau
} insignia;
#define PM_FLAG_ALLOW_TILING (1<<0) // Allow texture tiling
@@ -693,13 +770,19 @@ typedef struct polymodel {
int n_textures;
int original_textures[MAX_MODEL_TEXTURES]; // what gets read in from file
int textures[MAX_MODEL_TEXTURES]; // what textures you draw with. reset to original_textures by model_set_instance
int numframes[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int num_frames[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int fps[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int is_ani[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int glow_original_textures[MAX_MODEL_TEXTURES]; // what gets read in from file
int glow_textures[MAX_MODEL_TEXTURES]; // what textures you draw with. reset to original_textures by model_set_instance
int glow_numframes[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int glow_fps[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int glow_is_ani[MAX_MODEL_TEXTURES]; // flag for weather this texture is an ani-Bobboau
int ambient[MAX_MODEL_TEXTURES]; // ambient light-Bobboau
int transparent[MAX_MODEL_TEXTURES]; // flag this texture as being a transparent blend-Bobboau
vector autocenter; // valid only if PM_FLAG_AUTOCEN is set
bsp_info *submodel; // an array of size n_models of submodel info.
@@ -748,6 +831,19 @@ typedef struct polymodel {
} polymodel;
// texture replacement info - Goober5000
#define TEXTURE_NAME_LENGTH 128
#define MAX_TEXTURE_REPLACEMENTS 50
typedef struct texture_replace {
char ship_name[NAME_LENGTH];
char old_texture[TEXTURE_NAME_LENGTH];
char new_texture[TEXTURE_NAME_LENGTH];
int new_texture_id;
} texture_replace;
extern int Num_texture_replacements;
extern texture_replace Texture_replace[MAX_TEXTURE_REPLACEMENTS];
// Call once to initialize the model system
void model_init();
@@ -759,7 +855,13 @@ void model_level_post_init();
void model_free_all();
// Loads a model from disk and returns the model number it loaded into.
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems);
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror = 1, int duplicate = 0);
// Goober5000
void model_load_texture(polymodel *pm, int i, char *file);
// Goober5000
void model_duplicate_reskin(int modelnum, char *ship_name);
// notify the model system that a ship has died
void model_notify_dead_ship(int objnum);
@@ -810,12 +912,17 @@ void model_set_detail_level(int n);
// Renders a model and all it's submodels.
// See MR_? defines for values for flags
void model_render(int model_num, matrix *orient, vector * pos, uint flags = MR_NORMAL, int objnum = -1, int lighting_skip = -1 );
void model_render(int model_num, matrix *orient, vector * pos, uint flags = MR_NORMAL, int objnum = -1, int lighting_skip = -1, int *replacement_textures = NULL);
// Renders just one particular submodel on a model.
// See MR_? defines for values for flags
void submodel_render(int model_num,int submodel_num, matrix *orient, vector * pos, uint flags=MR_NORMAL, int light_ignore_id=-1 );
void submodel_render(int model_num,int submodel_num, matrix *orient, vector * pos, uint flags=MR_NORMAL, int light_ignore_id=-1, int *replacement_textures = NULL);
// forward references - moved out here by Goober5000
int model_interp_sub(void *model_ptr, polymodel * pm, bsp_info *sm, int do_box_check);
void set_warp_gloabals(float, float, float, int, float);
void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int num_lights);
void model_really_render(int model_num, matrix *orient, vector * pos, uint flags, int light_ignore_id);
// Returns the radius of a model
float model_get_radius(int modelnum);
@@ -1098,7 +1205,7 @@ int model_which_octant( vector *pnt, int model_num,matrix *model_orient, vector
// scale the engines thrusters by this much
// Only enabled if MR_SHOW_THRUSTERS is on
void model_set_thrust(int model_num, vector length, int bitmapnum, int glow_bitmapnum=-1, float glow_noise=1.0f);
void model_set_thrust(int model_num, vector *length, int bitmapnum, int glow_bitmapnum=-1, float glow_noise=1.0f);
//=========================================================
// model caching
@@ -1154,3 +1261,11 @@ void model_page_in_textures(int modelnum, int ship_info_index);
int model_is_pirate_ship(int modelnum);
#endif
void set_warp_gloabals(float, float, float, int, float);
void model_set_replacement_bitmap(int bmap);
void model_set_replacement_textures(int *replacement_textures);
int decal_make_model(polymodel * pm);
+8 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Model/ModelCollide.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-07 01:37:42 $
* $Author: bobboau $
*
* Routines for detecting collisions of models.
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -1055,5 +1058,7 @@ int model_collide(mc_info * mc_info)
}
}
return Mc->num_hits;
}
+478 -94
View File
@@ -9,13 +9,64 @@
/*
* $Logfile: /Freespace2/code/Model/ModelInterp.cpp $
* $Revision: 2.5 $
* $Date: 2002-10-22 23:02:40 $
* $Author: randomtiger $
* $Revision: 2.17 $
* $Date: 2003-01-30 23:19:14 $
* $Author: phreak $
*
* Rendering models, I think.
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2003/01/21 17:24:16 Goober5000
* fixed a few bugs in Bobboau's implementation of the glow sexps; also added
* help for the sexps in sexp_tree
* --Goober5000
*
* Revision 2.15 2003/01/20 05:40:49 bobboau
* added several sExps for turning glow points and glow maps on and off
*
* Revision 2.14 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.13 2003/01/17 01:48:49 Goober5000
* added capability to the $Texture replace code to substitute the textures
* without needing and extra model, however, this way you can't substitute
* transparent or animated textures
* --Goober5000
*
* Revision 2.12 2003/01/16 06:49:11 Goober5000
* yay! got texture replacement to work!!!
* --Goober5000
*
* Revision 2.11 2003/01/09 05:55:55 Goober5000
* fixed the giant thruster glow bug
* --Goober5000
*
* Revision 2.10 2003/01/06 19:33:22 Goober5000
* cleaned up some stuff with model_set_thrust and a commented Assert that
* shouldn't have been
* --Goober5000
*
* Revision 2.9 2002/12/07 01:37:42 bobboau
* inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
* collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
* it needs a better renderer, but is in prety good shape for now,
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.8 2002/12/02 23:16:45 Goober5000
* commented out an unneeded variable (ship *shipp) in model_really_render
*
* Revision 2.7 2002/11/14 06:15:03 bobboau
* added nameplate code
*
* Revision 2.6 2002/11/14 04:18:16 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.5 2002/10/22 23:02:40 randomtiger
* Made Phreaks alternative scanning style optional under the command line tag "-phreak"
* Fixed bug that changes HUD colour when targetting debris in a full nebula. - RT
*
* Revision 2.4 2002/10/19 19:29:27 bobboau
* inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry
*
@@ -264,6 +315,7 @@
#include "nebula/neb.h"
#include "math/staticrand.h"
#include "globalincs/alphacolors.h"
//#include "weapon/beam.h" //I don't need this after all:\ -Bobboau
// Some debug variables used externally for displaying stats
#ifndef NDEBUG
@@ -274,6 +326,10 @@ int modelstats_num_sortnorms = 0;
int modelstats_num_boxes = 0;
#endif
int glow_maps_active = 1;
extern int OGL_inited;
// a lighting object
typedef struct model_light_object {
ubyte r[MAX_POLYGON_NORMS];
@@ -335,12 +391,21 @@ static int Interp_thrust_glow_bitmap = -1;
static float Interp_thrust_glow_noise = 1.0f;
static float Interp_thrust_scale_x = 0.0f;//added -bobboau
static float Interp_thrust_scale_y = 0.0f;//added -bobboau
float Model_Interp_scale_x = 1.0f; //added these three for warpin stuff-Bobbau
float Model_Interp_scale_y = 1.0f;
float Model_Interp_scale_z = 1.0f;
int Warp_Model = -1; //global warp model number
int Warp_Map = -1; //global map to be used while rendering the warp model
float Warp_Alpha = -1.0f;
static int Interp_objnum = -1;
// if != -1, use this bitmap when rendering ship insignias
static int Interp_insignia_bitmap = -1;
// replacement - Goober5000
static int Interp_replacement_bitmap = -1;
static int *Interp_replacement_textures = NULL;
// if != -1, use this bitmap when rendering with a forced texture
static int Interp_forced_bitmap = -1;
@@ -349,8 +414,14 @@ static float Interp_xparent_alpha = 1.0f;
float Interp_light = 0.0f;
// forward references
int model_interp_sub(void *model_ptr, polymodel * pm, bsp_info *sm, int do_box_check );
void set_warp_gloabals(float a, float b, float c, int d, float e){
Model_Interp_scale_x =a;
Model_Interp_scale_y=b;
Model_Interp_scale_z=c;
Warp_Map=d;
Warp_Alpha=e;
// mprintf(("warpmap being set to %d\n",Warp_Map));
}
// call at the beginning of a level. after the level has been loaded
void model_level_post_init()
@@ -472,11 +543,11 @@ void interp_clear_instance()
}
// Scales the engines thrusters by this much
void model_set_thrust( int model_num, vector length /*<-I did that-Bobboau*/, int bitmap, int glow_bitmap, float glow_noise )
void model_set_thrust( int model_num, vector *length /*<-I did that-Bobboau*/, int bitmap, int glow_bitmap, float glow_noise )
{
Interp_thrust_scale = length.xyz.z;
Interp_thrust_scale_x = length.xyz.x;
Interp_thrust_scale_y = length.xyz.y;
Interp_thrust_scale = length->xyz.z;
Interp_thrust_scale_x = length->xyz.x;
Interp_thrust_scale_y = length->xyz.y;
Interp_thrust_bitmap = bitmap;
Interp_thrust_glow_bitmap = glow_bitmap;
Interp_thrust_glow_noise = glow_noise;
@@ -589,7 +660,33 @@ void model_interp_defpoints(ubyte * p, polymodel *pm, bsp_info *sm)
dest++;
}
} else {
} else if((Model_Interp_scale_x != 1) || (Model_Interp_scale_y != 1) || (Model_Interp_scale_z != 1)) {
mprintf(("warp model being scaled by %f %f %f\n",Model_Interp_scale_x ,Model_Interp_scale_y, Model_Interp_scale_z));
for (n=0; n<nverts; n++ ) {
vector tmp;
Interp_verts[n] = src;
tmp.xyz.x = (src->xyz.x) * Model_Interp_scale_x;
tmp.xyz.y = (src->xyz.y) * Model_Interp_scale_y;
tmp.xyz.z = (src->xyz.z) * Model_Interp_scale_z;
g3_rotate_vertex(dest,&tmp);
src++; // move to normal
for (i=0; i<normcount[n]; i++ ) {
Interp_light_applied[next_norm] = 0;
Interp_norms[next_norm] = src;
next_norm++;
src++;
}
dest++;
}
}else{
for (n=0; n<nverts; n++ ) {
Interp_verts[n] = src;
@@ -694,7 +791,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm)
Interp_list[i] = &Interp_points[verts[i*2]];
if ( Interp_flags & MR_NO_LIGHTING ) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_list[i]->r = 191;
Interp_list[i]->g = 191;
Interp_list[i]->b = 191;
@@ -706,7 +803,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm)
int norm = verts[i*2+1];
if ( Interp_flags & MR_NO_SMOOTHING ) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
light_apply_rgb( &Interp_list[i]->r, &Interp_list[i]->g, &Interp_list[i]->b, Interp_verts[vertnum], vp(p+8), Interp_light );
} else {
Interp_list[i]->b = light_apply( Interp_verts[vertnum], vp(p+8), Interp_light );
@@ -714,7 +811,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm)
} else {
// if we're not using saved lighting
if ( !Interp_use_saved_lighting && !Interp_light_applied[norm] ) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
light_apply_rgb( &Interp_lighting->r[norm], &Interp_lighting->g[norm], &Interp_lighting->b[norm], Interp_verts[vertnum], vp(p+8), Interp_light );
} else {
Interp_lighting->b[norm] = light_apply( Interp_verts[vertnum], Interp_norms[norm], Interp_light );
@@ -722,7 +819,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm)
Interp_light_applied[norm] = 1;
}
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_list[i]->r = Interp_lighting->r[norm];
Interp_list[i]->g = Interp_lighting->g[norm];
Interp_list[i]->b = Interp_lighting->b[norm];
@@ -739,7 +836,7 @@ void model_interp_flatpoly(ubyte * p,polymodel * pm)
}
if ( !(Interp_flags & MR_NO_POLYS)) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
g3_draw_poly( nv, Interp_list, TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB );
} else {
g3_draw_poly( nv, Interp_list, TMAP_FLAG_GOURAUD | TMAP_FLAG_RAMP );
@@ -787,15 +884,18 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
int is_invisible = 0;
if ((!Interp_thrust_scale_subobj) && (pm->textures[w(p+40)]<0)) {
// Don't draw invisible polygons.
if ( !(Interp_flags & MR_SHOW_INVISIBLE_FACES)) {
return;
} else {
is_invisible = 1;
if(Warp_Map < 0){
if ((!Interp_thrust_scale_subobj) && (pm->textures[w(p+40)]<0)) {
// Don't draw invisible polygons.
if ( !(Interp_flags & MR_SHOW_INVISIBLE_FACES)) {
return;
} else {
is_invisible = 1;
}
}
}
nv = w(p+36);
// Tmap_show_layers = 1;
@@ -804,12 +904,15 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
modelstats_num_polys++;
#endif
if (!g3_check_normal_facing(vp(p+20),vp(p+8)) && !(Interp_flags & MR_NO_CULL)) return;
if(Warp_Map < 0){
if (!g3_check_normal_facing(vp(p+20),vp(p+8)) && !(Interp_flags & MR_NO_CULL)) return;
}
if ( nv < 0 ) return;
verts = (model_tmap_vert *)(p+44);
for (i=0;i<nv;i++) {
Interp_list[i] = &Interp_points[verts[i].vertnum];
@@ -832,7 +935,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
// Assert( verts[i].normnum == verts[i].vertnum );
if ( (Interp_flags & MR_NO_LIGHTING) || (pm->ambient[w(p+40)])) { //gets the ambient glow to work
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_list[i]->r = 191;
Interp_list[i]->g = 191;
Interp_list[i]->b = 191;
@@ -844,7 +947,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
int norm = verts[i].normnum;
if ( Interp_flags & MR_NO_SMOOTHING ) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
light_apply_rgb( &Interp_list[i]->r, &Interp_list[i]->g, &Interp_list[i]->b, Interp_verts[vertnum], vp(p+8), Interp_light );
} else {
Interp_list[i]->b = light_apply( Interp_verts[vertnum], vp(p+8), Interp_light );
@@ -853,7 +956,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
// if we're applying lighting as normal, and not using saved lighting
if ( !Interp_use_saved_lighting && !Interp_light_applied[norm] ) {
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
light_apply_rgb( &Interp_lighting->r[norm], &Interp_lighting->g[norm], &Interp_lighting->b[norm], Interp_verts[vertnum], Interp_norms[norm], Interp_light );
} else {
@@ -888,7 +991,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
Interp_light_applied[norm] = 1;
}
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_list[i]->r = Interp_lighting->r[norm];
Interp_list[i]->g = Interp_lighting->g[norm];
Interp_list[i]->b = Interp_lighting->b[norm];
@@ -907,6 +1010,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
modelstats_num_polys_drawn++;
#endif
if (!(Interp_flags & MR_NO_POLYS) ) {
if ( is_invisible ) {
gr_set_color( 0, 255, 0 );
@@ -920,10 +1024,13 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
gr_set_color( 128, 128, 255 );
}
uint tflags = Interp_tmap_flags;
tflags &= (~(TMAP_FLAG_TEXTURED|TMAP_FLAG_TILED|TMAP_FLAG_CORRECT));
tflags &= (~(TMAP_FLAG_TEXTURED|TMAP_FLAG_TILED|TMAP_FLAG_CORRECT));
g3_draw_poly( nv, Interp_list, tflags );
}
} else {
} else if(Warp_Map > -1){ //warpin effect-Bobboau
gr_set_bitmap( Warp_Map, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, Warp_Alpha );
g3_draw_poly( nv, Interp_list, TMAP_FLAG_TEXTURED );
}else{
// all textured polys go through here
if ( Interp_tmap_flags & TMAP_FLAG_TEXTURED ) {
// subspace special case
@@ -937,11 +1044,17 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
// if we're rendering a nebula background pof, maybe select a custom texture
if((Interp_flags & MR_FORCE_TEXTURE) && (Interp_forced_bitmap >= 0)){
texture = Interp_forced_bitmap;
}else if(Interp_replacement_bitmap >= 0){
texture = Interp_replacement_bitmap;
} else {
if (pm->is_ani[w(p+40)]){
texture = pm->textures[w(p+40)] + ((timestamp() / (int)(pm->fps[w(p+40)])) % pm->numframes[w(p+40)]);//here is were it picks the texture to render for ani-Bobboau
texture = pm->textures[w(p+40)] + ((timestamp() / (int)(pm->fps[w(p+40)])) % pm->num_frames[w(p+40)]);//here is were it picks the texture to render for ani-Bobboau
if(glow_maps_active)
GLOWMAP = pm->glow_textures[w(p+40)] + ((timestamp() / (int)(pm->glow_fps[w(p+40)])) % pm->glow_numframes[w(p+40)]);
}else{
texture = pm->textures[w(p+40)];//here is were it picks the texture to render for normal-Bobboau
if(glow_maps_active)
GLOWMAP = pm->glow_textures[w(p+40)];
}
}
@@ -963,7 +1076,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
}
if ( Interp_subspace ) {
g3_draw_poly( nv, Interp_list, TMAP_FLAG_TEXTURED|TMAP_FLAG_TILED|TMAP_FLAG_CORRECT );
g3_draw_poly( nv, Interp_list, TMAP_FLAG_TEXTURED|TMAP_FLAG_TILED|TMAP_FLAG_CORRECT );
} else {
if(Interp_flags & MR_ALL_XPARENT){
g3_draw_poly( nv, Interp_list, Interp_tmap_flags );
@@ -971,6 +1084,7 @@ void model_interp_tmappoly(ubyte * p,polymodel * pm)
g3_draw_poly( nv, Interp_list, Interp_tmap_flags|TMAP_FLAG_NONDARKENING );
}
}
GLOWMAP = -1;
}
}
@@ -1438,7 +1552,7 @@ void model_interp_subcall(polymodel * pm, int mn, int detail_level)
} else {
Interp_thrust_scale_subobj=0;
}
g3_start_instance_angles(&pm->submodel[mn].offset, &pm->submodel[mn].angs);
if ( !(Interp_flags & MR_NO_LIGHTING ) ) {
light_rotate_all();
@@ -1542,15 +1656,28 @@ int model_interp_sub(void *model_ptr, polymodel * pm, bsp_info *sm, int do_box_c
chunk_type = w(p);
chunk_size = w(p+4);
while ( chunk_type != OP_EOF ) {
// mprintf(( "Processing chunk type %d, len=%d\n", chunk_type, chunk_size ));
switch (chunk_type) {
case OP_EOF: return 1;
case OP_DEFPOINTS: model_interp_defpoints(p,pm,sm); break;
case OP_DEFPOINTS: model_interp_defpoints(p,pm,sm); break;
case OP_FLATPOLY: model_interp_flatpoly(p,pm); break;
case OP_TMAPPOLY: model_interp_tmappoly(p,pm); break;
case OP_TMAPPOLY:
// possible texture replacements - Goober5000
if (Interp_replacement_textures)
{
model_set_replacement_bitmap(Interp_replacement_textures[w(p+40)]);
}
else
{
model_set_replacement_bitmap(-1);
}
model_interp_tmappoly(p,pm);
break;
case OP_SORTNORM: model_interp_sortnorm(p,pm,sm,do_box_check); break;
case OP_BOUNDBOX:
@@ -1618,6 +1745,7 @@ DoneWithThis:
void model_render_shields( polymodel * pm )
{
model_set_outline_color(255,255,255);
int i, j;
shield_tri *tri;
vertex pnt0, tmp, prev_pnt;
@@ -1658,9 +1786,12 @@ void model_render_insignias(polymodel *pm, int detail_level)
int idx, s_idx;
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
vector t1, t2, t3;
vector t1, t2, t3, x;
int i1, i2, i3;
x.xyz.x=0;
x.xyz.y=0;
x.xyz.z=0;
// if the model has no insignias we're done
if(pm->num_ins <= 0){
return;
@@ -1701,8 +1832,20 @@ void model_render_insignias(polymodel *pm, int detail_level)
vecs[1].u = pm->ins[idx].u[s_idx][1]; vecs[1].v = pm->ins[idx].v[s_idx][1];
vecs[2].u = pm->ins[idx].u[s_idx][2]; vecs[2].v = pm->ins[idx].v[s_idx][2];
// vm_vec_avg3(&x,
/*
for(int k =0; k < 3; k++){
if ( D3D_enabled ) {
light_apply_rgb( &vecs[k].r, &vecs[k].g, &vecs[k].b, &pm->ins[idx].vecs[k], &pm->ins[idx].norm[k], 0.8f );
} else {
vecs[k].b = light_apply( &x, &pm->ins[idx].norm[k], 0.8f );
}
}
vecs[k].r = (ubyte)255;*/
// gr_printf((0), (0), "r %d, g %d, b %d", (int)vecs[k].r, (int)vecs[k].g, (int)vecs[k].b);
// draw the polygon
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
// g3_draw_poly(3, vlist, 0);
}
}
}
@@ -1790,8 +1933,6 @@ int model_cache_calc_coords(vector *pnt,float rad, float *cx, float *cy, float *
return 0;
}
void model_really_render(int model_num, matrix *orient, vector * pos, uint flags, int light_ignore_id );
//draws a bitmap with the specified 3d width & height
//returns 1 if off screen, 0 if not
@@ -1925,7 +2066,6 @@ DCF(model_darkening,"Makes models darker with distance")
}
}
void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int num_lights );
// Compare it to 999.75f at R = 64.0f
// 0.0000f at R = 4.0f
@@ -1945,23 +2085,28 @@ float scale_it( float min, float max, float v, float v1, float v2 )
return v;
}
void model_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int lighting_skip )
void model_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int lighting_skip, int *replacement_textures)
{
// replacement textures - Goober5000
model_set_replacement_textures(replacement_textures);
polymodel *pm = model_get(model_num);
int time = timestamp();
for (int i = 0; i < pm->n_glows; i++ ) { //glow point blink code -Bobboau
glow_bank *bank = &pm->glows[i];
if (bank->glow_timestamp == 0)
bank->glow_timestamp=timestamp();
bank->glow_timestamp=time;
if(bank->off_time){
// time += bank->disp_time;
if(bank->is_on){
if( timestamp_elapsed(bank->glow_timestamp + bank->on_time + bank->disp_time) ){
bank->glow_timestamp=timestamp();
if( (bank->on_time) > ((time - bank->disp_time) % (bank->on_time + bank->off_time)) ){
bank->glow_timestamp=time;
bank->is_on=0;
}
}else{
if( timestamp_elapsed(bank->glow_timestamp + bank->off_time + bank->disp_time) ){
bank->glow_timestamp=timestamp();
if( (bank->off_time) < ((time - bank->disp_time) % (bank->on_time + bank->off_time)) ){
bank->glow_timestamp=time;
bank->is_on=1;
}
}
@@ -2096,7 +2241,7 @@ int Mc_detail_add[MAX_DETAIL_LEVEL+1] = { -2, -1, +1, +2, +4 };
extern float flFrametime;
void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int num_lights )
void model_try_cache_render(int model_num, matrix *orient, vector * pos, uint flags, int objnum, int num_lights)
{
model_really_render(model_num, orient, pos, flags, objnum);
/*
@@ -2571,14 +2716,48 @@ DCF(tiling, "")
extern void d3d_zbias(int bias);
#endif
void moldel_calc_facing_pts( vector *top, vector *bot, vector *fvec, vector *pos, float w, float z_add, vector *Eyeposition )
{
vector uvec, rvec;
vector temp;
temp = *pos;
vm_vec_sub( &rvec, Eyeposition, &temp );
vm_vec_normalize( &rvec );
vm_vec_crossprod(&uvec,fvec,&rvec);
vm_vec_normalize(&uvec);
vm_vec_scale_add( top, &temp, &uvec, w/2.0f );
vm_vec_scale_add( bot, &temp, &uvec, -w/2.0f );
// Int3();
}
#define mSTUFF_VERTICES() do { verts[0]->u = 0.0f; verts[0]->v = 0.0f; verts[1]->u = 1.0f; verts[1]->v = 0.0f; verts[2]->u = 1.0f; verts[2]->v = 1.0f; verts[3]->u = 0.0f; verts[3]->v = 1.0f; } while(0);
#define mR_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 mP_VERTICES() do { for(idx=0; idx<4; idx++){ g3_project_vertex(verts[idx]); } } while(0);
void model_really_render(int model_num, matrix *orient, vector * pos, uint flags, int light_ignore_id )
{
int i, detail_level;
polymodel * pm;
glow_maps_active = 1;
uint save_gr_zbuffering_mode;
int zbuf_mode;
int objnum = light_ignore_id;
ship *shipp = &Ships[Objects[objnum].instance];
ship *shipp = NULL;
int is_ship = 0;
object *obj = &Objects[objnum];
if(obj->type == OBJ_SHIP){
shipp = &Ships[obj->instance];
is_ship = 1;
glow_maps_active = shipp->glowmaps_active;
}
MONITOR_INC( NumModelsRend, 1 );
@@ -2611,7 +2790,7 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
pm = model_get(model_num);
// Set the flags we will pass to the tmapper
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB;
} else {
Interp_tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RAMP;
@@ -2622,6 +2801,7 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
Interp_tmap_flags |= TMAP_FLAG_PIXEL_FOG;
}
if ( !(Interp_flags & MR_NO_TEXTURING) ) {
Interp_tmap_flags |= TMAP_FLAG_TEXTURED;
@@ -2823,6 +3003,50 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
d3d_zbias(0);
}
#endif
// object *obj = &Objects[objnum];
decal_render_all(&Objects[objnum]);
// decal_render_all(&Objects[objnum]);//render decals-Bobboau
// mprintf(("out of the decal stuff\n"));
/* if(obj->type == OBJ_SHIP){
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
mprintf(("about to render all decals\n"));
// ship *shipp = &Ships[obj->instance];
for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
for(int i = 0; i<dec->n_poly; i++){
mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
gr_set_bitmap(dec->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
vecs[0] = dec->vert[i][0];
vecs[1] = dec->vert[i][1];
vecs[2] = dec->vert[i][2];
g3_rotate_vertex(&vecs[0], &obj->pos);
g3_rotate_vertex(&vecs[1], &obj->pos);
g3_rotate_vertex(&vecs[2], &obj->pos);
g3_project_vertex(&vecs[0]);
g3_project_vertex(&vecs[1]);
g3_project_vertex(&vecs[2]);
mprintf(("vert 1 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[0].x, vecs[0].y, vecs[0].z, vecs[0].u, vecs[0].v));
mprintf(("vert 2 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[1].x, vecs[1].y, vecs[1].z, vecs[1].u, vecs[1].v));
mprintf(("vert 3 at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", vecs[2].x, vecs[2].y, vecs[2].z, vecs[2].u, vecs[2].v));
gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);
}
}
}
mprintf(("decals rendered\n"));
}
*/
//start rendering glow points -Bobboau
if ( (pm->n_glows) /*&& (Interp_flags & MR_SHOW_THRUSTERS) /*&& (Detail.engine_glows)*/ ) {
@@ -2830,7 +3054,11 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
for (i = 0; i < pm->n_glows; i++ ) {
glow_bank *bank = &pm->glows[i];
int j;
if(bank->is_on){
if(bank->is_on)
{
if(is_ship && i<32)
if(!(shipp->glows_active & (1 << i)))
continue;
for ( j=0; j<bank->num_slots; j++ ) {
@@ -2840,58 +3068,133 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
}else{
flick = 1;
}
if(flick == 1){
float d;
vector tempv;
vm_vec_sub(&tempv,&View_position,&bank->pnt[j]);
vm_vec_normalize(&tempv);
vector pnt = bank->pnt[j];
vector norm = bank->norm[j];
if(bank->submodel_parent > 0){//this is were it rotates for the submodel parent-Bobboau
matrix m;
angles angs = pm->submodel[bank->submodel_parent].angs;
angs.b = PI2 - angs.b;
angs.p = PI2 - angs.p;
angs.h = PI2 - angs.h;
d = vm_vec_dot(&tempv,&bank->norm[j]);
if ( d > 0.0f) {
vertex p;
// Make glow bitmap fade in/out quicker from sides.
d *= 3.0f;
if ( d > 1.0f ) d = 1.0f;
// fade them in the nebula as well
if(The_mission.flags & MISSION_FLAG_FULLNEB){
d *= (1.0f - Interp_fog_level);
// gr_set_color_fast(&Color_bright_blue);
// gr_printf(0, 10, "b %0.2f, p %0.2f, h %0.2f", angs.b, angs.p, angs.h);
vm_angles_2_matrix(&m, &angs);
vector offset = pm->submodel[bank->submodel_parent].offset;
vm_vec_sub(&pnt, &pnt, &offset);
vector p = pnt;
vector n = norm;
vm_vec_rotate(&pnt, &p, &m);
vm_vec_rotate(&norm, &n, &m);
vm_vec_add2(&pnt, &offset);
}
vector tempv;
switch(bank->type){
case 0:
float d;
if((bank->norm[j].xyz.x == 0.0f) && (bank->norm[j].xyz.z == 0.0f) && (bank->norm[j].xyz.z == 0.0f)){
d=1.0f; //if given a nul vector then always show it
}else{
vm_vec_sub(&tempv,&View_position,&pnt);
vm_vec_normalize(&tempv);
d = vm_vec_dot(&tempv,&norm);
d -= 0.25;
}
if ( d > 0.0f) {
vertex p;
float w = bank->radius[j];
// disable fogging
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
d *= 3.0f;
if ( d > 1.0f ) d = 1.0f;
g3_rotate_vertex( &p, &bank->pnt[j] );
//need to rotate the vertex if it's parent is rotated
/*if(shipp->subsys_list.submodel_info_1.movement_axis){
float w = bank->radius[j];
// fade them in the nebula as well
if(The_mission.flags & MISSION_FLAG_FULLNEB){
d *= (1.0f - Interp_fog_level);
w *= 1.5; //make it bigger in a nebula
}
// disable fogging
gr_fog_set(GR_FOGMODE_NONE, 0, 0, 0);
g3_rotate_vertex( &p, &pnt );
matrix m;
// if(bank->submodel_parent)
// {
// }
vm_angles_2_matrix(&m, &pm->submodel[submodel_num].angs)
}*/
if(bank->submodel_parent)
gr_set_bitmap( bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, d );
{
gr_set_bitmap( bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, d );
// mprintf(( "rendering glow with texture %d\n", bank->glow_bitmap ));
extern int Gr_scaler_zbuffering;
Gr_scaler_zbuffering = 1;
g3_draw_bitmap(&p,0,w*0.5f, TMAP_FLAG_TEXTURED );
//g3_draw_rotated_bitmap(&p,0.0f,w,w, TMAP_FLAG_TEXTURED );
Gr_scaler_zbuffering = 0;
}//setbitmap
}//d>0
}//d>0
break;
case 1:
vertex h1[4]; // halves of a beam section
vertex *verts[4] = { &h1[0], &h1[1], &h1[2], &h1[3] };
vector fvec, top1, bottom1, top2, bottom2, start, end;
vm_vec_add2(&norm, &pnt);
vm_vec_rotate(&start, &pnt, orient);
vm_vec_rotate(&end, &norm, orient);
vm_vec_sub(&fvec, &end, &start);
vm_vec_normalize(&fvec);
moldel_calc_facing_pts(&top1, &bottom1, &fvec, &pnt, 1.0f, 1.0f, &Eye_position);
moldel_calc_facing_pts(&top2, &bottom2, &fvec, &norm, 1.0f, 1.0f, &Eye_position);
int idx = 0;
/*R_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);
/*P_VERTICES()*/ do { for(idx=0; idx<4; idx++){ g3_project_vertex(verts[idx]); } } while(0);
/*STUFF_VERTICES()*/ do {
verts[0]->u = 0.0f; verts[0]->v = 0.0f;
verts[1]->u = 1.0f; verts[1]->v = 0.0f;
verts[2]->u = 1.0f; verts[2]->v = 1.0f;
verts[3]->u = 0.0f; verts[3]->v = 1.0f;
} while(0);
// mR_VERTICES(); // rotate and project the vertices
// mP_VERTICES();
// mSTUFF_VERTICES(); // stuff the beam with creamy goodness (texture coords)
vm_vec_sub(&tempv,&View_position,&pnt);
vm_vec_normalize(&tempv);
gr_set_cull(0);
if(The_mission.flags & MISSION_FLAG_FULLNEB){
gr_set_bitmap(bank->glow_neb_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f);
}else{
gr_set_bitmap(bank->glow_bitmap, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f);
}
g3_draw_poly( 4, verts, TMAP_FLAG_TILED | TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT); // added TMAP_FLAG_TILED flag for beam texture tileing -Bobboau
gr_set_cull(1);
}
}//flick
}//for slot
}//bank is on
}//for bank
}//any glow banks
// gr_printf((200), (20), "x %0.2f, y %0.2f, z %0.2f", Eye_position.xyz.x, Eye_position.xyz.y, Eye_position.xyz.z);
//end rendering glow points
@@ -2926,39 +3229,65 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
#define NOISE_SCALE 0.5f
#define MIN_SCALE 3.4f
#define MAX_SCALE 4.7f
float scale = MIN_SCALE, x=0.0f, y=0.0f, z=0.0f;
float scale = MIN_SCALE;
// the following replaces Bobboau's code, commented out below - Goober5000
float magnitude;
vector scale_vec;
// normalize banks, in case of incredibly big normals
vm_vec_copy_normalize(&scale_vec, &bank->norm[j]);
// adjust for thrust
(scale_vec.xyz.x *= Interp_thrust_scale_x) -= 0.1f;
(scale_vec.xyz.y *= Interp_thrust_scale_y) -= 0.1f;
(scale_vec.xyz.z *= Interp_thrust_scale) -= 0.1f;
// get magnitude, which we will use as the scaling reference
magnitude = vm_vec_normalize(&scale_vec);
// get absolute value
if (magnitude < 0.0f)
magnitude *= -1.0f;
scale = magnitude*(MAX_SCALE-MIN_SCALE)+MIN_SCALE;
/* this is Bobboau's code
// if(abs(bank->norm->y + Interp_thrust_scale_y) > 0){
// if(abs(bank->norm->x + Interp_thrust_scale_x) > 0)
// if(abs(bank->norm->z + Interp_thrust_scale) > 0)
x = ((-bank->norm[j].xyz.x + Interp_thrust_scale_x) * Interp_thrust_scale_x);
// x = (x * Interp_thrust_scale_x)/2;
if((bank->norm[j].xyz.x < 0.0f) /*&& (Interp_thrust_scale_x < 0.0f)*/){
if((bank->norm[j].xyz.x < 0.0f) && (Interp_thrust_scale_x < 0.0f)){
x = -x;
}
y = ((-bank->norm[j].xyz.y + Interp_thrust_scale_y) * Interp_thrust_scale_y);
// y = (y * Interp_thrust_scale_y)/2;
if((bank->norm[j].xyz.y < 0.0f) /*&& (Interp_thrust_scale_y < 0.0f)*/){
if((bank->norm[j].xyz.y < 0.0f) && (Interp_thrust_scale_y < 0.0f)){
y = -y;
}
z = ((-bank->norm[j].xyz.z + Interp_thrust_scale) * Interp_thrust_scale);
// z = (z * Interp_thrust_scale)/2;
if((bank->norm[j].xyz.z < 0.0f) /*&& (Interp_thrust_scale < 0.0f)*/){
if((bank->norm[j].xyz.z < 0.0f) && (Interp_thrust_scale < 0.0f)){
z = -z;
}
#ifndef NDEBUG
if ( &Objects[objnum] == Player_obj ){
// if ( &Objects[objnum] == Player_obj ){
gr_set_color_fast(&Color_bright_blue);
gr_printf((i * 200), (20 +(j * 10)), "x %0.2f, y %0.2f, z %0.2f", x, y, z);
}
// }
#endif
scale = ((bank->norm[j].xyz.x * x)+(bank->norm[j].xyz.y * y)+(bank->norm[j].xyz.z * z))*(MAX_SCALE-MIN_SCALE)+MIN_SCALE;
//getting thruster glows to grow baised on witch direction they are pointing -Bobboau
*/
// this is the original scaling code - Goober5000
// scale = (Interp_thrust_scale-0.1f)*(MAX_SCALE-MIN_SCALE)+MIN_SCALE;
float w = bank->radius[j]*(scale+Interp_thrust_glow_noise*NOISE_SCALE );
@@ -3017,12 +3346,18 @@ void model_really_render(int model_num, matrix *orient, vector * pos, uint flags
}
g3_done_instance();
gr_zbuffer_set(save_gr_zbuffering_mode);
gr_zbuffer_set(save_gr_zbuffering_mode);
glow_maps_active = 1;
}
void submodel_render(int model_num, int submodel_num, matrix *orient, vector * pos, uint flags, int light_ignore_id)
void submodel_render(int model_num, int submodel_num, matrix *orient, vector * pos, uint flags, int light_ignore_id, int *replacement_textures)
{
// replacement textures - Goober5000
model_set_replacement_textures(replacement_textures);
polymodel * pm;
MONITOR_INC( NumModelsRend, 1 );
@@ -3040,7 +3375,7 @@ void submodel_render(int model_num, int submodel_num, matrix *orient, vector * p
pm = model_get(model_num);
// Set the flags we will pass to the tmapper
if ( D3D_enabled ) {
if ( D3D_enabled || OGL_inited ) {
Interp_tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RGB;
} else {
Interp_tmap_flags = TMAP_FLAG_GOURAUD | TMAP_FLAG_RAMP;
@@ -3327,6 +3662,16 @@ void model_set_insignia_bitmap(int bmap)
Interp_insignia_bitmap = bmap;
}
void model_set_replacement_bitmap(int bmap)
{
Interp_replacement_bitmap = bmap;
}
void model_set_replacement_textures(int *replacement_textures)
{
Interp_replacement_textures = replacement_textures; //replacement_textures;
}
// set the forces bitmap
void model_set_forced_texture(int bmap)
{
@@ -3497,3 +3842,42 @@ int model_is_pirate_ship(int modelnum)
{
return 0;
}
/*
void render_all_decal(object * obj){
vertex vecs[3];
vertex *vlist[3] = { &vecs[0], &vecs[1], &vecs[2] };
mprintf(("about to render all decals\n"));
ship *shipp = &Ships[obj->instance];
for(int h = 0; h < MAX_SHIP_DECALS; h++){
decal *dec = &shipp->decals[h];
if(dec->is_valid){
mprintf(("decal %d is valid, and has %d polys\n",h,dec->n_poly));
for(int i = 0; i<dec->n_poly; i++){
mprintf(("drawing decal poly %d, with bitmap %d\n", i, dec->texture));
gr_set_bitmap(dec->texture, GR_ALPHABLEND_FILTER, GR_BITBLT_MODE_NORMAL, 1.0f );
for( int j = 0; j < 3; j++){
vecs[j] = dec->vert[i][j];
vector pos;
vm_vert2vec(&vecs[j], &pos);
vm_vec_add2(&pos, &obj->pos);
g3_rotate_vertex(&vecs[j], &pos);
g3_project_vertex(&vecs[j]);
mprintf(("vert %d at x %0.2f y %0.2f z %0.2f u %0.2f v %0.2f\n", j, vecs[j].x, vecs[j].y, vecs[j].z, vecs[j].u, vecs[j].v));
}
gr_set_cull(0);
g3_draw_poly(3, vlist, TMAP_FLAG_TEXTURED | TMAP_FLAG_CORRECT );
gr_set_cull(1);
}
}
}
mprintf(("decals rendered\n"));
}
*/
+333 -111
View File
@@ -9,13 +9,73 @@
/*
* $Logfile: /Freespace2/code/Model/ModelRead.cpp $
* $Revision: 2.4 $
* $Date: 2002-10-19 19:29:27 $
* $Revision: 2.17 $
* $Date: 2003-02-25 16:46:01 $
* $Author: bobboau $
*
* file which reads and deciphers POF information
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2003/02/25 06:22:49 bobboau
* fixed a bunch of fighter beam bugs,
* most notabley the sound now works corectly,
* and they have limeted range with atenuated damage (table option)
* added bank specific compatabilities
*
* Revision 2.15 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.14 2003/01/17 01:48:49 Goober5000
* added capability to the $Texture replace code to substitute the textures
* without needing and extra model, however, this way you can't substitute
* transparent or animated textures
* --Goober5000
*
* Revision 2.13 2003/01/16 06:49:11 Goober5000
* yay! got texture replacement to work!!!
* --Goober5000
*
* Revision 2.12 2003/01/15 23:23:30 Goober5000
* NOW the model duplicates work! :p
* still gotta do the textures, but it shouldn't be hard now
* --Goober5000
*
* Revision 2.11 2003/01/15 08:57:23 Goober5000
* assigning duplicate models to ships now works; committing so I have a base
* to fall back to as I work on texture replacement
* --Goober5000
*
* Revision 2.10 2003/01/15 05:18:13 Goober5000
* moved texture loading around a bit; added Texture_replace in preparation
* for some cool stuff
* --Goober5000
*
* Revision 2.9 2003/01/09 21:22:36 phreak
* fixed a small error in bob's glowmap code
*
* Revision 2.8 2003/01/09 05:52:25 Goober5000
* snagged a potential bug
* --Goober5000
*
* Revision 2.7 2003/01/05 23:41:51 bobboau
* disabled decals (for now), removed the warp ray thingys,
* made some better error mesages while parseing weapons and ships tbls,
* and... oh ya, added glow mapping
*
* Revision 2.6 2002/12/07 01:37:42 bobboau
* inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
* collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
* it needs a better renderer, but is in prety good shape for now,
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.5 2002/11/14 04:18:16 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.4 2002/10/19 19:29:27 bobboau
* inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry
*
* Revision 2.3 2002/08/01 01:41:07 penguin
* The big include file move
*
@@ -724,7 +784,8 @@ char Global_filename[256];
int Model_ram = 0; // How much RAM the models use total
#endif
int Num_texture_replacements;
texture_replace Texture_replace[MAX_TEXTURE_REPLACEMENTS];
// Anything less than this is considered incompatible.
#define PM_COMPATIBLE_VERSION 1900
@@ -732,7 +793,7 @@ int Model_ram = 0; // How much RAM the models use total
// Anything greater than or equal to PM_COMPATIBLE_VERSION and
// whose major version is less than or equal to this is considered
// compatible.
#define PM_OBJFILE_MAJOR_VERSION 21
#define PM_OBJFILE_MAJOR_VERSION 30
static int Model_signature = 0;
@@ -959,7 +1020,7 @@ static void set_subsystem_info( model_subsystem *subsystemp, char *props, char *
strcpy(lcdname, dname);
strlwr(lcdname);
// check the name for it's specific type
// check the name for its specific type
if ( strstr(lcdname, "engine") ) {
subsystemp->type = SUBSYSTEM_ENGINE;
} else if ( strstr(lcdname, "radar") ) {
@@ -1059,9 +1120,29 @@ static void set_subsystem_info( model_subsystem *subsystemp, char *props, char *
// CASE OF AI ROTATION
else if ( (p = strstr(props, "$ai")) != NULL) {
get_user_prop_value(p+8, buf);
get_user_prop_value(p+3, buf);
subsystemp->flags |= MSS_FLAG_AI_ROTATE;
//reading early animation suport-Bobboau
if(!stricmp("dock",buf)){
subsystemp->ai_rotation.type &= MSS_AI_DOCK;
mprintf(("model has AI animation, %s", buf));
if((p = strstr(props, "$up")) != NULL){
get_user_prop_value(p+3, buf);
// mprintf((" up"));
subsystemp->ai_rotation.min = (float)(atof("90"));
}
if((p = strstr(props, "$down")) != NULL){
// mprintf(("down"));
get_user_prop_value(p+5, buf);
subsystemp->ai_rotation.max = (float)atof("0");
}
// if((p = strstr(props, "$time")) != NULL){
// mprintf(("time"));
// get_user_prop_value(p+5, buf);
subsystemp->ai_rotation.time = (int)(turn_time * 1000);
// }
mprintf(("animation values, %f %f %d", subsystemp->ai_rotation.min, subsystemp->ai_rotation.max, subsystemp->ai_rotation.time));
}
// get parameters - ie, speed / dist / other ??
// time to activate
// condition
@@ -1078,7 +1159,6 @@ static void set_subsystem_info( model_subsystem *subsystemp, char *props, char *
}
}
}
}
// used in collision code to check if submode rotates too far
@@ -1103,7 +1183,6 @@ void do_new_subsystem( int n_subsystems, model_subsystem *slist, int subobj_num,
int i;
model_subsystem *subsystemp;
if ( slist==NULL ) return; // For TestCode, POFView, etc don't bother
// try to find the name of the subsystem passed here on the list of subsystems currently on the
@@ -1128,14 +1207,17 @@ void do_new_subsystem( int n_subsystems, model_subsystem *slist, int subobj_num,
#ifdef _WIN32
char bname[_MAX_FNAME];
_splitpath(model_filename, NULL, NULL, bname, NULL);
Warning(LOCATION, "A subsystem was found in model %s that does not have a record in ships.tbl.\nA list of subsystems for this ship will be dumped to:\n\ndata\\tables\\%s.subsystems for inclusion\n into ships.tbl.", model_filename, bname);
// Warning(LOCATION, "A subsystem was found in model %s that does not have a record in ships.tbl.\nA list of subsystems for this ship will be dumped to:\n\ndata\\tables\\%s.subsystems for inclusion\n into ships.tbl.", model_filename, bname);
mprintf(("A subsystem was found in model %s that does not have a record in ships.tbl.\nA list of subsystems for this ship will be dumped to:\n\ndata\\tables\\%s.subsystems for inclusion\n into ships.tbl.", model_filename, bname));
#else
Warning(LOCATION, "A subsystem was found in model %s that does not have a record in ships.tbl.\n", model_filename);
// Warning(LOCATION, "A subsystem was found in model %s that does not have a record in ships.tbl.\n", model_filename);
mprintf(("A subsystem was found in model %s that does not have a record in ships.tbl.\nA list of subsystems for this ship will be dumped to:\n\ndata\\tables\\%s.subsystems for inclusion\n into ships.tbl.", model_filename, bname));
#endif // ifdef WIN32
ss_warning_shown = 1;
} else
#endif
nprintf(("warning", "Subsystem %s in ships.tbl not found in model!\n", subobj_name));
mprintf(("A subsystem was found in model %s that does not have a record in ships.tbl.\nA list of subsystems for this ship will be dumped to:\n\ndata\\tables\\%s.subsystems for inclusion\n into ships.tbl.", model_filename, model_filename));
// nprintf(("warning", "Subsystem %s in ships.tbl not found in model!\n", subobj_name));
#ifndef NDEBUG
if ( ss_fp ) {
char tmp_buffer[128];
@@ -1224,7 +1306,7 @@ int Bogus_warning_flag_1903 = 0;
#endif
//reads a binary file containing a 3d model
int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subsystem *subsystems)
int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subsystem *subsystems, int ferror)
{
CFILE *fp;
int version;
@@ -1237,8 +1319,8 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
fp = cfopen(filename,"rb");
if (!fp){
Error( LOCATION, "Can't open file <%s>",filename);
return 0;
if(ferror == 1)Error( LOCATION, "Can't open file <%s>",filename);
return -1;
}
// code to get a filename to write out subsystem information for each model that
@@ -1286,6 +1368,9 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
// reset insignia counts
pm->num_ins = 0;
// reset glow points!! - Goober5000
pm->n_glows = 0;
id = cfread_int(fp);
len = cfread_int(fp);
next_chunk = cftell(fp) + len;
@@ -1535,7 +1620,7 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
pm->submodel[n].is_damaged=1;
else
pm->submodel[n].is_damaged=0;
//mprintf(( "Submodel %d, name '%s', parent = %d\n", n, pm->submodel[n].name, pm->submodel[n].parent ));
//key_getch();
@@ -1671,63 +1756,18 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
for (int q = 0; q < pm->n_glows; q++ ) {
glow_bank *bank = &pm->glows[q];
bank->type=1;
bank->is_on=1;
bank->glow_timestamp=0;
bank->disp_time=0;
bank->on_time=1000;
bank->off_time=0;
bank->LOD=0;
bank->submodel_parent=-1;
bank->num_slots = cfread_int(fp);
cfread_string_len( props, MAX_PROP_LEN, fp );
// look for $glow_texture=xxx
int length = strlen(props);
if (length > 0) {
int base_length = strlen("$glow_texture=");
Assert( strstr( (const char *)&props, "$glow_texture=") != NULL );
Assert( length > base_length );
char *glow_texture_name = props + base_length;
if (glow_texture_name[0] == '$') {
glow_texture_name++;
}
bank->glow_bitmap = bm_load( glow_texture_name );
if (bank->glow_bitmap < 0) {
Error( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", glow_texture_name, pm->filename );
}
}
for (j = 0; j < bank->num_slots; j++) {
cfread_vector( &(bank->pnt[j]), fp );
cfread_vector( &(bank->norm[j]), fp );
bank->radius[j] = cfread_float( fp );
//mprintf(( "Rad = %.2f\n", rad ));
}
//mprintf(( "Num slots = %d\n", bank->num_slots ));
}
break;
} //end glowpoint reading -Bobboau
case ID_GLOX:{ //experimental glowpoints, so I can test code for things I have to use a hex editor for -Bobboau
//
char props[MAX_PROP_LEN];
pm->n_glows = cfread_int(fp);
pm->glows = (glow_bank *)malloc(sizeof(glow_bank) * pm->n_glows);
Assert( pm->glows != NULL );
for (int q = 0; q < pm->n_glows; q++ ) {
glow_bank *bank = &pm->glows[q];
bank->type=1;
bank->is_on=1;
bank->glow_timestamp=0;
bank->disp_time = cfread_int(fp);
bank->on_time = cfread_int(fp);
bank->off_time = cfread_int(fp);
bank->LOD=0;
bank->submodel_parent=-1;
bank->submodel_parent = cfread_int(fp);
bank->LOD = cfread_int(fp);
bank->type = cfread_int(fp);
bank->num_slots = cfread_int(fp);
if((bank->off_time > 0) && (bank->disp_time > 0)){
bank->is_on=0;
}
cfread_string_len( props, MAX_PROP_LEN, fp );
// look for $glow_texture=xxx
@@ -1742,9 +1782,20 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
}
bank->glow_bitmap = bm_load( glow_texture_name );
if (bank->glow_bitmap < 0) {
Error( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", glow_texture_name, pm->filename );
Warning( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", glow_texture_name, pm->filename );
}else{
mprintf(( "glowbank texture num is %d\n", bank->glow_bitmap ));
}
strcat(glow_texture_name, "-neb");
bank->glow_neb_bitmap = bm_load( glow_texture_name );
if (bank->glow_neb_bitmap < 0) {
bank->glow_neb_bitmap = bank->glow_bitmap;
mprintf(( "glowbank texture not found, setting as the normal one num\n"));
// Error( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", glow_texture_name, pm->filename );
}else{
mprintf(( "glowbank nebula texture num is %d\n", bank->glow_neb_bitmap ));
}
}
for (j = 0; j < bank->num_slots; j++) {
cfread_vector( &(bank->pnt[j]), fp );
@@ -1927,48 +1978,12 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
// Dont overwrite memory!!
Assert(n <= MAX_MODEL_TEXTURES);
//mprintf(0," num textures = %d\n",n);
for (i=0; i<n; i++ ) {
for (i=0; i<n; i++ )
{
char tmp_name[256];
cfread_string_len(tmp_name,127,fp);
pm->transparent[i]=0; //it's transparent
pm->ambient[i]=0; //ambient glow
pm->is_ani[i]=0; //animated textures
if ( strstr(tmp_name, "thruster") || strstr(tmp_name, "invisible") ) {
// Don't load textures for thruster animations or invisible textures
pm->textures[i] = -1;
} else {
if(strstr(tmp_name, "trans")){
pm->transparent[i]=1;
nprintf(("%s is transparent, oooow\n",tmp_name));
}
if(strstr(tmp_name, "amb")){
pm->ambient[i]=1;
nprintf(("%s is amient, aaaahhh\n",tmp_name));
}
pm->textures[i] = bm_load( tmp_name );
if (pm->textures[i]<0) { //if I couldn't find the PCX see if there is an ani-Bobboau
nprintf(("couldn't find %s.pcx",tmp_name));
pm->is_ani[i] = 1; //this is an animated texture
pm->textures[i] = bm_load_animation(tmp_name, &pm->numframes[i], &pm->fps[i], 1);
if(pm->textures[i]<0){
Warning( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", tmp_name, pm->filename );
pm->textures[i] = -1;
pm->is_ani[i] = 0; //this isn't an animated texture after all
nprintf((" or %s.ani\n",tmp_name));
}else{
mprintf(("but I did find %s.ani, ", tmp_name));
mprintf(("with %d frames, ", pm->numframes[i]));
mprintf(("and a rate of %d\n", pm->fps[i]));
}
}
}
pm->original_textures[i] = pm->textures[i];
model_load_texture(pm, i, tmp_name);
//mprintf(0,"<%s>\n",name_buf);
}
@@ -2107,6 +2122,18 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
pm->ins[idx].u[idx2][idx3] = cfread_float(fp);
pm->ins[idx].v[idx2][idx3] = cfread_float(fp);
}
vector tempv;
//get three points (rotated) and compute normal
vm_vec_perp(&tempv,
&pm->ins[idx].vecs[pm->ins[idx].faces[idx2][0]],
&pm->ins[idx].vecs[pm->ins[idx].faces[idx2][1]],
&pm->ins[idx].vecs[pm->ins[idx].faces[idx2][2]]);
pm->ins[idx].norm[idx2] = tempv;
mprintf(("insignorm %.2f %.2f %.2f\n",pm->ins[idx].norm[idx2].xyz.x, pm->ins[idx].norm[idx2].xyz.y, pm->ins[idx].norm[idx2].xyz.z));
}
}
break;
@@ -2152,10 +2179,90 @@ int read_model_file(polymodel * pm, char *filename, int n_subsystems, model_subs
return 1;
}
// Goober5000
void model_load_texture(polymodel *pm, int i, char *file)
{
char tmp_name[256];
strcpy(tmp_name, file);
pm->transparent[i]=0; //it's transparent
pm->ambient[i]=0; //ambient glow
pm->is_ani[i]=0; //animated textures
pm->num_frames[i]=1; // number of frames - default 1 (no animation)
if ( strstr(tmp_name, "thruster") || strstr(tmp_name, "invisible") || strstr(tmp_name, "warpmap"))
{
// Don't load textures for thruster animations or invisible textures
// or warp models!-Bobboau
pm->textures[i] = -1;
}
else
{
if(strstr(tmp_name, "-trans"))
{
pm->transparent[i]=1;
nprintf(("%s is transparent, oooow\n",tmp_name));
}
if(strstr(tmp_name, "-amb"))
{
pm->ambient[i]=1;
nprintf(("%s is ambient, aaaahhh\n",tmp_name));
}
pm->textures[i] = bm_load( tmp_name );
if (pm->textures[i]<0) //if I couldn't find the PCX see if there is an ani-Bobboau
{
nprintf(("couldn't find %s.pcx",tmp_name));
pm->is_ani[i] = 1; //this is an animated texture
pm->textures[i] = bm_load_animation(tmp_name, &pm->num_frames[i], &pm->fps[i], 1);
if(pm->textures[i]<0)
{
Warning( LOCATION, "Couldn't open texture '%s'\nreferenced by model '%s'\n", tmp_name, pm->filename );
pm->textures[i] = -1;
pm->is_ani[i] = 0; //this isn't an animated texture after all
nprintf((" or %s.ani\n",tmp_name));
}
else
{
mprintf(("but I did find %s.ani, ", tmp_name));
mprintf(("with %d frames, ", pm->num_frames[i]));
mprintf(("and a rate of %d\n", pm->fps[i]));
}
}
}
pm->original_textures[i] = pm->textures[i];
//a quick hack for glow mapping-Bobboau
//redid the way glowmaps are handeled
strcat( tmp_name, "-glow");
pm->glow_textures[i] = bm_load( tmp_name );
if (pm->glow_textures[i]<0) { //if I couldn't find the PCX see if there is an ani-Bobboau
nprintf(("couldn't find %s.pcx",tmp_name));
pm->glow_is_ani[i] = 1; //this is an animated texture
pm->glow_textures[i] = bm_load_animation(tmp_name, &pm->glow_numframes[i], &pm->glow_fps[i], 1);
if(pm->glow_textures[i]<0){
// Warning( LOCATION, "Couldn't open glow_texture '%s'\nreferenced by model '%s'\n", tmp_name, pm->filename );
pm->glow_textures[i] = -1;
pm->glow_is_ani[i] = 0; //this isn't an animated texture after all
nprintf((" or %s.ani\n",tmp_name));
}else{
mprintf(("but I did find %s.ani, ", tmp_name));
mprintf(("with %d frames, ", pm->glow_numframes[i]));
mprintf(("and a rate of %d\n", pm->glow_fps[i]));
}
}
pm->glow_original_textures[i] = pm->glow_textures[i];
}
//returns the number of this model
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems)
int model_load(char *filename, int n_subsystems, model_subsystem *subsystems, int ferror, int duplicate)
{
int i, num, arc_idx;
@@ -2174,7 +2281,7 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems)
for (i=0; i< MAX_POLYGON_MODELS; i++) {
if ( Polygon_models[i] ) {
if (!stricmp(filename, Polygon_models[i]->filename)) {
if (!stricmp(filename, Polygon_models[i]->filename) && !duplicate) {
// Model already loaded; just return.
return Polygon_models[i]->id;
}
@@ -2208,8 +2315,9 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems)
}
Assert( (Model_signature % MAX_POLYGON_MODELS) == 0 );
pm->id = Model_signature + num;
Assert( (pm->id % MAX_POLYGON_MODELS) == num );
if (!read_model_file(pm, filename, n_subsystems, subsystems)) {
if (read_model_file(pm, filename, n_subsystems, subsystems, ferror) < 0) {
return -1;
}
@@ -2368,6 +2476,7 @@ int model_load(char *filename, int n_subsystems, model_subsystem *subsystems)
//mprintf(( "Model RAM = %d KB\n", Model_ram ));
#endif
return pm->id;
}
@@ -2938,7 +3047,79 @@ void submodel_rotate(model_subsystem *psub, submodel_instance_info *sii)
break;
}
}
/*
void submodel_ai_rotate(model_subsystem *psub, submodel_instance_info *sii)
{
bsp_info * sm;
if ( psub->subobj_num < 0 ) return;
if(psub->ai_rotation.type = 0) return;
polymodel *pm = model_get(psub->model_num);
sm = &pm->submodel[psub->subobj_num];
if ( sm->movement_type != MOVEMENT_TYPE_ROT ) return;
// save last angles
sii->prev_angs = sii->angs;
// probably send in a calculated desired turn rate
float diff = sii->desired_turn_rate - sii->cur_turn_rate;
float final_turn_rate;
if (diff > 0) {
final_turn_rate = sii->cur_turn_rate + sii->turn_accel * flFrametime;
if (final_turn_rate > sii->desired_turn_rate) {
final_turn_rate = sii->desired_turn_rate;
}
} else if (diff < 0) {
final_turn_rate = sii->cur_turn_rate - sii->turn_accel * flFrametime;
if (final_turn_rate < sii->desired_turn_rate) {
final_turn_rate = sii->desired_turn_rate;
}
} else {
final_turn_rate = sii->desired_turn_rate;
}
float delta = (sii->cur_turn_rate + final_turn_rate) * 0.5f * flFrametime;
sii->cur_turn_rate = final_turn_rate;
//float delta = psub->turn_rate * flFrametime;
switch( sm->movement_axis ) {
case MOVEMENT_AXIS_X:
if (sii->angs.p + delta > psub->ai_rotation.max ){//if it will or has gone past it's max then set it to the max/min
sii->angs.p = psub->ai_rotation.max;
return;
} else if(sii->angs.p + delta < psub->ai_rotation.min){
sii->angs.p = psub->ai_rotation.min;
return;
}
sii->angs.p += delta;
if (sii->angs.p > PI2 )
sii->angs.p -= PI2;
else if (sii->angs.p < 0.0f )
sii->angs.p += PI2;
break;
case MOVEMENT_AXIS_Y:
sii->angs.h += delta;
if (sii->angs.h > PI2 )
sii->angs.h -= PI2;
else if (sii->angs.h < 0.0f )
sii->angs.h += PI2;
break;
case MOVEMENT_AXIS_Z:
sii->angs.b += delta;
if (sii->angs.b > PI2 )
sii->angs.b -= PI2;
else if (sii->angs.b < 0.0f )
sii->angs.b += PI2;
break;
}
}
*/
//=========================================================================
// Make a turret's correct orientation matrix. This should be done when
@@ -3589,3 +3770,44 @@ int model_get_num_dock_points(int modelnum)
pm = model_get(modelnum);
return pm->n_docks;
}
// Goober5000
void model_duplicate_reskin(int modelnum, char *ship_name)
{
polymodel *pm = model_get(modelnum);
int i, j;
char *p = NULL;
char texture_file[MAX_FILENAME_LEN];
// for all textures
for (i=0; i<Num_texture_replacements; i++)
{
// this the right ship?
if (!strcmp(ship_name, Texture_replace[i].ship_name))
{
// look for textures
for (j=0; j<pm->n_textures; j++)
{
// get texture file name
bm_get_filename(pm->textures[j], texture_file);
// get rid of file extension
p = strchr( texture_file, '.' );
if ( p )
{
mprintf(( "ignoring extension on file '%s'\n", texture_file ));
*p = 0;
}
// now compare the extension-less texture file names
if (!stricmp(texture_file, Texture_replace[i].old_texture))
{
// replace it
model_load_texture(pm, j, Texture_replace[i].new_texture);
break; // break out of the one loop
}
}
}
}
}
+2 -2
View File
@@ -121,8 +121,8 @@ void model_calc_bound_box( vector *box, vector *big_mn, vector *big_mx);
void interp_clear_instance();
#define MAX_POLYGON_VECS 1100 //6500 (7x)
#define MAX_POLYGON_NORMS 2800 //6500 (3x)
#define MAX_POLYGON_VECS 3500 //6500 (7x)
#define MAX_POLYGON_NORMS 5500 //6500 (3x)
extern vector *Interp_verts[MAX_POLYGON_VECS];
+16 -3
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Nebula/Neb.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-11-18 21:32:48 $
* $Author: phreak $
*
* Nebula effect
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:25 penguin
* Warpcore CVS sync
*
@@ -426,6 +429,11 @@ void neb2_level_init()
Neb_backg_fog_near = NEB_BACKG_FOG_NEAR_D3D;
Neb_backg_fog_far = NEB_BACKG_FOG_FAR_D3D;
break;
case GR_OPENGL:
Neb_backg_fog_near = NEB_BACKG_FOG_NEAR_D3D;
Neb_backg_fog_far = NEB_BACKG_FOG_FAR_D3D;
break;
case GR_SOFTWARE:
Assert(Fred_running);
break;
@@ -1143,6 +1151,11 @@ void neb2_get_fog_values(float *fnear, float *ffar, object *objp)
*ffar = Neb_ship_fog_vals_d3d[fog_index][1];
break;
case GR_OPENGL:
*fnear = Neb_ship_fog_vals_d3d[fog_index][0];
*ffar = Neb_ship_fog_vals_d3d[fog_index][1];
break;
default:
Int3();
}
+22 -3
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/Network/Multi.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2002-12-24 07:42:29 $
* $Author: Goober5000 $
*
* C file that contains high-level multiplayer functions
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/12/17 02:18:40 Goober5000
* added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
* --Goober5000
*
* Revision 2.2 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.1 2002/07/22 01:22:25 penguin
* Linux port -- added NO_STANDALONE ifdefs
*
@@ -913,10 +920,18 @@ void process_packet_normal(ubyte* data, header *header_info)
process_cargo_revealed_packet( data, header_info);
break;
case CARGO_HIDDEN:
process_cargo_hidden_packet( data, header_info);
break;
case SUBSYS_CARGO_REVEALED:
process_subsystem_cargo_revealed_packet( data, header_info);
break;
case SUBSYS_CARGO_HIDDEN:
process_subsystem_cargo_hidden_packet( data, header_info);
break;
case MISSION_GOAL_INFO:
process_mission_goal_info_packet(data, header_info);
break;
@@ -1029,6 +1044,10 @@ void process_packet_normal(ubyte* data, header *header_info)
process_change_iff_packet(data, header_info);
break;
case CHANGE_AI_CLASS:
process_change_ai_class_packet(data, header_info);
break;
case PRIMARY_FIRED_NEW:
process_NEW_primary_fired_packet(data, header_info);
break;
+17 -3
View File
@@ -9,14 +9,21 @@
/*
* $Logfile: /Freespace2/code/Network/Multi.h $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2002-12-24 07:42:29 $
* $Author: Goober5000 $
*
* Header file which contains type definitions for multiplayer, and support for high-level
* multiplayer functions.
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/12/17 02:18:40 Goober5000
* added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
* --Goober5000
*
* Revision 2.2 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.1 2002/07/22 01:22:25 penguin
* Linux port -- added NO_STANDALONE ifdefs
*
@@ -533,6 +540,13 @@ struct CFILE;
#define EMP_EFFECT 0xEB // EMP effect (mission disk only)
#define CHANGE_IFF 0xEC // change iff (1.04+ only)
#define CARGO_HIDDEN 0xED // cargo is hidden
#define SUBSYS_CARGO_HIDDEN 0xEE // Capital ship cargo subsystem is hidden
#define CHANGE_AI_CLASS 0xEF // change ai class
#define NO_SUBSYS_STRING "NO-SUBSYS" // see change_ai_class - because same routine is used
// for both ships and subsystems
#define MAX_TYPE_ID 0xFF // better not try to send > 255 in a single byte buddy
// ingame ack data codes
+51 -5
View File
@@ -9,11 +9,21 @@
/*
* $Logfile: /Freespace2/code/Network/multi_ingame.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:07 $
* $Author: penguin $
* $Revision: 2.5 $
* $Date: 2003-01-03 21:58:08 $
* $Author: Goober5000 $
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2002/12/31 18:59:43 Goober5000
* if it ain't broke, don't fix it
* --Goober5000
*
* Revision 2.2 2002/12/10 05:43:34 Goober5000
* Full-fledged ballistic primary support added! Try it and see! :)
*
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:26 penguin
* Warpcore CVS sync
*
@@ -1264,7 +1274,7 @@ void multi_ingame_handle_timeout()
void process_ingame_ships_packet( ubyte *data, header *hinfo )
{
int offset, sflags, oflags, team, j;
int offset, sflags, sflags2, oflags, team, j;
ubyte p_type;
ushort net_signature;
short wing_data;
@@ -1303,6 +1313,7 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
GET_STRING( ship_name );
GET_DATA( net_signature );
GET_DATA( sflags );
GET_DATA( sflags2 );
GET_DATA( oflags );
GET_DATA( team );
GET_DATA( wing_data );
@@ -1336,6 +1347,7 @@ void process_ingame_ships_packet( ubyte *data, header *hinfo )
// assign any common data
strcpy(Ships[ship_num].ship_name, ship_name);
Ships[ship_num].flags = sflags;
Ships[ship_num].flags2 = sflags2;
Ships[ship_num].team = team;
Ships[ship_num].wingnum = (int)wing_data;
@@ -1427,6 +1439,7 @@ void send_ingame_ships_packet(net_player *player)
ADD_STRING( shipp->ship_name );
ADD_DATA( Objects[so->objnum].net_signature );
ADD_DATA( shipp->flags );
ADD_DATA( shipp->flags2 );
ADD_DATA( Objects[so->objnum].flags );
ADD_DATA( shipp->team );
wing_data = (short)shipp->wingnum;
@@ -1692,6 +1705,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
{
ubyte data[MAX_PACKET_SIZE],val;
ship *shipp;
ship_info *sip;
int i, packet_size = 0;
ushort signature;
p_object *pobj;
@@ -1712,6 +1726,7 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
case INGAME_SR_CONFIRM:
// get a pointer to the ship
shipp = &Ships[Objects[rdata].instance];
sip = &Ship_info[shipp->ship_info_index];
// add the most recent position and orientation for the requested ship
ADD_DATA(Objects[rdata].pos);
@@ -1731,6 +1746,13 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
val = (ubyte)shipp->engine_recharge_index;
ADD_DATA(val);
// add the ballistic primary flag - Goober5000
val = 0;
if(sip->flags & SIF_BALLISTIC_PRIMARIES){
val |= (1<<0);
}
ADD_DATA(val);
// add current primary and secondary banks, and add link status
val = (ubyte)shipp->weapons.current_primary_bank;
ADD_DATA(val);
@@ -1746,6 +1768,16 @@ void send_ingame_ship_request_packet(int code,int rdata,net_player *pl)
ADD_DATA(val);
}
// add the current ammo count for primary banks - copied from above - Goober5000
val = (ubyte)shipp->weapons.num_primary_banks; // for sanity checking
ADD_DATA(val);
for ( i = 0; i < shipp->weapons.num_primary_banks; i++ )
{
Assert( shipp->weapons.primary_bank_ammo[i] < UCHAR_MAX );
val = (ubyte)shipp->weapons.primary_bank_ammo[i];
ADD_DATA(val);
}
// add the link status of weapons
// primary link status
val = 0;
@@ -1832,7 +1864,7 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
int offset = HEADER_LENGTH;
int team, slot_index, i;
uint respawn_count;
ubyte val, num_secondary_banks;
ubyte val, num_secondary_banks, num_primary_banks;
p_object *pobj;
// get the code
@@ -1960,6 +1992,12 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
GET_DATA(val);
Player_ship->engine_recharge_index = val;
// handle the ballistic primary flag - Goober5000
GET_DATA(val);
if(val & (1<<0)){
Player_ship->flags |= SIF_BALLISTIC_PRIMARIES;
}
// get current primary and secondary banks, and add link status
GET_DATA(val);
Player_ship->weapons.current_primary_bank = val;
@@ -1974,6 +2012,14 @@ void process_ingame_ship_request_packet(ubyte *data, header *hinfo)
Player_ship->weapons.secondary_bank_ammo[i] = val;
}
// primary bank ammo data - copied from above - Goober5000
GET_DATA( num_primary_banks );
Assert( num_primary_banks == Player_ship->weapons.num_primary_banks );
for ( i = 0; i < Player_ship->weapons.num_primary_banks; i++ )
{
GET_DATA(val);
Player_ship->weapons.primary_bank_ammo[i] = val;
}
// get the link status of weapons
GET_DATA(val);
+1 -1
View File
@@ -1142,7 +1142,7 @@ int multi_oo_maybe_update(net_player *pl, object *obj, ubyte *data)
oo_flags = OO_POS_NEW | OO_ORIENT_NEW;
// if its a small ship, add weapon link info
if((sip != NULL) && (sip->flags & (SIF_FIGHTER | SIF_BOMBER | SIF_STEALTH))){
if((sip != NULL) && (sip->flags & (SIF_FIGHTER | SIF_BOMBER | SIF_SHIP_CLASS_STEALTH))){
// primary bank 0 or 1
if(shipp->weapons.current_primary_bank > 0){
oo_flags |= OO_PRIMARY_BANK;
+207 -10
View File
@@ -9,13 +9,34 @@
/*
* $Logfile: /Freespace2/code/Network/MultiMsgs.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:08 $
* $Author: penguin $
* $Revision: 2.7 $
* $Date: 2003-02-16 18:55:35 $
* $Author: phreak $
*
* C file that holds functions for the building and processing of multiplayer packets
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2003/01/19 07:02:16 Goober5000
* fixed a bunch of bugs - "no-subspace-drive" should now work properly for
* all ships, and all ships who have their departure anchor set to a capital ship
* should exit to that ship when told to depart
* --Goober5000
*
* Revision 2.5 2002/12/24 07:42:29 Goober5000
* added change-ai-class and is-ai-class, and I think I may also have nailed the
* is-iff bug; did some other bug hunting as well
* --Goober5000
*
* Revision 2.4 2002/12/17 02:18:40 Goober5000
* added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
* --Goober5000
*
* Revision 2.3 2002/12/09 08:26:24 Goober5000
* fixed misspelling
*
* Revision 2.2 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.1 2002/07/22 01:22:25 penguin
* Linux port -- added NO_STANDALONE ifdefs
*
@@ -2879,6 +2900,58 @@ void process_cargo_revealed_packet( ubyte *data, header *hinfo )
}
}
// packet to tell clients cargo of a ship was hidden to all
void send_cargo_hidden_packet( ship *shipp )
{
ubyte data[MAX_PACKET_SIZE];
int packet_size;
// build the header and add the data
BUILD_HEADER(CARGO_HIDDEN);
ADD_DATA( Objects[shipp->objnum].net_signature );
// server sends to all players
if(MULTIPLAYER_MASTER){
multi_io_send_to_all_reliable(data, packet_size);
}
// clients just send to the server
else {
multi_io_send_reliable(Net_player, data, packet_size);
}
}
// process a cargo hidden packet
void process_cargo_hidden_packet( ubyte *data, header *hinfo )
{
int offset;
ushort signature;
object *objp;
offset = HEADER_LENGTH;
GET_DATA(signature);
PACKET_SET_SIZE();
// get a ship pointer and call the ship function to hide the cargo
objp = multi_get_network_object( signature );
if ( objp == NULL ) {
nprintf(("Network", "Could not find object with net signature %d for cargo hidden\n", signature ));
return;
}
// Assert( objp->type == OBJ_SHIP );
if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){
return;
}
// this will take care of re-routing to all other clients
ship_do_cargo_hidden( &Ships[objp->instance], 1);
// server should rebroadcast
if(MULTIPLAYER_MASTER){
send_cargo_hidden_packet(&Ships[objp->instance]);
}
}
// defines used for secondary fire packet
#define SFPF_ALLOW_SWARM (1<<7)
#define SFPF_DUAL_FIRE (1<<6)
@@ -2916,7 +2989,7 @@ void send_secondary_fired_packet( ship *shipp, ushort starting_sig, int starting
ADD_DATA( Objects[shipp->objnum].net_signature );
ADD_DATA( starting_sig );
// add a couple of bits for swarm missiles and dual fire secondary weaspons
// add a couple of bits for swarm missiles and dual fire secondary weapons
sinfo = 0;
sinfo = current_bank;
@@ -4511,7 +4584,6 @@ void process_subsystem_cargo_revealed_packet( ubyte *data, header *hinfo )
}
// this will take care of re-routing to all other clients
void ship_do_cap_subsys_cargo_revealed( ship *shipp, ship_subsys *subsys, int from_network );
ship_do_cap_subsys_cargo_revealed( shipp, subsysp, 1 );
// server should rebroadcast
@@ -4520,6 +4592,75 @@ void process_subsystem_cargo_revealed_packet( ubyte *data, header *hinfo )
}
}
// packet to tell clients cargo of a ship was hidden to all
void send_subsystem_cargo_hidden_packet( ship *shipp, int index )
{
ubyte data[MAX_PACKET_SIZE], uindex;
int packet_size;
Assert ( index < UCHAR_MAX );
uindex = (ubyte)(index);
// build the header and add the data
BUILD_HEADER(SUBSYS_CARGO_HIDDEN);
ADD_DATA( Objects[shipp->objnum].net_signature );
ADD_DATA( uindex );
// server sends to all players
if(MULTIPLAYER_MASTER){
multi_io_send_to_all_reliable(data, packet_size);
}
// clients just send to the server
else {
multi_io_send_reliable(Net_player, data, packet_size);
}
}
// process a subsystem cargo hidden packet
void process_subsystem_cargo_hidden_packet( ubyte *data, header *hinfo )
{
int offset;
ushort signature;
ubyte uindex;
object *objp;
ship *shipp;
ship_subsys *subsysp;
offset = HEADER_LENGTH;
GET_DATA( signature );
GET_DATA( uindex );
PACKET_SET_SIZE();
// get a ship pointer and call the ship function to reveal the cargo
objp = multi_get_network_object( signature );
if ( objp == NULL ) {
nprintf(("Network", "Could not find object with net signature %d for cargo hidden\n", signature ));
return;
}
// Assert( objp->type == OBJ_SHIP );
if((objp->type != OBJ_SHIP) || (objp->instance < 0) || (objp->instance >= MAX_SHIPS)){
return;
}
shipp = &Ships[objp->instance];
// call to get the pointer to the subsystem we should be working on
subsysp = ship_get_indexed_subsys( shipp, (int)uindex );
if (subsysp == NULL) {
nprintf(("Network", "Could not find subsys for ship %s for cargo hidden\n", Ships[objp->instance].ship_name ));
return;
}
// this will take care of re-routing to all other clients
ship_do_cap_subsys_cargo_hidden( shipp, subsysp, 1 );
// server should rebroadcast
if(MULTIPLAYER_MASTER){
send_subsystem_cargo_hidden_packet(&Ships[objp->instance], (int)uindex);
}
}
void send_netplayer_load_packet(net_player *pl)
{
ubyte data[MAX_PACKET_SIZE];
@@ -4749,7 +4890,7 @@ void process_repair_info_packet(ubyte *data, header *hinfo)
}
} else {
if ( code == REPAIR_INFO_WARP_ADD ){
mission_warp_in_support_ship( repaired_objp );
mission_bring_in_support_ship( repaired_objp );
} else {
mission_remove_scheduled_repair( repaired_objp );
}
@@ -6216,7 +6357,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player *
case STATS_ALLTIME:
// alltime kills
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
u_tmp = sc->kills[idx];
u_tmp = (ushort)sc->kills[idx];
ADD_DATA(u_tmp);
}
// medal information
@@ -6247,7 +6388,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player *
case STATS_MISSION:
// mission OKkills
for(idx=0;idx<MAX_SHIP_TYPES;idx++){
u_tmp = sc->m_okKills[idx];
u_tmp = (ushort)sc->m_okKills[idx];
ADD_DATA(u_tmp);
}
@@ -6274,7 +6415,7 @@ void send_player_stats_block_packet(net_player *pl, int stats_code, net_player *
case STATS_DOGFIGHT_KILLS:
for(idx=0; idx<MAX_PLAYERS; idx++){
u_tmp = sc->m_dogfight_kills[idx];
u_tmp = (ushort)sc->m_dogfight_kills[idx];
ADD_DATA(u_tmp);
}
ADD_DATA(sc->m_kill_count);
@@ -7264,6 +7405,62 @@ void process_change_iff_packet( ubyte *data, header *hinfo)
}
}
void send_change_ai_class_packet(ushort net_signature, char *subsystem, int new_ai_class)
{
ubyte data[MAX_PACKET_SIZE];
int packet_size = 0;
if(Net_player == NULL){
return;
}
if(!(Net_player->flags & NETINFO_FLAG_AM_MASTER)){
return;
}
// build the packet and add the data
BUILD_HEADER(CHANGE_AI_CLASS);
ADD_DATA(net_signature);
if (subsystem)
ADD_STRING(subsystem);
else
ADD_STRING(NO_SUBSYS_STRING);
ADD_DATA(new_ai_class);
// send to all players
multi_io_send_to_all_reliable(data, packet_size);
}
void process_change_ai_class_packet(ubyte *data, header *hinfo)
{
int offset = HEADER_LENGTH;
ushort net_signature;
int new_ai_class;
char subsys_buf[255];
object *objp;
// get the data
GET_DATA(net_signature);
GET_STRING(subsys_buf);
GET_DATA(new_ai_class);
PACKET_SET_SIZE();
// lookup the object
objp = multi_get_network_object(net_signature);
if((objp != NULL) && (objp->type == OBJ_SHIP) && (objp->instance >=0))
{
// no subsystem?
if (!strcmp(subsys_buf, NO_SUBSYS_STRING))
{
ship_set_new_ai_class(objp->instance, new_ai_class);
}
// subsystem
else
{
ship_subsystem_set_new_ai_class(objp->instance, subsys_buf, new_ai_class);
}
}
}
void send_NEW_primary_fired_packet(ship *shipp, int banks_fired)
{
int packet_size, objnum;
@@ -7311,7 +7508,7 @@ void send_NEW_primary_fired_packet(ship *shipp, int banks_fired)
}
// build up the standard weapon fired packet. This packet will get sent to all players if an AI
// ship fired the primary weapons. If a player fired the weaspon, then this packet will get sent
// ship fired the primary weapons. If a player fired the weapon, then this packet will get sent
// to every player but the guy who actullly fired the weapon. This method is used to help keep client
// and server in sync w.r.t. weapon energy for player ship
BUILD_HEADER( PRIMARY_FIRED_NEW );
+23 -4
View File
@@ -9,13 +9,20 @@
/*
* $Logfile: /Freespace2/code/Network/multimsgs.h $
* $Revision: 2.0 $
* $Date: 2002-06-03 04:02:26 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-24 07:42:29 $
* $Author: Goober5000 $
*
* Header file for the building and sending of multiplayer packets
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/12/17 02:18:40 Goober5000
* added functionality and fixed a few things with cargo being revealed and hidden in preparation for the set-scanned and set-unscanned sexp commit
* --Goober5000
*
* Revision 2.0 2002/06/03 04:02:26 penguin
* Warpcore CVS sync
*
* Revision 1.1 2002/05/02 18:03:11 mharris
* Initial checkin - converted filenames and includes to lower case
*
@@ -398,6 +405,10 @@ void process_cargo_revealed_packet( ubyte *data, header *hinfo );
void process_subsystem_cargo_revealed_packet( ubyte *data, header *hinfo );
void process_cargo_hidden_packet( ubyte *data, header *hinfo );
void process_subsystem_cargo_hidden_packet( ubyte *data, header *hinfo );
void process_mission_goal_info_packet( ubyte *data, header *hinfo );
void process_player_kick_packet(ubyte *data, header *hinfo);
@@ -594,6 +605,10 @@ void send_cargo_revealed_packet(ship *shipp);
void send_subsystem_cargo_revealed_packet(ship *shipp, int index);
void send_cargo_hidden_packet(ship *shipp);
void send_subsystem_cargo_hidden_packet(ship *shipp, int index);
void send_mission_goal_info_packet(int goal_num, int new_status, int valid);
void send_player_settings_packet(net_player *p = NULL);
@@ -650,7 +665,11 @@ void process_reinforcement_avail( ubyte *data, header *hinfo );
// change iff stuff
void send_change_iff_packet(ushort net_signature, int new_team);
void process_change_iff_packet( ubyte *data, header *hinfo);
void process_change_iff_packet( ubyte *data, header *hinfo );
// change ai class stuff
void send_change_ai_class_packet(ushort net_signature, char *subsystem, int new_ai_class);
void process_change_ai_class_packet( ubyte *data, header *hinfo );
// new primary fired info
void send_NEW_primary_fired_packet(ship *shipp, int banks_fired);
+8 -4
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Network/Psnet2.cpp $
* $Revision: 2.3 $
* $Date: 2002-08-01 01:41:08 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2002-12-02 23:18:53 $
* $Author: Goober5000 $
*
* C file containing application level network-interface.
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.2 2002/07/30 14:29:15 unknownplayer
*
* Started work on DX8.1 implementation. Updated the project files to encompass
@@ -2616,7 +2619,8 @@ void psnet_ras_status()
void psnet_socket_options( SOCKET sock )
{
int broadcast;
int ret, cursize, bufsize;
// int ret;
int cursize, bufsize;
socklen_t cursizesize;
// Set the mode of the socket to allow broadcasting. We need to be able to broadcast
+14 -5
View File
@@ -9,13 +9,21 @@
/*
* $Logfile: /Freespace2/code/Object/CollideShipShip.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:08 $
* $Author: penguin $
* $Revision: 2.4 $
* $Date: 2003-01-24 03:48:11 $
* $Author: Goober5000 $
*
* Routines to detect collisions and do physics, damage, etc for ships and ships
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2003/01/18 09:25:42 Goober5000
* fixed bug I inadvertently introduced by modifying SIF_ flags with sexps rather
* than SF_ flags
* --Goober5000
*
* Revision 2.2 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.1 2002/07/26 16:17:46 penguin
* renamed 'big' and 'small' (conflict w/ MS include file)
*
@@ -732,7 +740,7 @@ int ship_ship_check_collision(collision_info_struct *ship_ship_hit_info, vector
mc.flags = (MC_CHECK_MODEL | MC_CHECK_SPHERELINE); // flags
// Only check invisible face polygons for ship:ship of different teams.
if ( !(Ship_info[Ships[heavy_obj->instance].ship_info_index].flags & SIF_DONT_COLLIDE_INVIS) ) {
if ( !(Ships[heavy_obj->instance].flags2 & SF2_DONT_COLLIDE_INVIS) ) {
if ((heavy_obj->flags & OF_PLAYER_SHIP) || (light_obj->flags & OF_PLAYER_SHIP) || (Ships[heavy_obj->instance].team != Ships[light_obj->instance].team) ) {
mc.flags |= MC_CHECK_INVISIBLE_FACES;
}
@@ -1532,7 +1540,8 @@ void do_kamikaze_crash(object *obj1, object *obj2)
}
// response when hit by fast moving cap ship
void maybe_push_little_ship_from_fast_big_ship(object *big_obj, object *small_obj, float impulse, vector *normal)
void maybe_push_little_ship_from_fast_big_ship(object *big_obj, object *small_obj, float impulse, vector *normal)
{
// Move player out of the way of a BIG|HUGE ship warping in or out
if (Ship_info[Ships[big_obj->instance].ship_info_index].flags & (SIF_CAPITAL|SIF_SUPERCAP)) {
+43 -14
View File
@@ -9,13 +9,31 @@
/*
* $Logfile: /Freespace2/code/Object/CollideShipWeapon.cpp $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:08 $
* $Author: penguin $
* $Revision: 2.5 $
* $Date: 2003-02-25 06:22:49 $
* $Author: bobboau $
*
* Routines to detect collisions and do physics, damage, etc for weapons and ships
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2003/01/24 03:48:11 Goober5000
* aw, nuts - fixed a dumb bug with my new don't-collide-invisible code :p
* --Goober5000
*
* Revision 2.3 2003/01/18 09:25:42 Goober5000
* fixed bug I inadvertently introduced by modifying SIF_ flags with sexps rather
* than SF_ flags
* --Goober5000
*
* Revision 2.2 2002/12/07 01:37:42 bobboau
* inital decals code, if you are worried a bug is being caused by the decals code it's only references are in,
* collideshipweapon.cpp line 262, beam.cpp line 2771, and modelinterp.cpp line 2949.
* it needs a better renderer, but is in prety good shape for now,
* I also (think) I squashed a bug in the warpmodel code
*
* Revision 2.1 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:27 penguin
* Warpcore CVS sync
*
@@ -248,6 +266,18 @@ void ship_weapon_do_hit_stuff(object *ship_obj, object *weapon_obj, vector *worl
// apply a whack
ship_apply_whack( &force, hitpos, ship_obj );
}
if(quadrant_num == -1){
weapon_info *wip = &Weapon_info[Weapons[weapon_obj->instance].weapon_info_index];
decal_point dec;
dec.orient = weapon_obj->orient;
dec.pnt.xyz = hitpos->xyz;
dec.radius = wip->decal_rad;
if((dec.radius > 0) && (wip->decal_texture > -1))
decal_create(ship_obj, &dec, submodel_num, wip->decal_texture, wip->decal_backface_texture );
}
}
extern int Framecount;
@@ -325,21 +355,21 @@ int ship_weapon_check_collision(object * ship_obj, object * weapon_obj, float ti
// vector through to the hull if there is leftover damage.
if (!(shipp->flags & SF_DYING) && ship_is_shield_up(ship_obj,quadrant_num) ) {
// WIF2_PIERCE pierces shields
// AL 1-14-97: "Puncture" doesn't mean penetrate shield anymore, it means that it punctures
// hull do inflict maximum subsystem damage
/*
if ( Weapon_info[Weapons[other_obj->instance].weapon_info_index].wi_flags & WIF_PUNCTURE ) {
if ( Weapon_info[Weapons[weapon_obj->instance].weapon_info_index].wi_flags2 & WIF2_PIERCE ) {
// If this weapon punctures the shield, then do
// the hit effect, but act like a shield collision never occurred.
quadrant_num = -1; // ignore shield hit
add_shield_point(obj-Objects, mc.shield_hit_tri, &mc.hit_point);
add_shield_point(ship_obj-Objects, mc.shield_hit_tri, &mc.hit_point);
} else {
*/
valid_hit_occured = 1;
// shield effect
add_shield_point(ship_obj-Objects, mc.shield_hit_tri, &mc.hit_point);
do_model_check = 0; // since we hit the shield, no need to check the model
valid_hit_occured = 1;
// shield effect
add_shield_point(ship_obj-Objects, mc.shield_hit_tri, &mc.hit_point);
do_model_check = 0; // since we hit the shield, no need to check the model
}
} else {
quadrant_num = -1; // ignore shield hit
}
@@ -377,7 +407,7 @@ int ship_weapon_check_collision(object * ship_obj, object * weapon_obj, float ti
if (vm_vec_dot(&vec_to_ship, &weapon_obj->orient.vec.fvec) < 0.0f) {
// check if we're colliding against "invisible" ship
if (!(Ship_info[shipp->ship_info_index].flags & SIF_DONT_COLLIDE_INVIS)) {
if (!(shipp->flags2 & SF2_DONT_COLLIDE_INVIS)) {
wp->lifeleft = 0.001f;
if (ship_obj == Player_obj)
nprintf(("Jim", "Frame %i: Weapon %i set to detonate, dist = %7.3f.\n", Framecount, weapon_obj-Objects, dist));
@@ -388,7 +418,6 @@ int ship_weapon_check_collision(object * ship_obj, object * weapon_obj, float ti
}
}
return valid_hit_occured;
}
+30 -10
View File
@@ -9,13 +9,28 @@
/*
* $Logfile: /Freespace2/code/Object/Object.cpp $
* $Revision: 2.2 $
* $Date: 2002-10-19 19:29:27 $
* $Revision: 2.6 $
* $Date: 2003-02-25 06:22:49 $
* $Author: bobboau $
*
* Code to manage objects
*
* $Log: not supported by cvs2svn $
* Revision 2.5 2003/02/16 05:14:29 bobboau
* added glow map nebula bug fix for d3d, someone should add a fix for glide too
* more importantly I (think I) have fixed all major bugs with fighter beams, and added a bit of new functionality
*
* Revision 2.4 2003/01/19 01:07:41 bobboau
* redid the way glowmaps are handeled, you now must set the global int GLOWMAP (no longer an array) before you render a poly that uses a glow map then set GLOWMAP to -1 when you're done with, fixed a few other misc bugs it
*
* Revision 2.3 2002/11/14 04:18:17 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
* Revision 2.2 2002/10/19 19:29:27 bobboau
* inital commit, trying to get most of my stuff into FSO, there should be most of my fighter beam, beam rendering, beam sheild hit, ABtrails, and ssm stuff. one thing you should be happy to know is the beam texture tileing is now set in the beam section section of the weapon table entry
*
* Revision 2.1 2002/08/01 01:41:08 penguin
* The big include file move
*
@@ -1092,7 +1107,6 @@ float Avg_delay_total;
void obj_player_fire_stuff( object *objp, control_info ci )
{
ship *shipp;
int has_fired = -1; //stop fireing stuff-Bobboau
Assert( objp->flags & OF_PLAYER_SHIP);
@@ -1115,18 +1129,20 @@ void obj_player_fire_stuff( object *objp, control_info ci )
// fire non-streaming primaries here
ship_fire_primary( objp, 0 );
has_fired = -1;
// ship_stop_fire_primary(objp); //if it hasn't fired do the "has just stoped fireing" stuff
} else {
// unflag the ship as having the trigger down
if(shipp != NULL){
shipp->flags &= ~(SF_TRIGGER_DOWN);
has_fired = -1;
ship_stop_fire_primary(objp); //if it hasn't fired do the "has just stoped fireing" stuff
}
}
if ( ci.fire_countermeasure_count ){
ship_launch_countermeasure( objp );
}
}else{
// ship_stop_fire_primary(objp);
}
#ifndef NO_NETWORK
@@ -1153,10 +1169,6 @@ void obj_player_fire_stuff( object *objp, control_info ci )
afterburners_stop( objp, 1 );
}
if(has_fired == -1){
ship_stop_fire_primary(objp); //if it hasn't fired do the "has just stoped fireing" stuff
}
}
void obj_move_call_physics(object *objp, float frametime)
@@ -1253,6 +1265,7 @@ obj_maybe_fire:
if ( (objp->flags & OF_PLAYER_SHIP) && (objp->type != OBJ_OBSERVER) && (objp == Player_obj)) {
player *pp;
if(Player != NULL){
// has_fired = 1;
pp = Player;
obj_player_fire_stuff( objp, pp->ci );
}
@@ -1261,7 +1274,12 @@ obj_maybe_fire:
// fire streaming weapons for ships in here - ALL PLAYERS, regardless of client, single player, server, whatever.
// do stream weapon firing for all ships themselves.
if(objp->type == OBJ_SHIP){
has_fired = ship_fire_primary(objp, 1, 0);
ship_fire_primary(objp, 1, 0);
// if(ship_fire_primary(objp, 1, 0) < 1){
has_fired = 1;
// }else{
// has_fired = -1;
// }
}
}
}
@@ -1773,6 +1791,8 @@ void obj_move_all(float frametime)
// update artillery locking info now
ship_update_artillery_lock();
mprintf(("moved all objects\n"));
}
+13 -8
View File
@@ -9,13 +9,16 @@
/*
* $Logfile: /Freespace2/code/Object/Object.h $
* $Revision: 2.1 $
* $Date: 2002-08-01 01:41:08 $
* $Author: penguin $
* $Revision: 2.2 $
* $Date: 2002-12-10 05:43:33 $
* $Author: Goober5000 $
*
* <insert description of file here>
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:08 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:27 penguin
* Warpcore CVS sync
*
@@ -428,7 +431,7 @@ extern char *Object_type_names[MAX_OBJECT_TYPES];
#define OF_INVULNERABLE (1<<4) // invulnerable
#define OF_PROTECTED (1<<5) // Don't kill this object, probably mission-critical.
#define OF_PLAYER_SHIP (1<<6) // this object under control of some player -- don't do ai stuff on it!!!
#define OF_NO_SHIELDS (1<<7) // object has no shield generator system (i.e. no shileds)
#define OF_NO_SHIELDS (1<<7) // object has no shield generator system (i.e. no shields)
#define OF_JUST_UPDATED (1<<8) // for multiplayer -- indicates that we received object update this frame
#define OF_COULD_BE_PLAYER (1<<9) // for multiplayer -- indicates that it is selectable ingame joiners as their ship
#define OF_WAS_RENDERED (1<<10) // Set if this object was rendered this frame. Only gets set if OF_RENDERS set. Gets cleared or set in obj_render_all().
@@ -436,12 +439,14 @@ extern char *Object_type_names[MAX_OBJECT_TYPES];
#define OF_BEAM_PROTECTED (1<<12) // don't fire beam weapons at this type of object, probably mission critical.
#define OF_GUARDIAN (1<<13) // Don't allow ship to die, keep at least 1% hull
#define OF_SPECIAL_WARP (1<<14) // Object has special warp-in enabled.
#define OF_NO_LASERS (1<<15) // object has no laser energy management system
#define OF_NO_ENGINES (1<<16) // object has no engine power
// Flags used by Fred
#define OF_MARKED (1<<16) //Object is marked (Fred). Can be reused in Freespace for anything that won't be used by Fred.
#define OF_TEMP_MARKED (1<<17) //Temporarily marked (Fred).
#define OF_REFERENCED (1<<18) // (Fred) Object is referenced by something somewhere
#define OF_HIDDEN (1<<19) // Object is hidden (not shown) and can't be manipulated
#define OF_MARKED (1<<17) //Object is marked (Fred). Can be reused in Freespace for anything that won't be used by Fred.
#define OF_TEMP_MARKED (1<<18) //Temporarily marked (Fred).
#define OF_REFERENCED (1<<19) // (Fred) Object is referenced by something somewhere
#define OF_HIDDEN (1<<20) // Object is hidden (not shown) and can't be manipulated
// max # of object sounds per object
#define MAX_OBJECT_SOUNDS 4
+19 -20
View File
@@ -7,26 +7,22 @@
*
*/
/*
/*
* $Logfile: /Freespace2/code/OsApi/OsApi.cpp $
* $Revision: 2.2 $
* $Date: 2002-08-01 01:41:09 $
* $Author: penguin $
* $Revision: 2.5 $
* $Date: 2003-02-22 04:14:21 $
* $Author: wmcoolmon $
*
* Low level Windows code
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/07/07 19:55:59 penguin
* Back-port to MSVC
* Revision 2.4 2003/01/07 00:02:08 phreak
* fixed problem in win32_create_window() that disabled OpenGL from running in windowed mode
*
* Revision 2.0 2002/06/03 04:02:27 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/09 13:52:01 mharris
* debug_int3() calls abort()
*
* Revision 1.1 2002/05/02 18:03:12 mharris
* Initial checkin - converted filenames and includes to lower case
* Revision 2.3 2002/11/14 04:18:17 bobboau
* added warp model and type 1 glow points
* and well as made the new glow file type,
* some general improvement to fighter beams,
*
*
* 7 6/30/99 5:53p Dave
@@ -382,6 +378,13 @@ BOOL __stdcall os_enum_windows( HWND hwnd, char * search_string )
}
bool os_app_activate_hook_on = true;
void os_app_activate_set(bool state)
{
os_app_activate_hook_on = state;
}
int Got_message = 0;
// message handler for the main thread
LRESULT CALLBACK win32_message_handler(HWND hwnd,UINT msg,WPARAM wParam, LPARAM lParam)
@@ -602,7 +605,7 @@ BOOL win32_create_window()
int windowed = 0;
int hires = 0;
char *ptr = os_config_read_string(NULL, NOX("Videocard"), NULL);
if(ptr && strstr(ptr, NOX("Direct 3D -")) && Cmdline_window){
if(ptr && ( (strstr(ptr, NOX("Direct 3D -")) ) || (strstr(ptr, NOX("OpenGL -")))) && Cmdline_window){
windowed = 1;
}
if(ptr && strstr(ptr, NOX("1024")) && Cmdline_window){
@@ -705,11 +708,7 @@ void os_poll()
void debug_int3()
{
#ifdef _WIN32
gr_activate(0);
_asm { int 3 };
gr_activate(1);
#else
abort();
#endif
}
}
+4 -3
View File
@@ -6,13 +6,13 @@
* source.
*
*/
#include "globalincs/pstypes.h"
#include "OsRegistry.h"
#ifndef _OSAPI_H
#define _OSAPI_H
#include "globalincs/pstypes.h"
// --------------------------------------------------------------------------------------------------
// OSAPI DEFINES/VARS
//
@@ -59,6 +59,7 @@ int os_foreground();
// Returns the handle to the main window
uint os_get_window();
void os_app_activate_set(bool state);
// process management --------------------------------------------------------------
+1 -1
View File
@@ -6,7 +6,7 @@
* source.
*
*/
#include <windows.h>
#include <string.h>
#include "globalincs/pstypes.h"
+2 -2
View File
@@ -19,7 +19,7 @@ extern char *Osreg_company_name;
extern char *Osreg_class_name;
extern char *Osreg_app_name;
extern char *Osreg_title;
// ------------------------------------------------------------------------------------------------------------
// REGISTRY FUNCTIONS
@@ -59,4 +59,4 @@ unsigned int os_config_read_uint( char *section, char *name, unsigned int defau
// uses Ex versions of Windows registry functions
char * os_config_read_string_ex( char *keyname, char *name, char *default_value );
#endif
#endif
+11 -19
View File
@@ -9,25 +9,13 @@
/*
* $Logfile: /Freespace2/code/OsApi/OutWnd.cpp $
* $Revision: 2.2 $
* $Date: 2002-10-19 19:29:28 $
* $Revision: 2.3 $
* $Date: 2002-11-14 04:18:17 $
* $Author: bobboau $
*
* Routines for debugging output
*
* $Log: not supported by cvs2svn $
* Revision 2.1 2002/08/01 01:41:09 penguin
* The big include file move
*
* Revision 2.0 2002/06/03 04:02:27 penguin
* Warpcore CVS sync
*
* Revision 1.2 2002/05/09 13:52:26 mharris
* Removed dead test code
*
* Revision 1.1 2002/05/02 18:03:12 mharris
* Initial checkin - converted filenames and includes to lower case
*
*
* 6 6/03/99 6:37p Dave
* More TNT fun. Made perspective bitmaps more flexible.
@@ -35,7 +23,7 @@
* 5 6/02/99 6:18p Dave
* Fixed TNT lockup problems! Wheeeee!
*
* 4 12/14/98 12:13p Dave
* 4 12/14/98 12:13p Dave
* Spiffed up xfer system a bit. Put in support for squad logo file xfer.
* Need to test now.
*
@@ -136,7 +124,7 @@
#include <winioctl.h>
#include <conio.h>
#include "osapi/osapi.h"
#include "osapi/OsApi.h"
#include "osapi/outwnd.h"
#include "cfile/cfile.h"
#include "osapi/monopub.h"
@@ -454,7 +442,7 @@ void outwnd_print(char *id, char *tmp)
outwnd_filter_struct *temp;
if(gr_screen.mode == GR_DIRECT3D){
// return; //it doesn't print while playing if this is in-Bobboau
// return;
}
if (!outwnd_inited)
@@ -476,6 +464,7 @@ void outwnd_print(char *id, char *tmp)
if (!stricmp(id, outwnd_filter[i]->name))
break;
if (i == outwnd_filter_count) // new id found that's not yet in filter list
{
// Only create new filters if there was a filter file
@@ -564,10 +553,13 @@ void outwnd_print(char *id, char *tmp)
sptr++;
}
/* if(gr_screen.mode == GR_DIRECT3D){
if(gr_screen.mode == GR_DIRECT3D){
return;
}
*/// it doesn't print while playing if this is in-Bobboau
// if ( D3D_enabled ) {
// return; // Direct3D seems to hang sometimes printing to window
// }
if ( outwnd_disabled ){
return;
}
Loaded 100 of 133 files, more files were not shown because too many files have changed in this diff. Show more