The Robotech MOD had wanted transformable Veritechs (or Valkyries for you Macross fans) but had problems getting it to work in FS2. A SEXP based method was developed and used, but when the source code was released we all realized that now it might be possible to make real transforming ships.
Ronin made a transforming Veritech system (POF switching) that worked both by SEXP and key binding, but what ships could transform and what they transformed into was pretty much hardcoded. His code was also developed from the original freespace2_public code rather then fs2_open.
I had proposed an idea and some untested code to help make a transformation system that was table based. At the time I didn't have MSVC++ 6 so couldn't make it myself and Ronin was too busy to get anywhere with it.
Now that I have MSVC++ 6 I decided to take my old table reading code, the source code Ronin released, and try to make something from them using fs2_open. Right now I've got table reading code working (though I plan to expand it a bit) and some utility functions in. I haven't started on the actual transformation code yet, since to use it I'll also have to make some way to trigger it.
(So far I've been testing my functions using gr_string() and having the results of various function calls printed on the player select screen.) An example table (which will become outdated as I plan to add a flag entry for each ship to store bigflag info) and function prototypes from my header file are below.
;;***********************************************
;; Transformation table
+Name: VF-1A Fighter
+Form1: VF-1A Guardian
+Form2:
+Form3:
#end
+Name: VF-1A Guardian
+Form1: VF-1A Fighter
+Form2:
+Form3:
#end
+Name: VF-1A Super Veritech Fighter
+Form1: VF-1A Super Veritech Guardian
+Form2: VF-1A Veritech Fighter
+Form3:
#end
+Name: VF-1A Super Veritech Guardian
+Form1: VF-1A Super Veritech Fighter
+Form2: VF-1A Veritech Guardian
+Form3:
#end
#done
struct transform_data;
void transform_data_clear();
void table_tf_test();
int can_transform(char *type_name);
char *tf_mode_check(char *type_name, int newmode);
char *ship_type_lookup(ship *Ship);
void parse_transformtbl();
void transform_init();
I'm intending 2 different transformation types: One that carries over weapon and damage info and one that resets that info. The first would be used for a ship changing to another form without any armor/weapon differences. The second could be used for a ship that's jettisoning an armor/weapons pack. (Like a Super Veritech/Valkyrie losing it's FAST pack.)
I've got a ways to go, but I've got Ronin's code available as a reference. (Some of it I'll likely be able to use without major changes, other parts are not applicable to this method.) Right now, each mode can have 3 other modes it can change into. If you examine the table above you'll see that you can have a ship with more then 4 total modes though. A VF-1 Super Veritech Fighter can transform into it's guardian mode, remove it's armor and become a VF-1A Fighter which has it's own guardian mode, and there are still open slots. (You could also make a ship that cycles through modes one by one, by just using Form1: and giving the name of the next mode.
For the above table to work, you would have to have a ships.tbl entry for each mode, which means you can give each one different characteristics which should change the handling when the ship transforms. The max number of transform.tbl entries is set to be the same as the max number of ship types. (Currently 130.) As I don't have CVS access yet and the code doesn't really do anything yet, this isn't in the CVS copy or any releases yet.
Backwards compatibility note: The way I've coded this, the transform.tbl is optional and if not present transformation would be disabled, you won't get an error message about a table error the way you would if ships.tbl was missing. You should still get error messages if the table entries aren't done right though. (I've yet to test that, but it should work.)
I have and will try to keep the table transformation related code in seperate files whenever possible.
So, what were you doing while the forums were down?
