Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: zookeeper on October 24, 2011, 06:55:09 am

Title: Patch [committed]: mod-wide disable of the warp camera
Post by: zookeeper on October 24, 2011, 06:55:09 am
The warp camera being the external camera which shows your ship warp out. This is an extremely simple patch adding an optional ai_profiles flag to disable it.

Making it an ai_profiles flag might sound odd, but the reasons for this are:

It's a useful option to have, because overriding the warp camera while retaining the HUD on-screen is either impossible or really messy even using scripting.

Code: [Select]
Index: ai/ai_profiles.cpp
===================================================================
--- ai/ai_profiles.cpp (revision 7892)
+++ ai/ai_profiles.cpp (working copy)
@@ -462,6 +462,8 @@
  Default_ship_select_effect = 0;
  }
 
+ set_flag(profile, "$no warp camera:", AIPF2_NO_WARP_CAMERA, AIP_FLAG2);
+
  // if we've been through once already and are at the same place, force a move
  if ( saved_Mp && (saved_Mp == Mp) )
  {
Index: ai/ai_profiles.h
===================================================================
--- ai/ai_profiles.h (revision 7892)
+++ ai/ai_profiles.h (working copy)
@@ -61,6 +61,7 @@
 #define AIPF2_ALLOW_PRIMARY_LINK_DELAY (1 << 7)
 #define AIPF2_BEAMS_DAMAGE_WEAPONS (1 << 8)
 #define AIPF2_PLAYER_WEAPON_SCALE_FIX (1 << 9)
+#define AIPF2_NO_WARP_CAMERA (1 << 10)
 
 // AI Path types
 #define AI_PATH_MODE_NORMAL 0
Index: freespace2/freespace.cpp
===================================================================
--- freespace2/freespace.cpp (revision 7892)
+++ freespace2/freespace.cpp (working copy)
@@ -5394,10 +5394,12 @@
  mprintf(( "Hit target speed.  Starting warp effect and moving to stage 2!\n" ));
  shipfx_warpout_start( Player_obj );
  Player->control_mode = PCM_WARPOUT_STAGE2;
- Player->saved_viewer_mode = Viewer_mode;
- Viewer_mode |= VM_WARP_CHASE;
-
- Warp_camera = warp_camera(Player_obj);
+
+ if (!(The_mission.ai_profile->flags2 & AIPF2_NO_WARP_CAMERA)) {
+ Player->saved_viewer_mode = Viewer_mode;
+ Viewer_mode |= VM_WARP_CHASE;
+ Warp_camera = warp_camera(Player_obj);
+ }
  }
  break;
 

Of course, if there's a strong sentiment that it should really be a SEXP, then I can make it one.

EDIT: Committed to trunk in r7982.
Title: Re: Patch: mod-wide disable of the warp camera
Post by: karajorma on October 24, 2011, 07:08:10 am
This should actually be in the "yet to be coded by anyone" mod.tbl not AI_Profiles for exactly the reason you mention. :p
Title: Re: Patch: mod-wide disable of the warp camera
Post by: Dragon on October 24, 2011, 07:23:26 am
Isn't AIProfiles essentially a mod.tbl? It houses all mod-specific flags and everything that fits in "miscellaneous changes" category.
Title: Re: Patch: mod-wide disable of the warp camera
Post by: mjn.mixael on October 24, 2011, 08:22:30 am
Yup, that's what ai_profiles has become because no one seems interested in creating the mod.tbl
Title: Re: Patch: mod-wide disable of the warp camera
Post by: Iss Mneur on October 24, 2011, 01:06:10 pm
Yup, that's what ai_profiles has become because no one seems interested in creating the mod.tbl
I'm interested, I just haven't gotten to it yet.  In the meantime ai_profiles suffices.
Title: Re: Patch: mod-wide disable of the warp camera
Post by: karajorma on October 24, 2011, 09:42:38 pm
Isn't AIProfiles essentially a mod.tbl? It houses all mod-specific flags and everything that fits in "miscellaneous changes" category.

Mod.tbl should be "Set it and forget it." With AI_Profiles you must remember to copy everything to the next profile should you decide to have more than one.