This patch adds a way to change the time it takes for a ship's warp drive to engage. If used, it overrides the default 3.0s warpout delay for the player, and affects AI ships as well.
Index: ai/aicode.cpp
===================================================================
--- ai/aicode.cpp (revision 7940)
+++ ai/aicode.cpp (working copy)
@@ -12890,7 +12890,10 @@
aip->submode_start_time = Missiontime;
break;
case AIS_WARP_2: // Make sure won't collide with any object.
- if (timestamp_elapsed(aip->force_warp_time) || !collide_predict_large_ship(objp, objp->radius*2.0f + 100.0f)) {
+ if (timestamp_elapsed(aip->force_warp_time)
+ || (!collide_predict_large_ship(objp, objp->radius*2.0f + 100.0f)
+ || (Ship_info[shipp->ship_info_index].warpout_type == WT_HYPERSPACE
+ && !collide_predict_large_ship(objp, 100000.0f)))) {
aip->submode = AIS_WARP_3;
aip->submode_start_time = Missiontime;
@@ -12931,9 +12934,12 @@
}
break;
case AIS_WARP_4: {
- shipfx_warpout_start(objp);
- aip->submode = AIS_WARP_5;
- aip->submode_start_time = Missiontime;
+ // Only lets the ship warp after waiting for the warpout engage time
+ if ((Missiontime / 100) >= (aip->submode_start_time / 100 + Ship_info[shipp->ship_info_index].warpout_engage_time)) {
+ shipfx_warpout_start(objp);
+ aip->submode = AIS_WARP_5;
+ aip->submode_start_time = Missiontime;
+ }
break;
}
case AIS_WARP_5:
Index: playerman/playercontrol.cpp
===================================================================
--- playerman/playercontrol.cpp (revision 7940)
+++ playerman/playercontrol.cpp (working copy)
@@ -919,8 +919,16 @@
if ( Player->control_mode == PCM_WARPOUT_STAGE1 )
{
+ float warpout_delay;
+ ship_info *sip = &Ship_info[Ships[objp->instance].ship_info_index];
+
+ if (sip->warpout_engage_time >= 0)
+ warpout_delay = sip->warpout_engage_time / 1000.0f;
+ else
+ warpout_delay = MINIMUM_PLAYER_WARPOUT_TIME;
+
// Wait at least 3 seconds before making sure warp speed is set.
- if ( Warpout_time > MINIMUM_PLAYER_WARPOUT_TIME ) {
+ if ( Warpout_time > warpout_delay) {
// If we are going around 5% of the target speed, progress to next stage
float diffSpeed = objp->phys_info.fspeed;
if(target_warpout_speed != 0.0f) {
Index: ship/ship.cpp
===================================================================
--- ship/ship.cpp (revision 7940)
+++ ship/ship.cpp (working copy)
@@ -1943,6 +1943,17 @@
parse_sound("$Warpout Start Sound:", &sip->warpout_snd_start, sip->name);
parse_sound("$Warpout End Sound:", &sip->warpout_snd_end, sip->name);
+ if(optional_string("$Warpout engage time:"))
+ {
+ float t_time;
+ stuff_float(&t_time);
+ if (t_time >= 0)
+ sip->warpout_engage_time = fl2i(t_time*1000.0f);
+ else
+ Warning(LOCATION, "Warp-out engage time specified as 0 or less on ship '%s'; value ignored", sip->name);
+ } else
+ sip->warpout_engage_time = -1;
+
if(optional_string("$Warpout speed:"))
{
stuff_float(&sip->warpout_speed);
Index: ship/ship.h
===================================================================
--- ship/ship.h (revision 7940)
+++ ship/ship.h (working copy)
@@ -1168,6 +1168,7 @@
float warpout_radius;
int warpout_snd_start;
int warpout_snd_end;
+ int warpout_engage_time; //in ms
float warpout_speed;
int warpout_time; //in ms
float warpout_accel_exp;
Example tabling:
...
$Warpout type: Hyperspace
$Warpout engage time: 2.0 ;Two-second warpout delay
$Warpout time: 6.0
...
EDIT: Committed to trunk in r7980.