Author Topic: Patches for Mantis 2478 & 2482  (Read 2237 times)

0 Members and 1 Guest are viewing this topic.

Offline niffiwan

  • 211
  • Eluder Class
Patches for Mantis 2478 & 2482
I've created some patches for two issues reported in Mantis - both concerning the Freespace2 campaign ending.  Some extra discussion can see seen in this thread in the support forum.

Let me know what you think. I haven't done much coding before (unless you count bash scripts!  :D)

Thanks

Mantis 2478

Code: [Select]
Index: freespace2/freespace.cpp
===================================================================
--- freespace2/freespace.cpp (revision 7491)
+++ freespace2/freespace.cpp (working copy)
@@ -5251,17 +5251,15 @@
  break;
 
  case GS_EVENT_DEBRIEF:
- // This IF block isn't needed because it's not part of the end-campaign logic.
- // The supernova code and end-campaign sexp handle it all. - G5K
- //
- // // did we end the campaign in the middle of a mission?
- // if (Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) /*&& !stricmp(Campaign.filename, "freespace2")*/) {
- // gameseq_post_event(GS_EVENT_END_CAMPAIGN);
- // } else {
- // gameseq_set_state(GS_STATE_DEBRIEF);
- // }
- //
- gameseq_set_state(GS_STATE_DEBRIEF);
+ // re-added code to get good ending cutscenes to play in main freespace2 campaign
+ // end-campaign sexp only triggered once to set Campaign_ended_in_mission
+ // never runs a 2nd time to set GS_EVENT_END_CAMPAIGN - niffiwan
+ // did we end the campaign in the middle of a mission?
+ if (Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) /*&& !stricmp(Campaign.filename, "freespace2")*/) {
+ gameseq_post_event(GS_EVENT_END_CAMPAIGN);
+ } else {
+ gameseq_set_state(GS_STATE_DEBRIEF);
+ }
 
  //Player_multi_died_check = -1;
  break;

Mantis 2482

Code: [Select]
Index: mission/missioncampaign.cpp
===================================================================
--- mission/missioncampaign.cpp (revision 7491)
+++ mission/missioncampaign.cpp (working copy)
@@ -1713,13 +1713,14 @@
  event_music_level_close();
  mission_goal_fail_incomplete();
  scoring_level_close();
- mission_campaign_mission_over();
 
  // play the movies
  // eventually we'll want to play one of two options (good ending or bad ending)
 
  // this is specific to the FreeSpace 2 single-player campaign
  if (!stricmp(Campaign.filename, "freespace2")) {
+ // set next mission to ensure freespace2 campaign ends properly - niffiwan
+ mission_campaign_eval_next_mission();
  // did the supernova blow?
  if (Supernova_status == SUPERNOVA_HIT) {
  movie_play_two("endpart1.mve", "endprt2b.mve"); // bad ending
@@ -1730,5 +1731,8 @@
  common_maybe_play_cutscene(MOVIE_END_CAMPAIGN);
  }
 
+ // save state post cutscenes to ensure Cutscenes_viewable is saved - niffiwan
+ mission_campaign_mission_over();
+
  gameseq_post_event( GS_EVENT_MAIN_MENU );
 }

[attachment deleted by ninja]
« Last Edit: August 20, 2011, 02:19:36 am by Zacam »
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Patches for Mantis 2478 & 2482
I'll try these out then. Thanks for the pilot file. It will help. :D

EDIT : I can't get either patch to apply, can you just attach the patch files?
« Last Edit: August 20, 2011, 01:38:05 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Patches for Mantis 2478 & 2482
How do I generate the patch files?  I could just redirect the output from "svn diff" into a file, but I suspect that's not what you are after.

BTW - I'm using svn via the command line here, not Tortoise SVN or similar.

EDIT: I just had an idea about applying the patches - I'm using antipodes 8 as the source, not trunk.  Should I regenerate the patches using trunk?
« Last Edit: August 20, 2011, 02:04:23 am by niffiwan »
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patches for Mantis 2478 & 2482
Yes.

Also, the problem is that these patches are probably not the best things for a beginning coder to try.  The reason is that solving this problem may require investigating the source control history.  This code functionality has been changed multiple times in the past by multiple people, several of them veteran coders.  So the solution is very likely to be not obvious.  If you find a seemingly obvious solution, there's a high probability that it was already tried and found not to work for some subtle reason.

 

Offline Zacam

  • Magnificent Bastard
  • Administrator
  • 211
  • I go Sledge-O-Matic on Spammers
    • Steam
    • Twitter
    • ModDB Feature
Re: Patches for Mantis 2478 & 2482

I updated the OP with a .patch file, and corrected the contents of the code boxes so that they'll apply cleaner. Just some minor variance in the offset numbers.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!
Talk with the community on Discord
"If you can keep a level head in all this confusion, you just don't understand the situation"

¤[D+¬>

[08/01 16:53:11] <sigtau> EveningTea: I have decided that I am a 32-bit registerkin.  Pronouns are eax, ebx, ecx, edx.
[08/01 16:53:31] <EveningTea> dhauidahh
[08/01 16:53:32] <EveningTea> sak
[08/01 16:53:40] * EveningTea froths at the mouth
[08/01 16:53:40] <sigtau> i broke him, boys

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Patches for Mantis 2478 & 2482
Here's the patch applied to trunk/fs2_open instead of branches/antipodes - using trunk I ran through a fairly quick test of both the good & bad endings, they both seem to work as expected.

Also, the problem is that these patches are probably not the best things for a beginning coder to try.  The reason is that solving this problem may require investigating the source control history.  This code functionality has been changed multiple times in the past by multiple people, several of them veteran coders.  So the solution is very likely to be not obvious.  If you find a seemingly obvious solution, there's a high probability that it was already tried and found not to work for some subtle reason.

Fair enough. I became interested in these issues was because they were bugs I'd experienced myself... do you have any suggestions as to which other bugs on Mantis would be easier to look at?  Or would trying to remove the large number of warnings thrown by gcc be a better place to start?

Code: [Select]
Index: mission/missioncampaign.cpp
===================================================================
--- mission/missioncampaign.cpp (revision 7493)
+++ mission/missioncampaign.cpp (working copy)
@@ -2505,13 +2505,14 @@
  event_music_level_close();
  mission_goal_fail_incomplete();
  scoring_level_close();
- mission_campaign_mission_over();
 
  // play the movies
  // eventually we'll want to play one of two options (good ending or bad ending)
 
  // this is specific to the FreeSpace 2 single-player campaign
  if (!stricmp(Campaign.filename, "freespace2")) {
+ // set next mission to ensure freespace2 campaign ends properly - niffiwan
+ mission_campaign_eval_next_mission();
  // did the supernova blow?
  if (Supernova_status == SUPERNOVA_HIT) {
  movie_play_two("endpart1.mve", "endprt2b.mve"); // bad ending
@@ -2525,6 +2526,8 @@
 #ifdef FS2_DEMO
  gameseq_post_event( GS_EVENT_END_DEMO );
 #else
+ // save state post cutscenes to ensure Cutscenes_viewable is saved - niffiwan
+ mission_campaign_mission_over();
  gameseq_post_event( GS_EVENT_MAIN_MENU );
 #endif
 }
Index: freespace2/freespace.cpp
===================================================================
--- freespace2/freespace.cpp (revision 7493)
+++ freespace2/freespace.cpp (working copy)
@@ -5463,17 +5463,15 @@
  break;
 
  case GS_EVENT_DEBRIEF:
- // This IF block isn't needed because it's not part of the end-campaign logic.
- // The supernova code and end-campaign sexp handle it all. - G5K
- //
- // // did we end the campaign in the middle of a mission?
- // if (Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) /*&& !stricmp(Campaign.filename, "freespace2")*/) {
- // gameseq_post_event(GS_EVENT_END_CAMPAIGN);
- // } else {
- // gameseq_set_state(GS_STATE_DEBRIEF);
- // }
- //
- gameseq_set_state(GS_STATE_DEBRIEF);
+ // re-added code to get good ending cutscenes to play in main freespace2 campaign
+ // end-campaign sexp only triggered once to set Campaign_ended_in_mission
+ // never runs a 2nd time to set GS_EVENT_END_CAMPAIGN - niffiwan
+ // did we end the campaign in the middle of a mission?
+ if (Campaign_ended_in_mission && (Game_mode & GM_CAMPAIGN_MODE) /*&& !stricmp(Campaign.filename, "freespace2")*/) {
+ gameseq_post_event(GS_EVENT_END_CAMPAIGN);
+ } else {
+ gameseq_set_state(GS_STATE_DEBRIEF);
+ }
 
  //Player_multi_died_check = -1;
  break;

EDIT: attached the correct patch file

[attachment deleted by ninja]
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Patches for Mantis 2478 & 2482
Fair enough. I became interested in these issues was because they were bugs I'd experienced myself... do you have any suggestions as to which other bugs on Mantis would be easier to look at?  Or would trying to remove the large number of warnings thrown by gcc be a better place to start?
Removing warnings is always a good thing.  As for bugs, probably the best thing to do would be to pick a couple at random and take a look at them.  If you think you know how to investigate it, try it; if not, move on to another one.  There are quite a few bugs currently in Mantis that are either simple or straightforward, but people just haven't had time to sit down and study them yet.

Here are a few that I can suggest, just by looking at the descriptions:
http://scp.indiegames.us/mantis/view.php?id=2475
http://scp.indiegames.us/mantis/view.php?id=2470
http://scp.indiegames.us/mantis/view.php?id=2477
http://scp.indiegames.us/mantis/view.php?id=2468
http://scp.indiegames.us/mantis/view.php?id=2467

Those look pretty simple, and those will get you started.  There are quite a few other simple ones if you finish with those and want more.  In fact, we might even give you SCP access. ;)

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Patches for Mantis 2478 & 2482
Thanks for the suggestions, I'll take a look & see what I can do  :D
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

  

Offline Echelon9

  • 210
Re: Patches for Mantis 2478 & 2482
Thanks for the suggestions, I'll take a look & see what I can do  :D
Great to hear niffiwan. We always appreciate coders interested in bug fixing.