Compare commits

...
Author SHA1 Message Date
Goober5000 022a04472c revert the directory move 2008-02-09 21:33:46 +00:00
Goober5000 e80b91c27e experimentally move everything up one folder 2008-02-09 18:21:58 +00:00
argv 26a66f9c53 Mission ship flag beam-free-all. 2003-09-19 01:02:51 +00:00
argv a337c9a5d5 Don't restore player loadout in scramble missions. Avoids breakage when changing the default loadout in fred on such missions. 2003-09-19 00:58:49 +00:00
argv 85da72fb16 Mission ship flag beam-free-all. 2003-09-19 00:57:06 +00:00
argv 13ee1bdb60 Singular shield, beam-free-all mission ship flag, negative repeat count means repeat forever. Sorry for flooding the dev list with this junk. :P 2003-09-19 00:55:33 +00:00
argv 02465b9db6 Negative repeat count in mission means to repeat indefinitely. Shouldn't break anything, I don't think. Fred needs to be changed to be able to use this, though. 2003-09-19 00:49:11 +00:00
argv b33417a918 New energy system support. This doesn't compile yet, but this _is_ the experimental branch... 2003-09-19 00:42:13 +00:00
argv f802db8345 Table specified subsys display name. 2003-09-19 00:35:51 +00:00
argv 56054d6782 Made target nothing command not disable auto targeting if player says not to, and made targeting big ships not auto-select a turret if player says not to. 2003-09-19 00:31:10 +00:00
argv 1c3fb592cb Gave fredders more power over what orders players can give to big ships, like ordering a supercap to attack something. 2003-09-19 00:15:26 +00:00
argv 049870c973 Various singular shield stuff. 2003-09-19 00:10:21 +00:00
argv 22c0882bc6 New energy system and auto ETS stuff. 2003-09-19 00:02:20 +00:00
argv ffd3fbd922 Added my command-line options. Note that this is in my new experimental branch, so don't panic. 2003-09-18 23:40:16 +00:00
(no author) 42e496d103 This commit was manufactured by cvs2svn to create branch
'argv_experimental_branch'.
2003-09-16 13:30:17 +00:00
29 changed files with 546 additions and 1274 deletions

No files matched your search

-15
View File
@@ -1,15 +0,0 @@
# The "checkoutlist" file is used to support additional version controlled
# administrative files in $CVSROOT/CVSROOT, such as template files.
#
# The first entry on a line is a filename which will be checked out from
# the corresponding RCS file in the $CVSROOT/CVSROOT directory.
# The remainder of the line is an error message to use if the file cannot
# be checked out.
#
# File format:
#
# [<whitespace>]<filename><whitespace><error message><end-of-line>
#
# comment lines begin with '#'
new_commit_prep Error checking out/updating CVSROOT/new_commit_prep
new_log_accum Error checking out/updating CVSROOT/new_log_accum
-17
View File
@@ -1,17 +0,0 @@
# The "commitinfo" file is used to control pre-commit checks.
# The filter on the right is invoked with the repository and a list
# of files to check. A non-zero exit of the filter program will
# cause the commit to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
DEFAULT $CVSROOT/CVSROOT/new_commit_prep
CVSROOT $CVSROOT/CVSROOT/new_commit_prep
-14
View File
@@ -1,14 +0,0 @@
# Set this to "no" if pserver shouldn't check system users/passwords
#SystemAuth=no
# Put CVS lock files in this directory rather than directly in the repository.
LockDir=/var/lock/cvs
# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top
# level of the new working directory when using the `cvs checkout'
# command.
#TopLevelAdmin=no
# Set `LogHistory' to `all' or `TOFEWGCMAR' to log all transactions to the
# history file, or a subset as needed (ie `TMAR' logs all write operations)
#LogHistory=TOFEWGCMAR
-23
View File
@@ -1,23 +0,0 @@
# This file affects handling of files based on their names.
#
# The -t/-f options allow one to treat directories of files
# as a single file, or to transform a file in other ways on
# its way in and out of CVS.
#
# The -m option specifies whether CVS attempts to merge files.
#
# The -k option specifies keyword expansion (e.g. -kb for binary).
#
# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers)
#
# wildcard [option value][option value]...
#
# where option is one of
# -f from cvs filter value: path to filter
# -t to cvs filter value: path to filter
# -m update methodology value: MERGE or COPY
# -k expansion mode value: b, o, kkv, &c
#
# and value is a single-quote delimited value.
# For example:
#*.gif -k 'b'
-21
View File
@@ -1,21 +0,0 @@
# The "editinfo" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
-30
View File
@@ -1,30 +0,0 @@
# The "loginfo" file controls where "cvs commit" log information
# is sent. The first entry on a line is a regular expression which must match
# the directory that the change is being made to, relative to the
# $CVSROOT. If a match is found, then the remainder of the line is a filter
# program that should expect log information on its standard input.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name ALL appears as a regular expression it is always used
# in addition to the first matching regex or DEFAULT.
#
# You may specify a format string as part of the
# filter. The string is composed of a `%' followed
# by a single format character, or followed by a set of format
# characters surrounded by `{' and `}' as separators. The format
# characters are:
#
# s = file name
# V = old version number (pre-checkin)
# v = new version number (post-checkin)
#
# For example:
#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog
# or
#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog
DEFAULT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
CVSROOT $CVSROOT/CVSROOT/new_log_accum -m [email protected] %{sVv}
-26
View File
@@ -1,26 +0,0 @@
# Three different line formats are valid:
# key -a aliases...
# key [options] directory
# key [options] directory files...
#
# Where "options" are composed of:
# -i prog Run "prog" on "cvs commit" from top-level of module.
# -o prog Run "prog" on "cvs checkout" of module.
# -e prog Run "prog" on "cvs export" of module.
# -t prog Run "prog" on "cvs rtag" of module.
# -u prog Run "prog" on "cvs update" of module.
# -d dir Place module in directory "dir" instead of module name.
# -l Top-level directory only -- do not recurse.
#
# NOTE: If you change any of the "Run" options above, you'll have to
# release and re-checkout any working directories of these modules.
#
# And "directory" is a path to a directory relative to $CVSROOT.
#
# The "-a" option specifies an alias. An alias is interpreted as if
# everything on the right of the "-a" had been typed on the command line.
#
# You can encode a module within a module by using the special '&'
# character to interpose another module into the current module. This
# can be useful for creating a module that consists of many directories
# spread out over the entire source repository.
-104
View File
@@ -1,104 +0,0 @@
#!/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));
-757
View File
@@ -1,757 +0,0 @@
#!/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.3 2003-09-07 12:46:59 drevil Exp $
#
use strict;
use vars qw($MAILER $CVS $debug $boundary);
use Digest::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 Digest::MD5;
$digest->reset();
$digest->add(time() . rand());
$boundary = "----=MIME." . unpack("H*", $digest->digest());
# Build the mail header
push(@text, 'From: [email protected]');
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);
-12
View File
@@ -1,12 +0,0 @@
# The "notify" file controls where notifications from watches set by
# "cvs watch add" or "cvs edit" are sent. The first entry on a line is
# a regular expression which is tested against the directory that the
# change is being made to, relative to the $CVSROOT. If it matches,
# then the remainder of the line is a filter program that should contain
# one occurrence of %s for the user to notify, and information on its
# standard input.
#
# "ALL" or "DEFAULT" can be used in place of the regular expression.
#
# For example:
#ALL mail %s -s "CVS notification"
-19
View File
@@ -1,19 +0,0 @@
drevil:f76FWdDTUBG5c:fs2source
mysterial:f7nJUwoIhmSrg:fs2source
wmcoolmon:f7JRB.js9Q1sE:fs2source
inquisitor:f7BVkOvwjDlWk:fs2source
penguin:Jh.dOjaiO2jHk:fs2source
DTP:f7M92Z/6/uep.:fs2source
unknownplayer:f79BgAn.IzJs6:fs2source
phreak:f7WQyGiT/jzlM:fs2source
randomtiger:f7Way/xL9ic7o:fs2source
righteous1:f7fpcXiE0Ubao:fs2source
bobboau:f7jChSbXOIdWY:fs2source
sesquipedalian:f75AcAOV6TM6Q:fs2source
daveb:f7f2mVbMvbe.6:fs2source
Goober5000:f7Fc.gHzyrOL2:fs2source
dkharrat:f7odljbD5tm5k:fs2source
EdrickV:f7cDahmEbbAlg:fs2source
OldMan:f7N4NyUG5Ommw:fs2source
komet:f7fyoBN5r.m76:fs2source
anonymous:oIKtWP1q6GDt6:fs2source
-13
View File
@@ -1,13 +0,0 @@
# The "rcsinfo" file is used to control templates with which the editor
# is invoked on commit and import.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being made to, relative to the
# $CVSROOT. For the first match that is found, then the remainder of the
# line is the name of the file that contains the template.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
-20
View File
@@ -1,20 +0,0 @@
# The "taginfo" file is used to control pre-tag checks.
# The filter on the right is invoked with the following arguments:
#
# $1 -- tagname
# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d
# $3 -- repository
# $4-> file revision [file revision ...]
#
# A non-zero exit of the filter program will cause the tag to be aborted.
#
# The first entry on a line is a regular expression which is tested
# against the directory that the change is being committed to, relative
# to the $CVSROOT. For the first match that is found, then the remainder
# of the line is the name of the filter to run.
#
# If the repository name does not match any of the regular expressions in this
# file, the "DEFAULT" line is used, if it is specified.
#
# If the name "ALL" appears as a regular expression it is always used
# in addition to the first matching regex or "DEFAULT".
-21
View File
@@ -1,21 +0,0 @@
# The "verifymsg" file is used to allow verification of logging
# information. It works best when a template (as specified in the
# rcsinfo file) is provided for the logging procedure. Given a
# template with locations for, a bug-id number, a list of people who
# reviewed the code before it can be checked in, and an external
# process to catalog the differences that were code reviewed, the
# following test can be applied to the code:
#
# Making sure that the entered bug-id number is correct.
# Validating that the code that was reviewed is indeed the code being
# checked in (using the bug-id number or a seperate review
# number to identify this particular code set.).
#
# If any of the above test failed, then the commit would be aborted.
#
# Actions such as mailing a copy of the report to each reviewer are
# better handled by an entry in the loginfo file.
#
# One thing that should be noted is the the ALL keyword is not
# supported. There can be only one entry that matches a given
# repository.
-18
View File
@@ -1,18 +0,0 @@
drevil
inquisitor
mysterial
DTP
randomtiger
wmcoolmon
unknownplayer
phreak
bobboau
righteous1
sesquipedalian
Goober5000
dkharrat
daveb
EdrickV
OldMan
komet
penguin
+43 -6
View File
@@ -9,14 +9,17 @@
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.cpp $
* $Revision: 2.29 $
* $Date: 2003-09-14 19:00:02 $
* $Author: wmcoolmon $
* $Revision: 2.29 $
* $Date: 2003-09-14 19:00:02 $
* $Author: wmcoolmon $
* $Revision: 2.29.2.1 $
* $Date: 2003-09-18 23:40:16 $
* $Author: argv $
* $Revision: 2.29.2.1 $
* $Date: 2003-09-18 23:40:16 $
* $Author: argv $
*
* $Log: not supported by cvs2svn $
* Revision 2.29 2003/09/14 19:00:02 wmcoolmon
* Changed "nospec" and "cell" to "Cmdline_nospec" and "Cmdline_cell"
*
* Revision 2.28 2003/09/14 18:32:24 wmcoolmon
* Added "-safeloading" command line parameter, which uses old fs2_retail-style loading code -C
*
@@ -394,6 +397,11 @@ cmdline_parm spec_static_arg("-spec_static", NULL); // comand line FOV -Bobboau
cmdline_parm spec_tube_arg("-spec_tube", NULL); // comand line FOV -Bobboau
cmdline_parm safeloading_arg("-safeloading", NULL); //Uses old loading method -C
cmdline_parm nospec_arg("-nospec", NULL); // skip specular highlighting -Sticks
cmdline_parm auto_ets_arg("-auto-ets", NULL); // _argv[-1] - auto ETS.
cmdline_parm no_implicit_disable_auto_target("-no-implicit-disable-auto-target", NULL); // _argv[-1] - don't disable auto targeting when 'target nothing' command is used.
cmdline_parm no_auto_target_turret("-no-auto-target-turret", NULL); // _argv[-1] - don't auto-target turrets.
cmdline_parm sound_from_own_turrets("-sound-from-own-turrets", NULL); // _argv[-1] - play sounds when own turrets fire.
cmdline_parm singular_shields("-singular-shields", NULL); // _argv[-1] - turn on singular shields for all ships.
cmdline_parm cell_arg("-cell", NULL);
@@ -437,6 +445,8 @@ int Cmdline_d3dmipmap = 0;
int Cmdline_beams_no_pierce_shields = 0; // Goober5000
struct argv_options Argv_options; // _argv[-1] - options struct for my stuff, and maybe other people's too.
static cmdline_parm Parm_list(NULL, NULL);
static int Parm_list_inited = 0;
@@ -846,6 +856,33 @@ int parse_cmdline(int argc, char *argv[])
Cmdline_beams_no_pierce_shields = 1;
}
memset(&Argv_options, 0, sizeof(Argv_options));
// _argv[-1] - auto ETS.
if ( auto_ets_arg.found() ) {
Argv_options.auto_ets = 1;
}
// _argv[-1] - don't disable auto targeting when 'target nothing' command is used.
if ( no_implicit_disable_auto_target.found() ) {
Argv_options.no_implicit_disable_auto_target = 1;
}
// _argv[-1] - don't auto-target turrets.
if ( no_auto_target_turret.found() ) {
Argv_options.no_auto_target_turret = 1;
}
// _argv[-1] - play sounds when own turrets fire.
if ( sound_from_own_turrets.found() ) {
Argv_options.sound_from_own_turrets = 1;
}
// _argv[-1] - turn on singular shields for all ships.
if ( singular_shields.found() ) {
Argv_options.singular_shields = 1;
}
if ( fov_arg.found() ) {
Viewer_zoom = VIEWER_ZOOM_DEFAULT = Cmdline_fov = fov_arg.get_float();
}
+19 -3
View File
@@ -10,11 +10,14 @@
/*
* $Logfile: /Freespace2/code/Cmdline/cmdline.h $
* $Revision: 2.27 $
* $Date: 2003-09-14 19:00:02 $
* $Author: wmcoolmon $
* $Revision: 2.27.2.1 $
* $Date: 2003-09-18 23:40:16 $
* $Author: argv $
*
* $Log: not supported by cvs2svn $
* Revision 2.27 2003/09/14 19:00:02 wmcoolmon
* Changed "nospec" and "cell" to "Cmdline_nospec" and "Cmdline_cell"
*
* Revision 2.26 2003/09/14 18:32:24 wmcoolmon
* Added "-safeloading" command line parameter, which uses old fs2_retail-style loading code -C
*
@@ -333,4 +336,17 @@ extern double specular_exponent_value;
extern int Cmdline_cell;
// _argv[-1] - use a struct with bitfields to avoid wasting memory.
// Yes, I know this deviates from the usual Volition #define flags.
// This is intentional. Structs with bitfields waste less memory and are easier to understand.
// Also, the ':1' etc is not an initializer; it is a specification of how many bits to use.
struct argv_options {
int auto_ets:1;
int no_implicit_disable_auto_target:1;
int no_auto_target_turret:1;
int sound_from_own_turrets:1;
int singular_shields:1;
};
extern struct argv_options Argv_options;
#endif
+267 -93
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDets.cpp $
* $Revision: 2.6 $
* $Date: 2003-09-13 06:02:05 $
* $Author: Goober5000 $
* $Revision: 2.6.2.1 $
* $Date: 2003-09-19 00:02:20 $
* $Author: argv $
*
* C file that contains code to manage and display the Energy Transfer System (ETS)
*
* $Log: not supported by cvs2svn $
* Revision 2.6 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.4 2003/08/06 17:50:01 phreak
* added code to take into account a tertiary reactor pod
*
@@ -163,7 +167,10 @@
#include "weapon/emp.h"
#include "localization/localize.h"
#include "weapon/weapon.h"
#include "globalincs/linklist.h" // _argv[-1] - added this for stuff that's below.
#include "mission/missionlog.h" // _argv[-1] - this too.
#include "cmdline/cmdline.h" // _argv[-1] - yet again.
#define ENERGY_DIVERT_DELTA 0.2f // percentage of energy transferred in a shield->weapon or weapon->shield energy transfer
#define INTIAL_SHIELD_RECHARGE_INDEX 4 // default shield charge rate (index in Energy_levels[])
#define INTIAL_WEAPON_RECHARGE_INDEX 4 // default weapon charge rate (index in Energy_levels[])
@@ -312,7 +319,7 @@ void ets_init_ship(object* obj)
//
void update_ets(object* objp, float fl_frametime)
{
float max_new_shield_energy, max_new_weapon_energy, _ss;
float /*max_new_shield_energy, max_new_weapon_energy,*/ _ss;
if ( fl_frametime <= 0 ){
return;
@@ -327,7 +334,9 @@ void update_ets(object* objp, float fl_frametime)
return;
}
if ( sinfo_p->power_output == 0 ){
if ( sinfo_p->full_power_output == 0 ){
// _argv[-1] - ship might have 0 PO but some subsystems with some power output.
// If not, then energy management should obviously be disabled.
return;
}
@@ -342,25 +351,99 @@ void update_ets(object* objp, float fl_frametime)
// new_energy = fl_frametime * sinfo_p->power_output;
// _argv[-1] - made power output part of the equation again.
if (ship_p->power_drain > 0.0f) {
ship_p->time_to_next_jitter -= fl_frametime;
while (ship_p->time_to_next_jitter <= 0.0f) {
ship_p->effective_power_drain -= sinfo_p->full_power_output * 0.1f;
if (ship_p->effective_power_drain < 0.0f)
ship_p->effective_power_drain = 0.0f;
ship_p->time_to_next_jitter += 3.0f;
}
}
else
ship_p->time_to_next_jitter = 0.0f;
if (ship_p->effective_power_drain != ship_p->power_drain) {
if (ship_p->effective_power_drain < ship_p->power_drain) {
// Negative power drain means power boost. (Flying into a Descent style energy center?)
ship_p->effective_power_drain += max(sinfo_p->full_power_output, -ship_p->effective_power_drain) * 0.2f * fl_frametime;
if (ship_p->effective_power_drain > ship_p->power_drain)
// clamp
ship_p->effective_power_drain = ship_p->power_drain;
}
else /* if (ship_p->effective_power_drain > ship_p->power_drain) */ {
ship_p->effective_power_drain -= max(sinfo_p->full_power_output, ship_p->effective_power_drain) * 0.2f * fl_frametime;
if (ship_p->effective_power_drain < ship_p->power_drain)
// clamp
ship_p->effective_power_drain = ship_p->power_drain;
}
}
// calculate effective power output.
ship_p->power_output = sinfo_p->power_output;
for (ship_subsys *ss = GET_FIRST(&ship_p->subsys_list); ss != END_OF_LIST(&ship_p->subsys_list); ss = GET_NEXT(ss)) {
if (!ss->system_info->power_output) {
ss->power_output = 0.0f;
continue;
}
else if (ss->current_hits == 0.0f || ship_subsys_disrupted(ss)) {
ss->power_output = 0.0f;
continue;
}
else if (ss->current_hits < ss->system_info->max_subsys_strength / 2)
ss->power_output = ss->system_info->power_output * (ss->current_hits / (ss->system_info->max_subsys_strength / 2));
else
ss->power_output = ss->system_info->power_output;
ship_p->power_output += ss->power_output;
}
// apply power drain.
if (ship_p->effective_power_drain != 0.0f)
ship_p->power_output -= ship_p->effective_power_drain;
if (ship_p->power_output < 0.0f)
ship_p->power_output = 0.0f;
// update weapon energy
ship_p->weapon_energy += fl_frametime * ship_p->power_output * Energy_levels[ship_p->weapon_recharge_index] * (objp->flags & OF_PLAYER_SHIP ? Skill_level_weapon_energy_scale[Game_skill_level] : 1);
// apply power drain (real, not effective).
if (ship_p->power_drain != 0.0f) {
ship_p->weapon_energy -= fl_frametime * ship_p->power_drain;
if (ship_p->weapon_energy < 0.0f)
// clamp
ship_p->weapon_energy = 0.0f;
}
/*
max_new_weapon_energy = fl_frametime * MAX_WEAPON_REGEN_PER_SECOND * max_g;
if ( objp->flags & OF_PLAYER_SHIP ) {
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy * Skill_level_weapon_energy_scale[Game_skill_level];
} else {
ship_p->weapon_energy += Energy_levels[ship_p->weapon_recharge_index] * max_new_weapon_energy;
}
*/
if ( ship_p->weapon_energy > sinfo_p->max_weapon_reserve ){
ship_p->weapon_energy = sinfo_p->max_weapon_reserve;
}
float shield_delta;
shield_delta = fl_frametime * 16.0f * ((ship_p->power_output * Energy_levels[ship_p->shield_recharge_index] * (objp->flags & OF_PLAYER_SHIP ? Skill_level_shield_energy_scale[Game_skill_level] : 1)) - ship_p->power_drain);
/*
max_new_shield_energy = fl_frametime * MAX_SHIELD_REGEN_PER_SECOND * max_s;
if ( objp->flags & OF_PLAYER_SHIP ) {
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy * Skill_level_shield_energy_scale[Game_skill_level];
} else {
shield_delta = Energy_levels[ship_p->shield_recharge_index] * max_new_shield_energy;
}
*/
add_shield_strength(objp, shield_delta);
@@ -370,53 +453,91 @@ void update_ets(object* objp, float fl_frametime)
}
}
// calculate the top speed of the ship based on the energy flow to engines
float y = Energy_levels[ship_p->engine_recharge_index];
// easy out for disrupted engines.
if (ship_p->subsys_disrupted_flags & (1<<SUBSYSTEM_ENGINE))
ship_p->current_max_speed = 0.0f;
// easy out for stationary objects.
else if (sinfo_p->max_speed == 0.0f)
ship_p->flags &= ~SF_DISABLED; // stationary objects have no engine and thus cannot be disabled.
// calculate the real max speed of this ship, and set disabled flag as appropriate.
// FIXME: affect max speeds of lateral thrusters.
else {
float strength = ship_get_subsystem_strength(ship_p, SUBSYSTEM_ENGINE);
// calculate the top speed of the ship based on the energy flow to engines
float y = Energy_levels[ship_p->engine_recharge_index];
// check for a shortcuts first before doing linear interpolation
if ( y == Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX] ){
ship_p->current_max_speed = sinfo_p->max_speed;
} else if ( y == 0.0f ){
ship_p->current_max_speed = 0.5f * sinfo_p->max_speed;
} else if ( y == 1.0f ){
ship_p->current_max_speed = sinfo_p->max_overclocked_speed;
} else {
// do a linear interpolation to find the current max speed, using points (0,1/2 default_max_speed) (.333,default_max_speed)
// x = x1 + (y-y1) * (x2-x1) / (y2-y1);
if ( y < Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX] ){
ship_p->current_max_speed = 0.5f*sinfo_p->max_speed + (y * (0.5f*sinfo_p->max_speed) ) / Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX];
} else {
// do a linear interpolation to find the current max speed, using points (.333,default_max_speed) (1,max_overclock_speed)
ship_p->current_max_speed = sinfo_p->max_speed + (y - Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX]) * (sinfo_p->max_overclocked_speed - sinfo_p->max_speed) / (1.0f - Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX]);
}
}
// AL 11-15-97: Rules for engine strength affecting max speed:
// 1. if strength >= 0.5 no affect
// 2. if strength < 0.5 then max_speed = sqrt(strength)
//
// This will translate to 71% max speed at 50% engines, and 31% max speed at 10% engines
//
float strength = ship_get_subsystem_strength(ship_p, SUBSYSTEM_ENGINE);
// don't let engine strength affect max speed when playing on lowest skill level
if ( (objp != Player_obj) || (Game_skill_level > 0) ) {
if ( strength < 0.5 ) {
ship_p->current_max_speed *= fl_sqrt(strength);
}
}
if ( timestamp_elapsed(ship_p->next_manage_ets) ) {
if ( !(objp->flags & OF_PLAYER_SHIP) ) {
ai_manage_ets(objp);
ship_p->next_manage_ets = timestamp(AI_MODIFY_ETS_INTERVAL);
}
else {
if ( Weapon_energy_cheat ){
ship_p->weapon_energy = sinfo_p->max_weapon_reserve;
// check for a shortcuts first before doing linear interpolation
if (strength == 0.0f)
ship_p->current_max_speed;
else if ( y == Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX] ){
ship_p->current_max_speed = sinfo_p->max_speed;
} else if ( y == 0.0f ){
ship_p->current_max_speed = 0.5f * sinfo_p->max_speed;
} else if ( y == 1.0f ){
ship_p->current_max_speed = sinfo_p->max_overclocked_speed;
} else {
// do a linear interpolation to find the current max speed, using points (0,1/2 default_max_speed) (.333,default_max_speed)
// x = x1 + (y-y1) * (x2-x1) / (y2-y1);
if ( y < Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX] ){
ship_p->current_max_speed = 0.5f*sinfo_p->max_speed + (y * (0.5f*sinfo_p->max_speed) ) / Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX];
} else {
// do a linear interpolation to find the current max speed, using points (.333,default_max_speed) (1,max_overclock_speed)
ship_p->current_max_speed = sinfo_p->max_speed + (y - Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX]) * (sinfo_p->max_overclocked_speed - sinfo_p->max_speed) / (1.0f - Energy_levels[INTIAL_ENGINE_RECHARGE_INDEX]);
}
}
// _argv[-1] - if reduced power output, make it affect engines.
if (ship_p->power_output < sinfo_p->full_power_output)
ship_p->current_max_speed *= ship_p->power_output / sinfo_p->full_power_output;
// AL 11-15-97: Rules for engine strength affecting max speed:
// 1. if strength >= 0.5 no affect
// 2. if strength < 0.5 then max_speed = sqrt(strength)
//
// This will translate to 71% max speed at 50% engines, and 31% max speed at 10% engines
//
// don't let engine strength affect max speed when playing on lowest skill level
if ( (objp != Player_obj) || (Game_skill_level > 0) ) {
if ( strength < 0.5 ) {
ship_p->current_max_speed *= fl_sqrt(strength);
}
}
objp->phys_info.max_speed_mul = ship_p->current_max_speed / sinfo_p->max_speed;
// set disabled flag based on max speed, as max speed is always 0 if all engines are shot.
if (ship_p->current_max_speed == 0.0f) {
if (!(ship_p->flags & SF_DISABLED)) // if disabling, add log entry.
mission_log_add_entry(LOG_SHIP_DISABLED, ship_p->ship_name, NULL);
ship_p->flags |= SF_DISABLED;
}
else {
if (ship_p->flags & SF_DISABLED) { // if undisabling, reset disabled physics too.
extern void ship_reset_disabled_physics(object *objp, int ship_class);
ship_reset_disabled_physics(objp, ship_p->ship_info_index);
}
ship_p->flags &= ~SF_DISABLED;
}
}
// _argv[-1] - automatic energy management!
/*if ( timestamp_elapsed(ship_p->next_manage_ets) ) {
if ( !(objp->flags & OF_PLAYER_SHIP) ) {*/
if (objp->flags & OF_PLAYER_SHIP && Weapon_energy_cheat)
ship_p->weapon_energy = sinfo_p->max_weapon_reserve;
// _argv[-1] - FIXME: this probably won't work properly in multiplayer. Maybe it'll only apply auto ETS to the master?
if (!(objp->flags & OF_PLAYER_SHIP) || Argv_options.auto_ets)
ai_manage_ets(objp);
/* ship_p->next_manage_ets = timestamp(AI_MODIFY_ETS_INTERVAL);
}
else {
if ( Weapon_energy_cheat ){
ship_p->weapon_energy = sinfo_p->max_weapon_reserve;
}
ai_manage_ets(objp);
}
}*/
}
@@ -434,11 +555,12 @@ void update_ets(object* objp, float fl_frametime)
#define WEAPONS_MAX_LEVEL_PERCENT 0.8f
// emergency rule constants
#define SHIELDS_EMERG_LEVEL_PERCENT 0.10f
#define SHIELDS_EMERG_LEVEL_PERCENT 0.25f
#define WEAPONS_EMERG_LEVEL_PERCENT 0.05f
// need this, or ai's tend to totally eliminate engine power!
#define MIN_ENGINE_RECHARGE_INDEX 3
// _argv[-1] - reduced from 3. give engines low priority.
#define MIN_ENGINE_RECHARGE_INDEX 1
#define DEFAULT_CHARGE_INDEX 4
#define NORMAL_TOLERANCE_PERCENT .10f
@@ -447,71 +569,123 @@ void ai_manage_ets(object* obj)
{
ship* ship_p = &Ships[obj->instance];
ship_info* ship_info_p = &Ship_info[ship_p->ship_info_index];
// _argv[-1] - added this no_shields flag.
int no_shields = obj->flags & OF_NO_SHIELDS || !ship_p->ship_initial_shield_strength;
if ( ship_info_p->power_output == 0 )
if ( ship_info_p->full_power_output == 0 ) // _argv[-1] - ship might have 0 PO but some subsystems with some power output.
return;
if (ship_p->flags & SF_DYING)
return;
// check if any of the three systems are not being used. If so, don't allow energy management.
if ( !ship_p->ship_initial_shield_strength || !ship_info_p->max_speed || !ship_info_p->max_weapon_reserve)
// _argv[-1] - changed this so that ETS adjustment is allowed if the ship has more than one system to power.
if ( (ship_p->ship_initial_shield_strength ? 1 : 0) + (ship_info_p->max_speed ? 1 : 0) + (ship_info_p->max_weapon_reserve ? 1 : 0) < 2)
return;
float shield_left_percent = get_shield_strength(obj)/ship_p->ship_initial_shield_strength;
float weapon_left_percent = ship_p->weapon_energy/ship_info_p->max_weapon_reserve;
float shield_left_percent = (get_shield_strength(obj)+ship_p->target_shields_delta)/ship_p->ship_initial_shield_strength;
float weapon_left_percent = (ship_p->weapon_energy+ship_p->target_weapon_energy_delta)/ship_info_p->max_weapon_reserve;
// maximum level check
// MK, changed these, might as well let them go up to 100% if nothing else needs the recharge ability.
if ( weapon_left_percent == 1.0f) {
decrease_recharge_rate(obj, WEAPONS);
// _argv[-1] - redid all of this.
// if AB reserve needs filling, fill it! even if shield is low, this may be needed for escape.
if (ship_p->afterburner_fuel < ship_info_p->afterburner_fuel_capacity && !(obj->phys_info.flags & PF_AFTERBURNER_ON))
increase_recharge_rate(obj, ENGINES_QUIET);
else {
// establish how much power is needed in shields and weapons.
int shield_target, weapon_target, engine_off = ((obj->phys_info.forward_thrust == 0 || obj->phys_info.flags & PF_AFTERBURNER_ON) && obj->phys_info.side_thrust == 0 && obj->phys_info.vert_thrust == 0);
if (no_shields || shield_left_percent == 1.0f)
shield_target = 0;
else {
if (engine_off)
// engine is off, so take all power.
shield_target = ALL_INDEX;
else
shield_target = max((int) ((1.0f - shield_left_percent) * ALL_INDEX), 2) + 2;
if (shield_target > ALL_INDEX)
shield_target = ALL_INDEX;
}
if (weapon_left_percent == 1.0f)
weapon_target = 0;
else if (engine_off && shield_target < ALL_INDEX)
// engine is off, so take remaining power.
weapon_target = ALL_INDEX - shield_target;
else
weapon_target = max((int) ((1.0f - weapon_left_percent) * ALL_INDEX), 2);
// then, allocate power to weapons.
while (ship_p->weapon_recharge_index > weapon_target) {
ship_p->weapon_recharge_index--;
ship_p->engine_recharge_index++;
}
while (ship_p->weapon_recharge_index < weapon_target) {
if (!no_shields && ship_p->shield_recharge_index > shield_target) {
// swipe excess shield power (would otherwise go to engine, below).
ship_p->shield_recharge_index--;
ship_p->weapon_recharge_index++;
}
else if ((engine_off && ship_p->engine_recharge_index > 0) || ship_p->engine_recharge_index > 2) {
// swipe non-critical engine power.
ship_p->engine_recharge_index--;
ship_p->weapon_recharge_index++;
}
else
// no available power! ship has problems!
break;
}
// then, allocate power to shields.
// note that this must come after weapons because the shield may steal weapon energy.
if (!no_shields) {
while (ship_p->shield_recharge_index > shield_target) {
ship_p->shield_recharge_index--;
ship_p->engine_recharge_index++;
}
while (ship_p->shield_recharge_index < shield_target) {
if ((engine_off && ship_p->engine_recharge_index > 0) || ship_p->engine_recharge_index > 2) {
// swipe non-critical engine power.
ship_p->engine_recharge_index--;
ship_p->shield_recharge_index++;
}
else if (shield_left_percent < SHIELDS_EMERG_LEVEL_PERCENT && ship_p->weapon_recharge_index > 1) {
// swipe weapon power if shields are low.
ship_p->weapon_recharge_index--;
ship_p->shield_recharge_index++;
}
else
// no available power! ship has problems!
break;
}
}
else if (ship_p->shield_recharge_index > 0) {
// ship has no shields, but power is going to shields, so divert it all to engines. thought impossible, but it's not.
do {
ship_p->shield_recharge_index--;
ship_p->engine_recharge_index++;
} while (ship_p->shield_recharge_index > 0);
}
}
if (!(obj->flags & OF_NO_SHIELDS) && (shield_left_percent == 1.0f)) {
decrease_recharge_rate(obj, SHIELDS);
}
// minimum check
if (!(obj->flags & OF_NO_SHIELDS) && (shield_left_percent < SHIELDS_MIN_LEVEL_PERCENT)) {
if ( weapon_left_percent > WEAPONS_MIN_LEVEL_PERCENT )
increase_recharge_rate(obj, SHIELDS);
}
if ( weapon_left_percent < WEAPONS_MIN_LEVEL_PERCENT ) {
increase_recharge_rate(obj, WEAPONS);
}
if ( ship_p->engine_recharge_index < MIN_ENGINE_RECHARGE_INDEX ) {
increase_recharge_rate(obj, ENGINES);
}
// emergency check
if (!(obj->flags & OF_NO_SHIELDS)) {
if (!no_shields) {
if ( shield_left_percent < SHIELDS_EMERG_LEVEL_PERCENT ) {
if (ship_p->target_shields_delta == 0.0f)
if (ship_p->target_shields_delta == 0.0f && weapon_left_percent > WEAPONS_EMERG_LEVEL_PERCENT)
transfer_energy_to_shields(obj);
} else if ( weapon_left_percent < WEAPONS_EMERG_LEVEL_PERCENT ) {
if ( shield_left_percent > SHIELDS_MIN_LEVEL_PERCENT || weapon_left_percent <= 0.01 ) // dampen ai enthusiasm for sucking energy to weapons
if (ship_p->target_weapon_energy_delta == 0.0f && shield_left_percent > SHIELDS_MIN_LEVEL_PERCENT) // dampen ai enthusiasm for sucking energy to weapons
transfer_energy_to_weapons(obj);
}
// check for return to normal values
if ( fl_abs( shield_left_percent - 0.5f ) < NORMAL_TOLERANCE_PERCENT ) {
if ( ship_p->shield_recharge_index > DEFAULT_CHARGE_INDEX )
decrease_recharge_rate(obj, SHIELDS);
else if ( ship_p->shield_recharge_index < DEFAULT_CHARGE_INDEX )
increase_recharge_rate(obj, SHIELDS);
}
}
if ( fl_abs( weapon_left_percent - 0.5f ) < NORMAL_TOLERANCE_PERCENT ) {
if ( ship_p->weapon_recharge_index > DEFAULT_CHARGE_INDEX )
decrease_recharge_rate(obj, WEAPONS);
else if ( ship_p->weapon_recharge_index < DEFAULT_CHARGE_INDEX )
increase_recharge_rate(obj, WEAPONS);
}
}
@@ -658,7 +832,7 @@ void set_default_recharge_rates(object* obj)
ship* ship_p = &Ships[obj->instance];
ship_info* ship_info_p = &Ship_info[ship_p->ship_info_index];
if ( ship_info_p->power_output == 0 )
if ( ship_info_p->full_power_output == 0 ) // _argv[-1] - ship might have 0 PO but some subsystems with some power output.
return;
ship_properties = 0;
+35 -9
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDshield.cpp $
* $Revision: 2.9 $
* $Date: 2003-09-13 08:27:29 $
* $Author: Goober5000 $
* $Revision: 2.9.2.1 $
* $Date: 2003-09-19 00:10:21 $
* $Author: argv $
*
* C file for the display and management of the HUD shield
*
* $Log: not supported by cvs2svn $
* Revision 2.9 2003/09/13 08:27:29 Goober5000
* added some minor things, such as code cleanup and the following:
* --turrets will not fire at cargo
* --MAX_SHIELD_SECTIONS substituted for the number 4 in many places
* --supercaps have their own default message bitfields (distinguished from capships)
* --turrets are allowed on fighters
* --jump speed capped at 65m/s, to avoid ship travelling too far
* --non-huge weapons now scale their damage, instead of arbitrarily cutting off
* ----Goober5000
*
* Revision 2.8 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
@@ -456,7 +466,8 @@ void hud_shield_show(object *objp)
// draw the four quadrants
//
// Draw shield quadrants at one of NUM_SHIELD_LEVELS
max_shield = sp->ship_initial_shield_strength/(1.0f*MAX_SHIELD_SECTIONS);
// _argv[-1] - singular shield.
max_shield = sp->ship_initial_shield_strength / (1.0f * (sip->flags2 & SIF2_SINGULAR_SHIELDS ? 1 : MAX_SHIELD_SECTIONS));
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
@@ -464,12 +475,16 @@ void hud_shield_show(object *objp)
break;
}
if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
if ( objp->shield_quadrant[sip->flags2 & SIF2_SINGULAR_SHIELDS ? 0 : Quadrant_xlate[i]] < 0.1f ) {
continue;
}
range = max(HUD_COLOR_ALPHA_MAX, HUD_color_alpha + 4);
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
if (!ship_is_shield_up(objp, sip->flags2 & SIF2_SINGULAR_SHIELDS ? 0 : Quadrant_xlate[i]))
// sometimes, this will draw something even with the shield down. this is not informative, so don't do that!
hud_color_index = 0;
else
hud_color_index = fl2i( (objp->shield_quadrant[sip->flags2 & SIF2_SINGULAR_SHIELDS ? 0 : Quadrant_xlate[i]] / max_shield) * range + 0.5);
Assert(hud_color_index >= 0 && hud_color_index <= range);
if ( hud_color_index < 0 ) {
@@ -561,6 +576,10 @@ void hud_shield_equalize(object *objp, player *pl)
return;
}
// _argv[-1] - singular shield.
if (Ship_info[Ships[objp->instance].ship_info_index].flags2 & SIF2_SINGULAR_SHIELDS)
return;
// are all quadrants equal?
for(idx=0; idx<MAX_SHIELD_SECTIONS-1; idx++){
if(objp->shield_quadrant[idx] != objp->shield_quadrant[idx+1]){
@@ -612,6 +631,10 @@ void hud_shield_equalize(object *objp, player *pl)
//
void hud_augment_shield_quadrant(object *objp, int direction)
{
// _argv[-1] - singular shield.
if (Ship_info[Ships[objp->instance].ship_info_index].flags2 & SIF2_SINGULAR_SHIELDS)
return;
float full_shields, xfer_amount, energy_avail, percent_to_take, delta;
float max_quadrant_val;
int i;
@@ -763,7 +786,8 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off
// draw the four quadrants
// Draw shield quadrants at one of NUM_SHIELD_LEVELS
max_shield = sp->ship_initial_shield_strength/(1.0f*MAX_SHIELD_SECTIONS);
// _argv[-1] - singular shield.
max_shield = sp->ship_initial_shield_strength / (1.0f * (sip->flags2 & SIF2_SINGULAR_SHIELDS ? 1 : MAX_SHIELD_SECTIONS));
for ( i = 0; i < MAX_SHIELD_SECTIONS; i++ ) {
@@ -771,7 +795,8 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off
break;
}
if ( objp->shield_quadrant[Quadrant_xlate[i]] < 0.1f ) {
// _argv[-1] - use ship_is_shield_up, to implicitly support singular shields.
if (!ship_is_shield_up(objp, Quadrant_xlate[i])) {
continue;
}
@@ -782,7 +807,8 @@ void hud_shield_show_mini(object *objp, int x_force, int y_force, int x_hull_off
}
range = HUD_color_alpha;
hud_color_index = fl2i( (objp->shield_quadrant[Quadrant_xlate[i]] / max_shield) * range + 0.5);
// _argv[-1] - singular shield again.
hud_color_index = fl2i( (objp->shield_quadrant[sip->flags2 & SIF2_SINGULAR_SHIELDS ? 0 : Quadrant_xlate[i]] / max_shield) * range + 0.5);
Assert(hud_color_index >= 0 && hud_color_index <= range);
if ( hud_color_index < 0 ) {
+8 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDshield.h $
* $Revision: 2.3 $
* $Date: 2003-09-13 06:02:05 $
* $Author: Goober5000 $
* $Revision: 2.3.2.1 $
* $Date: 2003-09-19 00:10:21 $
* $Author: argv $
*
* Header file for the display and management of the HUD shield
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.1 2003/01/06 17:14:52 Goober5000
* added wing configurable squad logos - put +Squad Logo: filename.pcx as
* the last entry in each wing that you want (but the player's squad logo will
@@ -80,7 +84,7 @@ typedef struct shield_hit_info
int shield_hit_next_flash[NUM_SHIELD_HIT_MEMBERS];
} shield_hit_info;
extern ubyte Quadrant_xlate[4];
extern ubyte Quadrant_xlate[MAX_SHIELD_SECTIONS];
struct player;
+18 -6
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDsquadmsg.h $
* $Revision: 2.4 $
* $Date: 2003-09-13 08:27:29 $
* $Author: Goober5000 $
* $Revision: 2.4.2.1 $
* $Date: 2003-09-19 00:15:26 $
* $Author: argv $
*
* header file for squadmate messaging
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2003/09/13 08:27:29 Goober5000
* added some minor things, such as code cleanup and the following:
* --turrets will not fire at cargo
* --MAX_SHIELD_SECTIONS substituted for the number 4 in many places
* --supercaps have their own default message bitfields (distinguished from capships)
* --turrets are allowed on fighters
* --jump speed capped at 65m/s, to avoid ship travelling too far
* --non-huge weapons now scale their damage, instead of arbitrarily cutting off
* ----Goober5000
*
* Revision 2.3 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
@@ -175,11 +185,13 @@
#define TRANSPORT_MESSAGES (ATTACK_TARGET_ITEM | CAPTURE_TARGET_ITEM | DEPART_ITEM )
#define FREIGHTER_MESSAGES TRANSPORT_MESSAGES // freighters can do the same things as transports
#define CRUISER_MESSAGES (ATTACK_TARGET_ITEM | DEPART_ITEM)
// _argv[-1] - big ship AI can do protect, and (super)cap ships have the same AI as cruisers.
// So let the player give any orders the AI can do if mission says so!
#define CRUISER_MESSAGES (ATTACK_TARGET_ITEM | DEPART_ITEM | PROTECT_TARGET_ITEM)
#define CAPITAL_MESSAGES (DEPART_ITEM) // can't order capitals to do much!!!!
#define CAPITAL_MESSAGES CRUISER_MESSAGES // can't order capitals to do much!!!!
#define SUPERCAP_MESSAGES (0) // supercaps ignore you :p
#define SUPERCAP_MESSAGES CRUISER_MESSAGES // supercaps ignore you :p
#define SUPPORT_MESSAGES (REARM_REPAIR_ME_ITEM | ABORT_REARM_REPAIR_ITEM | STAY_NEAR_ME_ITEM | STAY_NEAR_TARGET_ITEM | KEEP_SAFE_DIST_ITEM | DEPART_ITEM )
+34 -11
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDtarget.cpp $
* $Revision: 2.22 $
* $Date: 2003-09-13 06:02:05 $
* $Author: Goober5000 $
* $Revision: 2.22.2.1 $
* $Date: 2003-09-19 00:31:10 $
* $Author: argv $
*
* C module to provide HUD targeting functions
*
* $Log: not supported by cvs2svn $
* Revision 2.22 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.19 2003/09/09 05:51:14 Goober5000
* if player has primitive sensors, hud will not display shield icons or message sender brackets
* --Goober5000
@@ -329,6 +333,7 @@
#include "localization/localize.h"
#include "ship/awacs.h"
#include "hud/hudartillery.h"
#include "cmdline/cmdline.h" // _argv[-1] - some things here are command-line optional.
// If any of these bits in the ship->flags are set, ignore this ship when targetting
int TARGET_SHIP_IGNORE_FLAGS = (SF_EXPLODED|SF_DEPART_WARP|SF_DYING|SF_ARRIVING_STAGE_1|SF_HIDDEN_FROM_SENSORS);
@@ -1636,7 +1641,9 @@ void hud_target_common(int team, int next_flag)
target_found = TRUE;
set_target_objnum( Player_ai, OBJ_INDEX(A) );
// if ship is BIG|HUGE and last subsys is NULL, get turret
hud_maybe_set_sorted_turret_subsys(shipp);
// _argv[-1] - allow player to disable.
if (!Argv_options.no_auto_target_turret)
hud_maybe_set_sorted_turret_subsys(shipp);
hud_restore_subsystem_target(shipp);
}
} else {
@@ -1936,7 +1943,9 @@ void hud_target_newest_ship()
if (newest_obj) {
set_target_objnum( Player_ai, OBJ_INDEX(newest_obj) );
// if BIG|HUGE and no selected subsystem, get sorted turret
hud_maybe_set_sorted_turret_subsys(&Ships[newest_obj->instance]);
// _argv[-1] - allow player to disable.
if (!Argv_options.no_auto_target_turret)
hud_maybe_set_sorted_turret_subsys(&Ships[newest_obj->instance]);
hud_restore_subsystem_target(&Ships[newest_obj->instance]);
}
else {
@@ -2548,7 +2557,8 @@ int hud_target_closest(int team, int attacked_objnum, int play_fail_snd, int fil
// if former subobject was not a turret do, not change subsystem
ss = Ships[nearest_obj->instance].last_targeted_subobject[Player_num];
if (ss == NULL || get_closest_turret_attacking_player) {
// _argv[-1] - don't f with subsys targeting unnecessarily if player doesn't want that.
if ((ss == NULL && !(Argv_options.no_auto_target_turret)) || get_closest_turret_attacking_player) {
// set_targeted_subsys(Player_ai, nearest_turret_subsys, OBJ_INDEX(nearest_obj));
// update nearest turret with later func
hud_target_live_turret(1, 1, get_closest_turret_attacking_player);
@@ -2668,7 +2678,8 @@ void hud_target_targets_target()
// if we've reached here, found player target's target
set_target_objnum( Player_ai, tt_objnum );
if (Objects[tt_objnum].type == OBJ_SHIP) {
// _argv[-1] - allow player to disable.
if (Objects[tt_objnum].type == OBJ_SHIP && !Argv_options.no_auto_target_turret) {
hud_maybe_set_sorted_turret_subsys(&Ships[Objects[tt_objnum].instance]);
}
hud_restore_subsystem_target(&Ships[Objects[tt_objnum].instance]);
@@ -2855,7 +2866,9 @@ void hud_target_in_reticle_old()
set_target_objnum( Player_ai, OBJ_INDEX(target_obj) );
if ( target_obj->type == OBJ_SHIP ) {
// if BIG|HUGE, maybe set subsys to turret
hud_maybe_set_sorted_turret_subsys(&Ships[target_obj->instance]);
// _argv[-1] - allow player to disable this.
if (!Argv_options.no_auto_target_turret)
hud_maybe_set_sorted_turret_subsys(&Ships[target_obj->instance]);
hud_restore_subsystem_target(&Ships[target_obj->instance]);
}
}
@@ -4415,9 +4428,17 @@ void hud_cease_subsystem_targeting(int print_message)
void hud_cease_targeting()
{
set_target_objnum( Player_ai, -1 );
Players[Player_num].flags &= ~PLAYER_FLAGS_AUTO_TARGETING;
// _argv[-1] - allow 'target nothing' command to not disable auto targeting.
if ((Argv_options.no_implicit_disable_auto_target) && (Players[Player_num].flags & PLAYER_FLAGS_AUTO_TARGETING))
{
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR("Selecting new target", -1));
}
else
{
Players[Player_num].flags &= ~PLAYER_FLAGS_AUTO_TARGETING;
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Deactivating targeting system", 325));
}
hud_cease_subsystem_targeting(0);
HUD_sourced_printf(HUD_SOURCE_HIDDEN, XSTR( "Deactivating targeting system", 325));
hud_lock_reset();
}
@@ -5506,7 +5527,9 @@ void hud_target_next_list(int hostile, int next_flag)
set_target_objnum( Player_ai, OBJ_INDEX(nearest_obj) );
// maybe set new turret subsystem
hud_maybe_set_sorted_turret_subsys(&Ships[nearest_obj->instance]);
// _argv[-1] - allow player to disable.
if (!Argv_options.no_auto_target_turret)
hud_maybe_set_sorted_turret_subsys(&Ships[nearest_obj->instance]);
hud_restore_subsystem_target(&Ships[nearest_obj->instance]);
}
else {
+20 -5
View File
@@ -9,13 +9,23 @@
/*
* $Logfile: /Freespace2/code/Hud/HUDtargetbox.cpp $
* $Revision: 2.19 $
* $Date: 2003-09-13 08:27:29 $
* $Author: Goober5000 $
* $Revision: 2.19.2.1 $
* $Date: 2003-09-19 00:35:51 $
* $Author: argv $
*
* C module for drawing the target monitor box on the HUD
*
* $Log: not supported by cvs2svn $
* Revision 2.19 2003/09/13 08:27:29 Goober5000
* added some minor things, such as code cleanup and the following:
* --turrets will not fire at cargo
* --MAX_SHIELD_SECTIONS substituted for the number 4 in many places
* --supercaps have their own default message bitfields (distinguished from capships)
* --turrets are allowed on fighters
* --jump speed capped at 65m/s, to avoid ship travelling too far
* --non-huge weapons now scale their damage, instead of arbitrarily cutting off
* ----Goober5000
*
* Revision 2.18 2003/09/13 06:02:05 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
@@ -965,8 +975,11 @@ void get_turret_subsys_name(model_subsystem *system_info, char *outstr)
Assert(system_info->type == SUBSYSTEM_TURRET);
if (system_info->turret_weapon_type >= 0) {
// _argv[-1] - table specified HUD display name!
if (Weapon_info[system_info->turret_weapon_type].use_turret_display_name)
sprintf(outstr, "%s", Weapon_info[system_info->turret_weapon_type].turret_display_name);
// check if beam or flak using weapon flags
if (Weapon_info[system_info->turret_weapon_type].wi_flags & WIF_FLAK) {
else if (Weapon_info[system_info->turret_weapon_type].wi_flags & WIF_FLAK) {
sprintf(outstr, "%s", XSTR("Flak turret", 1566));
} else if (Weapon_info[system_info->turret_weapon_type].wi_flags & WIF_BEAM) {
sprintf(outstr, "%s", XSTR("Beam turret", 1567));
@@ -1111,7 +1124,9 @@ void hud_render_target_ship_info(object *target_objp)
// PRINT SUBSYS NAME
// hud_set_default_color();
// get turret subsys name
if (Player_ai->targeted_subsys->system_info->type == SUBSYSTEM_TURRET) {
if (Player_ai->targeted_subsys->system_info->use_display_name) // _argv[-1] - table specified display name!
sprintf(outstr, "%s", Player_ai->targeted_subsys->system_info->display_name);
else if (Player_ai->targeted_subsys->system_info->type == SUBSYSTEM_TURRET) {
get_turret_subsys_name(Player_ai->targeted_subsys->system_info, outstr);
} else {
sprintf(outstr, "%s", Player_ai->targeted_subsys->system_info->name);
+9 -4
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Io/KeyControl.cpp $
* $Revision: 2.16 $
* $Date: 2003-09-13 06:02:06 $
* $Author: Goober5000 $
* $Revision: 2.16.2.1 $
* $Date: 2003-09-19 00:42:13 $
* $Author: argv $
*
* Routines to read and deal with keyboard input.
*
* $Log: not supported by cvs2svn $
* Revision 2.16 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.14 2003/08/16 03:52:23 bobboau
* update for the specmapping code includeing
* suport for seperate specular levels on lights and
@@ -1077,7 +1081,8 @@ void process_debug_keys(int k)
do_subobj_hit_stuff(objp, Player_obj, &g_subobj_pos, (float) -Player_ai->targeted_subsys->system_info->type); //100.0f);
if ( sp->subsys_info[SUBSYSTEM_ENGINE].current_hits <= 0.0f ) {
// _argv[-1] - with the new energy system, this is done in hudets.cpp.
if ( !(sp->flags2 & SIF2_NEW_ENERGY_SYSTEM) && sp->subsys_info[SUBSYSTEM_ENGINE].current_hits <= 0.0f ) {
mission_log_add_entry(LOG_SHIP_DISABLED, sp->ship_name, NULL );
sp->flags |= SF_DISABLED; // add the disabled flag
}
+13 -6
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionGoals.cpp $
* $Revision: 2.4 $
* $Date: 2003-09-13 06:02:06 $
* $Author: Goober5000 $
* $Revision: 2.4.2.1 $
* $Date: 2003-09-19 00:49:11 $
* $Author: argv $
*
* Module for working with Mission goals
*
* $Log: not supported by cvs2svn $
* Revision 2.4 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.2 2003/03/18 10:07:03 unknownplayer
* The big DX/main line merge. This has been uploaded to the main CVS since I can't manage to get it to upload to the DX branch. Apologies to all who may be affected adversely, but I'll work to debug it as fast as I can.
*
@@ -1245,11 +1249,13 @@ void mission_process_event( int event )
Event_index = 0;
Mission_events[event].result = result;
// _argv[-1] - changed this so that a negative repeat count means repeat indefinitely.
// if the sexpression is known false, then no need to evaluate anymore
if ((sindex >= 0) && (Sexp_nodes[sindex].value == SEXP_KNOWN_FALSE)) {
Mission_events[event].timestamp = (int) Missiontime;
Mission_events[event].satisfied_time = Missiontime;
Mission_events[event].repeat_count = -1;
Mission_events[event].repeat_count = 0;
Mission_events[event].formula = -1;
return;
}
@@ -1263,8 +1269,9 @@ void mission_process_event( int event )
// decrement the repeat count. When at 0, don't eval this function anymore
if ( result || timestamp_valid(Mission_events[event].timestamp) ) {
Mission_events[event].repeat_count--;
if ( Mission_events[event].repeat_count <= 0 ) {
if (Mission_events[event].repeat_count > 0)
Mission_events[event].repeat_count--;
if ( Mission_events[event].repeat_count == 0 ) {
Mission_events[event].timestamp = (int)Missiontime;
Mission_events[event].formula = -1;
+30 -7
View File
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/Mission/MissionParse.cpp $
* $Revision: 2.43 $
* $Date: 2003-09-13 06:02:06 $
* $Author: Goober5000 $
* $Revision: 2.43.2.1 $
* $Date: 2003-09-19 00:55:33 $
* $Author: argv $
*
* main upper level code for parsing stuff
*
* $Log: not supported by cvs2svn $
* Revision 2.43 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.40 2003/09/06 20:41:52 wmcoolmon
* Added "+Subsystem Repair Ceiling:" after "+Hull Repair Ceiling:" (formerly "+Support Repair Ceiling:"
*
@@ -803,7 +807,8 @@ char *Parse_object_flags[MAX_PARSE_OBJECT_FLAGS] = {
char *Parse_object_flags_2[MAX_PARSE_OBJECT_FLAGS_2] = {
"primitive-sensors",
"no-subspace-drive"
"no-subspace-drive",
"beam-free-all" // _argv[-1] - implicit beam-free-all for this ship.
};
char *Starting_wing_names[MAX_STARTING_WINGS+1] = {
@@ -2045,6 +2050,20 @@ int parse_create_object(p_object *objp)
}
}
// _argv[-1] - free beams by default if appropriate.
// Goober5000 - ugh, made this readable
// _argv[-1] - this really should be rolled into the block above, but it doesn't really matter.
if (ptr->system_info->type == SUBSYSTEM_TURRET)
{
if ( (objp->flags2 & P2_SF2_BEAM_FREE_ALL)
|| (ptr->system_info->beam_free_by_default == 2)
|| (sip->flags2 & SIF2_BEAM_FREE_BY_DEFAULT && ptr->system_info->beam_free_by_default != 0) )
{
ptr->weapons.flags |= SW_FLAG_BEAM_FREE;
ptr->turret_next_fire_stamp = timestamp((int) frand_range(50.0f, 4000.0f));
}
}
if (!stricmp(ptr->system_info->subobj_name, sssp->name)) {
if (Fred_running) {
ptr->current_hits = sssp->percent;
@@ -2111,7 +2130,10 @@ int parse_create_object(p_object *objp)
// Ships[shipnum].hull_hit_points_taken = (float)objp->initial_hull * sip->max_hull_hit_points / 100.0f;
Objects[objnum].hull_strength = objp->initial_hull * Ships[shipnum].ship_initial_hull_strength / 100.0f;
for (i = 0; i<MAX_SHIELD_SECTIONS; i++)
Objects[objnum].shield_quadrant[i] = (float)(objp->initial_shields * Ships[shipnum].ship_initial_shield_strength / 100.0f) / MAX_SHIELD_SECTIONS;
{
// _argv[-1] - singular shield.
Objects[objnum].shield_quadrant[i] = (float)(objp->initial_shields * Ships[shipnum].ship_initial_shield_strength / 100.0f) / (sip->flags2 & SIF2_SINGULAR_SHIELDS ? 1 : MAX_SHIELD_SECTIONS);
}
// initial velocities now do not apply to ships which warp in after mission starts
if ( !(Game_mode & GM_IN_MISSION) ) {
@@ -3528,8 +3550,9 @@ void parse_event(mission *pm)
event->timestamp = timestamp(-1);
// sanity check on the repeat count variable
if ( event->repeat_count <= 0 ){
Error (LOCATION, "Repeat count for mission event %s is <=0.\nMust be >= 1!", event->name );
// _argv[-1] - negative repeat count is legal now (means repeat forever).
if ( event->repeat_count == 0 ){
Error (LOCATION, "Repeat count for mission event %s is 0.\nMust be != 0!", event->name );
}
}
+15 -4
View File
@@ -9,13 +9,23 @@
/*
* $Source: /cvs/cvsroot/fs2open/fs2_open/code/mission/missionparse.h,v $
* $Revision: 2.32 $
* $Author: Goober5000 $
* $Date: 2003-09-13 08:27:28 $
* $Revision: 2.32.2.1 $
* $Author: argv $
* $Date: 2003-09-19 00:57:06 $
*
* main header file for parsing code
*
* $Log: not supported by cvs2svn $
* Revision 2.32 2003/09/13 08:27:28 Goober5000
* added some minor things, such as code cleanup and the following:
* --turrets will not fire at cargo
* --MAX_SHIELD_SECTIONS substituted for the number 4 in many places
* --supercaps have their own default message bitfields (distinguished from capships)
* --turrets are allowed on fighters
* --jump speed capped at 65m/s, to avoid ship travelling too far
* --non-huge weapons now scale their damage, instead of arbitrarily cutting off
* ----Goober5000
*
* Revision 2.31 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
@@ -636,10 +646,11 @@ typedef struct p_object {
// 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 2
#define MAX_PARSE_OBJECT_FLAGS_2 3
#define P2_SF2_PRIMITIVE_SENSORS (1<<0)
#define P2_SF2_NO_SUBSPACE_DRIVE (1<<1)
#define P2_SF2_BEAM_FREE_ALL (1<<2) // _argv[-1] - implicit beam-free-all for this ship.
// and again: these flags do not appear in the array
//#define blah (1<<29)
@@ -9,11 +9,15 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionScreenCommon.cpp $
* $Revision: 2.3 $
* $Date: 2003-09-13 06:02:06 $
* $Author: Goober5000 $
* $Revision: 2.3.2.1 $
* $Date: 2003-09-19 00:58:49 $
* $Author: argv $
*
* $Log: not supported by cvs2svn $
* Revision 2.3 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.1 2002/08/01 01:41:07 penguin
* The big include file move
*
@@ -1321,6 +1325,10 @@ void wss_direct_restore_loadout()
return;
}
// _argv[-1] - don't restore on scramble missions.
if (The_mission.scramble)
return;
for ( i = 0; i < MAX_WING_BLOCKS; i++ ) {
if ( Starting_wings[i] < 0 )
@@ -9,13 +9,17 @@
/*
* $Logfile: /Freespace2/code/MissionUI/MissionWeaponChoice.cpp $
* $Revision: 2.17 $
* $Date: 2003-09-13 06:02:06 $
* $Author: Goober5000 $
* $Revision: 2.17.2.1 $
* $Date: 2003-09-19 01:02:51 $
* $Author: argv $
*
* C module for the weapon loadout screen
*
* $Log: not supported by cvs2svn $
* Revision 2.17 2003/09/13 06:02:06 Goober5000
* clean rollback of all of argv's stuff
* --Goober5000
*
* Revision 2.15 2003/08/16 03:52:24 bobboau
* update for the specmapping code includeing
* suport for seperate specular levels on lights and
@@ -3445,6 +3449,23 @@ int wl_update_ship_weapons(int objnum, wss_unit *slot )
}
}
// _argv[-1] - since the ship class can obviously get changed in loadout, we need to deal with beam free again.
// By 'again' I mean that it was already done in missionparse.cpp, but that only applies to the default ship!
ship *shipp = &Ships[Objects[objnum].instance];
ship_info *sip = &Ship_info[shipp->ship_info_index];
for (ship_subsys *ss = GET_FIRST(&shipp->subsys_list); ss != END_OF_LIST(&shipp->subsys_list); ss = GET_NEXT(ss)) {
if (ss->system_info->type != SUBSYSTEM_TURRET)
continue;
if (ss->system_info->beam_free_by_default == 0)
continue;
if (!(sip->flags2 & SIF2_BEAM_FREE_BY_DEFAULT) && ss->system_info->beam_free_by_default == 1)
continue;
ss->weapons.flags |= SW_FLAG_BEAM_FREE;
ss->turret_next_fire_stamp = timestamp((int) frand_range(50.0f, 4000.0f));
}
wl_bash_ship_weapons(&Ships[Objects[objnum].instance].weapons, slot);
return 0;
}