Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: EdrickV on May 12, 2002, 03:11:06 am

Title: is_tagged fixed!
Post by: EdrickV on May 12, 2002, 03:11:06 am
I made a simple two line fix for the is_tagged SEXP. The source code changes are shown below. :cool:

Code: [Select]

Where: Code\Parse\SEXP.cpp, sexp_is_tagged() function.
The original code:

if(Ships[sindex].tag_left > 0.0f)
return 1;

The fixed code:

object *caller = &Objects[Ships[sindex].objnum];
if(ship_is_tagged(caller)) // This line and the one above were added.
// if(Ships[sindex].tag_left > 0.0f) The broken code. Changed by EdrickV@HLP
return 1;


The ship_is_tagged() function call is the same one used by the HUD code. The line above that which gets object* info from a ship object was borrowed from the sexp_special_warp_dist() function in the same file. (That being the first ship->object conversion I found.)
Vrodic, feel free to put this into your CVS copy. :)
Title: is_tagged fixed!
Post by: EdrickV on May 12, 2002, 03:13:37 am
Oh, and if you're wondering why I fixed this when has-been-tagged-delay already works, this doesn't do the same thing. This is true while the ship is tagged then goes false when the tag wears off. has-been-tagged-delay is true once a ship has been tagged. Period. It doesn't go back to false, except maybe when the ship departs or is destroyed. With this you could see if the player tags a ship multiple times. (Using chains.) And who knows what else.
Title: is_tagged fixed!
Post by: CP5670 on May 12, 2002, 11:19:39 am
This might be useful for some of those special missions; good work. :)
Title: is_tagged fixed!
Post by: EdrickV on May 12, 2002, 12:16:56 pm
It was surprisingly easy to do. Makes me wonder why :v: didn't do it. Maybe they didn't know it was broken? Or maybe they didn't care or just didn't think of using the HUD code. (My original idea was to dig into the HUD code and find where it tells if a ship is tagged or not. I expected code in there like the code that was in the sexp. But that function call was better and now I know how to get object* data from a ship struct object so it was a learning experience too. :) Now I should work on making my basic config program, so I can control my FS2X.exe's config.
Title: is_tagged fixed!
Post by: DTP on May 13, 2002, 12:14:12 am
The way V did it makes perfect sense. It is you who are asking the wrong Question.

The right Question is.

Is the ship tagged at this very moment with an active TAG missile?

and not

Has the ship been tagged at all?.

you should use a Variable that is set to 1 in FRED2, once the ship has been tagged,instead of rewriting the SEXP, maybe corrupting backward compatibility with the missions written in the past.:wink:
Title: is_tagged fixed!
Post by: EdrickV on May 13, 2002, 01:38:20 am
Quote
Originally posted by DTP
The way V did it makes perfect sense. It is you who are asking the wrong Question.

The right Question is.

Is the ship tagged at this very moment with an active TAG missile?

and not

Has the ship been tagged at all?.

you should use a Variable that is set to 1 in FRED2, once the ship has been tagged,instead of rewriting the SEXP, maybe corrupting backward compatibility with the missions written in the past.:wink:  


You're thinking of the wrong SEXP. has-been-tagged-delay is the one that does "has the ship been tagged at all" the one I fixed (which did not work) is is_tagged. The way is_tagged should have worked is to return true while the ship is tagged.
But the :v: code doesn't work. They probably changed the ship or tag code and broke is_tagged but didn't notice because they didn't use it. They didn't use has-been-tagged-delay either. They did use turret-tagged-only. (In SM02-02.fs2, grep is handy at times like these.)
I didn't touch has-been-tagged-delay since it works, though it doesn't do what some might want it to. Once it's true it stays true.
On the other hand, is_tagged goes back to being false when the tag wears off. I have a mission I have used it in to prove it. That mission won't work with the :v: exe, but with the modified exe it works fine.
And I just tested it again with both exes. (Right before I got kicked off by AOL for the second time while writing this dang post.)

Edit: Forgot the link to the Most Useless SEXP thread where I initially learned about is_tagged which I hadn't tried using before: http://www.hard-light.net/forums/index.php/topic,6242.0.html
Title: is_tagged fixed!
Post by: DTP on May 14, 2002, 06:13:00 pm
now i cant recall the mission name or filename, but;

I seem to remember that I tagged some fighters with the dummy TAG A in the nebula, in that test TAG A dumb fire missile mission.

And the minute i did that the Fighter got pulverized by AAA´s, flak, missiles.

EDIT-seems i misunderstood something about the tagged events.

Will be testing something.

Title: is_tagged fixed!
Post by: EdrickV on May 14, 2002, 06:44:08 pm
Quote
Originally posted by DTP
now i cant recall the mission name or filename, but;

I seem to remember that I tagged some fighters with the dummy TAG A in the nebula, in that test TAG A dumb fire missile mission.

And the minute i did that the Fighter got pulverized by AAA´s, flak, missiles.

EDIT-seems i misunderstood something about the tagged events.
Will be testing something.
 


It's SM2-02.fs2, and it uses turret-tagged-only which doesn't do what I'd thought it did. (I had wondered about the same thing myself, but grep doesn't lie. :) )

turret-tagged-only
   Makes turrets target and hence fire strictly at tagged objects
   1: Ship name
   NOTE: Will not stop a turret already firing at an untagged ship
Title: is_tagged fixed!
Post by: DTP on May 14, 2002, 06:52:01 pm
yeah, i just figured out the same thing.

Tested an freindly Deimos, a hostile fighter and a Hostile Cruiser.

Non of them jumped out when they where hit by a tag A missile, what they should have, according to events.

nice Fix, I will build it into my Version if you dont mind. When i get the time i will write everything down what I have done so far of fixes and so, and make it public.

EDIT:He i Forgot, I wonder who made that broken code was it by any chance AL?. the same dude who where / is  responsible for the NEXT BANK WITH AMMO INHERITS EMPTY BANK FIRE_WAIT TIME.
Title: is_tagged fixed!
Post by: EdrickV on May 14, 2002, 07:05:30 pm
I'm not quite sure, but it looks like Dave may have done that code. And it looks like it may have worked. I'm not entirely sure why it doesn't.
Title: is_tagged fixed!
Post by: Solatar on November 18, 2002, 04:41:11 pm
I know this is kind of digging up an old thread, but could somebody compile a version of fs2_open3.3 with this feature? You won't believe how useful it will be in a few of my missions. PLEASE!!!

Whoever does it can have a TVWP avatar, and can be a tester (access to all the latest TVWP stuff, WAY before anybody else gets it)

EDIT: A little OT - If somebody can compile this, can anybody put in the little piece of code that fixes the weapon techdatabase crashes thing?
Title: is_tagged fixed!
Post by: Inquisitor on November 18, 2002, 05:03:42 pm
Sticky-ing till we find a volunteer :)
Title: is_tagged fixed!
Post by: EdrickV on November 18, 2002, 05:06:59 pm
Dang, I thought this would be in fs2_open by now. DTP, or anyone else with CVS write access, you're welcome to put this into fs2_open 'cause looking at the sexp.cpp file through the CVS browser shows that it's not in there for revision 2.3. :)
Title: is_tagged fixed!
Post by: Solatar on November 18, 2002, 05:12:16 pm
Quote
Originally posted by Inquisitor
Sticky-ing till we find a volunteer :)


Thanks a lot!
Title: is_tagged fixed!
Post by: Sesquipedalian on November 18, 2002, 05:25:29 pm
Send me the files, EdrickV.  I'll put them in. :)
While we're at it, did you (or anyone) ever get a working end-mission sexp?
Title: is_tagged fixed!
Post by: Solatar on November 18, 2002, 05:29:12 pm
I think somebody did, anyway, Goober5000 really wants one for the Unification War also. Thanks Sesquipedalian.
Title: is_tagged fixed!
Post by: Inquisitor on November 18, 2002, 05:32:02 pm
Thanks Sesqui :)
Title: is_tagged fixed!
Post by: EdrickV on November 18, 2002, 05:51:51 pm
I think the following code would work to actually end a mission, but I don't have the tools to make a SEXP for it to test it:
Code: [Select]

// we have a special debriefing screen for multiplayer furballs
if((Game_mode & GM_MULTIPLAYER) && (The_mission.game_type & MISSION_TYPE_MULTI_DOGFIGHT)){
gameseq_post_event( GS_EVENT_MULTI_DOGFIGHT_DEBRIEF);
}
// do the normal debriefing for all other situations
else {
gameseq_post_event(GS_EVENT_DEBRIEF);
}


That code is, IIRC, run when the player's ship has finished it's warpout animation so it ought to work.
Title: is_tagged fixed!
Post by: Solatar on November 18, 2002, 07:13:09 pm
For the end-missin sexp, I will use it like so:
Player faces fighterbay of target ship, once he/she is inside (No_collide_invisible tag will be on all carriers) the fighterbay, the player presses Alt-J, and then the mission ends. No warpout, no charge-up.
Title: is_tagged fixed!
Post by: EdrickV on November 18, 2002, 07:39:24 pm
You only need no_collide_invisible if you're using a ship that has a hangarbay with an invisible wall. (Like the Orion.) If you're making your own ships, just don't put invisible walls in the hangar. And you can do almost everything you want now without source changes. (Everything except the no-charge up sound.)
Title: is_tagged fixed!
Post by: Goober5000 on November 18, 2002, 08:05:17 pm
I assumed so.  And the charge-up sound can be removed by setting the appropriate entry in sounds.tbl to Empty.  The problem is, the HUD displays "subspace drive activated", which is out of place if your fighter doesn't have a drive.  And even if there's no activation sound, there's still that pause before the fighter exits.

Is it possible to measure the distance from a fighterbay?  I realize that you can set waypoints in FRED, but that doesn't work if the carrier is moving.
Title: is_tagged fixed!
Post by: Solatar on November 18, 2002, 08:12:15 pm
I meant by no charge-up as no wait time, and no sound.
Title: is_tagged fixed!
Post by: Goober5000 on November 18, 2002, 08:17:22 pm
I know.  You can set Alpha 1 to have no warp-out effect in FRED, you can remove the warp-out sound in sounds.tbl, but you can't remove the warp-out wait time except with an end-mission sexp.
Title: is_tagged fixed!
Post by: Sesquipedalian on November 18, 2002, 08:17:36 pm
Added the is-tagged fix.
Title: is_tagged fixed!
Post by: Solatar on November 19, 2002, 05:49:34 am
Where can we download it?
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 01:08:41 pm
The fix would be in the CVS source code. If you want to use it, you'll need to wait for a release or compile it yourself. And the latter requires MSVC++ 6.0.
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 01:45:52 pm
How can I download all the newest files in one chunk?  It appears that the only thing I can do with the CVS is download each file individually.
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 01:56:37 pm
If you mean download all the files in one zip file kinda thing, it doesn't work that way. But if you follow the instructions on the warpcore site it should download all the files one by one.
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 02:03:37 pm
Arg - there's like 50 separate files in the fs2 project!  It'll take ages! :(
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 02:19:28 pm
50? There are 647 .cpp and .h files in the original release. But most of the files are small and, being text files, you should get really high transfer rates. Downloading them shouldn't take too long. (Maybe about 20 minutes on 56k, I think.)
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 02:26:04 pm
Yikes - I didn't look in all the folders.

I'm at college, so I have a T3 - transfer rate is not a problem.  But I don't want to click on the file, right-click on Download, and click Save 647 times!  I want some way of either downloading all the files at once or automating the download, and I don't see a way to do that.

EDIT: Okay, the site really needs better directions.  It looks like you can download the CVS.zip file from the main page, then run the program it contains which will batch download for you.  But that isn't at all clear from the main page. :mad:

EDIT2: It DOESN'T WORK.  See my next post. :mad: :mad2:
Title: is_tagged fixed!
Post by: Solatar on November 19, 2002, 02:53:37 pm
I was trying to get somebody to compile it for me, because I don't have anythign to compile it with, but I guess I'll just wait for the next release, which measn FREDing for the TVWP will be postponed until then.
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 02:57:38 pm
I could compile it, but I can't download the stupid thing.  I was able to figure out that I could download in bulk with CVS, but now the stupid program says it can't find the directory :mad: :mad: :mad:

Quote
C:\temp>cvs -d:pserver:[email protected]:/home/fs2source/cvsroot login
Logging in to :pserver:[email protected]:2401/home/fs2source/cvsroot
CVS password:
CVS.EXE [login aborted]: could not find out home directory
Title: is_tagged fixed!
Post by: Solatar on November 19, 2002, 03:01:50 pm
That stinks. Maybe I can try to download it, then put it all in a .zip.
Title: is_tagged fixed!
Post by: DTP on November 19, 2002, 06:00:15 pm
-crap :) sleepy me, wrong button
Title: is_tagged fixed!
Post by: Inquisitor on November 19, 2002, 06:08:06 pm
Follow the instructions in the CVS thread to "checkout" a copy.

Use anonymous as the username/password.

I am gonna get a "weekly tarball" or something for people to grab so they can compile. Only so much time in the day :)
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 06:54:35 pm
Thanks Inquisitor.  That was the most number of hoops I've ever had to jump through for a program. :)

Why doesn't the command-line CVS work?

"weekly tarball" :lol: - that sounds funny :)
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 07:43:06 pm
Quote
Originally posted by Goober5000
Why doesn't the command-line CVS work?


The Cygwin one works fine. *shrug*
Title: is_tagged fixed!
Post by: Inquisitor on November 19, 2002, 09:25:20 pm
Last I checked, command line CVS DOES work ;)
Title: is_tagged fixed!
Post by: Goober5000 on November 19, 2002, 09:45:19 pm
Eh, for me it kept on saying "could not find out home directory".  The command-line program I used was downloaded from the zip file at http://fs2source.warpcore.org.  Is it a buggy version that was never updated? :confused:
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 10:13:19 pm
That program doesn't seem to work right using the commands on the Warpcore site, not entirely sure why, and the batch file is screwy and will go into an endless loop if you try to use -download. (There appears to be a limit on label size so download1 and download2 appear identical to the parser.)
Title: is_tagged fixed!
Post by: Inquisitor on November 19, 2002, 10:15:38 pm
I'll delet all those and start over.

BASIC CVS should work, as should WinCVS.
Title: is_tagged fixed!
Post by: EdrickV on November 19, 2002, 10:24:23 pm
Ok, I found something else out: That CVS exe is designed to be run from Cygwin, that's why it's complaining about not finding a home directory. (AKA the Unix style user's home folder.) It also seems to use /'s rather then \'s so won't work right from a DOS box.
Title: is_tagged fixed!
Post by: Sesquipedalian on November 20, 2002, 03:13:04 am
WinCVS.  Works like a dream.
Title: is_tagged fixed!
Post by: Goober5000 on November 20, 2002, 03:02:11 pm
Okay, I finally got the thing downloaded and loaded up in MSVC6.0.  Huge daunting mess of code...

I hit Rebuild All and the thing started chugging away, but then I got a bunch of errors...

Quote
Deleting intermediate files and output files for project 'code - Win32 Debug'.
Deleting intermediate files and output files for project 'Freespace2 - Win32 Debug'.
--------------------Configuration: code - Win32 Debug--------------------
Compiling...
\fs2_open\code\debugconsole\timerbar.cpp(82) : warning C4127: conditional expression is constant
\fs2_open\code\io\swff_lib.cpp(367) : warning C4100: 'lpvRef' : unreferenced formal parameter
\fs2_open\code\Model\ModelInterp.cpp(2672) : warning C4189: 'shipp' : local variable is initialized but not referenced
\fs2_open\code\Parse\SEXP.CPP(6791) : error C2143: syntax error : missing ';' before 'return'
\fs2_open\code\Parse\SEXP.CPP(6792) : error C2143: syntax error : missing ';' before '}'
\fs2_open\code\Parse\SEXP.CPP(6792) : error C2143: syntax error : missing ';' before '}'
\fs2_open\code\Parse\SEXP.CPP(6792) : error C2143: syntax error : missing ';' before '}'
\fs2_open\code\Parse\SEXP.CPP(6795) : error C2143: syntax error : missing ';' before '{'
\fs2_open\code\Parse\SEXP.CPP(6795) : error C2447: missing function header (old-style formal list?)
\fs2_open\code\Parse\SEXP.CPP(7967) : error C2065: 'sexp_num_kills' : undeclared identifier
\fs2_open\code\Network\Psnet2.cpp(2622) : warning C4101: 'ret' : unreferenced local variable
Error executing cl.exe.

fs2_open_debug.exe - 7 error(s), 4 warning(s)


I assume you guys know about these.  Are they bugs in the code, or am I using the wrong configuration?  I'm nervous about those "undeclared" and "unreferenced" messages...:nervous:
Title: is_tagged fixed!
Post by: DTP on November 20, 2002, 03:09:27 pm
Quote
Originally posted by Goober5000
Okay, I finally got the thing downloaded and loaded up in MSVC6.0.  Huge daunting mess of code...

I hit Rebuild All and the thing started chugging away, but then I got a bunch of errors...



I assume you guys know about these.  Are they bugs in the code, or am I using the wrong configuration?  I'm nervous about those "undeclared" and "unreferenced" messages...:nervous:


edit: looking into it, seems SEXP is broken. looking into it.

ignore the warnings regarding timerbar, and lvp*** something

unrefenrenced means it is being setup to be used, but never used. in other words, not a bug, but bad habits from some programmers.

but it seems someone forgot a keyword seperator, the ";" sign, that can really goof up things.

edit2

error identified

someone forgot a {

at line 6785 in SEXP.cpp

if(ship_is_tagged(caller))

that should be

if(ship_is_tagged(caller)) {

Fixed, and commiting now, Goober5000, you need to down SEXP.cpp again, or in other words checkout from wincvs or whatever cvs program you use.

thx for the report.
Title: is_tagged fixed!
Post by: Sesquipedalian on November 20, 2002, 08:58:43 pm
Oops.  I guess that was me.  Maybe I made a mistake in copying and pasting from EdrickV.  I guess if I had a compiler I'd be able to test these things.  Sorry. :)
Title: is_tagged fixed!
Post by: EdrickV on November 20, 2002, 09:39:22 pm
You didn't miss a {, you added a }. To explain I'll show you the code I actually used in my version (I'd moved the comment out of the function after I originally posted) followed by your version. :)

Code: [Select]

object *caller = &Objects[Ships[sindex].objnum];
if(ship_is_tagged(caller))
return 1;
// not tagged
return 0;


Code: [Select]

object *caller = &Objects[Ships[sindex].objnum];
if(ship_is_tagged(caller)) { // This line and the one above were added.
// if(Ships[sindex].tag_left> 0.0f) The broken code. Changed by EdrickV@HLP
         return 1;
}
// not tagged
return 0;


One line if()'s don't need {}'s, the commented code makes it look like there's more to it though. :)
Title: is_tagged fixed!
Post by: Goober5000 on November 20, 2002, 10:24:48 pm
Quote
Originally posted by DTP
thx for the report.


You're welcome.  Thanks for the fix. :)