mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-08 07:28:22 -10:00
Compare commits
264
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b92333b16 | ||
|
|
7238ae9025 | ||
|
|
f6634e882c | ||
|
|
f99a3916de | ||
|
|
cc9f972e80 | ||
|
|
609da60af3 | ||
|
|
7b794ea056 | ||
|
|
3f66617c68 | ||
|
|
f8f60965a9 | ||
|
|
6f0832c6d8 | ||
|
|
33c321d328 | ||
|
|
16fdb53870 | ||
|
|
b5ab80797d | ||
|
|
1385a9c6ac | ||
|
|
a11c390fd5 | ||
|
|
a498b79b2d | ||
|
|
6a22f2443e | ||
|
|
cd2597f3a2 | ||
|
|
d32a38c267 | ||
|
|
64bcc9942e | ||
|
|
cf750429cb | ||
|
|
32843f18f8 | ||
|
|
d7bd110ffe | ||
|
|
36176b8eb4 | ||
|
|
8c94fbd199 | ||
|
|
d9e1e01afc | ||
|
|
8edec19426 | ||
|
|
5419f3b5de | ||
|
|
6df0403964 | ||
|
|
2bef522bfc | ||
|
|
4e86a928b3 | ||
|
|
254b4f6603 | ||
|
|
7373203236 | ||
|
|
55a4c34bab | ||
|
|
b060ac5928 | ||
|
|
ab27958761 | ||
|
|
dca1600f46 | ||
|
|
218ac8a0d7 | ||
|
|
cac96f1a44 | ||
|
|
55948f0db1 | ||
|
|
c80033de55 | ||
|
|
dd378506ee | ||
|
|
9e890d8df5 | ||
|
|
f4030700dc | ||
|
|
b7f924ea6b | ||
|
|
c5c4fd08e9 | ||
|
|
bf7871905e | ||
|
|
28ef47c26f | ||
|
|
7a6e12df06 | ||
|
|
97130623dc | ||
|
|
a1ad295557 | ||
|
|
ecc552eda8 | ||
|
|
56d7afd8a0 | ||
|
|
46e465b1d2 | ||
|
|
4c52cb0441 | ||
|
|
4da09ccefc | ||
|
|
389921bd48 | ||
|
|
e9f6827211 | ||
|
|
042d935a80 | ||
|
|
1f7fee5baa | ||
|
|
ff33077291 | ||
|
|
70c909302c | ||
|
|
900f57bc94 | ||
|
|
41fabe25bd | ||
|
|
1e634da6dd | ||
|
|
a4386862f5 | ||
|
|
7435ddd89b | ||
|
|
f1e5508023 | ||
|
|
0fd8e46ea2 | ||
|
|
cb4764e8d0 | ||
|
|
0c55ff682b | ||
|
|
8659222b82 | ||
|
|
64b2332534 | ||
|
|
303278228a | ||
|
|
16baec8877 | ||
|
|
0b7cc9aa9d | ||
|
|
77bc1ed93b | ||
|
|
d2969046d4 | ||
|
|
b3c67343e5 | ||
|
|
f26624902f | ||
|
|
f96196c271 | ||
|
|
f47b3c0fd0 | ||
|
|
170ac43ebe | ||
|
|
93e0b43b03 | ||
|
|
b9c9069c5a | ||
|
|
fdc9b42d14 | ||
|
|
6cb690996d | ||
|
|
eb63396934 | ||
|
|
f1aa394d29 | ||
|
|
415969fca0 | ||
|
|
dfbd9ad9d0 | ||
|
|
a50424930b | ||
|
|
9843ff7b49 | ||
|
|
7ea79b3ed4 | ||
|
|
b783b7e364 | ||
|
|
60d0011159 | ||
|
|
e730044cc1 | ||
|
|
60ea566ecc | ||
|
|
fd797419dd | ||
|
|
3a5a785f51 | ||
|
|
65564198ef | ||
|
|
def0b0ceb0 | ||
|
|
01776721ab | ||
|
|
6f7d012184 | ||
|
|
7d4d468e58 | ||
|
|
d1a870b372 | ||
|
|
680e55e493 | ||
|
|
c779bae39a | ||
|
|
5a4fafec31 | ||
|
|
cfcc94c2bb | ||
|
|
8d1c8fad7c | ||
|
|
c6cc437092 | ||
|
|
6a30e96439 | ||
|
|
95d7869aa6 | ||
|
|
95a26b87ce | ||
|
|
6c0bfdd0b7 | ||
|
|
0e19a3a614 | ||
|
|
35350315b7 | ||
|
|
8f97380d75 | ||
|
|
fe6bac98c7 | ||
|
|
77c5502b19 | ||
|
|
065eb6f1d5 | ||
|
|
103e4b2b22 | ||
|
|
cb4e5b551f | ||
|
|
c22d9a7e99 | ||
|
|
2b52cf3896 | ||
|
|
5b16bd3748 | ||
|
|
40bbe0cd39 | ||
|
|
661dc39d9c | ||
|
|
07c240e9a1 | ||
|
|
93f20cb8e4 | ||
|
|
e512f60386 | ||
|
|
59442ea786 | ||
|
|
ee8a7f67a7 | ||
|
|
c2c24787da | ||
|
|
60f69cb79b | ||
|
|
3bc70fc2c2 | ||
|
|
f09a3c0a09 | ||
|
|
f15a879898 | ||
|
|
984f3f0aa7 | ||
|
|
1559d18757 | ||
|
|
c2c0ca0eeb | ||
|
|
754c35f2f5 | ||
|
|
2bbd5a806b | ||
|
|
5891192fda | ||
|
|
5effb36530 | ||
|
|
bc72cea911 | ||
|
|
ec8886cf09 | ||
|
|
bce0cc4ca0 | ||
|
|
66eaf28ac8 | ||
|
|
d728b3d745 | ||
|
|
11426ed5a2 | ||
|
|
386abb7000 | ||
|
|
476fb7bbfc | ||
|
|
c825720ae0 | ||
|
|
6e407fff7b | ||
|
|
11b24d23aa | ||
|
|
2135e20299 | ||
|
|
123277167b | ||
|
|
4a9f85674f | ||
|
|
719579177e | ||
|
|
3f6a1f33d4 | ||
|
|
688dee73c2 | ||
|
|
5fa10d82f4 | ||
|
|
4cde77929f | ||
|
|
41f66ee2f3 | ||
|
|
2ee9db9479 | ||
|
|
f87883712e | ||
|
|
ea22ebfe09 | ||
|
|
0edd905be5 | ||
|
|
47e2ff7500 | ||
|
|
c011621363 | ||
|
|
8c47d95901 | ||
|
|
e08be40462 | ||
|
|
d7022ad67b | ||
|
|
38f435eba8 | ||
|
|
6f429c16ee | ||
|
|
dfaebd0908 | ||
|
|
d6abb06544 | ||
|
|
d950369202 | ||
|
|
745fc385e9 | ||
|
|
f02a1caced | ||
|
|
e547962d31 | ||
|
|
31fe8e2a4c | ||
|
|
1b1dc86fb6 | ||
|
|
7539390fc3 | ||
|
|
ad7b508184 | ||
|
|
0fa37a5b62 | ||
|
|
1cbfc73384 | ||
|
|
c58ae29dd5 | ||
|
|
96e442b564 | ||
|
|
e817f867af | ||
|
|
8c8c96bb89 | ||
|
|
f0e7af10bb | ||
|
|
4e44bcfdef | ||
|
|
d4cea3a9ff | ||
|
|
f06b7dfd20 | ||
|
|
6dd4f692e2 | ||
|
|
d860dc0011 | ||
|
|
d5d8e66dee | ||
|
|
ad4843b8ea | ||
|
|
3162ede091 | ||
|
|
f9e3871b3e | ||
|
|
53abc32182 | ||
|
|
39267bcb05 | ||
|
|
7398df34ec | ||
|
|
62c8792c2a | ||
|
|
e561a547a7 | ||
|
|
5128907c07 | ||
|
|
5ddef96ccc | ||
|
|
e75251141a | ||
|
|
4f419025fe | ||
|
|
c6cf69e4a3 | ||
|
|
10e444df95 | ||
|
|
eeab39d62d | ||
|
|
28e46d411b | ||
|
|
1195eb3ada | ||
|
|
5f779fae4c | ||
|
|
cdb274654e | ||
|
|
b486c02ac8 | ||
|
|
9bcb08776c | ||
|
|
d36c788e00 | ||
|
|
00bbac6ae1 | ||
|
|
40db1ce831 | ||
|
|
bbf18d5667 | ||
|
|
377f78db0f | ||
|
|
ad96da3537 | ||
|
|
db8cf9134f | ||
|
|
0d65873a0b | ||
|
|
c38ff6302d | ||
|
|
abc9a3ddb1 | ||
|
|
650c4dea46 | ||
|
|
a2d1cf8f37 | ||
|
|
23c449af6c | ||
|
|
2d548f46bf | ||
|
|
c3c4ce064c | ||
|
|
fb7a0d5257 | ||
|
|
f8351a9818 | ||
|
|
5aefddd246 | ||
|
|
facefe5872 | ||
|
|
ef794efbb3 | ||
|
|
573a1f2fa3 | ||
|
|
a763d84b56 | ||
|
|
c06ccbb602 | ||
|
|
ffd8a5ae2a | ||
|
|
aa753d5d6e | ||
|
|
1cf042064f | ||
|
|
a4e14a94d2 | ||
|
|
5871d644cc | ||
|
|
145a149873 | ||
|
|
7492c51ee6 | ||
|
|
be4954a69e | ||
|
|
875a95b82e | ||
|
|
f6b129577b | ||
|
|
4d30bbba3e | ||
|
|
8823dc67eb | ||
|
|
8690c9d7f6 | ||
|
|
f70d242903 | ||
|
|
5b4306dbd6 | ||
|
|
013870fc6a | ||
|
|
0e3d4e562f | ||
|
|
48d1ec4575 | ||
|
|
32ad077676 | ||
|
|
9942308fc8 |
No files matched your search
@@ -11,3 +11,5 @@
|
||||
# [<whitespace>]<filename><whitespace><error message><end-of-line>
|
||||
#
|
||||
# comment lines begin with '#'
|
||||
new_commit_prep Error checking out/updating CVSROOT/new_commit_prep
|
||||
new_log_accum Error checking out/updating CVSROOT/new_log_accum
|
||||
@@ -13,3 +13,5 @@
|
||||
#
|
||||
# If the name "ALL" appears as a regular expression it is always used
|
||||
# in addition to the first matching regex or "DEFAULT".
|
||||
DEFAULT $CVSROOT/CVSROOT/new_commit_prep
|
||||
CVSROOT $CVSROOT/CVSROOT/new_commit_prep
|
||||
@@ -24,3 +24,7 @@
|
||||
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
# or
|
||||
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
|
||||
|
||||
DEFAULT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
|
||||
CVSROOT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
|
||||
|
||||
Executable
+104
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
#
|
||||
# Script to store the last visited directory for newlogaccum.pl.
|
||||
#
|
||||
# $Id: new_commit_prep,v 1.1 2002-08-11 23:05:15 drevil Exp $
|
||||
|
||||
use strict;
|
||||
|
||||
# This routine removes everything in a directory
|
||||
sub clear_dir {
|
||||
my ($dir) = @_;
|
||||
my ($file);
|
||||
|
||||
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
|
||||
while ($file = readdir(DIR)) {
|
||||
next
|
||||
if ($file eq "." || $file eq "..");
|
||||
|
||||
$file = "$dir/$file";
|
||||
|
||||
if (-d $file) {
|
||||
# It's a directory, recurse into it, then delete it.
|
||||
clear_dir($file);
|
||||
rmdir($file);
|
||||
} else {
|
||||
# It's a file, delete it.
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
# This routine prepares a temporary directory, hopefully in a secure
|
||||
# fashion; it uses the process group to make secondary programs be able
|
||||
# to find it.
|
||||
sub tmpdir (;$) {
|
||||
my ($clear) = @_;
|
||||
my ($pgrp, $own, $mode, $tmpdir);
|
||||
|
||||
$pgrp = getpgrp();
|
||||
|
||||
die "Don't run $0 setuid!"
|
||||
unless ($< == $>);
|
||||
|
||||
# Decide on the directory name, using various environment variables
|
||||
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
|
||||
"/.#cvs.$pgrp";
|
||||
|
||||
# Doesn't exist, but we can't create it...
|
||||
die "Can't create temporary directory $tmpdir: $!"
|
||||
unless (-e $tmpdir || mkdir($tmpdir, 0700));
|
||||
|
||||
die "Temporary directory $tmpdir is not a directory"
|
||||
unless (-d $tmpdir);
|
||||
|
||||
# Check ownership and permissions
|
||||
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
|
||||
|
||||
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
|
||||
unless ($own == $<);
|
||||
|
||||
die "Temporary directory $tmpdir group-writable"
|
||||
if ($mode & 0020);
|
||||
die "Temporary directory $tmpdir other-writable"
|
||||
if ($mode & 0002);
|
||||
|
||||
# If we're supposed to clear the directory, do so...
|
||||
clear_dir($tmpdir)
|
||||
if ($clear);
|
||||
|
||||
return $tmpdir;
|
||||
}
|
||||
|
||||
# This routine writes a single line to a file
|
||||
sub write_line ($$) {
|
||||
my ($fname, $line) = @_;
|
||||
|
||||
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
|
||||
print FILE "$line\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
# Create and empty the temporary directory
|
||||
my ($tmpdir) = (tmpdir(1));
|
||||
|
||||
# Store the directory name
|
||||
write_line("$tmpdir/lastdir", shift(@ARGV));
|
||||
Executable
+757
@@ -0,0 +1,757 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Copyright (C) 2000 by Kevin L. Mitchell <[email protected]>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
#
|
||||
# Script to accumulate log messages for an entire tree and send them along
|
||||
# with the diffs; deals correctly with all manner of branching (I hope)
|
||||
#
|
||||
# $Id: new_log_accum,v 1.1 2002-08-11 23:05:15 drevil Exp $
|
||||
#
|
||||
|
||||
use strict;
|
||||
|
||||
use vars qw($MAILER $CVS $debug $boundary);
|
||||
use MD5;
|
||||
|
||||
# Set this to the full path of a mailer that takes a list
|
||||
# of email addresses as arguments...
|
||||
$MAILER = "/usr/sbin/sendmail -oi -oeq";
|
||||
|
||||
# Set this to the path of the CVS binary responsible for this tree...
|
||||
$CVS = "/usr/bin/cvs";
|
||||
|
||||
# Don't touch this; use the -d command line option
|
||||
$debug = 0;
|
||||
|
||||
# This is initialized by build_mailheader()
|
||||
$boundary = '';
|
||||
|
||||
use POSIX qw(setsid);
|
||||
|
||||
# We have to dissociate from our parent, so that the CVS commit can
|
||||
# complete, before we try to extract the diffs
|
||||
sub daemonize {
|
||||
defined(my $pid = fork()) || die "Can't fork: $!";
|
||||
exit(0)
|
||||
if $pid;
|
||||
setsid() || die "Can't start a new session: $!";
|
||||
}
|
||||
|
||||
# Debugging output
|
||||
sub debug (@) {
|
||||
print STDERR @_
|
||||
if ($debug);
|
||||
}
|
||||
|
||||
# Constants used in the FSM below for parsing the log message
|
||||
sub STATE_NONE { 0 }
|
||||
sub STATE_MODIFIED { 1 }
|
||||
sub STATE_ADDED { 2 }
|
||||
sub STATE_REMOVED { 3 }
|
||||
sub STATE_LOG1 { 4 }
|
||||
sub STATE_LOG2 { 5 }
|
||||
|
||||
# This routine removes everything in a directory
|
||||
sub clear_dir {
|
||||
my ($dir) = @_;
|
||||
my ($file);
|
||||
|
||||
opendir(DIR, $dir) || die "Cannot clear directory $dir: $!";
|
||||
while ($file = readdir(DIR)) {
|
||||
next
|
||||
if ($file eq "." || $file eq "..");
|
||||
|
||||
$file = "$dir/$file";
|
||||
|
||||
if (-d $file) {
|
||||
# It's a directory, recurse into it, then delete it.
|
||||
clear_dir($file);
|
||||
rmdir($file);
|
||||
} else {
|
||||
# It's a file, delete it.
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
closedir(DIR);
|
||||
}
|
||||
|
||||
# This routine prepares a temporary directory, hopefully in a secure
|
||||
# fashion; it uses the process group to make secondary programs be able
|
||||
# to find it.
|
||||
sub tmpdir (;$) {
|
||||
my ($clear) = @_;
|
||||
my ($pgrp, $own, $mode, $tmpdir);
|
||||
|
||||
$pgrp = getpgrp();
|
||||
|
||||
die "Don't run $0 setuid!"
|
||||
unless ($< == $>);
|
||||
|
||||
# Decide on the directory name, using various environment variables
|
||||
$tmpdir = ($ENV{TMPDIR} || $ENV{TMP} || $ENV{TEMP} || "/tmp") .
|
||||
"/.#cvs.$pgrp";
|
||||
|
||||
# Doesn't exist, but we can't create it...
|
||||
die "Can't create temporary directory $tmpdir: $!"
|
||||
unless (-e $tmpdir || mkdir($tmpdir, 0700));
|
||||
|
||||
die "Temporary directory $tmpdir is not a directory"
|
||||
unless (-d $tmpdir);
|
||||
|
||||
# Check ownership and permissions
|
||||
(undef, undef, $mode, undef, $own, undef) = stat($tmpdir);
|
||||
|
||||
die "Temporary directory $tmpdir not owned by $< (owned by $own)"
|
||||
unless ($own == $<);
|
||||
|
||||
die "Temporary directory $tmpdir group-writable"
|
||||
if ($mode & 0020);
|
||||
die "Temporary directory $tmpdir other-writable"
|
||||
if ($mode & 0002);
|
||||
|
||||
# If we're supposed to clear the directory, do so...
|
||||
clear_dir($tmpdir)
|
||||
if ($clear);
|
||||
|
||||
return $tmpdir;
|
||||
}
|
||||
|
||||
# Routine to remove the temporary directory when done
|
||||
sub cleanup_dir ($) {
|
||||
# If we're debugging, we may want to look at the contents...
|
||||
return
|
||||
if ($debug);
|
||||
|
||||
clear_dir($_[0]);
|
||||
rmdir($_[0]);
|
||||
}
|
||||
|
||||
# Retrieve a single line from a specified file
|
||||
sub get_line ($) {
|
||||
my ($fname) = @_;
|
||||
|
||||
open(FILE, "<$fname") || die "Cannot open file $fname for reading";
|
||||
my $line = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
# Chomp off the \n
|
||||
chomp $line;
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
# Routine that only allows one value to be pushed on the array;
|
||||
# implemented by making the first element of the array a hash-reference.
|
||||
# When we add a new value, we also increment the count of an element in
|
||||
# the hash with the key being the array value...
|
||||
sub push_once (\@@) {
|
||||
my ($array, @values) = @_;
|
||||
|
||||
# If the array is empty, create our hash ref
|
||||
push @{$array}, {}
|
||||
if (@{$array} == 0);
|
||||
|
||||
foreach my $value (@values) {
|
||||
push @{$array}, $value
|
||||
if (!exists($array->[0]{$value}));
|
||||
|
||||
$array->[0]{$value}++;
|
||||
}
|
||||
|
||||
return @{$array} - 1;
|
||||
}
|
||||
|
||||
# Filter //, /./, and remove leading ./ or / from filenames
|
||||
sub fname_filter ($) {
|
||||
my ($fname) = @_;
|
||||
|
||||
$fname =~ s,//,/,g;
|
||||
$fname =~ s,/\./,/,g;
|
||||
$fname =~ s,^\.?/,,g;
|
||||
|
||||
return $fname;
|
||||
}
|
||||
|
||||
# Store file data in a temporary file
|
||||
sub names_to_file ($$@) {
|
||||
my ($fname, $dir, @names) = @_;
|
||||
|
||||
if (@names > 0) {
|
||||
open(FILE, ">>$fname") || die "Cannot open file $fname for appending";
|
||||
|
||||
# Store the directory data
|
||||
print FILE "D $dir\n";
|
||||
|
||||
foreach my $name (@names) {
|
||||
# Mark record as a file...
|
||||
print FILE "F ";
|
||||
|
||||
# Store the tag, if there is one...
|
||||
print FILE "$name->{tag}"
|
||||
if (defined($name->{tag}));
|
||||
|
||||
# Then store old revision, new revision, and file name
|
||||
print FILE ":$name->{old}:$name->{new}:$name->{file}\n";
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
}
|
||||
}
|
||||
|
||||
# Retrieve file data from temporary file; updates branch tags with what it
|
||||
# reads
|
||||
sub file_to_names (\@$) {
|
||||
my ($btags, $fname) = @_;
|
||||
my ($dir) = (undef);
|
||||
my (@names) = ();
|
||||
|
||||
debug "Reading file names from $fname...\n";
|
||||
|
||||
# We may not have, say, added a file in this subdirectory...
|
||||
return ()
|
||||
if (!-e $fname);
|
||||
|
||||
open(FILE, "<$fname");
|
||||
while(<FILE>) {
|
||||
chomp;
|
||||
|
||||
# Get record type...
|
||||
my ($type, $data) = split(' ', $_, 2);
|
||||
|
||||
# ok, it's a directory, remember that...
|
||||
if ($type eq "D") {
|
||||
$dir = $data;
|
||||
|
||||
debug "Read directory $dir\n";
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
debug "Read file $data\n";
|
||||
|
||||
# Get all the information about the file
|
||||
my ($tag, $old, $new, $file) = split(':', $data);
|
||||
|
||||
# and store it all
|
||||
push(@names, { tag => $tag, old => $old, new => $new, file => $file,
|
||||
dir => $dir, name => fname_filter("$dir/$file") });
|
||||
|
||||
# Remember the tags...
|
||||
push_once(@{$btags}, $tag)
|
||||
if (defined($tag) && $tag ne "");
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
return @names;
|
||||
}
|
||||
|
||||
# Create a text-formatted list of names
|
||||
sub name_to_list (\@@) {
|
||||
my ($btags, @names) = @_;
|
||||
my (@nlist, @nline) = ();
|
||||
|
||||
debug "Tags:", join(':', @{$btags}), "\n";
|
||||
|
||||
# We group them by tag
|
||||
foreach my $tag ("", @{$btags}[1..$#{$btags}]) {
|
||||
debug "Processing tag $tag...\n";
|
||||
|
||||
@nlist = ();
|
||||
|
||||
# Get a list of files by the tag...
|
||||
foreach my $name (@names) {
|
||||
debug "Processing $name->{file}...\n";
|
||||
|
||||
next
|
||||
if ($name->{tag} ne $tag);
|
||||
|
||||
debug "Pushing $name->{name} on \@nlist...\n";
|
||||
push(@nlist, $name->{name});
|
||||
}
|
||||
|
||||
# If the tag is not the empty string, list the tag...
|
||||
push(@nline, " Tag: $tag", " ")
|
||||
if ($tag ne "");
|
||||
|
||||
# Now list each file name
|
||||
foreach my $name (@nlist) {
|
||||
# indent if we run past the end of line limit
|
||||
push(@nline, " ")
|
||||
if (@nline == 0 || ($nline[$#nline] ne " " &&
|
||||
length($nline[$#nline]) + length($name) + 1 > 70));
|
||||
|
||||
# add the file name to the list
|
||||
debug "Adding $name to \@nline...\n";
|
||||
$nline[$#nline] .= " $name";
|
||||
}
|
||||
}
|
||||
|
||||
return @nline;
|
||||
}
|
||||
|
||||
# write the log message to a temporary file
|
||||
sub write_log ($@) {
|
||||
my ($fname, @text) = @_;
|
||||
|
||||
open(FILE, ">$fname") || die "Cannot open file $fname for writing";
|
||||
print FILE join("\n", @text), "\n";
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
# Build the header of the commit message: CVSROOT, module name, any
|
||||
# branch tags, and the commit time
|
||||
sub build_header ($@) {
|
||||
my ($module, $subject, $mailto, @branch_tags) = @_;
|
||||
my (@text, @mailto);
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
|
||||
my ($user, $dummy);
|
||||
my ($digest);
|
||||
|
||||
($user, $dummy, $dummy, $dummy, $dummy, $dummy, $dummy) = getpwuid($<);
|
||||
|
||||
@mailto = @{$mailto};
|
||||
|
||||
# generate a unique boundary by calculating the md5sum of the
|
||||
# current time
|
||||
$digest = new MD5;
|
||||
$digest->reset();
|
||||
$digest->add(time() . rand());
|
||||
$boundary = "----=MIME." . unpack("H*", $digest->digest());
|
||||
|
||||
# Build the mail header
|
||||
push(@text, "From: $user");
|
||||
push(@text, "To: " . join(' ', @mailto));
|
||||
push(@text, "Subject: $subject");
|
||||
push(@text, "MIME-Version: 1.0");
|
||||
push(@text, "Content-Type: multipart/mixed; boundary=\"$boundary\"");
|
||||
push(@text, "");
|
||||
push(@text, "This is a multipart message as defined by RFC2049 (MIME)");
|
||||
push(@text, "");
|
||||
push(@text, "--$boundary");
|
||||
push(@text, "Content-Type: text/plain; charset=us-ascii");
|
||||
push(@text, "Content-Disposition: inline");
|
||||
push(@text, "");
|
||||
|
||||
# Build the commit message header
|
||||
push(@text, "Commiter : $user");
|
||||
push(@text, "CVSROOT : $ENV{CVSROOT}");
|
||||
push(@text, "Module : $module");
|
||||
push(@text, "Branch tags: " . join(' ', @branch_tags[1..$#branch_tags]))
|
||||
if (@branch_tags > 0);
|
||||
push(@text, sprintf("Commit time: %04d-%02d-%02d %02d:%02d:%02d UTC",
|
||||
$year + 1900, $mon + 1, $mday, $hour, $min, $sec));
|
||||
|
||||
return @text, "";
|
||||
}
|
||||
|
||||
# Send the mail message
|
||||
sub send_mail {
|
||||
my ($mailto, $text) = @_;
|
||||
my (@mailto, @text);
|
||||
# I <heart> perl
|
||||
@mailto = @{$mailto};
|
||||
@text = @{$text};
|
||||
|
||||
open(MAIL, "|$MAILER " . join(' ', @mailto));
|
||||
push(@text, "--$boundary--", "");
|
||||
print MAIL join("\n", @text), "\n";
|
||||
close(MAIL);
|
||||
}
|
||||
|
||||
# Find the tmp directory
|
||||
my ($tmpdir) = (tmpdir());
|
||||
|
||||
my (@mailto) = ();
|
||||
my (@files) = ();
|
||||
my (@path) = ();
|
||||
my ($modname, $repdir, $dir) = (undef, undef, undef);
|
||||
|
||||
# Process command line arguments
|
||||
while (@ARGV > 0) {
|
||||
my ($arg) = (shift(@ARGV));
|
||||
|
||||
if ($arg eq '-d') {
|
||||
# Turn on debugging
|
||||
$debug++;
|
||||
} elsif ($arg eq '-M') {
|
||||
# Module name explicitly set -- XXX Not tested, use at your own risk
|
||||
die "Argument for -M missing"
|
||||
unless (@ARGV > 0);
|
||||
|
||||
$modname = shift(@ARGV);
|
||||
} elsif ($arg eq '-m') {
|
||||
# An address to mail the notification to
|
||||
die "Argument for -m missing"
|
||||
unless (@ARGV > 0);
|
||||
|
||||
push(@mailto, shift(@ARGV));
|
||||
} else {
|
||||
# the list of filenames passed by CVS--you *must* use %{sVv}!
|
||||
die "Too many arguments!"
|
||||
unless (@files == 0);
|
||||
|
||||
@files = split(" ", $arg);
|
||||
}
|
||||
}
|
||||
|
||||
die "Nobody to mail to"
|
||||
unless (@mailto > 0);
|
||||
|
||||
die "No files to process"
|
||||
unless (@files > 1);
|
||||
|
||||
# The repository directory
|
||||
$repdir = shift(@files);
|
||||
|
||||
# break it appart...
|
||||
@path = split("/", $repdir);
|
||||
|
||||
# Now we know the module name, if it wasn't explicitly set
|
||||
$modname = $path[0]
|
||||
unless (defined($modname));
|
||||
|
||||
# Figure out what our directory is
|
||||
if (@path == 1) {
|
||||
$dir = ".";
|
||||
} else {
|
||||
$dir = join("/", @path[1..$#path]);
|
||||
}
|
||||
|
||||
# append a / to it...
|
||||
$dir .= "/";
|
||||
|
||||
debug "module = $modname\n";
|
||||
debug "dir = $dir\n";
|
||||
debug "path = ", join(":", @path), "\n";
|
||||
debug "files = ", join(":", @files), "\n";
|
||||
debug "tmpdir = $tmpdir\n";
|
||||
|
||||
my (%fversions);
|
||||
|
||||
# Unless its a new directory or imported sources, create file records
|
||||
unless (defined($files[1]) && defined($files[2]) &&
|
||||
(($files[1] eq "New" && $files[2] eq "directory") ||
|
||||
($files[1] eq "Imported" && $files[2] eq "sources"))) {
|
||||
|
||||
foreach my $fname (@files) {
|
||||
# You *must* use %{sVv} in the call in loginfo!
|
||||
die "Invalid filenames"
|
||||
unless ($fname =~ /^(.*),([0-9.]+|NONE),([0-9.]+|NONE)$/);
|
||||
|
||||
$fversions{$1} = {
|
||||
old => ($2 eq "NONE" ? "0" : $2),
|
||||
new => ($3 eq "NONE" ? "0" : $3),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# process log message
|
||||
my ($state, $tag) = (STATE_NONE, undef);
|
||||
|
||||
my (@modified, @added, @removed, @log, @branch_tags) = ();
|
||||
|
||||
while (<STDIN>) {
|
||||
chomp;
|
||||
|
||||
debug "State $state, line:$_\n";
|
||||
|
||||
# Ignore empty space at the beginning of the log message
|
||||
next
|
||||
if ($state == STATE_LOG1 && /^\s*$/);
|
||||
|
||||
# We're done ignoring empty space
|
||||
if ($state == STATE_LOG1) {
|
||||
$state = STATE_LOG2;
|
||||
}
|
||||
|
||||
if ($state == STATE_LOG2) {
|
||||
# Don't modify the lines at all if we're processing the log message
|
||||
push(@log, $_);
|
||||
next;
|
||||
} else {
|
||||
# Strip out leading and trailing space
|
||||
s/^\s*(.*?)\s*$/$1/;
|
||||
}
|
||||
|
||||
if (/^Modified Files/) {
|
||||
# Collect list of modified files
|
||||
debug "State switching to STATE_MODIFIED\n";
|
||||
|
||||
$state = STATE_MODIFIED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Added Files/) {
|
||||
# Collect list of added files
|
||||
debug "State switching to STATE_ADDED\n";
|
||||
|
||||
$state = STATE_ADDED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Removed Files/) {
|
||||
# Collect list of removed files
|
||||
debug "State switching to STATE_REMOVED\n";
|
||||
|
||||
$state = STATE_REMOVED;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Log Message/) {
|
||||
# Collect log message
|
||||
debug "State switching to STATE_LOG1\n";
|
||||
|
||||
$state = STATE_LOG1;
|
||||
$tag = undef;
|
||||
|
||||
next;
|
||||
|
||||
} elsif (/^Revision\/Branch/) {
|
||||
# Parse old-style Revision/Branch field
|
||||
debug "Found a branch tag\n";
|
||||
|
||||
/^[^:]+:\s*(.*)/;
|
||||
|
||||
push_once(@branch_tags, $1);
|
||||
|
||||
warn "Tag == $tag"
|
||||
if (defined($tag));
|
||||
|
||||
next;
|
||||
}
|
||||
|
||||
# Ignore the stuff at the top of the commit report
|
||||
next
|
||||
if ($state == STATE_NONE);
|
||||
|
||||
if (/^Tag:\s*(.*)$/) {
|
||||
# Remember the tag
|
||||
debug "Setting tag to $1\n";
|
||||
$tag = $1;
|
||||
next;
|
||||
}
|
||||
|
||||
my (@tfiles) = ();
|
||||
|
||||
# Find the file in our command line list of files
|
||||
foreach my $file (split) {
|
||||
die "Nothing known about file $file!"
|
||||
unless (exists($fversions{$file}));
|
||||
|
||||
push @tfiles, {
|
||||
file => $file,
|
||||
tag => $tag,
|
||||
old => $fversions{$file}{old},
|
||||
new => $fversions{$file}{new},
|
||||
};
|
||||
}
|
||||
|
||||
# Store the file list in the correct array
|
||||
push(@modified, @tfiles)
|
||||
if ($state == STATE_MODIFIED);
|
||||
|
||||
push(@added, @tfiles)
|
||||
if ($state == STATE_ADDED);
|
||||
|
||||
push(@removed, @tfiles)
|
||||
if ($state == STATE_REMOVED);
|
||||
}
|
||||
|
||||
# Remove trailing blank lines from the log message
|
||||
while (@log > 0 && $log[$#log] =~ /^\s*$/) {
|
||||
pop(@log);
|
||||
}
|
||||
|
||||
# If a new directory was added, we're done...
|
||||
if (defined($files[1]) && defined($files[2]) &&
|
||||
$files[1] eq "New" && $files[2] eq "directory") {
|
||||
|
||||
my (@text) = ();
|
||||
|
||||
# If there was a sticky tag for the directory, make it a branch tag
|
||||
if ($log[$#log] =~ /^--> Using per-directory sticky tag \`(.*)\'$/) {
|
||||
push_once(@branch_tags, $1);
|
||||
pop(@log);
|
||||
}
|
||||
|
||||
# Build the message...
|
||||
push(@text, build_header($modname, "Module $modname: New directory $dir",
|
||||
\@mailto, @branch_tags));
|
||||
push(@text, "Log message:", "", @log);
|
||||
|
||||
# and send it (synchronously)
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# Clean up after ourselves and exit.
|
||||
cleanup_dir($tmpdir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
# If an import was done, we're done...
|
||||
if (defined($files[1]) && defined($files[2]) &&
|
||||
$files[1] eq "Imported" && $files[2] eq "sources") {
|
||||
|
||||
my (@text) = ();
|
||||
|
||||
# Build the message...
|
||||
push(@text, build_header($modname, "Module $modname: Imported $dir",
|
||||
\@mailto, @branch_tags));
|
||||
push(@text, "Log message:", "", @log);
|
||||
|
||||
# and send it (synchronously)
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# Clean up after ourselves and exit.
|
||||
cleanup_dir($tmpdir);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
debug "Searching for log file index...";
|
||||
|
||||
my ($i);
|
||||
|
||||
# Look for an empty log file or one that matches our current log message
|
||||
for ($i = 0; ; $i++) {
|
||||
my (@text);
|
||||
|
||||
# found one that doesn't exist...
|
||||
last
|
||||
if (!-e "$tmpdir/logfile.$i");
|
||||
|
||||
# read in the log file
|
||||
open(FILE, "<$tmpdir/logfile.$i");
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
# If the log file was empty, use it
|
||||
last
|
||||
if (@text == 0);
|
||||
|
||||
# If the log messages are identical, use that
|
||||
last
|
||||
if (join(' ', @log) eq join(' ', @text));
|
||||
}
|
||||
|
||||
debug "$tmpdir/logfile.$i\n";
|
||||
|
||||
# Store modified, added, and removed file lists, along with the log message
|
||||
names_to_file("$tmpdir/modified.$i", $dir, @modified);
|
||||
names_to_file("$tmpdir/added.$i", $dir, @added);
|
||||
names_to_file("$tmpdir/removed.$i", $dir, @removed);
|
||||
write_log("$tmpdir/logfile.$i", @log);
|
||||
|
||||
# Now check to see if we're at the end of our rope
|
||||
my ($lastdir) = (get_line("$tmpdir/lastdir"));
|
||||
|
||||
debug "Checking $ENV{CVSROOT}/$repdir against lastdir $lastdir\n";
|
||||
|
||||
# Nope, exit instead of sending a message
|
||||
exit(0)
|
||||
if ($lastdir ne "$ENV{CVSROOT}/$repdir");
|
||||
|
||||
debug "At last, we've reached the end\n";
|
||||
|
||||
# We have to daemonize and sleep so that there isn't any lock hanging
|
||||
# around when we get to the cvs rdiff below...
|
||||
daemonize();
|
||||
sleep(10);
|
||||
|
||||
# Build the mail message...
|
||||
my (@text) = ();
|
||||
@files = ();
|
||||
@branch_tags = ();
|
||||
|
||||
for ($i = 0; ; $i++) {
|
||||
# No more log files
|
||||
last
|
||||
if (!-e "$tmpdir/logfile.$i");
|
||||
|
||||
# read and insert the log message
|
||||
open(FILE, "<$tmpdir/logfile.$i");
|
||||
push(@text, "Log message:", "");
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
push(@text, "");
|
||||
close(FILE);
|
||||
|
||||
# read modified list and list all modified files if non-empty
|
||||
@modified = file_to_names(@branch_tags, "$tmpdir/modified.$i");
|
||||
push(@text, "Modified files:", name_to_list(@branch_tags, @modified), "")
|
||||
if (@modified > 0);
|
||||
|
||||
# read added list and list all added files if non-empty
|
||||
@added = file_to_names(@branch_tags, "$tmpdir/added.$i");
|
||||
push(@text, "Added files:", name_to_list(@branch_tags, @added), "")
|
||||
if (@added > 0);
|
||||
|
||||
# read removed list and list all removed files if non-empty
|
||||
@removed = file_to_names(@branch_tags, "$tmpdir/removed.$i");
|
||||
push(@text, "Removed files:", name_to_list(@branch_tags, @removed), "")
|
||||
if (@removed > 0);
|
||||
|
||||
# remember all the files we looked at
|
||||
push(@files, @modified, @added, @removed);
|
||||
}
|
||||
|
||||
# Now that name_to_list has rebuilt our list of branch tags, we can build the
|
||||
# header and prepend it to the message
|
||||
unshift(@text, build_header($modname, "Module $modname: Change committed",
|
||||
\@mailto, @branch_tags));
|
||||
|
||||
# sort the files out for our diff
|
||||
@files = sort { $a->{name} cmp $b->{name} } @files;
|
||||
|
||||
my ($user, $filename);
|
||||
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time());
|
||||
$user = getpwuid($<);
|
||||
|
||||
$filename = sprintf("%s.%04d%02d%02d.%02d%02d%02d.%s.diff", $modname,
|
||||
$year + 1900, $mon + 1, $mday, $hour, $min, $sec, $user);
|
||||
|
||||
push(@text, "--$boundary");
|
||||
push(@text, "Content-Type: text/plain; name=\"$filename\"");
|
||||
push(@text, "Content-Disposition: attachment; filename=\"$filename\"");
|
||||
push(@text, "Content-Transfer-Encoding: 8bit");
|
||||
push(@text, "");
|
||||
|
||||
foreach my $file (@files) {
|
||||
debug "Diffing file $file->{name}...\n";
|
||||
|
||||
# Run cvs rdiff, extracting a diff between the old version and the new
|
||||
open(DIFF, "$CVS -Q rdiff -u -r $file->{old} -r $file->{new} " .
|
||||
"$modname/$file->{name}|");
|
||||
while (<DIFF>) {
|
||||
chomp;
|
||||
push(@text, $_);
|
||||
}
|
||||
close(DIFF);
|
||||
}
|
||||
|
||||
# send the mail...
|
||||
send_mail(\@mailto, \@text);
|
||||
|
||||
# and clean up after ourselves
|
||||
cleanup_dir($tmpdir);
|
||||
@@ -1,3 +1,761 @@
|
||||
ChangeLog for fs2_open. All times are UTC.
|
||||
Updated 2002-10-31 03:46
|
||||
|
||||
|
||||
2002-10-30 22:57 randomtiger
|
||||
|
||||
* code/: code.dsp (1.6.2.8), graphics/grd3d.cpp (2.2.2.18),
|
||||
graphics/grd3dinternal.h (2.1.2.7), graphics/grd3dtexture.cpp
|
||||
(2.1.2.16), model/modelinterp.cpp (2.3.2.1):
|
||||
|
||||
Changed DX8 code to not use set render and texture states if they
|
||||
are already set to that value. Disabled buffer saving and
|
||||
restoring code when windowed to stop DX8 debug runs from crashing.
|
||||
- RT
|
||||
|
||||
2002-10-30 20:22 inquisitor
|
||||
|
||||
* code/cmdline/cmdline.h (2.10):
|
||||
|
||||
Bad Committ, Rolling back
|
||||
|
||||
2002-10-30 06:29 DTP
|
||||
|
||||
* code/cfile/: cfilesystem.cpp (2.5), cfile.cpp (2.5):
|
||||
|
||||
doh!, used upper case in include, dont know how much it matters for
|
||||
*nix systems, but here it is
|
||||
|
||||
2002-10-30 06:26 DTP
|
||||
|
||||
* code/cfile/cfilesystem.cpp (2.4):
|
||||
|
||||
DTP Implemented basic VP files handling. mission and campaign files
|
||||
inside VP files found in mod dir still not supported, cheking /
|
||||
creating directories not implented either
|
||||
|
||||
2002-10-29 22:41 sesquipedalian
|
||||
|
||||
* code/parse/: sexp.cpp (2.3), sexp.h (2.3):
|
||||
|
||||
no message
|
||||
|
||||
2002-10-28 02:28 DTP
|
||||
|
||||
* code/cmdline/cmdline.h (2.9):
|
||||
|
||||
Crap, somebody may restore cmdline.h to 2 version before this.
|
||||
|
||||
2002-10-28 00:40 randomtiger
|
||||
|
||||
* code/graphics/grd3d.cpp (2.2.2.17):
|
||||
|
||||
Implemented screen saving code for restoring when drawing popups, a
|
||||
bit slow but works. - RT
|
||||
|
||||
2002-10-27 23:59 DTP
|
||||
|
||||
* code/cfile/: cfile.cpp (2.4), cfile.h (2.3):
|
||||
|
||||
DTP; started basic implementation of mod-support plain files only
|
||||
for now. fs2_open.exe -mod X will look for files in fs2/ X
|
||||
/all-legal-subdirectories. no checking/creating dirs yet.
|
||||
directories must be there.
|
||||
|
||||
2002-10-27 23:55 DTP
|
||||
|
||||
* code/cmdline/: cmdline.cpp (2.9), cmdline.h (2.8):
|
||||
|
||||
DTP; started basic implementation of mod-support plain files only
|
||||
for now. fs2_open.exe -mod X will look for files in fs2/ X
|
||||
/all-legal-subdirectories. no checking/creating dirs yet.
|
||||
directories must be there.
|
||||
|
||||
2002-10-26 09:55 unknownplayer
|
||||
|
||||
* code/: freespace2/freespace.cpp (2.6.2.5), nebula/neb.cpp
|
||||
(2.1.2.1):
|
||||
|
||||
Fixed the nebula flicker bug. Check the NO_DIRECT3D conditional
|
||||
compile sections in the future for bits of code which may cause
|
||||
problems due to hacks correcting for DirectX5 that no longer apply.
|
||||
|
||||
2002-10-26 01:24 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.10), bmpman/bmpman.h (2.0.2.7),
|
||||
graphics/grd3d.cpp (2.2.2.16), graphics/grd3drender.cpp (2.3.2.15),
|
||||
graphics/grd3dtexture.cpp (2.1.2.15):
|
||||
|
||||
Fixed debug bitmap compiling bug. Fixed tga bug. - RT
|
||||
|
||||
2002-10-22 23:02 randomtiger
|
||||
|
||||
* code/: cmdline/cmdline.cpp (2.8), cmdline/cmdline.h (2.7),
|
||||
debugconsole/timerbar.h (1.2), hud/hudtargetbox.cpp (2.4),
|
||||
model/modelinterp.cpp (2.5):
|
||||
|
||||
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
|
||||
|
||||
2002-10-22 17:46 randomtiger
|
||||
|
||||
* Freespace2.dsp (1.7.2.4), code/bmpman/bmpman.cpp (2.2.2.9),
|
||||
code/bmpman/bmpman.h (2.0.2.6), code/graphics/grd3dtexture.cpp
|
||||
(2.1.2.14):
|
||||
|
||||
Fixed new TGA code texturing bug. - RT
|
||||
|
||||
2002-10-22 17:42 randomtiger
|
||||
|
||||
* code/: freespace2/freespace.cpp (2.13),
|
||||
missionui/missionpause.cpp (2.3):
|
||||
|
||||
Fixed lighting bug that caused special pause to crash on debug
|
||||
build. Also added TAB functionality for special pause that toggles
|
||||
HUD. - RT
|
||||
|
||||
2002-10-21 16:33 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.8), bmpman/bmpman.h (2.0.2.5),
|
||||
graphics/grd3d.cpp (2.2.2.15), graphics/grd3dinternal.h (2.1.2.6),
|
||||
graphics/grd3drender.cpp (2.3.2.14), graphics/grd3dtexture.cpp
|
||||
(2.1.2.13):
|
||||
|
||||
Added D3D only 32 bit TGA functionality. Will load a texture as big
|
||||
as your graphics card allows. Code not finished yet and will forge
|
||||
the beginnings of the new texture system. - RT
|
||||
|
||||
2002-10-20 22:21 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.7), graphics/grd3d.cpp
|
||||
(2.2.2.14), graphics/grd3drender.cpp (2.3.2.13), palman/palman.cpp
|
||||
(2.1.2.1):
|
||||
|
||||
Some incomplete code to handle background drawing when message
|
||||
boxes are drawn. It doesnt work but its a good base for someone to
|
||||
start from. - RT
|
||||
|
||||
2002-10-19 23:56 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.6), bmpman/bmpman.h (2.0.2.4),
|
||||
globalincs/pstypes.h (2.4.2.3), graphics/grd3d.cpp (2.2.2.13),
|
||||
graphics/grd3dtexture.cpp (2.1.2.12):
|
||||
|
||||
Changed generic bitmap code to allow maximum dimensions to be
|
||||
determined by 3D's engines maximum texture size query. Defaults to
|
||||
256 as it was before. Also added base code for reworking the
|
||||
texture code to be more efficient. - RT
|
||||
|
||||
2002-10-19 19:29 bobboau
|
||||
|
||||
* code/: controlconfig/controlsconfig.h (2.2),
|
||||
controlconfig/controlsconfigcommon.cpp (2.3), model/model.h (2.5),
|
||||
model/modelinterp.cpp (2.4), model/modelread.cpp (2.4),
|
||||
model/modelsinc.h (2.4), object/object.cpp (2.2), osapi/outwnd.cpp
|
||||
(2.2), physics/physics.cpp (2.2), physics/physics.h (2.2),
|
||||
playerman/playercontrol.cpp (2.2), ship/ai.h (2.2), ship/aibig.cpp
|
||||
(2.2), ship/aicode.cpp (2.8), ship/ship.cpp (2.7), ship/ship.h
|
||||
(2.4), ship/shipcontrails.cpp (2.3), ship/shipcontrails.h (2.1),
|
||||
ship/shiphit.cpp (2.6), starfield/starfield.cpp (2.3),
|
||||
weapon/beam.cpp (2.4), weapon/beam.h (2.3), weapon/weapon.h (2.2),
|
||||
weapon/weapons.cpp (2.2):
|
||||
|
||||
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
|
||||
|
||||
2002-10-19 03:50 randomtiger
|
||||
|
||||
* code/: cmdline/cmdline.cpp (2.7), cmdline/cmdline.h (2.6),
|
||||
freespace2/freespace.cpp (2.12), io/keycontrol.cpp (2.4),
|
||||
menuui/readyroom.cpp (2.2), missionui/missionpause.cpp (2.2),
|
||||
missionui/missionpause.h (2.2):
|
||||
|
||||
Added special pause mode for easier action screenshots. Added new
|
||||
command line parameter for accessing all single missions in tech
|
||||
room. - RT
|
||||
|
||||
2002-10-17 20:40 randomtiger
|
||||
|
||||
* code/: controlconfig/controlsconfig.h (2.1),
|
||||
controlconfig/controlsconfigcommon.cpp (2.2), hud/hud.cpp (2.2),
|
||||
hud/hud.h (2.2), io/keycontrol.cpp (2.3),
|
||||
mission/missionmessage.cpp (2.2):
|
||||
|
||||
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.
|
||||
|
||||
2002-10-16 00:41 randomtiger
|
||||
|
||||
* code/graphics/: 2d.cpp (2.3.2.8), 2d.h (2.1.2.2), grd3d.cpp
|
||||
(2.2.2.12), grd3d.h (2.0.2.4), grd3drender.cpp (2.3.2.12):
|
||||
|
||||
Fixed small bug that was stopping unactive text from displaying
|
||||
greyed out Also added ability to run FS2 DX8 in 640x480, however I
|
||||
needed to make a small change to 2d.cpp which invloved calling the
|
||||
resolution processing code after initialising the device for D3D
|
||||
only. This is because D3D8 for the moment has its own internal
|
||||
launcher. Also I added a fair bit of documentation and tidied some
|
||||
stuff up. - RT
|
||||
|
||||
2002-10-14 21:52 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.5), graphics/grd3d.cpp
|
||||
(2.2.2.11), graphics/grd3drender.cpp (2.3.2.11),
|
||||
graphics/grd3dtexture.cpp (2.1.2.11):
|
||||
|
||||
Finally tracked down and killed off that 8 bit alpha bug. So the
|
||||
font, HUD and 8 bit ani's now work fine. - RT
|
||||
|
||||
2002-10-14 19:49 phreak
|
||||
|
||||
* code/graphics/gropenglw32x.cpp (1.4):
|
||||
|
||||
screenshots, yay!
|
||||
|
||||
2002-10-13 21:43 phreak
|
||||
|
||||
* code/graphics/gropenglw32x.cpp (1.3):
|
||||
|
||||
further optimizations
|
||||
|
||||
2002-10-12 17:48 phreak
|
||||
|
||||
* code/graphics/gropenglw32x.cpp (1.2):
|
||||
|
||||
fixed text
|
||||
|
||||
2002-10-11 21:35 phreak
|
||||
|
||||
* code/graphics/gropenglw32.cpp (1.2):
|
||||
|
||||
dont use this one
|
||||
|
||||
2002-10-11 21:30 phreak
|
||||
|
||||
* code/graphics/: gropenglw32.cpp (1.1), gropenglw32x.cpp (1.1):
|
||||
|
||||
first run at opengl for w32, only useful in main hall, barracks and
|
||||
campaign room
|
||||
|
||||
2002-10-11 18:50 randomtiger
|
||||
|
||||
* code/graphics/: 2d.cpp (2.3.2.7), 2d.h (2.1.2.1), grd3d.cpp
|
||||
(2.2.2.10), grd3d.h (2.0.2.3), grd3dinternal.h (2.1.2.5),
|
||||
grd3drender.cpp (2.3.2.10), grd3dtexture.cpp (2.1.2.10):
|
||||
|
||||
Checked in fix for 16 bit problem, thanks to Righteous1 Removed a
|
||||
fair bit of code that was used by the 16 bit code path which no
|
||||
longer exists. 32 bit and 16 bit should now work in exactly the
|
||||
same way. - RT
|
||||
|
||||
2002-10-08 14:33 randomtiger
|
||||
|
||||
* code/: graphics/grd3d.cpp (2.2.2.9), graphics/grd3drender.cpp
|
||||
(2.3.2.9), graphics/grd3dtexture.cpp (2.1.2.9), osapi/outwnd.cpp
|
||||
(2.1.2.1):
|
||||
|
||||
OK, I've fixed the z-buffer problem. However I have abandoned
|
||||
using w-buffer for now because of problems. I think I know how to
|
||||
solve it but Im not sure it would make much difference given the
|
||||
way FS2 engine works. I have left code in there of use if anyone
|
||||
wants to turn their hand to it. However for now we just need to
|
||||
crack of the alpha problem then we will have FS2 fully wokring in
|
||||
DX8 on GF4 in 32 bit.
|
||||
|
||||
2002-10-05 16:46 randomtiger
|
||||
|
||||
* code/: code.dsp (1.10), debugconsole/timerbar.cpp (1.1),
|
||||
debugconsole/timerbar.h (1.1), freespace2/freespace.cpp (2.11),
|
||||
globalincs/systemvars.h (2.2), graphics/grd3d.cpp (2.3),
|
||||
graphics/grd3dinternal.h (2.2), graphics/grd3drender.cpp (2.4),
|
||||
menuui/credits.cpp (2.3):
|
||||
|
||||
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.
|
||||
|
||||
2002-10-04 00:48 randomtiger
|
||||
|
||||
* code/graphics/: grd3d.cpp (2.2.2.8), grd3dinternal.h (2.1.2.4),
|
||||
grd3drender.cpp (2.3.2.8), grd3dtexture.cpp (2.1.2.8):
|
||||
|
||||
Fixed video memory leaks Added code to cope with lost device, not
|
||||
tested Got rid of some DX5 stuff we definately dont need Moved some
|
||||
enum's into internal,h because gr_d3d_set_state should be able to
|
||||
be called from any dx file Cleaned up some stuff - RT
|
||||
|
||||
2002-10-03 08:32 unknownplayer
|
||||
|
||||
* code/: graphics/grd3d.cpp (2.2.2.7), graphics/grd3dtexture.cpp
|
||||
(2.1.2.7), osapi/osapi.cpp (2.2.2.2):
|
||||
|
||||
Hacked in a windowed mode so we can properly debug this without
|
||||
using monitors (although I drool at the concept of having that!)
|
||||
|
||||
2002-10-02 17:52 randomtiger
|
||||
|
||||
* code/: debugconsole/dbugfile.cpp (2.1.2.3),
|
||||
debugconsole/dbugfile.h (2.1.2.3), graphics/grd3d.cpp (2.2.2.6),
|
||||
graphics/grd3drender.cpp (2.3.2.7), graphics/grd3dtexture.cpp
|
||||
(2.1.2.6):
|
||||
|
||||
Fixed blue lighting bug. Put filtering flag set back in that I
|
||||
accidentally removed Added some new functionality to my debuging
|
||||
system - RT
|
||||
|
||||
2002-10-02 11:40 randomtiger
|
||||
|
||||
* code/: code.dsp (1.6.2.7), bmpman/bmpman.cpp (2.2.2.4),
|
||||
bmpman/bmpman.h (2.0.2.3), graphics/2d.cpp (2.3.2.6),
|
||||
graphics/grd3d.cpp (2.2.2.5), graphics/grd3d.h (2.0.2.2),
|
||||
graphics/grd3dinternal.h (2.1.2.3), graphics/grd3drender.cpp
|
||||
(2.3.2.6), graphics/grd3dtexture.cpp (2.1.2.5),
|
||||
pcxutils/pcxutils.cpp (2.1.2.2):
|
||||
|
||||
Bmpmap has been reverted to an old non d3d8 version. All d3d8 code
|
||||
is now in the proper place. PCX code is now working to an extent.
|
||||
Problems with alpha though. Ani's work slowly with alpha problems.
|
||||
Also I have done a bit of tidying - RT
|
||||
|
||||
2002-09-28 22:13 randomtiger
|
||||
|
||||
* code/: anim/animplay.cpp (2.1.2.2), bmpman/bmpman.cpp (2.2.2.3),
|
||||
graphics/grd3d.cpp (2.2.2.4), graphics/grd3dinternal.h (2.1.2.2),
|
||||
graphics/grd3drender.cpp (2.3.2.5), graphics/grd3dtexture.cpp
|
||||
(2.1.2.4), weapon/weapons.cpp (2.1.2.2):
|
||||
|
||||
Sorted out some bits and pieces. The background nebula blends now
|
||||
which is nice. – RT
|
||||
|
||||
2002-09-28 12:20 randomtiger
|
||||
|
||||
* code/graphics/: grd3d.cpp (2.2.2.3), grd3drender.cpp (2.3.2.4),
|
||||
grd3dtexture.cpp (2.1.2.3):
|
||||
|
||||
Just a tiny code change that lets stuff work in 16 bit. For some
|
||||
reason 16 bit code was taking a different code path for displaying
|
||||
textures. So until I unstand why, Im cutting off that codepath
|
||||
because it isnt easy to convert into DX8.
|
||||
|
||||
2002-09-28 00:18 randomtiger
|
||||
|
||||
* code/: bmpman/bmpman.cpp (2.2.2.2), bmpman/bmpman.h (2.0.2.2),
|
||||
graphics/grd3drender.cpp (2.3.2.3), graphics/grd3dtexture.cpp
|
||||
(2.1.2.2):
|
||||
|
||||
Did some work on trying to get textures to load from pcx, define
|
||||
TX_ATTEMPT for access to it. Converted some DX7 blending calls to
|
||||
DX8 which a fair difference to ingame visuals.
|
||||
|
||||
- RT
|
||||
|
||||
2002-09-24 18:56 randomtiger
|
||||
|
||||
* Freespace2.dsp (1.7.2.3), code/code.dsp (1.6.2.6),
|
||||
code/anim/animplay.cpp (2.1.2.1), code/bmpman/bmpman.cpp (2.2.2.1),
|
||||
code/bmpman/bmpman.h (2.0.2.1), code/cfile/cfile.cpp (2.3.2.1),
|
||||
code/cmeasure/cmeasure.cpp (2.1.2.1),
|
||||
code/controlconfig/controlsconfig.cpp (2.1.2.1),
|
||||
code/cutscene/cutscenes.cpp (2.2.2.4), code/cutscene/movie.cpp
|
||||
(2.1.2.4), code/cutscene/movie.h (2.1.2.2),
|
||||
code/debugconsole/console.cpp (2.1.2.1),
|
||||
code/debugconsole/dbugfile.cpp (2.1.2.2),
|
||||
code/debugconsole/dbugfile.h (2.1.2.2),
|
||||
code/freespace2/freespace.cpp (2.6.2.4),
|
||||
code/freespace2/freespace.rc (2.0.2.1),
|
||||
code/freespace2/freespaceresource.h (2.0.2.1),
|
||||
code/gamehelp/gameplayhelp.cpp (2.1.2.1), code/globalincs/pstypes.h
|
||||
(2.4.2.2), code/graphics/2d.cpp (2.3.2.5), code/graphics/bitblt.cpp
|
||||
(2.1.2.1), code/graphics/grd3d.cpp (2.2.2.2), code/graphics/grd3d.h
|
||||
(2.0.2.1), code/graphics/grd3dinternal.h (2.1.2.1),
|
||||
code/graphics/grd3drender.cpp (2.3.2.2),
|
||||
code/graphics/grd3dtexture.cpp (2.1.2.1),
|
||||
code/graphics/grdirectdraw.cpp (2.1.2.2), code/hud/hudconfig.cpp
|
||||
(2.2.2.1), code/hud/hudmessage.cpp (2.1.2.1),
|
||||
code/menuui/barracks.cpp (2.2.2.1), code/menuui/credits.cpp
|
||||
(2.2.2.1), code/menuui/mainhallmenu.cpp (2.3.2.4),
|
||||
code/menuui/mainhalltemp.cpp (2.1.2.1), code/menuui/optionsmenu.cpp
|
||||
(2.1.2.1), code/menuui/playermenu.cpp (2.2.2.1),
|
||||
code/menuui/readyroom.cpp (2.1.2.1), code/menuui/techmenu.cpp
|
||||
(2.1.2.1), code/menuui/trainingmenu.cpp (2.1.2.1),
|
||||
code/mission/missioncampaign.cpp (2.3.2.3),
|
||||
code/mission/missiongoals.cpp (2.1.2.1),
|
||||
code/mission/missionhotkey.cpp (2.1.2.1),
|
||||
code/mission/missionload.cpp (2.1.2.1),
|
||||
code/missionui/missionbrief.cpp (2.1.2.1),
|
||||
code/missionui/missioncmdbrief.cpp (2.1.2.1),
|
||||
code/missionui/missiondebrief.cpp (2.2.2.1),
|
||||
code/missionui/missionloopbrief.cpp (2.1.2.1),
|
||||
code/missionui/missionpause.cpp (2.1.2.1),
|
||||
code/missionui/missionshipchoice.cpp (2.1.2.1),
|
||||
code/missionui/missionweaponchoice.cpp (2.1.2.1),
|
||||
code/missionui/redalert.cpp (2.1.2.1),
|
||||
code/network/multi_dogfight.cpp (2.1.2.1),
|
||||
code/network/multi_ingame.cpp (2.1.2.1),
|
||||
code/network/multi_pinfo.cpp (2.1.2.1),
|
||||
code/network/multiteamselect.cpp (2.2.2.1),
|
||||
code/network/multiui.cpp (2.4.2.1), code/pcxutils/pcxutils.cpp
|
||||
(2.1.2.1), code/popup/popup.cpp (2.1.2.1), code/render/3ddraw.cpp
|
||||
(2.2.2.1), code/ship/ship.cpp (2.6.2.1), code/stats/medals.cpp
|
||||
(2.2.2.1), code/ui/gadget.cpp (2.1.2.1), code/weapon/weapons.cpp
|
||||
(2.1.2.1):
|
||||
|
||||
DX8 branch commit
|
||||
|
||||
This is the scub of UP's previous code with the more up to date RT
|
||||
code. For full details check previous dev e-mails
|
||||
|
||||
2002-09-20 20:09 phreak
|
||||
|
||||
* code/freespace2/freespace.cpp (2.10):
|
||||
|
||||
did glare stuff in game_sunspot_process()
|
||||
|
||||
2002-09-20 20:05 phreak
|
||||
|
||||
* code/starfield/starfield.cpp (2.2):
|
||||
|
||||
glare parser stuff in stars_init()
|
||||
|
||||
2002-09-20 20:04 phreak
|
||||
|
||||
* code/starfield/starfield.h (2.2):
|
||||
|
||||
added glare variable for ambient suns if glare is 0 then the sun
|
||||
glare whiteout is not shown when looking at the sun
|
||||
|
||||
2002-09-20 20:02 phreak
|
||||
|
||||
* code/hud/hudtarget.cpp (2.2):
|
||||
|
||||
lead indicator for dumbfire missiles
|
||||
|
||||
2002-09-20 20:01 phreak
|
||||
|
||||
* code/hud/hudtargetbox.cpp (2.3):
|
||||
|
||||
extra effects during cargo scan
|
||||
|
||||
2002-09-10 21:58 unknownplayer
|
||||
|
||||
* code/graphics/directx8/GrD3d81Stubs.cpp (1.1):
|
||||
|
||||
file GrD3d81Stubs.cpp was initially added on branch directx8.
|
||||
|
||||
2002-09-10 21:58 unknownplayer
|
||||
|
||||
* code/: freespace2/freespace.cpp (2.6.2.3), graphics/2d.cpp
|
||||
(2.3.2.4), graphics/grdirectdraw.cpp (2.1.2.1),
|
||||
graphics/directx8/GrD3D81.cpp (1.2.2.4),
|
||||
graphics/directx8/GrD3D81.h (1.1.2.4),
|
||||
graphics/directx8/GrD3d81Stubs.cpp (1.1.2.1):
|
||||
|
||||
Added the DX8 stub file, plus new CODE!
|
||||
|
||||
2002-09-08 02:36 unknownplayer
|
||||
|
||||
* code/: code.dsp (1.6.2.5), graphics/2d.cpp (2.3.2.3),
|
||||
graphics/grd3d.cpp (2.2.2.1), graphics/grd3drender.cpp (2.3.2.1),
|
||||
graphics/directx8/GrD3D81.cpp (1.2.2.3),
|
||||
graphics/directx8/GrD3D81.h (1.1.2.3):
|
||||
|
||||
Framework for the new D3DRENDER class is in place, and gr_screen
|
||||
function structures are now there too. The way it's done is
|
||||
probably kind of inefficient, but until we're further along
|
||||
actually drawing polygons we should keep it that way for
|
||||
consistency's sake.
|
||||
|
||||
2002-09-01 08:18 unknownplayer
|
||||
|
||||
* Freespace2.dsp (1.7.2.2), code/code.dsp (1.6.2.4),
|
||||
code/globalincs/pstypes.h (2.4.2.1), code/graphics/2d.cpp
|
||||
(2.3.2.2), code/graphics/directx8/GrD3D81.cpp (1.2.2.2),
|
||||
code/graphics/directx8/GrD3D81.h (1.1.2.2),
|
||||
code/menuui/mainhallmenu.cpp (2.3.2.3):
|
||||
|
||||
Started writing some code for the new DX8.1 class and hit a serious
|
||||
snag to do with window handling and DirectDraw (and possibly my
|
||||
unfamiliarity with DX). It seems we may need to make some changes
|
||||
further up the code because we no longer use DX through DD in 8.1
|
||||
and the V code did that a lot (to go fullscreen and such check out
|
||||
the device creation code)
|
||||
|
||||
2002-08-31 04:50 unknownplayer
|
||||
|
||||
* code/: code.dsp (1.6.2.3), graphics/2d.cpp (2.3.2.1),
|
||||
graphics/directx8/GrD3D81.cpp (1.2.2.1),
|
||||
graphics/directx8/GrD3D81.h (1.1.2.1):
|
||||
|
||||
Removed some older DX81 stuff I added before and changed some other
|
||||
things. I'm currently thinking that I'm going to run with putting
|
||||
everything into a specialized class with the d3d_init and
|
||||
d3d_cleanup functions as gods. (Creation / Destruction functions -
|
||||
i.e. gods :)
|
||||
|
||||
2002-08-31 04:48 unknownplayer
|
||||
|
||||
* code/graphics/directx8/grd3d81internal.h (1.2.2.1):
|
||||
|
||||
These are all officially now out of FS2 unless you have a specific
|
||||
reason to need them. I'm running with the idea that we make a C++
|
||||
class and use that as an effective way to control the code.
|
||||
Rewriting V's stuff is just insanely difficult.
|
||||
|
||||
2002-08-28 21:47 randomtiger
|
||||
|
||||
* Freespace2.dsp (1.10), code/cutscene/cutscenes.cpp (2.2.2.3),
|
||||
code/cutscene/movie.cpp (2.1.2.3):
|
||||
|
||||
Tiny change to DX branch to keep movie code optional (default off)
|
||||
|
||||
2002-08-28 12:39 randomtiger
|
||||
|
||||
* code/: code.dsp (1.6.2.2), cutscene/cutscenes.cpp (2.2.2.2),
|
||||
cutscene/movie.cpp (2.1.2.2), debugconsole/dbugfile.cpp (2.1.2.1),
|
||||
debugconsole/dbugfile.h (2.1.2.1), directx/dx8show.cpp (1.1.2.2),
|
||||
directx/dx8show.h (1.1.2.2), freespace2/freespace.cpp (2.6.2.2),
|
||||
menuui/mainhallmenu.cpp (2.3.2.2), mission/missioncampaign.cpp
|
||||
(2.3.2.2), osapi/osapi.cpp (2.2.2.1), osapi/osapi.h (2.2.2.1):
|
||||
|
||||
OK, this should be a commit to the DX branch or Im going to be in a
|
||||
lot of trouble. The movie and dx8show files have been cleaned up
|
||||
big time. My debug system is in but has NO EFFECT at all unless a
|
||||
compiler flag is turned on, check h file for details. Aside from
|
||||
that a few changes to help the movie code work properly. Works on
|
||||
most things including GF4 and Voodoo 3. However may not work
|
||||
properly on a voodoo 2. Im going to leave this as a bug for now,
|
||||
serves you right for buying voodoo!
|
||||
|
||||
2002-08-28 10:51 randomtiger
|
||||
|
||||
* code/: code.dsp (1.9), debugconsole/dbugfile.cpp (2.1),
|
||||
debugconsole/dbugfile.h (2.1), freespace2/freespace.cpp (2.9):
|
||||
|
||||
Woh! I sure as hell didnt modify all these files it says I did. I
|
||||
will put this down to the branch! Note: I did start from a fresh
|
||||
checkout!
|
||||
|
||||
2002-08-27 13:38 penguin
|
||||
|
||||
* Freespace2.dsp (1.9), code/code.dsp (1.8),
|
||||
code/cmdline/cmdline.cpp (2.6), code/cmdline/cmdline.h (2.5),
|
||||
code/cutscene/cutscenes.cpp (2.4), code/cutscene/movie.cpp (2.2),
|
||||
code/cutscene/movie.h (2.2), code/directx/DShow.h (1.2),
|
||||
code/directx/ddraw.lib (1.2), code/directx/dx8show.cpp (1.2),
|
||||
code/directx/dx8show.h (1.2), code/directx/dxguid.lib (1.2),
|
||||
code/directx/strmiids.lib (1.2), code/freespace2/freespace.cpp
|
||||
(2.8), code/menuui/mainhallmenu.cpp (2.5),
|
||||
code/mission/missioncampaign.cpp (2.5):
|
||||
|
||||
Moved DirectX8 stuff to directx8 branch; reverted to previous
|
||||
|
||||
2002-08-27 13:25 penguin
|
||||
|
||||
* code/directx/: DShow.h (1.1.2.1), ddraw.lib (1.1.2.1),
|
||||
dx8show.cpp (1.1.2.1), dx8show.h (1.1.2.1), dxguid.lib (1.1.2.1),
|
||||
strmiids.lib (1.1.2.1):
|
||||
|
||||
Moved to directx8 branch
|
||||
|
||||
2002-08-27 13:21 penguin
|
||||
|
||||
* code/: freespace2/freespace.cpp (2.6.2.1),
|
||||
menuui/mainhallmenu.cpp (2.3.2.1), mission/missioncampaign.cpp
|
||||
(2.3.2.1), code.dsp (1.6.2.1), cmdline/cmdline.cpp (2.4.2.1),
|
||||
cmdline/cmdline.h (2.3.2.1), cutscene/cutscenes.cpp (2.2.2.1),
|
||||
cutscene/movie.cpp (2.1.2.1), cutscene/movie.h (2.1.2.1),
|
||||
Freespace2.dsp (1.7.2.1):
|
||||
|
||||
Moved to directx8 branch
|
||||
|
||||
2002-08-18 19:48 randomtiger
|
||||
|
||||
* Freespace2.dsp (1.8), code/code.dsp (1.7),
|
||||
code/cmdline/cmdline.cpp (2.5), code/cmdline/cmdline.h (2.4),
|
||||
code/cutscene/cutscenes.cpp (2.3), code/cutscene/movie.cpp (2.1),
|
||||
code/cutscene/movie.h (2.1), code/directx/DShow.h (1.1),
|
||||
code/directx/ddraw.lib (1.1), code/directx/dx8show.cpp (1.1),
|
||||
code/directx/dx8show.h (1.1), code/directx/dxguid.lib (1.1),
|
||||
code/directx/strmiids.lib (1.1), code/freespace2/freespace.cpp
|
||||
(2.7), code/menuui/mainhallmenu.cpp (2.4),
|
||||
code/mission/missioncampaign.cpp (2.4):
|
||||
|
||||
Added new lib files: strmiids and ddraw to get dshow working Added
|
||||
new command line parameter to active direct show movie play:
|
||||
-dshowvid Uncommented movie_play calls and includes
|
||||
|
||||
2002-08-15 04:41 penguin
|
||||
|
||||
* code/globalincs/systemvars.h (2.1):
|
||||
|
||||
Added #include, needed for FRED
|
||||
|
||||
2002-08-13 03:40 penguin
|
||||
|
||||
RELEASED: fs2_open 3.2 (tag: fs2_open3_2)
|
||||
|
||||
2002-08-13 03:34 penguin
|
||||
|
||||
* code/freespace2/freespace.cpp (2.6):
|
||||
|
||||
1. Disable CD checking
|
||||
2. Add CVS tag to version string
|
||||
|
||||
2002-08-13 03:32 penguin
|
||||
|
||||
* code/globalincs/version.h (2.2):
|
||||
|
||||
Bumped to version 3.2
|
||||
|
||||
2002-08-07 00:45 DTP
|
||||
|
||||
* code/graphics/grd3drender.cpp (2.3):
|
||||
|
||||
Implented -GF4FIX commandline switch & #include "cmdline/cmdline.h"
|
||||
|
||||
2002-08-07 00:44 DTP
|
||||
|
||||
* code/cmdline/: cmdline.cpp (2.4), cmdline.h (2.3):
|
||||
|
||||
Implented -GF4FIX commandline switch
|
||||
|
||||
2002-08-06 16:50 phreak
|
||||
|
||||
* code/hud/hudtargetbox.cpp (2.2):
|
||||
|
||||
added wireframe targetbox feature
|
||||
|
||||
2002-08-06 16:50 phreak
|
||||
|
||||
* code/hud/hudtargetbox.h (2.1):
|
||||
|
||||
added Targetbox_wire variable to check what mode the hud targetbox
|
||||
uses
|
||||
|
||||
2002-08-06 16:49 phreak
|
||||
|
||||
* code/io/keycontrol.cpp (2.2):
|
||||
|
||||
added keybing for wireframe hud, fixed previous missile cheat
|
||||
|
||||
2002-08-06 04:39 penguin
|
||||
|
||||
* code/hud/hudwingmanstatus.cpp (2.2):
|
||||
|
||||
Use text strings for wingmen names instead of ANI
|
||||
|
||||
2002-08-06 03:50 penguin
|
||||
|
||||
* code/ui/ui.h (2.2):
|
||||
|
||||
inserted "class" keyword on "friend" definitions (ANSI C++ )
|
||||
|
||||
2002-08-06 02:42 penguin
|
||||
|
||||
* Freespace2.dsp (1.7), code/code.dsp (1.6):
|
||||
|
||||
Fixed problem w/ compile options for Debug mode
|
||||
|
||||
2002-08-06 01:49 penguin
|
||||
|
||||
* code/Makefile (2.4):
|
||||
|
||||
Removed a couple more include dirs I missed
|
||||
|
||||
2002-08-06 01:49 penguin
|
||||
|
||||
* code/: globalincs/pstypes.h (2.4), render/3dclipper.cpp (2.2),
|
||||
render/3ddraw.cpp (2.2):
|
||||
|
||||
Renamed ccode members to cc_or and cc_and
|
||||
|
||||
2002-08-04 05:43 penguin
|
||||
|
||||
* ChangeLog (1.1), code/ChangeLog (1.3):
|
||||
|
||||
Moved ChangeLog to top-level directory
|
||||
|
||||
2002-08-04 05:13 penguin
|
||||
|
||||
RELEASED: fs2_open 3.1 (tag: fs2_open3_1)
|
||||
|
||||
2002-08-04 05:13 penguin
|
||||
|
||||
* code/network/stand_gui.cpp (2.3):
|
||||
|
||||
Change version display
|
||||
|
||||
* code/menuui/playermenu.cpp (2.2):
|
||||
|
||||
Display fs2_open version instead of "Freespace 2"
|
||||
|
||||
* code/menuui/mainhallmenu.cpp (2.3):
|
||||
|
||||
Change version display location
|
||||
|
||||
* code/globalincs/version.h (2.1):
|
||||
|
||||
Update version number to 3.1
|
||||
|
||||
* code/freespace2/freespace.cpp (2.5):
|
||||
|
||||
Don't write version to registry; change way version string is
|
||||
formatted
|
||||
|
||||
* code/ChangeLog (1.1), ChangeLog (1.2):
|
||||
|
||||
Moved ChangeLog to top-level directory
|
||||
|
||||
2002-08-03 19:42 randomtiger
|
||||
|
||||
* code/graphics/grd3drender.cpp (2.2):
|
||||
|
||||
Fixed Geforce 4 bug that caused font and hall video distortion.
|
||||
Very small change in 'gr_d3d_aabitmap_ex_internal'
|
||||
|
||||
Tested and works on the following systems
|
||||
|
||||
OUTSIDER Voodoo 3 win98 OUTSIDER Geforce 2 win2000 Me Geforce 4 PNY
|
||||
4600 XP JBX-Phoenix Geforce 4 PNY XP Mehrunes GeForce 3 XP
|
||||
WMCoolmon nVidia TNT2 M64 win2000 Orange GeForce 4 4200 XP
|
||||
ShadowWolf_IH Monster2 win98 ShadowWolf_IH voodoo 2 win98
|
||||
|
||||
2002-08-03 18:34 wmcoolmon
|
||||
|
||||
* code/code.dsp (1.5), Freespace2.dsp (1.6):
|
||||
|
||||
Fixed Win32 debug configuration
|
||||
|
||||
2002-08-03 17:42 wmcoolmon
|
||||
|
||||
* Freespace2.dsp (1.5), code/code.dsp (1.4):
|
||||
|
||||
Sync with makefile 1.4
|
||||
|
||||
2002-08-01 04:04 penguin
|
||||
|
||||
* code/ChangeLog (1.2):
|
||||
|
||||
updated
|
||||
|
||||
2002-08-01 02:00 penguin
|
||||
|
||||
* fs2_open.w32.mak (1.4):
|
||||
|
||||
The big include file move
|
||||
|
||||
====
|
||||
NOTE:
|
||||
====
|
||||
below this point, all files are relative to the 'code' directory
|
||||
|
||||
|
||||
2002-08-01 01:41 penguin
|
||||
|
||||
* Makefile (2.3), anim/animplay.cpp (2.1), anim/animplay.h (2.1),
|
||||
@@ -1107,3 +1865,4 @@
|
||||
|
||||
|
||||
# generated by cvs2cl.pl
|
||||
# cvs2cl.pl -r -S --utc -f ChangeLog2
|
||||
@@ -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 "." /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"
|
||||
@@ -79,10 +79,10 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo /o"debug/profile/Freespace2.bsc" "./debug/profile/*.sbr"
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib code.lib /nologo /subsystem:windows /debug /debugtype:both /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcd.lib" /out:"Debug/fs2_open.exe" /libpath:"debug"
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib winmm.lib vfw32.lib msacm32.lib comctl32.lib code.lib /nologo /subsystem:windows /debug /debugtype:both /machine:I386 /nodefaultlib:"libc.lib" /nodefaultlib:"libcd.lib" /out:"debug\fs2_open_debug.exe" /libpath:"debug"
|
||||
# SUBTRACT LINK32 /pdb:none /incremental:no /map
|
||||
# Begin Custom Build - Copying $(InputPath) to c:\games\freespace2
|
||||
InputPath=.\Debug\fs2_open.exe
|
||||
InputPath=.\debug\fs2_open_debug.exe
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"c:\games\freespace2\fs2_open.exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
README for fs2_open, Release 0.1
|
||||
|
||||
WARNINGS:
|
||||
========
|
||||
This is very much an pre-alpha build. Don't expect too much from it!
|
||||
|
||||
In particular, do not run this in the same directory as existing pilot
|
||||
files or anything else that you don't want to get destroyed...
|
||||
|
||||
I have tried to modify as little code as possible to keep the existing
|
||||
Windows code from breaking, but I have not verified that this code
|
||||
will still work on Windows. Some changes may be necessary.
|
||||
|
||||
There are occasional crashes and segfaults from time to time.
|
||||
|
||||
All of this was tested on my system only. I don't know if any
|
||||
assumptions about my hardware have crept into the code. I guess it
|
||||
goes without saying that this will only work on x86-based Linux
|
||||
systems :-)
|
||||
|
||||
|
||||
STATUS:
|
||||
=======
|
||||
Most 2D graphics appear to be working, although very slowly.
|
||||
Improving the performance of the 2D graphic system is a high priority.
|
||||
|
||||
3D graphics are in a very primitive state right now. No texturing is
|
||||
done, so all objects (ships, lasers, explosions, etc.) look "ghostly."
|
||||
|
||||
Nebula missions do not work at all.
|
||||
|
||||
Sound, joystick, and network are all disabled.
|
||||
|
||||
|
||||
REQUIREMENTS:
|
||||
=============
|
||||
The only "non-standard" package that you will need (as far as I can
|
||||
tell) is the SDL library, available at http://www.libsdl.org I think
|
||||
SDL requires XFree86 release 4 or higher.
|
||||
|
||||
|
||||
INSTALLING:
|
||||
===========
|
||||
There is no configure script, no options, etc. -- just a Makefile. It
|
||||
is likely that you will need to adjust it to match your configuration,
|
||||
in particular the location of the SDL files.
|
||||
|
||||
If everything is right, you should be able to run 'make' from the
|
||||
fs2_open/code directory and create an 'fs2' executable.
|
||||
|
||||
|
||||
RUNNING:
|
||||
========
|
||||
The fs2 executable should be copied (or symlinked) to the same
|
||||
directory as the *.VP files. All the *.VP files that you need should
|
||||
be here -- the code isn't smart enough to look in your CD for command
|
||||
brief ANIs, etc.
|
||||
|
||||
It only runs in windowed mode, no full screen.
|
||||
|
||||
I have never run it in high-resolution mode (1024x768), so all bets
|
||||
are off if you try it.
|
||||
|
||||
There seems to be a bug in some of the 'glob' routines that scan for
|
||||
files in the 'data' directory, so you will have better results if you:
|
||||
1. Keep everything in the *.VP file (i.e., no mods)
|
||||
2. Only have one player file
|
||||
|
||||
I recommend that background graphics be turned off via the "Options"
|
||||
screen or it will look very odd. Your in-game framerate will be
|
||||
significantly higher if you turn off (or set to 'popup') as many HUD
|
||||
gauges as possible.
|
||||
|
||||
Due to the painful slowness of the 2D UI, you might need to hold the
|
||||
mouse button down a little longer to get buttons to activate.
|
||||
|
||||
===
|
||||
|
||||
Mike Harris (HLP penguin)
|
||||
02 June 2002
|
||||
|
||||
@@ -91,9 +91,8 @@ LDLIBS = -L/usr/X11R6/lib -lSDL -lGL -lGLU -lpthread
|
||||
CXXFLAGS = \
|
||||
-g \
|
||||
-I/usr/local/include/SDL \
|
||||
-I. -Iwindows_stub \
|
||||
-I. \
|
||||
-fno-exceptions \
|
||||
-IWeapon -ILocalization -INebula -IDemo -IInetfile -IExceptionHandler \
|
||||
-D_DEBUG -DNO_CD_CHECK -UNDEBUG \
|
||||
-DNO_DIRECT3D $(SOUND_DEF) $(JOYSTICK_DEF) $(NETWORK_DEF) $(OPENGL_DEF)
|
||||
|
||||
|
||||
+286
-28
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/cfile.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.7 $
|
||||
* $Date: 2002-11-10 16:29:53 $
|
||||
* $Author: DTP $
|
||||
*
|
||||
* Utilities for operating on files
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.6 2002/11/04 08:32:38 DTP
|
||||
* Made sure, that VP and Plain files dont get added twice to the search order. Side-effect of Mod support.
|
||||
*
|
||||
* Revision 2.5 2002/10/30 06:31:05 DTP
|
||||
* doh!, used upper case in include, dont know how much it matters for *nix systems, but here it is
|
||||
*
|
||||
* Revision 2.4 2002/10/27 23:59:28 DTP
|
||||
* DTP; started basic implementation of mod-support
|
||||
* plain files only for now. fs2_open.exe -mod X will look for files in fs2/ X /all-legal-subdirectories. no checking/creating dirs yet. directories must be there.
|
||||
*
|
||||
* Revision 2.3 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.2 2002/07/29 19:04:48 penguin
|
||||
* added #ifdef _WIN32 around windows-specific system headers
|
||||
*
|
||||
@@ -206,6 +219,7 @@
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "parse/encrypt.h"
|
||||
@@ -1768,3 +1782,4 @@ int cflush(CFILE *cfile)
|
||||
|
||||
|
||||
|
||||
|
||||
+43
-29
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/cfile.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2002-11-10 16:29:53 $
|
||||
* $Author: DTP $
|
||||
*
|
||||
* <insert description of file here>
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2002/11/02 23:06:59 DTP
|
||||
* DOh,uhmm, define error again, this is getting to me.
|
||||
*
|
||||
* Revision 2.4 2002/11/02 23:04:46 DTP
|
||||
* DOh, fixed that define, learn to count DTP :)
|
||||
*
|
||||
* Revision 2.3 2002/10/27 23:59:28 DTP
|
||||
* DTP; started basic implementation of mod-support
|
||||
* plain files only for now. fs2_open.exe -mod X will look for files in fs2/ X /all-legal-subdirectories. no checking/creating dirs yet. directories must be there.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -378,44 +391,45 @@ typedef struct {
|
||||
|
||||
#define CF_TYPE_ANY -1 // Used to check in any directory
|
||||
|
||||
#define CF_TYPE_INVALID 0
|
||||
#define CF_TYPE_ROOT 1 // Root must be 1!!
|
||||
#define CF_TYPE_DATA 2
|
||||
#define CF_TYPE_MAPS 3
|
||||
#define CF_TYPE_TEXT 4
|
||||
#define CF_TYPE_MISSIONS 5
|
||||
#define CF_TYPE_MODELS 6
|
||||
#define CF_TYPE_TABLES 7
|
||||
#define CF_TYPE_SOUNDS 8
|
||||
#define CF_TYPE_SOUNDS_8B22K 9
|
||||
#define CF_TYPE_SOUNDS_16B11K 10
|
||||
#define CF_TYPE_VOICE 11
|
||||
#define CF_TYPE_INVALID 0
|
||||
#define CF_TYPE_ROOT 1 // Root must be 1!!
|
||||
#define CF_TYPE_DATA 2
|
||||
#define CF_TYPE_MAPS 3
|
||||
#define CF_TYPE_TEXT 4
|
||||
#define CF_TYPE_MISSIONS 5
|
||||
#define CF_TYPE_MODELS 6
|
||||
#define CF_TYPE_TABLES 7
|
||||
#define CF_TYPE_SOUNDS 8
|
||||
#define CF_TYPE_SOUNDS_8B22K 9
|
||||
#define CF_TYPE_SOUNDS_16B11K 10
|
||||
#define CF_TYPE_VOICE 11
|
||||
#define CF_TYPE_VOICE_BRIEFINGS 12
|
||||
#define CF_TYPE_VOICE_CMD_BRIEF 13
|
||||
#define CF_TYPE_VOICE_DEBRIEFINGS 14
|
||||
#define CF_TYPE_VOICE_PERSONAS 15
|
||||
#define CF_TYPE_VOICE_SPECIAL 16
|
||||
#define CF_TYPE_VOICE_SPECIAL 16
|
||||
#define CF_TYPE_VOICE_TRAINING 17
|
||||
#define CF_TYPE_MUSIC 18
|
||||
#define CF_TYPE_MOVIES 19
|
||||
#define CF_TYPE_INTERFACE 20
|
||||
#define CF_TYPE_FONT 21
|
||||
#define CF_TYPE_EFFECTS 22
|
||||
#define CF_TYPE_HUD 23
|
||||
#define CF_TYPE_MUSIC 18
|
||||
#define CF_TYPE_MOVIES 19
|
||||
#define CF_TYPE_INTERFACE 20
|
||||
#define CF_TYPE_FONT 21
|
||||
#define CF_TYPE_EFFECTS 22
|
||||
#define CF_TYPE_HUD 23
|
||||
#define CF_TYPE_PLAYER_MAIN 24
|
||||
#define CF_TYPE_PLAYER_IMAGES_MAIN 25
|
||||
#define CF_TYPE_CACHE 26
|
||||
#define CF_TYPE_PLAYERS 27
|
||||
#define CF_TYPE_CACHE 26
|
||||
#define CF_TYPE_PLAYERS 27
|
||||
#define CF_TYPE_SINGLE_PLAYERS 28
|
||||
#define CF_TYPE_MULTI_PLAYERS 29
|
||||
#define CF_TYPE_MULTI_PLAYERS 29
|
||||
#define CF_TYPE_MULTI_CACHE 30
|
||||
#define CF_TYPE_CONFIG 31
|
||||
#define CF_TYPE_CONFIG 31
|
||||
#define CF_TYPE_SQUAD_IMAGES_MAIN 32
|
||||
#define CF_TYPE_DEMOS 33
|
||||
#define CF_TYPE_CBANIMS 34
|
||||
#define CF_TYPE_DEMOS 33
|
||||
#define CF_TYPE_CBANIMS 34
|
||||
#define CF_TYPE_INTEL_ANIMS 35
|
||||
|
||||
#define CF_MAX_PATH_TYPES 36 // Can be as high as you'd like
|
||||
#define CF_MAX_PATH_TYPES 36 // Can be as high as you'd like //DTP; yeah but beware alot of things uses CF_MAX_PATH_TYPES
|
||||
|
||||
|
||||
// TRUE if type is specified and valid
|
||||
#define CF_TYPE_SPECIFIED(path_type) (((path_type)>CF_TYPE_INVALID) && ((path_type)<CF_MAX_PATH_TYPES))
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/CFile/CfileSystem.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.6 $
|
||||
* $Date: 2002-11-10 16:28:08 $
|
||||
* $Author: DTP $
|
||||
*
|
||||
* Functions to keep track of and find files that can exist
|
||||
* on the harddrive, cd-rom, or in a pack file on either of those.
|
||||
@@ -20,6 +20,15 @@
|
||||
* all those locations, inherently enforcing precedence orders.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.5 2002/10/30 06:29:45 DTP
|
||||
* doh!, used upper case in include, dont know how much it matters for *nix systems, but here it is
|
||||
*
|
||||
* Revision 2.4 2002/10/30 06:26:11 DTP
|
||||
* DTP Implemented basic VP files handling. mission and campaign files inside VP files found in mod dir still not supported, cheking / creating directories not implented either
|
||||
*
|
||||
* Revision 2.3 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.2 2002/07/29 19:52:48 penguin
|
||||
* added #ifdef _WIN32 around windows-specific system headers
|
||||
*
|
||||
@@ -123,6 +132,7 @@
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cfile/cfilesystem.h"
|
||||
@@ -248,10 +258,11 @@ int cf_get_packfile_count(cf_root *root)
|
||||
packfile_count = 0;
|
||||
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
|
||||
strcpy( filespec, root->path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)){
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
// }
|
||||
}
|
||||
|
||||
#if defined _WIN32
|
||||
@@ -337,11 +348,13 @@ void cf_build_pack_list( cf_root *root )
|
||||
root_index = 0;
|
||||
for (i=CF_TYPE_ROOT; i<CF_MAX_PATH_TYPES; i++ ) {
|
||||
strcpy( filespec, root->path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)){
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( filespec, Pathtypes[i].path );
|
||||
strcat( filespec, DIR_SEPARATOR_STR );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if defined _WIN32
|
||||
strcat( filespec, "*.vp" );
|
||||
@@ -362,12 +375,13 @@ void cf_build_pack_list( cf_root *root )
|
||||
|
||||
// fill in all the proper info
|
||||
strcpy(rptr_sort->path, root->path);
|
||||
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
|
||||
if(strlen(Pathtypes[i].path)){
|
||||
strcat(rptr_sort->path, Pathtypes[i].path );
|
||||
strcat(rptr_sort->path, Pathtypes[i].path );
|
||||
strcat(rptr_sort->path, DIR_SEPARATOR_STR);
|
||||
}
|
||||
|
||||
|
||||
strcat(rptr_sort->path, find.name );
|
||||
rptr_sort->roottype = CF_ROOTTYPE_PACK;
|
||||
rptr_sort->cf_type = i;
|
||||
@@ -434,12 +448,17 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
|
||||
cf_root *root;
|
||||
|
||||
//======================================================
|
||||
// First, check the current directory.
|
||||
// strcpy( root->path, "d:\\projects\\freespace\\" );
|
||||
if(Cmdline_mod) {
|
||||
strcat(Cmdline_mod, DIR_SEPARATOR_STR);
|
||||
cf_root *modroot;
|
||||
modroot = cf_create_root();
|
||||
strcpy(modroot->path,Cmdline_mod);
|
||||
modroot->roottype = CF_ROOTTYPE_PATH;
|
||||
cf_build_pack_list(modroot);
|
||||
}
|
||||
|
||||
root = cf_create_root();
|
||||
|
||||
|
||||
if ( !_getcwd(root->path, CF_MAX_PATHNAME_LENGTH ) ) {
|
||||
Error(LOCATION, "Can't get current working directory -- %d", errno );
|
||||
}
|
||||
@@ -448,6 +467,8 @@ void cf_build_root_list(char *cdrom_dir)
|
||||
if(strlen(root->path) && (root->path[strlen(root->path)-1] != DIR_SEPARATOR_CHAR)){
|
||||
strcat(root->path, DIR_SEPARATOR_STR); // put trailing backslash on for easier path construction
|
||||
}
|
||||
|
||||
|
||||
root->roottype = CF_ROOTTYPE_PATH;
|
||||
|
||||
//======================================================
|
||||
@@ -500,7 +521,7 @@ void cf_search_root_path(int root_index)
|
||||
|
||||
strcpy( search_path, root->path );
|
||||
|
||||
if(strlen(Pathtypes[i].path)){
|
||||
if(strlen(Pathtypes[i].path)) {
|
||||
strcat( search_path, Pathtypes[i].path );
|
||||
strcat( search_path, DIR_SEPARATOR_STR );
|
||||
}
|
||||
@@ -593,9 +614,7 @@ typedef struct VP_FILE {
|
||||
} VP_FILE;
|
||||
|
||||
void cf_search_root_pack(int root_index)
|
||||
{
|
||||
int i;
|
||||
|
||||
{
|
||||
cf_root *root = cf_get_root(root_index);
|
||||
|
||||
//mprintf(( "Searching root pack '%s'\n", root->path ));
|
||||
@@ -621,6 +640,7 @@ void cf_search_root_pack(int root_index)
|
||||
strcpy( search_path, "" );
|
||||
|
||||
// Go through all the files
|
||||
int i;
|
||||
for (i=0; i<VP_header.num_files; i++ ) {
|
||||
VP_FILE find;
|
||||
|
||||
@@ -644,38 +664,35 @@ void cf_search_root_pack(int root_index)
|
||||
//mprintf(( "Current dir = '%s'\n", search_path ));
|
||||
} else {
|
||||
|
||||
int j;
|
||||
int j;
|
||||
|
||||
for (j=CF_TYPE_ROOT; j<CF_MAX_PATH_TYPES; j++ ) {
|
||||
|
||||
|
||||
if ( !stricmp( search_path, Pathtypes[j].path )) {
|
||||
|
||||
char *ext = strchr( find.filename, '.' );
|
||||
if ( ext ) {
|
||||
if ( is_ext_in_list( Pathtypes[j].extensions, ext ) ) {
|
||||
// Found a file!!!!
|
||||
cf_file *file = cf_create_file();
|
||||
|
||||
strcpy( file->name_ext, find.filename );
|
||||
file->root_index = root_index;
|
||||
file->pathtype_index = j;
|
||||
file->write_time = find.write_time;
|
||||
file->size = find.size;
|
||||
file->pack_offset = find.offset; // Mark as a non-packed file
|
||||
|
||||
file->pack_offset = find.offset; // Mark as a packed file
|
||||
//mprintf(( "Found pack file '%s'\n", file->name_ext ));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void cf_build_file_list()
|
||||
{
|
||||
int i;
|
||||
@@ -705,7 +722,7 @@ void cf_build_secondary_filelist(char *cdrom_dir)
|
||||
|
||||
// Init the path types
|
||||
for (i=0; i<CF_MAX_PATH_TYPES; i++ ) {
|
||||
Assert( Pathtypes[i].index == i );
|
||||
//Assert( Pathtypes[i].index == i );
|
||||
// [mharris] can't modify constant strings, why do this anyhow???
|
||||
// just need to make sure exts are all lc in the definition...
|
||||
// if ( Pathtypes[i].extensions ) {
|
||||
@@ -868,8 +885,8 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
strcat( pack_filename, DIR_SEPARATOR_STR );
|
||||
strcat( pack_filename, f->name_ext );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
// restore original filespec
|
||||
strcpy(filespec, temp);
|
||||
@@ -892,12 +909,13 @@ int cf_find_file_location( char *filespec, int pathtype, char *pack_filename, in
|
||||
|
||||
strcat( pack_filename, f->name_ext );
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -953,6 +971,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
|
||||
if (max < 1) {
|
||||
Get_file_list_filter = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -973,6 +992,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
if (find_handle != -1) {
|
||||
do {
|
||||
if (num_files >= max)
|
||||
|
||||
break;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
@@ -1047,8 +1067,9 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
}
|
||||
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
if ( !cf_matches_spec( filter,f->name_ext)) {
|
||||
continue;
|
||||
}
|
||||
@@ -1091,6 +1112,7 @@ int cf_get_file_list( int max, char **list, int pathtype, char *filter, int sort
|
||||
}
|
||||
|
||||
Get_file_list_filter = NULL;
|
||||
|
||||
return num_files;
|
||||
}
|
||||
|
||||
@@ -1124,6 +1146,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
|
||||
if (max < 1) {
|
||||
Get_file_list_filter = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1154,7 +1177,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
find_handle = _findfirst( filespec, &find );
|
||||
if (find_handle != -1) {
|
||||
do {
|
||||
if (num_files >= max)
|
||||
if (num_files >= max)
|
||||
break;
|
||||
|
||||
if (!(find.attrib & _A_SUBDIR)) {
|
||||
@@ -1229,6 +1252,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
}
|
||||
|
||||
if (num_files >= max)
|
||||
|
||||
break;
|
||||
|
||||
if ( !cf_matches_spec( filter,f->name_ext)) {
|
||||
@@ -1269,6 +1293,7 @@ int cf_get_file_list_preallocated( int max, char arr[][MAX_FILENAME_LEN], char *
|
||||
}
|
||||
|
||||
Get_file_list_filter = NULL;
|
||||
|
||||
return num_files;
|
||||
}
|
||||
|
||||
@@ -1301,7 +1326,7 @@ void cf_create_default_path_string( char *path, int pathtype, char *filename, bo
|
||||
|
||||
// Don't add slash for root directory
|
||||
if (Pathtypes[pathtype].path[0] != '\0') {
|
||||
strcat(path, DIR_SEPARATOR_STR);
|
||||
strcat(path, DIR_SEPARATOR_STR);
|
||||
}
|
||||
|
||||
// add filename
|
||||
|
||||
@@ -9,11 +9,54 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cmdline/cmdline.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $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,
|
||||
*
|
||||
* Revision 2.9 2002/10/27 23:55:36 DTP
|
||||
* DTP; started basic implementation of mod-support
|
||||
* plain files only for now. fs2_open.exe -mod X will look for files in fs2/ X /all-legal-subdirectories. no checking/creating dirs yet. directories must be there.
|
||||
*
|
||||
* Revision 2.8 2002/10/22 23:02:39 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.7 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
|
||||
*
|
||||
* Revision 2.6 2002/08/27 13:38:57 penguin
|
||||
* Moved DirectX8 stuff to directx8 branch; reverted to previous
|
||||
*
|
||||
* Revision 2.4 2002/08/07 00:44:13 DTP
|
||||
* Implented -GF4FIX commandline switch
|
||||
*
|
||||
* Revision 2.3 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.2 2002/07/29 06:35:15 DTP
|
||||
* added -almission commandline arguement, will autoload mission i.e fs2_open.exe -almission kickass will autoload kickass.fs2 which should be a multiplayer mission.
|
||||
*
|
||||
@@ -251,8 +294,12 @@ cmdline_parm mouse_coords("-coords", NULL);
|
||||
cmdline_parm timeout("-timeout", NULL);
|
||||
cmdline_parm d3d_window("-window", NULL);
|
||||
cmdline_parm almission_arg("-almission", NULL); //DTP for autoload Multi mission
|
||||
|
||||
|
||||
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;
|
||||
@@ -270,7 +317,8 @@ char *Cmdline_game_password = NULL;
|
||||
char *Cmdline_rank_above= NULL;
|
||||
char *Cmdline_rank_below = NULL;
|
||||
char *Cmdline_connect_addr = NULL;
|
||||
char *Cmdline_almission = NULL; //DTP FOR AUTO-LOAD Multi MISSION
|
||||
char *Cmdline_almission = NULL; //DTP for autoload multi mission.
|
||||
char *Cmdline_mod = NULL; //DTP for mod arguement
|
||||
int Cmdline_multi_log = 0;
|
||||
int Cmdline_server_firing = 0;
|
||||
int Cmdline_client_dodamage = 0;
|
||||
@@ -280,6 +328,14 @@ int Cmdline_mouse_coords = 0;
|
||||
int Cmdline_timeout = -1;
|
||||
|
||||
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;
|
||||
|
||||
|
||||
|
||||
|
||||
static cmdline_parm Parm_list(NULL, NULL);
|
||||
static int Parm_list_inited = 0;
|
||||
@@ -643,6 +699,32 @@ int parse_cmdline(int argc, char *argv[])
|
||||
Cmdline_use_last_pilot = 1;
|
||||
Cmdline_start_netgame = 1;
|
||||
}
|
||||
if (gf4fix_arg.found() ) {
|
||||
Cmdline_gf4fix = 1;
|
||||
}
|
||||
|
||||
if (allslev_arg.found() ) {
|
||||
Cmdline_allslev = 1;
|
||||
}
|
||||
|
||||
if(phreak_arg.found() ) {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -5,15 +5,54 @@
|
||||
* or otherwise commercially exploit the source or things you created based on the
|
||||
* source.
|
||||
*
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-07-29 06:35:15 $
|
||||
* $Author: DTP $
|
||||
* $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.
|
||||
*
|
||||
* Revision 2.10 2002/10/30 20:22:30 inquisitor
|
||||
* Bad Committ, Rolling back
|
||||
*
|
||||
* Revision 2.7 2002/10/22 23:02:39 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.6 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
|
||||
*
|
||||
* Revision 2.5 2002/08/27 13:38:57 penguin
|
||||
* Moved DirectX8 stuff to directx8 branch; reverted to previous
|
||||
*
|
||||
* Revision 2.3 2002/08/07 00:44:13 DTP
|
||||
* Implented -GF4FIX commandline switch
|
||||
*
|
||||
* Revision 2.2 2002/07/29 06:35:15 DTP
|
||||
* added -almission commandline arguement, will autoload mission i.e fs2_open.exe -almission kickass will autoload kickass.fs2 which should be a multiplayer mission.
|
||||
*
|
||||
* Revision 2.1 2002/07/07 19:55:58 penguin
|
||||
* Back-port to MSVC
|
||||
*
|
||||
@@ -198,6 +237,13 @@ extern int Cmdline_timeout;
|
||||
|
||||
extern int Cmdline_window;
|
||||
extern char *Cmdline_almission; //DTP for autoload mission
|
||||
extern int Cmdline_gf4fix; //DTP for Random tigers GF4fix.
|
||||
extern int Cmdline_allslev;
|
||||
extern int Cmdline_phreak;
|
||||
extern int Cmdline_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
|
||||
+67
-7
@@ -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 "." /FI"PSTypes.h" /D "_WINDOWS" /D "WIN32" /D "_DEBUG" /D "USE_DX81" /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"
|
||||
|
||||
@@ -227,12 +235,36 @@ SOURCE=.\Debris\Debris.h
|
||||
|
||||
SOURCE=.\DebugConsole\Console.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\debugconsole\dbugfile.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\debugconsole\dbugfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\debugconsole\timerbar.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\debugconsole\timerbar.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "DirectX"
|
||||
|
||||
# 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
|
||||
@@ -301,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
|
||||
@@ -313,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"
|
||||
@@ -2475,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
|
||||
@@ -9,13 +9,26 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfig.h $
|
||||
* $Revision: 2.0 $
|
||||
* $Date: 2002-06-03 04:02:21 $
|
||||
* $Author: penguin $
|
||||
* $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.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -292,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
|
||||
@@ -445,8 +458,15 @@ typedef struct config_item {
|
||||
|
||||
#define MULTI_SELF_DESTRUCT 106
|
||||
|
||||
#define TOGGLE_HUD 107
|
||||
#define RIGHT_SLIDE_THRUST 108
|
||||
#define LEFT_SLIDE_THRUST 109
|
||||
#define UP_SLIDE_THRUST 110
|
||||
#define DOWN_SLIDE_THRUST 111
|
||||
|
||||
|
||||
// this should be the total number of control action defines above (or last define + 1)
|
||||
#define CCFG_MAX 107
|
||||
#define CCFG_MAX 112
|
||||
|
||||
extern int Failed_key_index;
|
||||
extern int Invert_heading;
|
||||
|
||||
@@ -9,13 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/ControlConfig/ControlsConfigCommon.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-10-19 19:29:27 $
|
||||
* $Author: bobboau $
|
||||
*
|
||||
* C module for keyboard, joystick and mouse configuration common stuff (between Fred and FreeSpace)
|
||||
*
|
||||
* $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:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:21 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -536,6 +543,13 @@ config_item Control_config[CCFG_MAX + 1] = {
|
||||
{ KEY_SHIFTED | KEY_N, -1, COMPUTER_TAB, "(Multiplayer) Toggle network info"},
|
||||
{ KEY_SHIFTED | KEY_END, -1, COMPUTER_TAB, "(Multiplayer) Self destruct"},
|
||||
|
||||
// Misc
|
||||
{ KEY_SHIFTED | KEY_O, -1, COMPUTER_TAB, "Toggle HUD"},
|
||||
{ KEY_SHIFTED | KEY_3, -1, SHIP_TAB, "Right Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_1, -1, SHIP_TAB, "Left Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADPLUS, -1, SHIP_TAB, "Up Thrust", CC_TYPE_CONTINUOUS},
|
||||
{ KEY_SHIFTED | KEY_PADENTER, -1, SHIP_TAB, "Down Thrust", CC_TYPE_CONTINUOUS},
|
||||
|
||||
{ -1, -1, -1, "" }
|
||||
};
|
||||
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Cutscene/Cutscenes.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $Revision: 2.4 $
|
||||
* $Date: 2002-08-27 13:38:57 $
|
||||
* $Author: penguin $
|
||||
*
|
||||
* Code for the cutscenes viewer screen
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* 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
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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?";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1,254 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/timeb.h>
|
||||
|
||||
#include "dbugfile.h"
|
||||
|
||||
bool dbugfile_init_var = false;
|
||||
|
||||
char dbugfile_filename[512];
|
||||
|
||||
void dbugfile_output(char *buffer)
|
||||
{
|
||||
if(dbugfile_init_var == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
FILE *fp = fopen(dbugfile_filename, "a");
|
||||
|
||||
if(fp == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(buffer, sizeof(char) * strlen(buffer), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
void dbugfile_init()
|
||||
{
|
||||
char big_buffer[1000];
|
||||
char temp_buff[512];
|
||||
|
||||
strcpy(dbugfile_filename, "DBUG-");
|
||||
strcpy(big_buffer, "DBUGFILE Active: ");
|
||||
|
||||
#ifdef _WIN32
|
||||
{
|
||||
unsigned long len = 512;
|
||||
GetUserName(temp_buff, &len);
|
||||
|
||||
strcat(dbugfile_filename, temp_buff);
|
||||
strcat(big_buffer, temp_buff);
|
||||
|
||||
strcat(dbugfile_filename, "-");
|
||||
strcat(big_buffer, " ");
|
||||
}
|
||||
#endif
|
||||
|
||||
_tzset();
|
||||
|
||||
// Display operating system-style date and time.
|
||||
_strtime( temp_buff);
|
||||
strcat(dbugfile_filename, "(");
|
||||
strcat(dbugfile_filename,temp_buff);
|
||||
strcat(big_buffer,temp_buff);
|
||||
|
||||
strcat(dbugfile_filename, ")-(");
|
||||
strcat(big_buffer, " ");
|
||||
_strdate( temp_buff);
|
||||
strcat(dbugfile_filename,temp_buff);
|
||||
strcat(big_buffer,temp_buff);
|
||||
|
||||
strcat(dbugfile_filename, ").txt");
|
||||
strcat(big_buffer, "\n");
|
||||
|
||||
// Remove invalid slash chars
|
||||
int len = strlen(dbugfile_filename);
|
||||
while(len >= 0)
|
||||
{
|
||||
if(dbugfile_filename[len] == '/' || dbugfile_filename[len] == ':')
|
||||
{
|
||||
dbugfile_filename[len] = '-';
|
||||
}
|
||||
len--;
|
||||
}
|
||||
|
||||
// open file
|
||||
FILE *fp = fopen(dbugfile_filename, "w");
|
||||
|
||||
if(fp == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fwrite(big_buffer, sizeof(char) * strlen(big_buffer), 1, fp);
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
// detect OS type
|
||||
|
||||
OSVERSIONINFO version_info;
|
||||
version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
||||
|
||||
if(GetVersionEx(&version_info) != false)
|
||||
{
|
||||
char *error = "Error in detecting OS version";
|
||||
char *version = error;
|
||||
|
||||
switch(version_info.dwMajorVersion)
|
||||
{
|
||||
case 4:
|
||||
{
|
||||
if(version_info.dwMinorVersion == 0)
|
||||
{
|
||||
version = "Windows 95";
|
||||
}
|
||||
else if(version_info.dwMinorVersion == 10)
|
||||
{
|
||||
version = "Windows 98";
|
||||
}
|
||||
else if(version_info.dwMinorVersion == 90)
|
||||
{
|
||||
version = "Windows Me";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
if(version_info.dwMinorVersion == 0)
|
||||
{
|
||||
version = "Windows 2000";
|
||||
}
|
||||
else if(version_info.dwMinorVersion == 1)
|
||||
{
|
||||
version = "Windows XP";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char *release_type = NULL;
|
||||
#ifdef _DEBUG
|
||||
release_type = "Debug";
|
||||
#else
|
||||
release_type = "Release";
|
||||
#endif
|
||||
sprintf(big_buffer, "OS: %s %s\n", version, release_type);
|
||||
}
|
||||
|
||||
fwrite(big_buffer, sizeof(char) * strlen(big_buffer), 1, fp);
|
||||
|
||||
#endif
|
||||
|
||||
fclose(fp);
|
||||
|
||||
dbugfile_init_var = true;
|
||||
}
|
||||
|
||||
void dbugfile_deinit()
|
||||
{
|
||||
dbugfile_output("Normal end");
|
||||
dbugfile_init_var = false;
|
||||
}
|
||||
|
||||
void dbugfile_sprintf(int line, char *file, const char *format, ...)
|
||||
{
|
||||
if(dbugfile_init_var == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// find last slash (for PC) to crop file path
|
||||
char *ptr = strrchr(file, '\\');
|
||||
|
||||
if(ptr == NULL)
|
||||
{
|
||||
ptr = file;
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
|
||||
char buffer[1000];
|
||||
int i = sprintf(buffer, "[%s,%4d] ", ptr, line);
|
||||
|
||||
va_list ap;
|
||||
char *p, *sval;
|
||||
long ival;
|
||||
double dval;
|
||||
|
||||
// Add each extra parameter to string
|
||||
va_start(ap, format);
|
||||
|
||||
for(p = (char *) format; *p; p++)
|
||||
{
|
||||
if(*p != '%')
|
||||
{
|
||||
*(buffer + i) = *p;
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
p++;
|
||||
|
||||
switch(*p)
|
||||
{
|
||||
case 'd':
|
||||
{
|
||||
ival = va_arg(ap, int);
|
||||
i += sprintf(buffer+i,"%d", ival);
|
||||
break;
|
||||
}
|
||||
case 'c':
|
||||
{
|
||||
ival = va_arg(ap, char);
|
||||
buffer[i] = (char) ival;
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
case 'x':
|
||||
{
|
||||
ival = va_arg(ap, int);
|
||||
i += sprintf(buffer+i,"%x", ival);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'f':
|
||||
{
|
||||
dval = va_arg(ap, double);
|
||||
i += sprintf(buffer+i,"%f", dval);
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
{
|
||||
for(sval = va_arg(ap, char *); *sval; sval++)
|
||||
{
|
||||
*(buffer + i++) = *sval;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
i += sprintf(buffer+i,"N/A: %%%c", *p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
|
||||
i += sprintf(buffer + i, "\n");
|
||||
|
||||
dbugfile_output(buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
#ifndef _DBUGFILE_HEADER_
|
||||
#define _DBUGFILE_HEADER_
|
||||
|
||||
void dbugfile_init();
|
||||
void dbugfile_deinit();
|
||||
void dbugfile_sprintf(int line, char *file, const char *format, ...);
|
||||
|
||||
#ifdef DBUGFILE_ACTIVE
|
||||
|
||||
#define DBUGFILE_INIT() dbugfile_init();
|
||||
#define DBUGFILE_DEINIT() dbugfile_deinit();
|
||||
|
||||
#define DBUGFILE_OUTPUT_0(t) dbugfile_sprintf(__LINE__, __FILE__, t);
|
||||
#define DBUGFILE_OUTPUT_1(t,a) dbugfile_sprintf(__LINE__, __FILE__, t,a);
|
||||
#define DBUGFILE_OUTPUT_2(t,a,b) dbugfile_sprintf(__LINE__, __FILE__, t,a,b);
|
||||
#define DBUGFILE_OUTPUT_3(t,a,b,c) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c);
|
||||
#define DBUGFILE_OUTPUT_4(t,a,b,c,d) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c,d);
|
||||
#define DBUGFILE_OUTPUT_5(t,a,b,c,d,e) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c,d,e);
|
||||
#define DBUGFILE_OUTPUT_6(t,a,b,c,d,e,f) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c,d,e,f;
|
||||
#define DBUGFILE_OUTPUT_7(t,a,b,c,d,e,f,g) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c,d,e,f,g);
|
||||
#define DBUGFILE_OUTPUT_9(t,a,b,c,d,e,f,g,h) dbugfile_sprintf(__LINE__, __FILE__, t,a,b,c,d,e,f,g,h);
|
||||
|
||||
#else
|
||||
|
||||
#define DBUGFILE_INIT() ;
|
||||
#define DBUGFILE_DEINIT() ;
|
||||
|
||||
#define DBUGFILE_OUTPUT_0(t) ;
|
||||
#define DBUGFILE_OUTPUT_1(t,a) ;
|
||||
#define DBUGFILE_OUTPUT_2(t,a,b) ;
|
||||
#define DBUGFILE_OUTPUT_3(t,a,b,c) ;
|
||||
#define DBUGFILE_OUTPUT_4(t,a,b,c,d) ;
|
||||
#define DBUGFILE_OUTPUT_5(t,a,b,c,d,e) ;
|
||||
#define DBUGFILE_OUTPUT_6(t,a,b,c,d,e,f) ;
|
||||
#define DBUGFILE_OUTPUT_7(t,a,b,c,d,e,f,g) ;
|
||||
#define DBUGFILE_OUTPUT_9(t,a,b,c,d,e,f,g,h) ;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <winbase.h>
|
||||
|
||||
#include "dbugfile.h"
|
||||
#include "timerbar.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
LARGE_INTEGER start_value;
|
||||
LARGE_INTEGER total_value;
|
||||
|
||||
LARGE_INTEGER average;
|
||||
LARGE_INTEGER frame_total;
|
||||
|
||||
} timerbar_profile;
|
||||
|
||||
timerbar_profile profiles[TIMERBAR_COLOUR_MAX];
|
||||
int timerbar_current_profile = 0;
|
||||
|
||||
LARGE_INTEGER timerbar_ultimate_start_value;
|
||||
LARGE_INTEGER timerbar_last_start_value;
|
||||
|
||||
void (*draw_func_ptr)(int colour, float x, float y, float w, float h) = NULL;
|
||||
|
||||
void timerbar_start_frame()
|
||||
{
|
||||
timerbar_current_profile = 0;
|
||||
|
||||
if(QueryPerformanceCounter(&timerbar_ultimate_start_value) == FALSE)
|
||||
{
|
||||
DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
draw_func_ptr = NULL;
|
||||
}
|
||||
|
||||
timerbar_last_start_value = timerbar_ultimate_start_value;
|
||||
|
||||
}
|
||||
|
||||
const int WIDTH = 480;
|
||||
const float WIDTHF = ((float) WIDTH) * 1.05f;
|
||||
|
||||
void timerbar_conv_and_draw(int colour, int xpos, int xwidth, int yrow)
|
||||
{
|
||||
float fxpos = (float) xpos;
|
||||
float fxwidth = (float) xwidth;
|
||||
|
||||
|
||||
draw_func_ptr(colour,
|
||||
fxpos / WIDTHF,
|
||||
yrow * 0.01f,
|
||||
fxwidth / WIDTHF,
|
||||
0.005f);
|
||||
}
|
||||
|
||||
void timerbar_end_frame()
|
||||
{
|
||||
// Now we want to draw the bars
|
||||
if(draw_func_ptr == NULL)
|
||||
{
|
||||
// we have not been given a draw function so we are going to have to quit
|
||||
return;
|
||||
}
|
||||
|
||||
timerbar_switch_type(-1);
|
||||
|
||||
int last_xpos = 0;
|
||||
int y_pos = 0;
|
||||
|
||||
|
||||
for(int i = 0; i < TIMERBAR_COLOUR_MAX; i++)
|
||||
{
|
||||
// Nothing to render this frame
|
||||
if(profiles[i].frame_total.QuadPart == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int xsize = (int) profiles[i].frame_total.QuadPart / 60;
|
||||
|
||||
// break condition in else
|
||||
for (;;)
|
||||
{
|
||||
// if bar runs over
|
||||
if(last_xpos + xsize > WIDTH)
|
||||
{
|
||||
int rem_len = WIDTH - last_xpos;
|
||||
|
||||
// Draw from current position to the end of the bar
|
||||
timerbar_conv_and_draw(i, last_xpos, rem_len, y_pos);
|
||||
|
||||
xsize -= rem_len;
|
||||
last_xpos = 0;
|
||||
y_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw whats left and break for the next bar
|
||||
timerbar_conv_and_draw(i,last_xpos, xsize, y_pos);
|
||||
|
||||
last_xpos += xsize;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// reset for next frame
|
||||
profiles[i].frame_total.QuadPart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void timerbar_switch_type(int num)
|
||||
{
|
||||
if(num >= TIMERBAR_COLOUR_MAX)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Calculate old profile's total
|
||||
LARGE_INTEGER now;
|
||||
if(QueryPerformanceCounter(&now) == FALSE)
|
||||
{
|
||||
DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
|
||||
profiles[timerbar_current_profile].frame_total.QuadPart =
|
||||
(now.QuadPart - timerbar_last_start_value.QuadPart);
|
||||
|
||||
if(num != -1)
|
||||
{
|
||||
// Switch to new profile
|
||||
timerbar_current_profile = num;
|
||||
}
|
||||
|
||||
// Update time to count from
|
||||
if(QueryPerformanceCounter(&timerbar_last_start_value) == FALSE)
|
||||
{
|
||||
DBUGFILE_OUTPUT_0("QueryPerformanceCounter not supported by hardware");
|
||||
}
|
||||
}
|
||||
|
||||
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h))
|
||||
{
|
||||
draw_func_ptr = new_draw_func_ptr;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef _TIMERBAR_HEADER_
|
||||
#define _TIMERBAR_HEADER_
|
||||
|
||||
enum
|
||||
{
|
||||
TIMERBAR_COLOUR_RED,
|
||||
TIMERBAR_COLOUR_GREEN,
|
||||
TIMERBAR_COLOUR_BLUE,
|
||||
TIMERBAR_COLOUR_MAX,
|
||||
};
|
||||
|
||||
void timerbar_start_frame();
|
||||
void timerbar_end_frame();
|
||||
void timerbar_switch_type(int num);
|
||||
void timerbar_set_draw_func(void (*new_draw_func_ptr)(int colour, float x, float y, float w, float h));
|
||||
|
||||
#ifdef TIMEBAR_ACTIVE
|
||||
|
||||
#define TIMERBAR_SET_DRAW_FUNC(f) timerbar_set_draw_func(f);
|
||||
#define TIMERBAR_START_FRAME() timerbar_start_frame();
|
||||
#define TIMERBAR_END_FRAME() timerbar_end_frame();
|
||||
#define TIMERBAR_SWITCH_TYPE(n) timerbar_switch_type(n);
|
||||
|
||||
#else
|
||||
|
||||
#define TIMERBAR_SET_DRAW_FUNC(f) ;
|
||||
#define TIMERBAR_START_FRAME() ;
|
||||
#define TIMERBAR_END_FRAME() ;
|
||||
#define TIMERBAR_SWITCH_TYPE(n) ;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -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], ¢er, &plain_point[0], rad );
|
||||
vm_vec_scale_add( &dec[0].vert[1], ¢er, &plain_point[2], rad );
|
||||
vm_vec_scale_add( &dec[0].vert[2], ¢er, &plain_point[1], rad );
|
||||
vm_vec_scale_add( &dec[0].vert[3], ¢er, &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, ¢er, &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(¢er, &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
|
||||
}
|
||||
@@ -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.
@@ -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, ¶m1, ¶m2, 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;
|
||||
}
|
||||
@@ -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.
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
@@ -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( ¢er, 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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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], ¢er, &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 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,13 +9,97 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Freespace2/FreeSpace.cpp $
|
||||
* $Revision: 2.5 $
|
||||
* $Date: 2002-08-04 05:11:05 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.11 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.10 2002/09/20 20:09:01 phreak
|
||||
* did glare stuff in game_sunspot_process()
|
||||
*
|
||||
<<<<<<< freespace.cpp
|
||||
*
|
||||
*
|
||||
* Revision 2.51 2002/08/04 2`:08:55 PhReAk
|
||||
* Draw mem usage - will be needed for increasing original limits
|
||||
*
|
||||
* Revision 2.51 2002/08/04 20:04:35 PhReAk
|
||||
* Draw FPS when running debug build
|
||||
*
|
||||
=======
|
||||
* Revision 2.9 2002/08/28 10:51:04 randomtiger
|
||||
* Woh! I sure as hell didnt modify all these files it says I did.
|
||||
* I will put this down to the branch! Note: I did start from a fresh checkout!
|
||||
*
|
||||
* Revision 2.8 2002/08/27 13:38:57 penguin
|
||||
* Moved DirectX8 stuff to directx8 branch; reverted to previous
|
||||
*
|
||||
* Revision 2.6 2002/08/13 03:34:00 penguin
|
||||
* 1. Disable CD checking
|
||||
* 2. Add CVS tag to version string
|
||||
*
|
||||
>>>>>>> 2.9
|
||||
* Revision 2.5 2002/08/04 05:11:05 penguin
|
||||
* Don't write version to registry; change way version string is formatted
|
||||
*
|
||||
* Revision 2.4 2002/08/01 01:41:04 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -482,6 +566,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
static const char RCS_Name[] = "$Name: not supported by cvs2svn $";
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -638,6 +724,8 @@
|
||||
#include "hud/hudshield.h"
|
||||
#include "ship/shiphit.h"
|
||||
#include "missionui/missionloopbrief.h"
|
||||
#include "debugconsole/dbugfile.h"
|
||||
#include "debugconsole/timerbar.h"
|
||||
|
||||
#ifdef NDEBUG
|
||||
#ifdef FRED
|
||||
@@ -737,14 +825,16 @@ float frametimes[FRAME_FILTER];
|
||||
float frametotal = 0.0f;
|
||||
float flFrametime;
|
||||
|
||||
#ifdef RELEASE_REAL
|
||||
int Show_framerate = 0;
|
||||
#else
|
||||
#ifndef NDEBUG
|
||||
int Show_framerate = 1;
|
||||
int Show_mem = 1;
|
||||
#else
|
||||
int Show_framerate = 0;
|
||||
int Show_mem = 0;
|
||||
#endif
|
||||
|
||||
int Framerate_cap = 120;
|
||||
int Show_mem = 0;
|
||||
|
||||
int Show_cpu = 0;
|
||||
int Show_target_debug_info = 0;
|
||||
int Show_target_weapons = 0;
|
||||
@@ -1002,7 +1092,7 @@ void game_do_training_checks();
|
||||
void game_shutdown(void);
|
||||
void game_show_event_debug(float frametime);
|
||||
void game_event_debug_init();
|
||||
void game_frame();
|
||||
void game_frame(int paused = false);
|
||||
void demo_upsell_show_screens();
|
||||
void game_start_subspace_ambient_sound();
|
||||
void game_stop_subspace_ambient_sound();
|
||||
@@ -1023,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
|
||||
@@ -1170,7 +1268,7 @@ void game_framerate_check()
|
||||
Gf_critical_time += flFrametime;
|
||||
}
|
||||
|
||||
if(!Show_framerate){
|
||||
if((!Show_framerate) || (!Cmdline_show_fps)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1258,6 +1356,7 @@ DCF(sn_glare, "")
|
||||
}
|
||||
|
||||
float Supernova_last_glare = 0.0f;
|
||||
extern starfield_bitmap *stars_lookup_sun(starfield_bitmap_instance *s);
|
||||
void game_sunspot_process(float frametime)
|
||||
{
|
||||
int n_lights, idx;
|
||||
@@ -1325,6 +1424,7 @@ void game_sunspot_process(float frametime)
|
||||
Sun_drew = 0;
|
||||
} else {
|
||||
if ( Sun_drew ) {
|
||||
starfield_bitmap* sbm;
|
||||
// check sunspots for all suns
|
||||
n_lights = light_get_global_count();
|
||||
|
||||
@@ -1336,10 +1436,17 @@ void game_sunspot_process(float frametime)
|
||||
vector light_dir;
|
||||
light_get_global_dir(&light_dir, idx);
|
||||
|
||||
float dot = vm_vec_dot( &light_dir, &Eye_matrix.vec.fvec )*0.5f+0.5f;
|
||||
|
||||
Sun_spot_goal += (float)pow(dot,85.0f);
|
||||
sbm=stars_lookup_sun(&Suns[idx]);
|
||||
if (!sbm)
|
||||
continue;
|
||||
|
||||
//only do sunglare stuff if this sun has one
|
||||
if (sbm->glare)
|
||||
{
|
||||
float dot = vm_vec_dot( &light_dir, &Eye_matrix.vec.fvec )*0.5f+0.5f;
|
||||
|
||||
Sun_spot_goal += (float)pow(dot,85.0f);
|
||||
}
|
||||
// draw the glow for this sun
|
||||
stars_draw_sun_glow(idx);
|
||||
} else {
|
||||
@@ -2315,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);
|
||||
@@ -2366,6 +2467,7 @@ void game_init()
|
||||
gr_init(GR_640, GR_SOFTWARE);
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
// tried d3d ?
|
||||
@@ -2402,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)
|
||||
@@ -2456,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();
|
||||
@@ -2576,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 );
|
||||
}
|
||||
@@ -3908,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){
|
||||
@@ -3939,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 ) {
|
||||
@@ -3960,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 ) {
|
||||
@@ -3986,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)
|
||||
@@ -4029,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
|
||||
@@ -4049,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
|
||||
@@ -4062,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
|
||||
@@ -4084,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
|
||||
@@ -4099,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
|
||||
@@ -4239,7 +4360,7 @@ void game_render_hud_3d(vector *eye_pos, matrix *eye_orient)
|
||||
}
|
||||
|
||||
|
||||
void game_frame()
|
||||
void game_frame(int paused)
|
||||
{
|
||||
int actually_playing;
|
||||
fix total_time1, total_time2;
|
||||
@@ -4267,83 +4388,96 @@ void game_frame()
|
||||
}
|
||||
#endif
|
||||
|
||||
// start timing frame
|
||||
timing_frame_start();
|
||||
|
||||
total_time1 = timer_get_fixed_seconds();
|
||||
|
||||
// var to hold which state we are in
|
||||
actually_playing = game_actually_playing();
|
||||
// start timing frame
|
||||
timing_frame_start();
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
if ((!(Game_mode & GM_MULTIPLAYER)) || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER))) {
|
||||
if (!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
Assert( OBJ_INDEX(Player_obj) >= 0 );
|
||||
total_time1 = timer_get_fixed_seconds();
|
||||
|
||||
if(paused)
|
||||
{
|
||||
// Reset the lights here or they just keep on increasing
|
||||
light_reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
// var to hold which state we are in
|
||||
actually_playing = game_actually_playing();
|
||||
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
if ((!(Game_mode & GM_MULTIPLAYER)) || ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER))) {
|
||||
if (!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
Assert( OBJ_INDEX(Player_obj) >= 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
Assert( OBJ_INDEX(Player_obj) >= 0 );
|
||||
#endif // ifndef NO_NETWORK
|
||||
|
||||
if (Missiontime > Entry_delay_time){
|
||||
Pre_player_entry = 0;
|
||||
} else {
|
||||
; //nprintf(("AI", "Framecount = %i, time = %7.3f\n", Framecount, f2fl(Missiontime)));
|
||||
}
|
||||
|
||||
// Note: These are done even before the player enters, else buffers can overflow.
|
||||
if (! (Game_mode & GM_STANDALONE_SERVER)){
|
||||
radar_frame_init();
|
||||
}
|
||||
|
||||
shield_frame_init();
|
||||
|
||||
if ( Player->control_mode != PCM_NORMAL )
|
||||
camera_move();
|
||||
|
||||
if ( !Pre_player_entry && actually_playing ) {
|
||||
if (! (Game_mode & GM_STANDALONE_SERVER) ) {
|
||||
|
||||
if( (!popup_running_state()) && (!popupdead_is_active()) ){
|
||||
game_process_keys();
|
||||
|
||||
// don't read flying controls if we're playing a demo back
|
||||
if(!(Game_mode & GM_DEMO_PLAYBACK)){
|
||||
read_player_controls( Player_obj, flFrametime);
|
||||
#else
|
||||
Assert( OBJ_INDEX(Player_obj) >= 0 );
|
||||
#endif // ifndef NO_NETWORK
|
||||
|
||||
if (Missiontime > Entry_delay_time){
|
||||
Pre_player_entry = 0;
|
||||
} else {
|
||||
; //nprintf(("AI", "Framecount = %i, time = %7.3f\n", Framecount, f2fl(Missiontime)));
|
||||
}
|
||||
|
||||
// Note: These are done even before the player enters, else buffers can overflow.
|
||||
if (! (Game_mode & GM_STANDALONE_SERVER)){
|
||||
radar_frame_init();
|
||||
}
|
||||
|
||||
shield_frame_init();
|
||||
|
||||
if ( Player->control_mode != PCM_NORMAL )
|
||||
camera_move();
|
||||
|
||||
if ( !Pre_player_entry && actually_playing ) {
|
||||
if (! (Game_mode & GM_STANDALONE_SERVER) ) {
|
||||
|
||||
if( (!popup_running_state()) && (!popupdead_is_active()) ){
|
||||
game_process_keys();
|
||||
|
||||
// don't read flying controls if we're playing a demo back
|
||||
if(!(Game_mode & GM_DEMO_PLAYBACK)){
|
||||
read_player_controls( Player_obj, flFrametime);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
// if we're not the master, we may have to send the server-critical ship status button_info bits
|
||||
if ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER)){
|
||||
multi_maybe_send_ship_status();
|
||||
}
|
||||
#endif // ifndef NO_NETWORK
|
||||
}
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
// if we're not the master, we may have to send the server-critical ship status button_info bits
|
||||
if ((Game_mode & GM_MULTIPLAYER) && !(Net_player->flags & NETINFO_FLAG_AM_MASTER) && !(Net_player->flags & NETINFO_FLAG_OBSERVER)){
|
||||
multi_maybe_send_ship_status();
|
||||
}
|
||||
#endif // ifndef NO_NETWORK
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the whack stuff
|
||||
game_whack_reset();
|
||||
|
||||
// These two lines must be outside of Pre_player_entry code,
|
||||
// otherwise too many lights are added.
|
||||
light_reset();
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.game_state == NETGAME_STATE_SERVER_TRANSFER)){
|
||||
return;
|
||||
}
|
||||
#endif // ifndef NO_NETWORK
|
||||
|
||||
game_simulation_frame();
|
||||
// Reset the whack stuff
|
||||
game_whack_reset();
|
||||
|
||||
// These two lines must be outside of Pre_player_entry code,
|
||||
// otherwise too many lights are added.
|
||||
light_reset();
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
if ((Game_mode & GM_MULTIPLAYER) && (Netgame.game_state == NETGAME_STATE_SERVER_TRANSFER)){
|
||||
return;
|
||||
}
|
||||
#endif // ifndef NO_NETWORK
|
||||
|
||||
game_simulation_frame();
|
||||
|
||||
// if not actually in a game play state, then return. This condition could only be true in
|
||||
// a multiplayer game.
|
||||
if (!actually_playing ) {
|
||||
Assert( Game_mode & GM_MULTIPLAYER );
|
||||
return;
|
||||
}
|
||||
|
||||
// if not actually in a game play state, then return. This condition could only be true in
|
||||
// a multiplayer game.
|
||||
if ( !actually_playing ) {
|
||||
Assert( Game_mode & GM_MULTIPLAYER );
|
||||
return;
|
||||
}
|
||||
|
||||
TIMERBAR_SWITCH_TYPE(TIMERBAR_D3DCODE);
|
||||
|
||||
|
||||
if (!Pre_player_entry) {
|
||||
if (! (Game_mode & GM_STANDALONE_SERVER)) {
|
||||
clear_time1 = timer_get_fixed_seconds();
|
||||
@@ -4458,7 +4592,7 @@ void game_frame()
|
||||
nebl_process();
|
||||
|
||||
total_time2 = timer_get_fixed_seconds();
|
||||
|
||||
|
||||
// Got some timing numbers
|
||||
Timing_total = f2fl( total_time2 - total_time1 ) * 1000.0f;
|
||||
Timing_clear = f2fl( clear_time2 - clear_time1 ) * 1000.0f;
|
||||
@@ -4473,6 +4607,8 @@ void game_frame()
|
||||
demo_close();
|
||||
}
|
||||
#endif
|
||||
|
||||
TIMERBAR_SWITCH_TYPE(TIMERBAR_DEFAULT);
|
||||
}
|
||||
|
||||
#define MAX_FRAMETIME (F1_0/4) // Frametime gets saturated at this. Changed by MK on 11/1/97.
|
||||
@@ -4670,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));
|
||||
@@ -5951,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;
|
||||
|
||||
@@ -6483,6 +6618,14 @@ void game_do_state(int state)
|
||||
break;
|
||||
|
||||
case GS_STATE_GAME_PAUSED:
|
||||
|
||||
if(pause_get_type() == PAUSE_TYPE_VIEWER) {
|
||||
|
||||
read_player_controls( Player_obj, flFrametime);
|
||||
// game_process_keys();
|
||||
game_frame(true);
|
||||
}
|
||||
|
||||
pause_do(0);
|
||||
break;
|
||||
|
||||
@@ -7093,6 +7236,7 @@ int PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int nCmdSh
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
DBUGFILE_INIT();
|
||||
int result = -1;
|
||||
|
||||
#ifdef _WIN32
|
||||
@@ -7114,6 +7258,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
DBUGFILE_DEINIT()
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -7826,14 +7971,33 @@ void get_version_string(char *str)
|
||||
{
|
||||
//XSTR:OFF
|
||||
if ( FS_VERSION_BUILD == 0 ) {
|
||||
sprintf(str,"fs2_open %d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
|
||||
sprintf(str,"V%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR);
|
||||
} else {
|
||||
sprintf(str,"fs2_open %d.%d.%d", FS_VERSION_MAJOR, FS_VERSION_MINOR, FS_VERSION_BUILD );
|
||||
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
|
||||
|
||||
// append the CVS "release" version in the $Name variable, but
|
||||
// only do this if it's been tagged
|
||||
int rcs_name_len = strlen(RCS_Name);
|
||||
if (rcs_name_len > 11) {
|
||||
char buffer[100];
|
||||
strcpy(buffer, RCS_Name + 7);
|
||||
buffer[rcs_name_len-9] = 0;
|
||||
|
||||
strcat(str, " Build: ");
|
||||
strcat(str, buffer);
|
||||
} else {
|
||||
strcat(str, " (fs2_open)");
|
||||
}
|
||||
|
||||
//XSTR:ON
|
||||
/*
|
||||
HMODULE hMod;
|
||||
@@ -8607,7 +8771,8 @@ int game_do_cd_check_specific(char *volume_name, int cdnum)
|
||||
// only need to do this in RELEASE_REAL
|
||||
int game_do_cd_mission_check(char *filename)
|
||||
{
|
||||
#ifdef RELEASE_REAL
|
||||
//#ifdef RELEASE_REAL
|
||||
#if 0
|
||||
int cd_num;
|
||||
int cd_present = 0;
|
||||
int cd_drive_num;
|
||||
@@ -8710,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()
|
||||
{
|
||||
@@ -8777,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()
|
||||
{
|
||||
@@ -8850,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)){
|
||||
@@ -8869,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
|
||||
@@ -8885,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
|
||||
|
||||
@@ -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()
|
||||
//
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
//---------------------------------------------------
|
||||
|
||||
@@ -9,13 +9,25 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/GlobalIncs/PsTypes.h $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-01 01:41:04 $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.2 2002/07/22 01:04:37 penguin
|
||||
* took out GAME_CD_CHECK define
|
||||
*
|
||||
@@ -269,7 +281,7 @@ typedef unsigned int uint;
|
||||
|
||||
//Stucture to store clipping codes in a word
|
||||
typedef struct ccodes {
|
||||
ubyte or,and; //or is low byte, and is high byte
|
||||
ubyte cc_or, cc_and; //or is low byte, and is high byte
|
||||
} ccodes;
|
||||
|
||||
typedef struct vector {
|
||||
@@ -325,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
|
||||
@@ -380,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 }
|
||||
|
||||
@@ -494,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,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] = {
|
||||
|
||||
@@ -9,13 +9,19 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/GlobalIncs/SystemVars.h $
|
||||
* $Revision: 2.0 $
|
||||
* $Date: 2002-06-03 04:02:22 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-10-05 16:46:09 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
* Variables and constants common to FreeSpace and Fred.
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.1 2002/08/15 04:41:17 penguin
|
||||
* Added #include, needed for FRED
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:22 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
* Revision 1.2 2002/05/03 22:07:08 mharris
|
||||
* got some stuff to compile
|
||||
*
|
||||
@@ -192,6 +198,7 @@
|
||||
#ifndef _SYSTEMVARS_H
|
||||
#define _SYSTEMVARS_H
|
||||
|
||||
#include "globalincs/pstypes.h"
|
||||
#include "math.h"
|
||||
|
||||
#define GM_MULTIPLAYER (1 << 0)
|
||||
@@ -346,4 +353,10 @@ int current_detail_level();
|
||||
extern int TotalRam;
|
||||
void windebug_memwatch_init();
|
||||
|
||||
enum
|
||||
{
|
||||
TIMERBAR_DEFAULT,
|
||||
TIMERBAR_D3DCODE,
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -9,12 +9,28 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/GlobalIncs/version.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-04 05:11:36 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.1 2002/08/04 05:11:36 penguin
|
||||
* Update version number to 3.1
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:22 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -123,7 +139,7 @@
|
||||
// Major.Minor.Bugfix
|
||||
|
||||
#define FS_VERSION_MAJOR 3 // major version
|
||||
#define FS_VERSION_MINOR 1 // 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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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__ */
|
||||
@@ -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
@@ -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
|
||||
@@ -9,13 +9,22 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Graphics/GrD3D.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-01 01:41:05 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.1 2002/07/30 14:29:15 unknownplayer
|
||||
*
|
||||
* Started work on DX8.1 implementation. Updated the project files to encompass
|
||||
@@ -209,6 +218,7 @@
|
||||
#include "globalincs/systemvars.h"
|
||||
#include "cfile/cfile.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
#include "debugconsole/timerbar.h"
|
||||
|
||||
|
||||
LPDIRECTDRAW lpDD1 = NULL;
|
||||
@@ -791,7 +801,10 @@ void d3d_stop_frame()
|
||||
|
||||
In_frame--;
|
||||
|
||||
TIMERBAR_END_FRAME();
|
||||
ddrval = lpD3DDevice->EndScene();
|
||||
TIMERBAR_START_FRAME();
|
||||
|
||||
if (ddrval != D3D_OK ) {
|
||||
//mprintf(( "Failed to end scene!\n%s\n", d3d_error_string(ddrval) ));
|
||||
return;
|
||||
@@ -1804,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?
|
||||
@@ -2818,6 +2831,8 @@ void gr_d3d_init()
|
||||
gr_clear();
|
||||
gr_flip();
|
||||
Mouse_hidden--;
|
||||
|
||||
TIMERBAR_SET_DRAW_FUNC(d3d_render_timer_bar);
|
||||
}
|
||||
|
||||
char* d3d_error_string(HRESULT error)
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Graphics/GrD3DInternal.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:05 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-10-05 16:46:09 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
* Prototypes for the variables used internally by the Direct3D renderer
|
||||
*
|
||||
* $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 @@ void gr_d3d_set_palette(ubyte *new_palette, int restrict_alphacolor);
|
||||
void gr_d3d_diamond(int x, int y, int width, int height);
|
||||
void gr_d3d_print_screen(char *filename);
|
||||
|
||||
void d3d_render_timer_bar(int colour, float x, float y, float w, float h);
|
||||
|
||||
// Functions used to render. Calls either DrawPrim or Execute buffer code
|
||||
HRESULT d3d_SetRenderState( D3DRENDERSTATETYPE dwRenderStateType, DWORD dwRenderState );
|
||||
|
||||
@@ -9,13 +9,52 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Graphics/GrD3DRender.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-03 19:42:17 $
|
||||
* $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"
|
||||
*
|
||||
* Revision 2.2 2002/08/03 19:42:17 randomtiger
|
||||
* Fixed Geforce 4 bug that caused font and hall video distortion.
|
||||
* Very small change in 'gr_d3d_aabitmap_ex_internal'
|
||||
*
|
||||
* Tested and works on the following systems
|
||||
*
|
||||
* OUTSIDER Voodoo 3 win98
|
||||
* OUTSIDER Geforce 2 win2000
|
||||
* Me Geforce 4 PNY 4600 XP
|
||||
* JBX-Phoenix Geforce 4 PNY XP
|
||||
* Mehrunes GeForce 3 XP
|
||||
* WMCoolmon nVidia TNT2 M64 win2000
|
||||
* Orange GeForce 4 4200 XP
|
||||
* ShadowWolf_IH Monster2 win98
|
||||
* ShadowWolf_IH voodoo 2 win98
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:05 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -326,6 +365,8 @@
|
||||
#include "cfile/cfile.h"
|
||||
#include "nebula/neb.h"
|
||||
#include "render/3d.h"
|
||||
#include "cmdline/cmdline.h" //DTP for random tigers GF4fix, and the commandline switch.
|
||||
#include "debugconsole/timerbar.h"
|
||||
|
||||
typedef enum gr_texture_source {
|
||||
TEXTURE_SOURCE_NONE,
|
||||
@@ -690,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 )
|
||||
{
|
||||
@@ -954,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
|
||||
@@ -977,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 )
|
||||
@@ -1489,19 +1548,30 @@ void gr_d3d_aabitmap_ex_internal(int x,int y,int w,int h,int sx,int sy)
|
||||
|
||||
bm_get_info( gr_screen.current_bitmap, &bw, &bh );
|
||||
|
||||
// Rendition
|
||||
// Rendition
|
||||
if ( D3d_rendition_uvs ) {
|
||||
u0 = u_scale*(i2fl(sx)+0.5f)/i2fl(bw);
|
||||
v0 = v_scale*(i2fl(sy)+0.5f)/i2fl(bh);
|
||||
|
||||
u1 = u_scale*(i2fl(sx+w)+0.5f)/i2fl(bw);
|
||||
v1 = v_scale*(i2fl(sy+h)+0.5f)/i2fl(bh);
|
||||
} else {
|
||||
u0 = u_scale*i2fl((sx)-0.5f)/i2fl(bw);
|
||||
v0 = v_scale*i2fl((sy)-0.5f)/i2fl(bh);
|
||||
//} else { //DTP; commented out, for easy re-editing
|
||||
// u0 = u_scale*i2fl((sx)-0.5f)/i2fl(bw);
|
||||
// v0 = v_scale*i2fl((sy)-0.5f)/i2fl(bh);
|
||||
|
||||
u1 = u_scale*i2fl((sx+w)-0.5f)/i2fl(bw);
|
||||
v1 = v_scale*i2fl((sy+h)-0.5f)/i2fl(bh);
|
||||
// u1 = u_scale*i2fl((sx+w)-0.5f)/i2fl(bw);
|
||||
// v1 = v_scale*i2fl((sy+h)-0.5f)/i2fl(bh);
|
||||
//}
|
||||
} else if (!Cmdline_gf4fix) { //DTP if not set at commandline do the original code
|
||||
u0 = u_scale*i2fl(sx)/i2fl(bw);
|
||||
v0 = v_scale*i2fl(sy)/i2fl(bh);
|
||||
u1 = u_scale*i2fl(sx+w)/i2fl(bw);
|
||||
v1 = v_scale*i2fl(sy+h)/i2fl(bh);
|
||||
} else { //DTP; these next 4 lines is random tigers Fix. activated by setting -GF4FIX in the commandline.
|
||||
u0 = u_scale*(i2fl(sx)-0.5f)/i2fl(bw);
|
||||
v0 = v_scale*(i2fl(sy)-0.5f)/i2fl(bh);
|
||||
u1 = u_scale*(i2fl(sx+w)-0.5f)/i2fl(bw);
|
||||
v1 = v_scale*(i2fl(sy+h)-0.5f)/i2fl(bh);
|
||||
}
|
||||
|
||||
x1 = i2fl(x+gr_screen.offset_x);
|
||||
@@ -2269,5 +2339,44 @@ void gr_d3d_print_screen(char *filename)
|
||||
|
||||
}
|
||||
|
||||
void d3d_render_timer_bar(int colour, float x, float y, float w, float h)
|
||||
{
|
||||
static D3DCOLOR pre_set_colours[TIMERBAR_COLOUR_MAX] =
|
||||
{
|
||||
0xffff0000, // red
|
||||
0xff00ff00, // green
|
||||
0xff0000ff, // blue
|
||||
};
|
||||
|
||||
D3DTLVERTEX d3d_verts[4];
|
||||
|
||||
static float max_fw = (float) gr_screen.max_w;
|
||||
static float max_fh = (float) gr_screen.max_h;
|
||||
|
||||
d3d_verts[0].rhw = 1;
|
||||
d3d_verts[0].color = pre_set_colours[colour];
|
||||
d3d_verts[0].sx = max_fw * x;
|
||||
d3d_verts[0].sy = max_fh * y;
|
||||
|
||||
d3d_verts[1].rhw = 1;
|
||||
d3d_verts[1].color = pre_set_colours[colour];
|
||||
d3d_verts[1].sx = max_fw * (x + w);
|
||||
d3d_verts[1].sy = max_fh * y;
|
||||
|
||||
d3d_verts[2].rhw = 1;
|
||||
d3d_verts[2].color = pre_set_colours[colour];
|
||||
d3d_verts[2].sx = max_fw * (x + w);
|
||||
d3d_verts[2].sy = max_fh * (y + h);
|
||||
|
||||
d3d_verts[3].rhw = 1;
|
||||
d3d_verts[3].color = pre_set_colours[colour];
|
||||
d3d_verts[3].sx = max_fw * x;
|
||||
d3d_verts[3].sy = max_fh * (y + h);
|
||||
|
||||
gr_d3d_set_state(TEXTURE_SOURCE_NONE, ALPHA_BLEND_NONE, ZBUFFER_TYPE_NONE);
|
||||
d3d_DrawPrimitive(D3DPT_TRIANGLEFAN,D3DVT_TLVERTEX,(LPVOID)d3d_verts,4,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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
|
||||
|
||||
+2884
-837
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+34
-17
@@ -9,13 +9,25 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUD.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:05 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -372,12 +384,15 @@
|
||||
#define HUD_NEW_ALPHA_NORMAL_HI 190
|
||||
#define HUD_NEW_ALPHA_BRIGHT_HI 255
|
||||
|
||||
// This is used to prevent drawing of hud (and pause popup)
|
||||
|
||||
// globals that will control the color of the HUD gauges
|
||||
int HUD_color_red = 0;
|
||||
int HUD_color_green = 255;
|
||||
int HUD_color_blue = 0;
|
||||
int HUD_color_alpha = HUD_COLOR_ALPHA_DEFAULT; // 1 -> HUD_COLOR_ALPHA_USER_MAX
|
||||
|
||||
int HUD_draw = 1;
|
||||
int HUD_contrast = 0; // high or lo contrast (for nebula, etc)
|
||||
|
||||
color HUD_color_defaults[HUD_NUM_COLOR_LEVELS]; // array of colors with different alpha blending
|
||||
@@ -959,11 +974,18 @@ void HUD_init()
|
||||
|
||||
// default to high contrast in the nebula
|
||||
HUD_contrast = 0;
|
||||
HUD_draw = 1;
|
||||
|
||||
if(The_mission.flags & MISSION_FLAG_FULLNEB){
|
||||
HUD_contrast = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void hud_toggle_draw()
|
||||
{
|
||||
HUD_draw = !HUD_draw;
|
||||
}
|
||||
|
||||
// return !0 if HUD is disabled (ie no gauges are shown/usable), otherwise return 0
|
||||
int hud_disabled()
|
||||
{
|
||||
@@ -971,7 +993,7 @@ int hud_disabled()
|
||||
//return 1;
|
||||
//}
|
||||
|
||||
return 0;
|
||||
return !HUD_draw;
|
||||
}
|
||||
|
||||
// Determine if we should popup the weapons gauge on the HUD.
|
||||
@@ -2459,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;
|
||||
@@ -3088,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)
|
||||
{
|
||||
|
||||
+11
-6
@@ -9,13 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUD.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:05 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -344,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);
|
||||
@@ -404,6 +408,7 @@ void hud_subspace_notify_abort();
|
||||
// render multiplayer text message currently being entered if any
|
||||
void hud_maybe_render_multi_text();
|
||||
|
||||
void hud_toggle_draw();
|
||||
int hud_disabled();
|
||||
int hud_support_find_closest( int objnum );
|
||||
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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__ */
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+448
-94
@@ -9,13 +9,55 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDtarget.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:05 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -282,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[];
|
||||
|
||||
@@ -480,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] = {
|
||||
@@ -563,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
|
||||
@@ -571,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
|
||||
};
|
||||
@@ -632,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;
|
||||
}
|
||||
}
|
||||
@@ -924,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 )
|
||||
{
|
||||
@@ -1154,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++ ) {
|
||||
@@ -1162,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;
|
||||
}
|
||||
}
|
||||
@@ -1188,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;
|
||||
@@ -1253,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.
|
||||
@@ -3185,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;
|
||||
@@ -3811,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;
|
||||
}
|
||||
@@ -3912,6 +4117,7 @@ void hud_show_lead_indicator(vector *target_world_pos)
|
||||
polymodel *po;
|
||||
ship_weapon *swp;
|
||||
weapon_info *wip;
|
||||
weapon_info *tmp=NULL;
|
||||
float dist_to_target, time_to_target, target_moved_dist, prange, srange;
|
||||
int bank_to_fire, indicator_frame, frame_offset;
|
||||
|
||||
@@ -3971,18 +4177,50 @@ void hud_show_lead_indicator(vector *target_world_pos)
|
||||
|
||||
srange = ship_get_secondary_weapon_range(Player_ship);
|
||||
|
||||
if ( swp->current_secondary_bank >= 0 ) {
|
||||
weapon_info *wip;
|
||||
if ( swp->current_secondary_bank >= 0 )
|
||||
{
|
||||
int bank = swp->current_secondary_bank;
|
||||
wip = &Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
if ( wip->wi_flags & WIF_HOMING_ASPECT ) {
|
||||
if ( !Player->target_in_lock_cone ) {
|
||||
tmp = &Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
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;
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
if ((dist_to_target < srange) && (tmp->wi_flags & WIF_HOMING_HEAT))
|
||||
{
|
||||
frame_offset=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
frame_offset=-1;
|
||||
|
||||
if (tmp)
|
||||
{
|
||||
if((dist_to_target < srange) && (tmp->wi_flags & WIF_HOMING_HEAT))
|
||||
{
|
||||
frame_offset=0; // and this probably should be 2 - Goober5000
|
||||
}
|
||||
}
|
||||
}
|
||||
----------------------------------------------------------- */
|
||||
|
||||
if ( frame_offset < 0 ) {
|
||||
return;
|
||||
}
|
||||
@@ -4027,6 +4265,66 @@ void hud_show_lead_indicator(vector *target_world_pos)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//do dumbfire lead indicator - color is orange (255,128,0) - bright, (192,96,0) - dim
|
||||
//phreak changed 9/01/02
|
||||
|
||||
if(swp->current_secondary_bank>=0)
|
||||
{
|
||||
int bank=swp->current_secondary_bank;
|
||||
wip=&Weapon_info[swp->secondary_bank_weapons[bank]];
|
||||
|
||||
//get out of here if the secondary weapon is a homer or if its out of range
|
||||
if ( (wip->wi_flags & WIF_HOMING_HEAT) || (wip->wi_flags & WIF_HOMING_ASPECT))
|
||||
return;
|
||||
|
||||
double max_dist=wip->lifetime*wip->max_speed;
|
||||
if (dist_to_target > max_dist)
|
||||
return;
|
||||
}
|
||||
|
||||
//give it the "in secondary range frame
|
||||
indicator_frame = Lead_indicator_gauge.first_frame;
|
||||
|
||||
Assert(wip->max_speed != 0);
|
||||
time_to_target = dist_to_target / wip->max_speed;
|
||||
|
||||
target_moved_dist = targetp->phys_info.speed * time_to_target;
|
||||
|
||||
target_moving_direction = targetp->phys_info.vel;
|
||||
|
||||
// if we've reached here, the lead target indicator will be displayed
|
||||
Players[Player_num].lead_indicator_active = 1;
|
||||
|
||||
// test if the target is moving at all
|
||||
if ( vm_vec_mag_quick(&targetp->phys_info.vel) < 0.1f) // Find distance!
|
||||
Players[Player_num].lead_target_pos = *target_world_pos;
|
||||
else {
|
||||
vm_vec_normalize(&target_moving_direction);
|
||||
vm_vec_scale(&target_moving_direction,target_moved_dist);
|
||||
vm_vec_add(&Players[Player_num].lead_target_pos, target_world_pos, &target_moving_direction );
|
||||
polish_predicted_target_pos(target_world_pos, &Players[Player_num].lead_target_pos, dist_to_target, &last_delta_vector, 1); // Not used:, float time_to_enemy)
|
||||
}
|
||||
|
||||
g3_rotate_vertex(&lead_target_vertex,&Players[Player_num].lead_target_pos);
|
||||
|
||||
if (lead_target_vertex.codes == 0) { // on screen
|
||||
|
||||
g3_project_vertex(&lead_target_vertex);
|
||||
if (!(lead_target_vertex.flags & PF_OVERFLOW)) {
|
||||
|
||||
if ( hud_gauge_maybe_flash(HUD_LEAD_INDICATOR) == 1 ) {
|
||||
hud_set_iff_color(targetp, 0);
|
||||
} else {
|
||||
hud_set_iff_color(targetp, 1);
|
||||
}
|
||||
|
||||
if ( indicator_frame >= 0 ) {
|
||||
GR_AABITMAP(indicator_frame, fl2i(lead_target_vertex.sx - Lead_indicator_half[gr_screen.res][0]), fl2i(lead_target_vertex.sy - Lead_indicator_half[gr_screen.res][1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// hud_cease_subsystem_targeting() will cease targeting the current targets subsystems
|
||||
@@ -4529,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;
|
||||
}
|
||||
|
||||
@@ -4553,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;
|
||||
@@ -4620,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];
|
||||
@@ -4644,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);
|
||||
@@ -4676,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)
|
||||
{
|
||||
@@ -4750,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];
|
||||
|
||||
@@ -4760,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;
|
||||
@@ -4772,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));
|
||||
|
||||
@@ -4788,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) {
|
||||
@@ -4805,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) {
|
||||
@@ -4847,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:
|
||||
@@ -4860,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;
|
||||
@@ -5147,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;
|
||||
@@ -5574,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);
|
||||
|
||||
@@ -9,13 +9,69 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDtargetbox.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.2 2002/08/06 16:50:44 phreak
|
||||
* added wireframe targetbox feature
|
||||
*
|
||||
* Revision 2.2 2002/08/04 23:17:40 phreak
|
||||
* Did the toggling code for wireframes -> CTRL+SHIFT+Q
|
||||
*
|
||||
* Revision 2.2 2002/08/04 21:53:13 phreak
|
||||
* Changed hud_render_target_asteroid, ...weapon, ...ship to render in wireframe
|
||||
*
|
||||
* Revision 2.1 2002/08/01 01:41:06 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.0 2002/06/03 04:02:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -228,6 +284,7 @@
|
||||
#include "network/multi.h"
|
||||
#include "weapon/emp.h"
|
||||
#include "localization/localize.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
int Target_window_coords[GR_NUM_RESOLUTIONS][4] =
|
||||
{
|
||||
@@ -368,6 +425,8 @@ int Targetbox_flash_flags;
|
||||
// during the game.
|
||||
int Targetbox_show_extra_info = 1;
|
||||
|
||||
int Targetbox_wire=0;
|
||||
|
||||
// Different target states. This drives the text display right below the hull integrity on the targetbox.
|
||||
#define TS_DIS 0
|
||||
#define TS_OK 1
|
||||
@@ -794,11 +853,14 @@ void hud_render_target_asteroid(object *target_objp)
|
||||
float time_to_impact, factor;
|
||||
int subtype;
|
||||
|
||||
int flags=0; //draw flags for wireframe
|
||||
asteroidp = &Asteroids[target_objp->instance];
|
||||
|
||||
target_team = obj_team(target_objp);
|
||||
|
||||
subtype = asteroidp->asteroid_subtype;
|
||||
|
||||
time_to_impact = asteroid_time_to_impact(target_objp);
|
||||
|
||||
if ( Detail.targetview_model ) {
|
||||
// take the forward orientation to be the vector from the player to the current target
|
||||
@@ -817,7 +879,20 @@ void hud_render_target_asteroid(object *target_objp)
|
||||
|
||||
hud_render_target_setup(&camera_eye, &camera_orient, 0.5f);
|
||||
model_clear_instance(Asteroid_info[asteroidp->type].model_num[subtype]);
|
||||
model_render(Asteroid_info[asteroidp->type].model_num[subtype], &target_objp->orient, &obj_pos, MR_NO_LIGHTING | MR_LOCK_DETAIL );
|
||||
|
||||
if (Targetbox_wire!=0)
|
||||
{
|
||||
if (time_to_impact>=0)
|
||||
model_set_outline_color(255,255,255);
|
||||
else
|
||||
model_set_outline_color(64,64,0);
|
||||
|
||||
flags = MR_SHOW_OUTLINE;
|
||||
if (Targetbox_wire==1)
|
||||
flags |=MR_NO_POLYS;
|
||||
}
|
||||
|
||||
model_render(Asteroid_info[asteroidp->type].model_num[subtype], &target_objp->orient, &obj_pos, flags |MR_NO_LIGHTING | MR_LOCK_DETAIL );
|
||||
hud_render_target_close();
|
||||
}
|
||||
|
||||
@@ -860,7 +935,7 @@ void hud_render_target_asteroid(object *target_objp)
|
||||
|
||||
emp_hud_printf(Targetbox_coords[gr_screen.res][TBOX_NAME][0], Targetbox_coords[gr_screen.res][TBOX_NAME][1], EG_TBOX_NAME, hud_name);
|
||||
|
||||
time_to_impact = asteroid_time_to_impact(target_objp);
|
||||
|
||||
if ( time_to_impact >= 0 ) {
|
||||
emp_hud_printf(Targetbox_coords[gr_screen.res][TBOX_CLASS][0], Targetbox_coords[gr_screen.res][TBOX_CLASS][1], EG_TBOX_CLASS, NOX("impact: %.1f sec"), time_to_impact);
|
||||
}
|
||||
@@ -880,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 {
|
||||
@@ -946,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) {
|
||||
@@ -1017,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);
|
||||
@@ -1180,12 +1263,26 @@ void hud_maybe_render_cargo_scan(ship_info *target_sip)
|
||||
|
||||
gr_line(x1, y1, x2, y1);
|
||||
|
||||
// RT Changed this to be optional
|
||||
if(Cmdline_phreak) {
|
||||
// added 2nd horizontal scan line - phreak
|
||||
y1 = fl2i(Cargo_scan_coords[gr_screen.res][1] + Cargo_scan_coords[gr_screen.res][3] - ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_coords[gr_screen.res][3] ));
|
||||
gr_line(x1, y1, x2, y1);
|
||||
}
|
||||
|
||||
// draw vertical scan line
|
||||
x1 = fl2i(0.5f + Cargo_scan_coords[gr_screen.res][0] + ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_coords[gr_screen.res][2] ));
|
||||
y1 = Cargo_scan_coords[gr_screen.res][1];
|
||||
y2 = y1 + Cargo_scan_coords[gr_screen.res][3];
|
||||
|
||||
gr_line(x1, y1-3, x1, y2-1);
|
||||
|
||||
// RT Changed this to be optional
|
||||
if(Cmdline_phreak) {
|
||||
// added 2nd vertical scan line - phreak
|
||||
x1 = fl2i(0.5f + Cargo_scan_coords[gr_screen.res][2] + Cargo_scan_coords[gr_screen.res][0] - ( (i2fl(Player->cargo_inspect_time) / scan_time) * Cargo_scan_coords[gr_screen.res][2] ));
|
||||
gr_line(x1, y1-3, x1, y2-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Get the eye position for an object at the origin, called from hud_render_target_ship()
|
||||
@@ -1231,6 +1328,7 @@ void hud_render_target_ship(object *target_objp)
|
||||
target_shipp = &Ships[target_objp->instance];
|
||||
target_sip = &Ship_info[target_shipp->ship_info_index];
|
||||
|
||||
int flags=0;
|
||||
if ( Detail.targetview_model ) {
|
||||
// take the forward orientation to be the vector from the player to the current target
|
||||
vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
|
||||
@@ -1250,14 +1348,44 @@ 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)
|
||||
{
|
||||
//set team colors
|
||||
if (target_shipp->team==Player_ship->team)
|
||||
{
|
||||
model_set_outline_color(0,255,0);
|
||||
}
|
||||
else if (((Player_ship->team==TEAM_TRAITOR) && (target_shipp->team==TEAM_FRIENDLY)) ||
|
||||
(target_shipp->team==TEAM_HOSTILE) || (target_shipp->team==TEAM_NEUTRAL))
|
||||
{
|
||||
model_set_outline_color(255,0,0);
|
||||
}
|
||||
else if (target_shipp->team==TEAM_UNKNOWN)
|
||||
{
|
||||
model_set_outline_color(255,0,255);
|
||||
}
|
||||
else
|
||||
{
|
||||
model_set_outline_color(255,255,255);
|
||||
}
|
||||
|
||||
//if a ship is tagged, it overrides team colors
|
||||
if (ship_is_tagged(target_objp))
|
||||
{
|
||||
model_set_outline_color(255,255,0);
|
||||
}
|
||||
flags = MR_SHOW_OUTLINE;
|
||||
if (Targetbox_wire==1)
|
||||
flags |=MR_NO_POLYS;
|
||||
}
|
||||
// maybe render a special hud-target-only model
|
||||
if(target_sip->modelnum_hud >= 0){
|
||||
model_render( target_sip->modelnum_hud, &target_objp->orient, &obj_pos, MR_NO_LIGHTING | MR_LOCK_DETAIL | MR_AUTOCENTER);
|
||||
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, 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 );
|
||||
|
||||
@@ -1293,6 +1421,8 @@ void hud_render_target_ship(object *target_objp)
|
||||
hud_blit_target_foreground();
|
||||
hud_blit_target_integrity(0,OBJ_INDEX(target_objp));
|
||||
|
||||
hud_set_gauge_color(HUD_TARGET_MONITOR);
|
||||
|
||||
hud_render_target_ship_info(target_objp);
|
||||
hud_maybe_render_cargo_scan(target_sip);
|
||||
}
|
||||
@@ -1311,13 +1441,13 @@ void hud_render_target_debris(object *target_objp)
|
||||
vector orient_vec, up_vector;
|
||||
int target_team, base_index;
|
||||
float factor;
|
||||
int flags=0;
|
||||
|
||||
debrisp = &Debris[target_objp->instance];
|
||||
|
||||
//target_sip = &Ship_info[debrisp->ship_info_index];
|
||||
target_team = obj_team(target_objp);
|
||||
|
||||
|
||||
if ( Detail.targetview_model ) {
|
||||
// take the forward orientation to be the vector from the player to the current target
|
||||
vm_vec_sub(&orient_vec, &target_objp->pos, &Player_obj->pos);
|
||||
@@ -1333,17 +1463,24 @@ void hud_render_target_debris(object *target_objp)
|
||||
// the objects position
|
||||
vm_vec_copy_scale(&obj_pos,&orient_vec,factor);
|
||||
|
||||
if (Targetbox_wire!=0)
|
||||
{
|
||||
model_set_outline_color(255,255,255);
|
||||
flags = MR_SHOW_OUTLINE;
|
||||
if (Targetbox_wire==1)
|
||||
flags |=MR_NO_POLYS;
|
||||
}
|
||||
hud_render_target_setup(&camera_eye, &camera_orient, 0.5f);
|
||||
model_clear_instance(debrisp->model_num);
|
||||
submodel_render( debrisp->model_num, debrisp->submodel_num, &target_objp->orient, &obj_pos, MR_NO_LIGHTING | MR_LOCK_DETAIL );
|
||||
|
||||
// This calls the colour that doesnt get reset
|
||||
submodel_render( debrisp->model_num, debrisp->submodel_num, &target_objp->orient, &obj_pos, flags | MR_NO_LIGHTING | MR_LOCK_DETAIL );
|
||||
hud_render_target_close();
|
||||
}
|
||||
|
||||
HUD_reset_clip();
|
||||
hud_blit_target_foreground();
|
||||
hud_blit_target_integrity(1);
|
||||
// hud_set_default_color();
|
||||
hud_set_gauge_color(HUD_TARGET_MONITOR);
|
||||
|
||||
// take ship "copies" into account before printing out ship class information
|
||||
base_index = debrisp->ship_info_index;
|
||||
@@ -1351,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));
|
||||
@@ -1377,9 +1510,11 @@ 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
|
||||
int flags=0;
|
||||
|
||||
target_team = obj_team(target_objp);
|
||||
|
||||
@@ -1406,8 +1541,34 @@ 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)
|
||||
{
|
||||
if (target_team==Player_ship->team)
|
||||
{
|
||||
model_set_outline_color(0,255,0);
|
||||
}
|
||||
else if (((Player_ship->team==TEAM_TRAITOR) && (target_team==TEAM_FRIENDLY)) ||
|
||||
(target_team==TEAM_HOSTILE) || (target_team==TEAM_NEUTRAL))
|
||||
{
|
||||
model_set_outline_color(128,128,0);
|
||||
}
|
||||
else if (target_team==TEAM_UNKNOWN)
|
||||
{
|
||||
model_set_outline_color(255,0,255);
|
||||
}
|
||||
else
|
||||
{
|
||||
model_set_outline_color(255,255,255);
|
||||
}
|
||||
flags = MR_SHOW_OUTLINE;
|
||||
if (Targetbox_wire==1)
|
||||
flags |=MR_NO_POLYS;
|
||||
}
|
||||
|
||||
|
||||
// take the forward orientation to be the vector from the player to the current target
|
||||
vm_vec_sub(&orient_vec, &viewed_obj->pos, &viewer_obj->pos);
|
||||
vm_vec_normalize(&orient_vec);
|
||||
@@ -1427,7 +1588,8 @@ 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, MR_NO_LIGHTING | MR_LOCK_DETAIL );
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -1447,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
|
||||
|
||||
@@ -9,13 +9,20 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDtargetbox.h $
|
||||
* $Revision: 2.0 $
|
||||
* $Date: 2002-06-03 04:02:23 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-06 16:50:13 $
|
||||
* $Author: phreak $
|
||||
*
|
||||
* Header file for drawing the target monitor box on the HUD
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.0 2002/06/03 04:02:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
* Revision 1.2 2002/08/04 22:46:55 PhReAk
|
||||
* Added "Targetbox_wire" variable to toggle if wireframes are on=1 or off=0
|
||||
*
|
||||
*
|
||||
* Revision 1.1 2002/05/02 18:03:08 mharris
|
||||
* Initial checkin - converted filenames and includes to lower case
|
||||
*
|
||||
@@ -145,6 +152,9 @@ extern int Target_window_coords[GR_NUM_RESOLUTIONS][4];
|
||||
// during the game.
|
||||
extern int Targetbox_show_extra_info;
|
||||
|
||||
//used to track if the player has wireframe hud target box turned on
|
||||
extern int Targetbox_wire;
|
||||
|
||||
void hud_targetbox_init();
|
||||
void hud_targetbox_init_flash();
|
||||
void hud_render_target_model();
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Hud/HUDWingmanStatus.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-06 04:39:26 $
|
||||
* $Author: penguin $
|
||||
*
|
||||
* Module for the wingman status gauge
|
||||
*
|
||||
* $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:23 penguin
|
||||
* Warpcore CVS sync
|
||||
*
|
||||
@@ -172,6 +175,13 @@ static int HUD_wingman_flash_duration[HUD_WINGMAN_MAX_WINGS][HUD_WINGMAN_MAX_SHI
|
||||
static int HUD_wingman_flash_next[HUD_WINGMAN_MAX_WINGS][HUD_WINGMAN_MAX_SHIPS_PER_WINGS];
|
||||
static int HUD_wingman_flash_is_bright;
|
||||
|
||||
|
||||
//XSTR:OFF
|
||||
// Text versions of wingman names (instead of bitmaps in winman5.ani)
|
||||
static char *Wingman_status_name_abbr[6] = { "alp", "bet", "gam", "del", "eps", "zet" };
|
||||
//XSTR:ON
|
||||
|
||||
|
||||
// coords to draw wingman status icons, for 1-5 wings (0-4)
|
||||
int HUD_wingman_left_coords[GR_NUM_RESOLUTIONS][5][2] = {
|
||||
{ // GR_640
|
||||
@@ -691,8 +701,6 @@ void hud_wingman_status_blit_dots(int wing_index, int screen_index, int num_wing
|
||||
}
|
||||
|
||||
// draw wing name
|
||||
bitmap = Wingman_status_frames[WINGMAN_STATUS_NAMES].first_frame + wing_index;
|
||||
|
||||
if ( num_wings_to_draw == 1 ) {
|
||||
sx = HUD_wingman_status_single_coords[gr_screen.res][0][0] - 8;
|
||||
sy = HUD_wingman_status_single_coords[gr_screen.res][0][1] + 26;
|
||||
@@ -700,15 +708,8 @@ void hud_wingman_status_blit_dots(int wing_index, int screen_index, int num_wing
|
||||
sx = HUD_wingman_status_name_coords[gr_screen.res][screen_pos][0];
|
||||
sy = HUD_wingman_status_name_coords[gr_screen.res][screen_pos][1];
|
||||
}
|
||||
|
||||
// hud_set_default_color();
|
||||
hud_set_gauge_color(HUD_WINGMEN_STATUS);
|
||||
if ( bitmap > -1 ) {
|
||||
GR_AABITMAP(bitmap, sx, sy);
|
||||
// gr_set_bitmap(bitmap);
|
||||
// gr_aabitmap(sx, sy);
|
||||
}
|
||||
|
||||
gr_string(sx, sy, Wingman_status_name_abbr[wing_index]);
|
||||
}
|
||||
|
||||
int hud_wingman_status_wingmen_exist(int num_wings_to_draw)
|
||||
|
||||
+166
-14
@@ -9,13 +9,48 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Io/KeyControl.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $Author: penguin $
|
||||
* $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.
|
||||
*
|
||||
* Revision 2.2 2002/08/06 16:49:22 phreak
|
||||
* added keybing for wireframe hud,
|
||||
* fixed previous missile cheat
|
||||
*
|
||||
*
|
||||
* Revision 2.2 2002/08/04 23:15:40 PhReAk
|
||||
* Fixed previous missile cheat, commented out beam_test(x) lines
|
||||
* in process_debug_keys(). beam_test(x) caused assertion failure in
|
||||
* beam.cpp apprx line 3147. Also added toggle for wire_hud in process_player_ship_keys()
|
||||
*
|
||||
* 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
|
||||
*
|
||||
@@ -348,6 +383,7 @@
|
||||
#include "mission/missionmessage.h"
|
||||
#include "menuui/mainhallmenu.h"
|
||||
#include "ship/aigoals.h"
|
||||
#include "missionui/missionpause.h"
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// Global to file
|
||||
@@ -511,7 +547,9 @@ int Normal_key_set[] = {
|
||||
TOGGLE_HUD_CONTRAST,
|
||||
|
||||
MULTI_TOGGLE_NETINFO,
|
||||
MULTI_SELF_DESTRUCT
|
||||
MULTI_SELF_DESTRUCT,
|
||||
|
||||
TOGGLE_HUD
|
||||
};
|
||||
|
||||
int Dead_key_set[] = {
|
||||
@@ -635,7 +673,9 @@ int Non_critical_key_set[] = {
|
||||
TOGGLE_HUD_CONTRAST,
|
||||
|
||||
MULTI_TOGGLE_NETINFO,
|
||||
MULTI_SELF_DESTRUCT
|
||||
MULTI_SELF_DESTRUCT,
|
||||
|
||||
TOGGLE_HUD
|
||||
};
|
||||
|
||||
|
||||
@@ -737,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];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1025,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
|
||||
@@ -1066,7 +1131,7 @@ void process_debug_keys(int k)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
case KEY_DEBUGGED + KEY_SHIFTED + KEY_9: {
|
||||
case KEY_DEBUGGED1 + KEY_SHIFTED + KEY_9:
|
||||
ship* shipp;
|
||||
@@ -1079,7 +1144,7 @@ void process_debug_keys(int k)
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Secondary Weapon forced to %s", 18), Weapon_info[shipp->weapons.secondary_bank_weapons[shipp->weapons.current_secondary_bank]].name);
|
||||
break;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#ifndef FS2_DEMO
|
||||
case KEY_DEBUGGED + KEY_U: {
|
||||
@@ -1251,7 +1316,7 @@ void process_debug_keys(int k)
|
||||
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Skill level set to %s.", 25), Skill_level_names(Game_skill_level));
|
||||
break;
|
||||
|
||||
// kill all missiles
|
||||
/*// kill all missiles
|
||||
case KEY_DEBUGGED + KEY_SHIFTED + KEY_1:
|
||||
beam_test(1);
|
||||
break;
|
||||
@@ -1288,7 +1353,7 @@ void process_debug_keys(int k)
|
||||
break;
|
||||
case KEY_DEBUGGED + KEY_CTRLED + KEY_3:
|
||||
beam_test_new(3);
|
||||
break;
|
||||
break;*/
|
||||
|
||||
#ifndef NO_SOUND
|
||||
case KEY_DEBUGGED + KEY_T: {
|
||||
@@ -1368,6 +1433,7 @@ void process_debug_keys(int k)
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} // end switch
|
||||
|
||||
}
|
||||
@@ -1499,6 +1565,17 @@ void process_player_ship_keys(int k)
|
||||
return;
|
||||
}
|
||||
|
||||
//phreak 2002/08/04 - put this here for now
|
||||
if (k==KEY_SHIFTED + KEY_CTRLED + KEY_Q)
|
||||
{
|
||||
extern int Targetbox_wire;
|
||||
Targetbox_wire++;
|
||||
if (Targetbox_wire==3)
|
||||
Targetbox_wire=0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// pass the key to the squadmate messaging code. If the messaging code took the key, then return
|
||||
// from here immediately since we don't want to do further key processing.
|
||||
if ( hud_squadmsg_read_key(k) )
|
||||
@@ -1857,9 +1934,25 @@ void game_process_keys()
|
||||
gameseq_post_event( GS_EVENT_DEBUG_PAUSE_GAME );
|
||||
break;
|
||||
|
||||
case KEY_PAUSE:
|
||||
case KEY_ALTED + KEY_PAUSE:
|
||||
if( Game_mode & GM_DEAD_BLEW_UP ||
|
||||
Game_mode & GM_DEAD_DIED) {
|
||||
break;
|
||||
}
|
||||
|
||||
pause_set_type(PAUSE_TYPE_VIEWER);
|
||||
game_process_pause_key();
|
||||
break;
|
||||
case KEY_PAUSE:
|
||||
if( Game_mode & GM_DEAD_BLEW_UP ||
|
||||
Game_mode & GM_DEAD_DIED) {
|
||||
break;
|
||||
}
|
||||
|
||||
pause_set_type(PAUSE_TYPE_NORMAL);
|
||||
game_process_pause_key();
|
||||
break;
|
||||
|
||||
} // end switch
|
||||
} while (k);
|
||||
|
||||
@@ -2155,6 +2248,8 @@ int button_function_critical(int n, net_player *p = NULL)
|
||||
// return !0 if the action is allowed, otherwise return 0
|
||||
int button_allowed(int n)
|
||||
{
|
||||
// RT Commented this out cos it was disabling use of keys when HUD is off
|
||||
#if 0
|
||||
if ( hud_disabled() ) {
|
||||
switch (n) {
|
||||
case SHOW_GOALS:
|
||||
@@ -2173,6 +2268,7 @@ int button_allowed(int n)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -2270,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);
|
||||
@@ -2284,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:
|
||||
@@ -2337,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 ) {
|
||||
@@ -2828,6 +2976,10 @@ int button_function(int n)
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case TOGGLE_HUD:
|
||||
gamesnd_play_iface(SND_USER_SELECT);
|
||||
hud_toggle_draw();
|
||||
break;
|
||||
|
||||
// following are not handled here, but we need to bypass the Int3()
|
||||
case LAUNCH_COUNTERMEASURE:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -9,13 +9,31 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MenuUI/Credits.cpp $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $Author: penguin $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.4 2002/11/02 22:10:48 DTP
|
||||
* shameless self promotion
|
||||
*
|
||||
* Revision 2.3 2002/10/05 16:46:10 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:06 penguin
|
||||
* The big include file move
|
||||
*
|
||||
* Revision 2.1 2002/07/07 19:55:59 penguin
|
||||
* Back-port to MSVC
|
||||
*
|
||||
@@ -172,6 +190,41 @@
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "localization/localize.h"
|
||||
|
||||
// This is the fs2_open credit list, please only add yourself if you have actually contributed code// Rules!
|
||||
char *fs2_open_credit_text =
|
||||
"FS2_OPEN STAFF:\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"Project leader:\n"
|
||||
"Edward \"Inquisitor\" Gardner\n"
|
||||
"\n"
|
||||
"Programmers:\n"
|
||||
"\n"
|
||||
"\"Bobboau\"\n"
|
||||
"Dennis \"DTP\" Pedersen\n"
|
||||
"Ian \"Goober5000\" Warfield\n"
|
||||
"Joe \"Righteous1\" Dowd\n"
|
||||
"Mike \"penguin\" Harris\n"
|
||||
"\"Mysterial\"\n"
|
||||
"\"PhReAk\"\n"
|
||||
"Thomas \"Random Tiger\" Whittaker\n"
|
||||
"Will \"Unknown PLayer\" Rousnel\n"
|
||||
"\"WMCoolmon\"\n"
|
||||
|
||||
"Web support:\n"
|
||||
"Icefire and the staff at Volitionwatch.com\n"
|
||||
"Alex \"Thunder\" Avery and the staff at Hard Light Productions\n"
|
||||
|
||||
|
||||
"\nSpecial thanks to:\n"
|
||||
"\n"
|
||||
"Volition for making FS2 such a great game\n"
|
||||
"Dave Baranec for giving us the code and keeping us sanity checked\n"
|
||||
"\n\n\n\n";
|
||||
|
||||
char *unmodified_credits = "ORIGINAL VOLITION STAFF:\n\n\n";
|
||||
char *mod_check = "Design:";
|
||||
|
||||
#define CREDITS_MUSIC_DELAY 2000
|
||||
#define CREDITS_SCROLL_RATE 15.0f
|
||||
#define CREDITS_ARTWORK_DISPLAY_TIME 9.0f
|
||||
@@ -374,7 +427,7 @@ void credits_init()
|
||||
if(fp != NULL){
|
||||
int size;
|
||||
size = cfilelength(fp);
|
||||
Credit_text = (char *) malloc(size + 200);
|
||||
Credit_text = (char *) malloc(size + 200 + strlen(fs2_open_credit_text) + strlen(unmodified_credits));
|
||||
cfclose(fp);
|
||||
|
||||
// open localization and parse
|
||||
@@ -383,9 +436,25 @@ void credits_init()
|
||||
reset_parse();
|
||||
|
||||
// keep reading everything in
|
||||
strcpy(Credit_text,"");
|
||||
while(!check_for_string_raw("#end")){
|
||||
strcpy(Credit_text,fs2_open_credit_text);
|
||||
|
||||
bool first_run = true;
|
||||
while(!check_for_string_raw("#end")){
|
||||
|
||||
stuff_string_line(line, 511);
|
||||
|
||||
// This is a bit odd but it means if a total conversion uses different credits the
|
||||
// Volition credit wont happen
|
||||
if(first_run == true)
|
||||
{
|
||||
if(strcmp(line, mod_check) == 0)
|
||||
{
|
||||
strcat(Credit_text, unmodified_credits);
|
||||
}
|
||||
|
||||
first_run = false;
|
||||
}
|
||||
|
||||
linep1 = line;
|
||||
|
||||
do {
|
||||
|
||||
@@ -9,13 +9,19 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MenuUI/MainHallMenu.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-04 05:12:10 $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.2 2002/08/01 01:41:06 penguin
|
||||
* The big include file move
|
||||
*
|
||||
@@ -2033,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:");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MenuUI/ReadyRoom.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-10-19 03:50:29 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
* Ready Room code, which is the UI screen for selecting Campaign/mission to play next mainly.
|
||||
*
|
||||
* $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
|
||||
*
|
||||
@@ -102,6 +105,7 @@
|
||||
#include "cfile/cfilesystem.h"
|
||||
#include "freespace2/freespace.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "cmdline/cmdline.h"
|
||||
|
||||
#define MAX_MISSIONS 1024
|
||||
|
||||
@@ -592,7 +596,7 @@ int build_campaign_mission_list_do_frame()
|
||||
Campaign_mission_flags[Num_campaign_missions_with_info] = 0;
|
||||
|
||||
// Only allow missions already completed
|
||||
if (Campaign.missions[Num_campaign_missions_with_info].completed) {
|
||||
if (Campaign.missions[Num_campaign_missions_with_info].completed || Cmdline_allslev) {
|
||||
if (!get_mission_info(Campaign.missions[Num_campaign_missions_with_info].name)) {
|
||||
// add to list
|
||||
Campaign_mission_names[Num_campaign_missions_with_info] = strdup(The_mission.name);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,13 +9,23 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Mission/MissionCampaign.cpp $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-08-01 01:41:06 $
|
||||
* $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
|
||||
*
|
||||
* Revision 2.2 2002/07/29 20:12:31 penguin
|
||||
* added #ifdef _WIN32 around windows-specific system headers
|
||||
*
|
||||
@@ -207,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"
|
||||
@@ -598,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();
|
||||
@@ -1510,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
|
||||
}
|
||||
@@ -1755,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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,13 +9,16 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/Mission/MissionMessage.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:07 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-10-17 20:40:51 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
* Controls messaging to player during the mission
|
||||
*
|
||||
* $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
|
||||
*
|
||||
@@ -1246,6 +1249,10 @@ void message_play_anim( message_q *q )
|
||||
message_kill_all( 0 );
|
||||
}
|
||||
|
||||
if ( hud_disabled() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( hud_gauge_active(HUD_TALKING_HEAD) ) {
|
||||
int anim_start_frame;
|
||||
anim_play_struct aps;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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 );
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -9,12 +9,19 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MissionUI/MissionPause.cpp $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:07 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.3 $
|
||||
* $Date: 2002-10-22 17:42:09 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
*
|
||||
* $Log: not supported by cvs2svn $
|
||||
* Revision 2.2 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.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
|
||||
*
|
||||
@@ -51,7 +58,8 @@
|
||||
#include "object/object.h"
|
||||
#include "graphics/font.h"
|
||||
#include "globalincs/alphacolors.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "weapon/beam.h"
|
||||
#include "controlconfig/controlsconfig.h"
|
||||
|
||||
#ifndef NO_NETWORK
|
||||
#include "network/multi_pause.h"
|
||||
@@ -95,6 +103,7 @@ UI_CHECKBOX Pause_ai_render;
|
||||
UI_CHECKBOX Pause_firing;
|
||||
UI_CHECKBOX Pause_external_view_mode_check;
|
||||
UI_BUTTON Pause_continue;
|
||||
int Pause_type = PAUSE_TYPE_NORMAL;
|
||||
|
||||
// if we're already paused
|
||||
int Paused = 0;
|
||||
@@ -121,6 +130,16 @@ extern int game_single_step;
|
||||
// PAUSE FUNCTIONS
|
||||
//
|
||||
|
||||
int pause_get_type()
|
||||
{
|
||||
return Pause_type;
|
||||
}
|
||||
|
||||
void pause_set_type(int type)
|
||||
{
|
||||
Pause_type = type;
|
||||
}
|
||||
|
||||
// initialize the pause screen
|
||||
void pause_init(int multi)
|
||||
{
|
||||
@@ -139,7 +158,10 @@ void pause_init(int multi)
|
||||
#ifndef NO_NETWORK
|
||||
if(!(Game_mode & GM_STANDALONE_SERVER)){
|
||||
#endif
|
||||
Pause_saved_screen = gr_save_screen();
|
||||
|
||||
if(Pause_type == PAUSE_TYPE_NORMAL) {
|
||||
Pause_saved_screen = gr_save_screen();
|
||||
}
|
||||
|
||||
// pause all game music
|
||||
audiostream_pause_all();
|
||||
@@ -181,22 +203,35 @@ void pause_do(int multi)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// RENDER A GAME FRAME HERE AS THE BACKGROUND
|
||||
gr_restore_screen(Pause_saved_screen);
|
||||
if (Pause_background_bitmap >= 0) {
|
||||
gr_set_bitmap(Pause_background_bitmap);
|
||||
if(multi){
|
||||
gr_bitmap(0,0);
|
||||
} else {
|
||||
// draw the bitmap
|
||||
gr_bitmap(Please_wait_coords[gr_screen.res][0], Please_wait_coords[gr_screen.res][1]);
|
||||
// RENDER A GAME FRAME HERE AS THE BACKGROUND (if normal pause)
|
||||
|
||||
// draw "Paused" on it
|
||||
gr_set_color_fast(&Color_normal);
|
||||
gr_set_font(FONT2);
|
||||
gr_get_string_size(&str_w, &str_h, pause_str);
|
||||
gr_string((gr_screen.max_w - str_w) / 2, (gr_screen.max_h - str_h) / 2, pause_str);
|
||||
gr_set_font(FONT1);
|
||||
if(Pause_type == PAUSE_TYPE_NORMAL) {
|
||||
|
||||
// Fall back to viewer just incase saved screen is invalid
|
||||
if(Pause_saved_screen == -1){
|
||||
Pause_type = PAUSE_TYPE_VIEWER;
|
||||
}
|
||||
else if(Pause_type == PAUSE_TYPE_NORMAL) {
|
||||
gr_restore_screen(Pause_saved_screen);
|
||||
}
|
||||
}
|
||||
|
||||
if(Pause_type == PAUSE_TYPE_NORMAL){
|
||||
if (Pause_background_bitmap >= 0) {
|
||||
gr_set_bitmap(Pause_background_bitmap);
|
||||
if(multi){
|
||||
gr_bitmap(0,0);
|
||||
} else {
|
||||
// draw the bitmap
|
||||
gr_bitmap(Please_wait_coords[gr_screen.res][0], Please_wait_coords[gr_screen.res][1]);
|
||||
|
||||
// draw "Paused" on it
|
||||
gr_set_color_fast(&Color_normal);
|
||||
gr_set_font(FONT2);
|
||||
gr_get_string_size(&str_w, &str_h, pause_str);
|
||||
gr_string((gr_screen.max_w - str_w) / 2, (gr_screen.max_h - str_h) / 2, pause_str);
|
||||
gr_set_font(FONT1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,8 +245,24 @@ void pause_do(int multi)
|
||||
{
|
||||
// otherwise process the ui window here
|
||||
k = Pause_win.process() & ~KEY_DEBUGGED;
|
||||
switch (k) {
|
||||
switch (k) {
|
||||
|
||||
case KEY_TAB:
|
||||
hud_toggle_draw();
|
||||
break;
|
||||
|
||||
// case VIEW_EXTERNAL:
|
||||
case KEY_ENTER:
|
||||
if(Pause_type != PAUSE_TYPE_VIEWER) {
|
||||
break;
|
||||
}
|
||||
|
||||
extern int button_function_demo_valid(int n);
|
||||
button_function_demo_valid(VIEW_EXTERNAL);
|
||||
|
||||
break;
|
||||
case KEY_ESC:
|
||||
case KEY_ALTED + KEY_PAUSE:
|
||||
case KEY_PAUSE:
|
||||
gameseq_post_event(GS_EVENT_PREVIOUS_STATE);
|
||||
break;
|
||||
@@ -223,7 +274,9 @@ void pause_do(int multi)
|
||||
|
||||
// a very unique case where we shouldn't be doing the page flip because we're inside of popup code
|
||||
if(!popup_active()){
|
||||
gr_flip();
|
||||
if(Pause_type == PAUSE_TYPE_NORMAL) {
|
||||
gr_flip();
|
||||
}
|
||||
} else {
|
||||
// this should only be happening in a very unique multiplayer case
|
||||
Assert(Game_mode & GM_MULTIPLAYER);
|
||||
@@ -250,7 +303,10 @@ void pause_close(int multi)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
gr_free_screen(Pause_saved_screen);
|
||||
if(Pause_saved_screen != -1) {
|
||||
gr_free_screen(Pause_saved_screen);
|
||||
Pause_saved_screen = -1;
|
||||
}
|
||||
|
||||
if (Pause_background_bitmap){
|
||||
bm_unload(Pause_background_bitmap);
|
||||
|
||||
@@ -9,12 +9,15 @@
|
||||
|
||||
/*
|
||||
* $Logfile: /Freespace2/code/MissionUI/MissionPause.h $
|
||||
* $Revision: 2.1 $
|
||||
* $Date: 2002-08-01 01:41:07 $
|
||||
* $Author: penguin $
|
||||
* $Revision: 2.2 $
|
||||
* $Date: 2002-10-19 03:50:29 $
|
||||
* $Author: randomtiger $
|
||||
*
|
||||
*
|
||||
* $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
|
||||
*
|
||||
@@ -64,4 +67,13 @@ void pause_debug_do();
|
||||
// debug pause close
|
||||
void pause_debug_close();
|
||||
|
||||
enum
|
||||
{
|
||||
PAUSE_TYPE_NORMAL,
|
||||
PAUSE_TYPE_VIEWER,
|
||||
};
|
||||
|
||||
void pause_set_type(int type);
|
||||
int pause_get_type();
|
||||
|
||||
#endif
|
||||
@@ -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];
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 164 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user