Author Topic: WCS source code  (Read 13591 times)

0 Members and 1 Guest are viewing this topic.

Offline MatthTheGeek

  • Captain Obvious
  • 212
  • Frenchie McFrenchface
I regret nothing.
People are stupid, therefore anything popular is at best suspicious.

Mod management tools     -     Wiki stuff!     -     Help us help you

666maslo666: Releasing a finished product is not a good thing! It is a modern fad.

SpardaSon21: it seems like you exist in a permanent state of half-joking misanthropy

Axem: when you put it like that, i sound like an insane person

bigchunk1: it's not retarded it's american!
bigchunk1: ...

batwota: steele's maneuvering for the coup de gras
MatthTheGeek: you mispelled grâce
Awaesaar: grace
batwota: oh right :P
Darius: ah!
Darius: yes, i like that
MatthTheGeek: the way you just spelled it it means fat
Awaesaar: +accent I forgot how to keyboard
MatthTheGeek: or grease
Darius: the killing fat!
Axem: jabba does the coup de gras
MatthTheGeek: XD
Axem: bring me solo and a cookie

 

Offline Lorric

  • 212
Matt, this trolling of the WCS team you are delighting in puts the other negative things you've said about WCS into doubt for me.

Also the fact that while I tried to find it and cannot, I'm sure it was you who told me when I enquired about the fork that basically you put it as if they split for no apparant reason because they're stupid, when what was said here shows otherwise.

 

Offline Cyborg17

  • 29
  • Life? Don't talk to me about life....
For those too lazy to look it up, the split was r5919 (around 4100 commits ago), if it is really 3.6.12 RC1.

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Minecraft
    • Skype
    • Twitter
    • Headdie on Deviant Art
indeed i only see KK venting in that thread, nothing new for the interwebs, if more members or if like kara says a member like Tolywn (who I generally have fount in my limited interactions a cool guy) then I would belive there was a problem.

but at the same time, over the last couple of years when have we as a community proven to be the better people? I noticed several occasions around the time of DD's release where things were said here and I got the feeling it was because it was aimed at WCS that it was felt to be acceptable by some members that they were expressed in the way they were.
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline Mad Bomber

  • Booooom
  • 210
1) It's good to see the code getting reintegrated with FSO.

2) I really don't know the reasons behind the animosity; I've been semi-lurking for quite a while and it really threw me off to find out there was raw feelings on the matter. And it doesn't seem like there's a point to continuing the feud, or whatever it is, IMO... :sigh:
"What the hell!? I've got a Snuffleupagus on my scanners! The Snuffleupagus is active!"

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Minecraft
    • Skype
    • Twitter
    • Headdie on Deviant Art

2) I really don't know the reasons behind the animosity; I've been semi-lurking for quite a while and it really threw me off to find out there was raw feelings on the matter. And it doesn't seem like there's a point to continuing the feud, or whatever it is, IMO... :sigh:

yer its built over a number of years, some of it pre-dates prologue even.  hopefully the hatchet can be buried one day, but it would seem that today might not be that day :(
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
I've been doing a comparison between the wc_saga code versus r5919 (the release revision for FS2_open 3.6.12 R1, the probable fork point that the WC Saga team forked at) and from what I can tell, a lot of the "differences" between their code and FSO are code formatting:

FSO: anim/animplay.cpp:56
Code: [Select]
// -------------------------------------------------------------------------------------------------
// anim_render_all() will display the frames for the currently playing anims
//
void anim_render_all(int screen_id, float frametime)
{
anim_instance* A;
anim_instance* temp;

A = GET_FIRST(&anim_render_list);
while( A !=END_OF_LIST(&anim_render_list) ) {
temp = GET_NEXT(A);
if ( A->screen_id == screen_id ) {
if ( Anim_ignore_frametime ) {
frametime = 0.0f;
Anim_ignore_frametime=0;
}
if ( anim_show_next_frame(A, frametime) == -1 ) {
A->data = NULL;
anim_release_render_instance(A);
}
}
A = temp;
}
}


WCS:
Code: [Select]
// -------------------------------------------------------------------------------------------------
// anim_render_all() will display the frames for the currently playing anims
//
void anim_render_all(int screen_id, float frametime)
{
anim_instance* A;
anim_instance* temp;

A = GET_FIRST(&anim_render_list);
while (A != END_OF_LIST(&anim_render_list))
{
temp = GET_NEXT(A);
if (A->screen_id == screen_id)
{
if (Anim_ignore_frametime)
{
frametime = 0.0f;
Anim_ignore_frametime = 0;
}
if (anim_show_next_frame(A, frametime) == -1)
{
A->data = NULL;
anim_release_render_instance(A);
}
}
A = temp;
}
}

All I can say about that is  :nono:. I really wish they didn't do silly things like that. It really makes it difficult to tell the real differences from the quasi-differences! It's too bad that we can't use a tool like Semantic Merge to weed out "differences" like this one! I'm curious how many of the 593 different files  WinMerge found are either just formatting differences or mostly formatting differences.

In any event, I've attached a report in both html and csv containing all the different files between r5919 and WCS if anyone's curious.

[attachment deleted by an evil time traveler]

 

Offline niffiwan

  • 211
  • Eluder Class
Indeed, I think I've seen tabs converted to spaces, pointers from int *foo to int* foo, conversion to only Allman braces, etc.  As you say, hard to diff easily.

Some material differences that I have noted are:
1) multi-threaded OGG reader
2) keyboard detection

Both are strictly win32 only as they rely on the windows API.

There's a few other things as well, but they're lost in the sea of the other changes I made to get semi sane diffs for some of the files :)
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 The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
I spotted a shader management system that is pretty different from ours (whether it's better, I do not know; It's certainly a cleaner, more explicitly object oriented design).
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
We should be able to reduce the signal-to-noise ratio by doing a regex transform on the whole WCS tree to at least delete the extra newline added between angle brackets. I probably won't be able to do that tonight, though. Does someone else feel up to doing something like that and pushing it into a git branch?

 
I'd like to point out that Luke is currently working on his own improvements for Wing Commander Saga. They are also for the German translation project he and his team are working on.
If you're curious on what he has done, I recommend going to this topic on wcnews and read his post below:
http://www.wcnews.com/chatzone/threads/wc-saga-source-code-released.27158/
Audio Converter of Enigma Campaign 2666:
http://enigma.de.to/

German translator of WC: Hostile Frontier:
http://www.ciinet.org/kevin/wchf/

My Youtube Channel:
http://www.youtube.com/user/FekLeyrTarg?feature=mhee

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
I've started the tedious work of removing all the mere-formatting changes made to the codebase by the WCS team members so we can identify what substantive changes they've made to the codebase that we need to account for in some way or another. I'll get this posted to the github as soon as I have the time to jump through all the hoops involved in working with github via a Mercurial client (yes, you can do that without anyone knowing or, hopefully, caring). Until then, I'll post the patch here so SCP / WCS members can review progress.

A note to WCS coders: during this initial phase of the port, I / we (?) are focusing on identifying what functional changes have been made to the code base that are not part of SCP and thus need to be accounted for in some way. As such, my "reconciliation" efforts on formatting differences is simply to conform the formatting of WCS's codebase to that of SCP's code base as it looked like at r5919. Please bear in mind that this in no way is meant as a critical opinion of the cosmetic changes you made: it is simply a mechanism to filter out all the noise so we can all see what functional changes have been made to the SCP codebase so we can port them to SCP.

[attachment deleted by an evil time traveler]

 

Offline Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
Could use a hand with the format reconciliation
As I said in the previous post, I have started work on ironing out the cosmetic and formatting differences between the WCS source code and the SCP code base at r5919. This is definitely tedious work and I could use some help in making this happen. While this work is by no means glamorous, doing this work will enable us to identify what changes the WCS team made to the SCP code base and allow us to either (1) fold the changes that don't break retail into SCP directly or (2) find a roundabout way of allowing the WCS "mod" to vary from SCP in a one-off manner w/o needing a special executable to do so.


So, would anyone be interested in signing up?  ;7

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Well you can ignore the SEXP changes and anything that stems from them as I'm handling those anyway.


EDIT :

Here's a patch to add in the Was-destroyed-by-delay SEXP. The allow-dynamic-goals, and set-scannable SEXPs are basically useless as this functionality can already be called from the alter-ship-flag SEXP without all the bollocks that resulted in me writing the alter-ship-flag SEXP in the first place. The hide-ship-name SEXP's functionality can and has been added to alter-ship-flag SEXP in the patch.

Code: [Select]
Index: code/parse/sexp.cpp
===================================================================
--- code/parse/sexp.cpp (revision 10205)
+++ code/parse/sexp.cpp (working copy)
@@ -180,6 +180,7 @@
  //Objectives Category
  { "is-destroyed", OP_IS_DESTROYED, 1, INT_MAX, SEXP_BOOLEAN_OPERATOR, },
  { "is-destroyed-delay", OP_IS_DESTROYED_DELAY, 2, INT_MAX, SEXP_BOOLEAN_OPERATOR, },
+ { "was-destroyed-by-delay", OP_WAS_DESTROYED_BY_DELAY, 3, INT_MAX, SEXP_BOOLEAN_OPERATOR,  },
  { "is-subsystem-destroyed", OP_IS_SUBSYSTEM_DESTROYED, 2, 2, SEXP_BOOLEAN_OPERATOR, },
  { "is-subsystem-destroyed-delay", OP_IS_SUBSYSTEM_DESTROYED_DELAY, 3, 3, SEXP_BOOLEAN_OPERATOR, },
  { "is-disabled", OP_IS_DISABLED, 1, INT_MAX, SEXP_BOOLEAN_OPERATOR, },
@@ -5117,6 +5118,77 @@
  return SEXP_FALSE;
 }
 
+
+// First ship is the destroyer, rest of the arguments are the destroyed ships.
+int sexp_was_destroyed_by(int n, fix* latest_time)
+{
+ char* destroyer_ship_name;
+ char* destroyed_ship_name;
+ int count = 0, num_destroyed;
+ fix time;
+
+ Assert(n != -1);
+
+ destroyer_ship_name = CTEXT(n);
+
+ num_destroyed = 0;
+
+ for (n = CDR(n); n != -1; n = CDR(n))
+ {
+ count++;
+ destroyed_ship_name = CTEXT(n);
+
+ if (sexp_query_has_yet_to_arrive(destroyed_ship_name))
+ return SEXP_CANT_EVAL;
+
+ // check to see if this ship/wing has departed.  If so, then function is known false
+ if (mission_log_get_time(LOG_SHIP_DEPARTED, destroyed_ship_name, NULL, NULL))
+ return SEXP_KNOWN_FALSE;
+
+ // check the mission log.  If ship/wing not destroyed, immediately return SEXP_FALSE.
+ if (mission_log_get_time(LOG_SHIP_DESTROYED, destroyed_ship_name, destroyer_ship_name, &time))
+ {
+ num_destroyed++;
+ if (latest_time && (time > *latest_time))
+ *latest_time = time;
+ }
+ }
+
+ if (count == num_destroyed)
+ return SEXP_KNOWN_TRUE;
+ else
+ return SEXP_FALSE;
+}
+
+int sexp_was_destroyed_by_delay(int n)
+{
+ fix delay, time;
+ int val;
+
+ Assert(n >= 0);
+
+ time = 0;
+
+ delay = i2f(eval_num(n));
+
+ // check value of is_destroyed function.  KNOWN_FALSE should be returned immediately
+ val = sexp_was_destroyed_by(CDR(n), &time);
+ if (val == SEXP_KNOWN_FALSE)
+ return val;
+
+ if (val == SEXP_CANT_EVAL)
+ return SEXP_CANT_EVAL;
+
+ if (val)
+ {
+
+ if ((Missiontime - time) >= delay)
+ return SEXP_KNOWN_TRUE;
+ }
+
+ return SEXP_FALSE;
+}
+
 int sexp_is_subsystem_destroyed_delay(int n)
 {
  char *ship_name, *subsys_name;
@@ -22027,6 +22099,10 @@
  sexp_val = sexp_is_destroyed( node, NULL );
  break;
 
+ case OP_WAS_DESTROYED_BY_DELAY:
+ sexp_val = sexp_was_destroyed_by_delay(node);
+ break;
+
  case OP_IS_SUBSYSTEM_DESTROYED:
  sexp_val = sexp_is_subsystem_destroyed(node);
  break;
@@ -24452,6 +24528,7 @@
  case OP_HAS_ARRIVED:
  case OP_HAS_DEPARTED:
  case OP_IS_DESTROYED_DELAY:
+ case OP_WAS_DESTROYED_BY_DELAY:
  case OP_IS_SUBSYSTEM_DESTROYED_DELAY:
  case OP_IS_DISABLED_DELAY:
  case OP_IS_DISARMED_DELAY:
@@ -25318,6 +25395,12 @@
  else
  return OPF_SHIP_WING;
 
+ case OP_WAS_DESTROYED_BY_DELAY:
+ if (argnum == 0)
+ return OPF_POSITIVE;
+ else
+ return OPF_SHIP;
+
  case OP_IS_DESTROYED_DELAY:
  case OP_HAS_ARRIVED_DELAY:
  case OP_HAS_DEPARTED_DELAY:
@@ -29288,6 +29371,13 @@
  "\t1:\tTime delay in seconds (see above).\r\n"
  "\tRest:\tName of ship (or wing) to check status of." },
 
+ { OP_WAS_DESTROYED_BY_DELAY, "Was destroyed by delay (Boolean operator)\r\n"
+ "\tBecomes true <delay> seconds after all specified ships have been destroyed by the specified first ship.\r\n\r\n"
+ "Returns a boolean value.  Takes 3 or more arguments...\r\n"
+ "\t1:\tTime delay in seconds (see above).\r\n"
+ "\t2:\tShip that should have destroyed the other ships (see below).\r\n"
+ "\tRest:\tName of ships to check status of." },
+
  { OP_IS_SUBSYSTEM_DESTROYED_DELAY, "Is subsystem destroyed delay (Boolean operator)\r\n"
  "\tBecomes true <delay> seconds after the specified subsystem of the specified "
  "ship is destroyed.\r\n\r\n"
Index: code/parse/sexp.h
===================================================================
--- code/parse/sexp.h (revision 10205)
+++ code/parse/sexp.h (working copy)
@@ -286,6 +286,7 @@
 #define OP_PERCENT_SHIPS_DISABLED (0x000f | OP_CATEGORY_OBJECTIVE | OP_NONCAMPAIGN_FLAG) // Goober5000
 #define OP_PERCENT_SHIPS_ARRIVED (0x0010 | OP_CATEGORY_OBJECTIVE | OP_NONCAMPAIGN_FLAG) // FUBAR-BDHR
 #define OP_NAV_IS_VISITED (0x0011 | OP_CATEGORY_OBJECTIVE | OP_NONCAMPAIGN_FLAG) // Kazan
+#define OP_WAS_DESTROYED_BY_DELAY (0x0012 | OP_CATEGORY_OBJECTIVE | OP_NONCAMPAIGN_FLAG) // WCS
 
 #define OP_TIME_SHIP_DESTROYED (0x0000 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
 #define OP_TIME_SHIP_ARRIVED (0x0001 | OP_CATEGORY_TIME | OP_NONCAMPAIGN_FLAG)
@@ -382,7 +383,6 @@
 #define OP_IS_IN_MISSION (0x004d | OP_CATEGORY_STATUS | OP_NONCAMPAIGN_FLAG) // Goober5000
 
 
-
 // conditional sexpressions
 #define OP_WHEN (0x0000 | OP_CATEGORY_CONDITIONAL)
 #define OP_WHEN_ARGUMENT (0x0001 | OP_CATEGORY_CONDITIONAL) // Goober5000
Index: code/ship/ship.cpp
===================================================================
--- code/ship/ship.cpp (revision 10205)
+++ code/ship/ship.cpp (working copy)
@@ -361,6 +361,7 @@
 };
 
 // Constant for flag, Name of flag, In flags or flags2
+//  When adding new flags remember to bump MAX_SHIP_FLAG_NAMES in ship.h
 ship_flag_name Ship_flag_names[] = {
  {SF_VAPORIZE, "vaporize", 1, },
  {SF_WARP_BROKEN, "break-warp", 1, },
@@ -370,6 +371,7 @@
  {SF_HIDDEN_FROM_SENSORS, "hidden-from-sensors", 1, },
  {SF2_STEALTH, "stealth", 2, },
  {SF2_FRIENDLY_STEALTH_INVIS, "friendly-stealth-invisible", 2, },
+ {SF2_HIDE_SHIP_NAME, "hide-ship-name", 2, },
  {SF2_AFTERBURNER_LOCKED, "afterburners-locked", 2, },
  {SF2_PRIMARIES_LOCKED, "primaries-locked", 2, },
  {SF2_SECONDARIES_LOCKED, "secondaries-locked", 2, },
Index: code/ship/ship.h
===================================================================
--- code/ship/ship.h (revision 10205)
+++ code/ship/ship.h (working copy)
@@ -421,7 +421,7 @@
  int flag_list; // is this flag in the 1st or 2nd ship flags list?
 } ship_flag_name;
 
-#define MAX_SHIP_FLAG_NAMES 15
+#define MAX_SHIP_FLAG_NAMES 16
 extern ship_flag_name Ship_flag_names[];
 
 // states for the flags variable within the ship structure

What other SEXPs were added by the WCS team? Matth might be able to answer but from using X3N0-Life-Form re-engineered WCS code I've identified these SEXPs which I suspect we already have an alternative to

trigger-arrival-track
force-battle-music
set-forward-deceleration


About the only other SEXP which might be useful is their lock-controls SEXP. I remember in Diaspora we did the same thing using scripts and the ignore-key SEXP. So it's probably worth adding.

[attachment deleted by an evil time traveler]
« Last Edit: December 07, 2013, 04:11:06 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
Mastadon, I can help out with the sorting out the cosmetic and formatting differences (well, in between a few other things I've got in progress).  You seem to have started at A (for ai), so I'll start at W (for wxfred2) and work backwards.  I'll throw all my work into a branch on github.
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 Dragon

  • Citation needed
  • 212
  • The sky is the limit.
About the only other SEXP which might be useful is their lock-controls SEXP. I remember in Diaspora we did the same thing using scripts and the ignore-key SEXP. So it's probably worth adding.
Yeah, that would be nice. I was really disappointed we don't have such a SEXP when trying to do a Diaspora-style catapult launch. That would simplify the launch sequence somewhat, which is probably a good thing. Otherwise, there isn't really much in there that we don't already have. In WCSOpen thread I've already pointed out some table fields that were implemented by SCP independently, with a slightly different syntax and minor differences in functionality.

In fact, I was really interested in was increased gun/missile bank limit and whatever under-the-hood stuff they might've done. Seeing that there's less of the latter than I thought was a bit disappointing, TBH.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
The gun/missile bank limit change is the leading candidate for whatever broke multiplayer though. It probably also broke the loadout menu too but that code is a pile of **** and needs replacing anyway.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Yeah, I'm aware of that. It'd be nice to somehow go around this limitation, or preferably remove it altogether... Still, that would probably require a different approach than how WCS did it. Overall, this release was a bit of a disappointment. As it is now, it looks like the biggest influence of this code on FSO would be "lock-controls" SEXP for easy carrier launches. Perhaps the shader code will be good for something, but I don't know if this has any improvement potential over what we have now.

 

Offline niffiwan

  • 211
  • Eluder Class
Mastadon,

After running through code/weapon/beam.cpp (mostly) by hand, I've come to the conclusion that we need to format both wcsaga & FSO @ r5919.  I believe that the WCSaga guys used an automatic code formatter on the code, thus it's all consistent.  However, the FSO code is _not_ which makes it very laborious to return the WCSaga to the same state as FSO.  Therefore, I was going to propose running astyle over the two branches of the code, using the following options file:

Code: [Select]
# format reconciliation for WCSaga
--style=allman
--indent=tab
--align-pointer=name
--keep-one-line-statements
--keep-one-line-blocks
--lineend=linux
--pad-oper
--pad-paren
--pad-header
--convert-tabs
--indent-col1-comments
--suffix=none

The comparison can then be done with "git diff --ignore-space-change" which ends up with a fairly sane amount of output to manually reformat.

I was going to use these two branches for this:
https://github.com/niffiwan/wcsaga/tree/format_reconciliation
https://github.com/niffiwan/fs2open.github.com/tree/format_reconciliation

What do you think?
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 Mastadon

  • Contributes SCP patches and doesn't afraid of anything
  • 26
I tried running astyle against both source code trees and it gets rid of a great deal of the stylistic differences between the two code bases. That was a really good idea you had niffiwan!

There are two major stylistic differences that still need to be accounted for, though: cases where multi-dimensional arrays are not reformatted and, much more significantly, function calls / definitions are not formatted to be on a consistent number of lines chopped at a specific number of spaces (if chopped at all).

I'll toy around with the formatting options and see what I can figure out after I push what I have to github (only the wc_saga stuff, since I'm not an SCP-er and can't push to either of the FSO repos).
« Last Edit: December 10, 2013, 05:12:09 pm by Mastadon »