Author Topic: Capship death screams  (Read 2912 times)

0 Members and 1 Guest are viewing this topic.

Capship death screams
Could this be why capships don't use death screams even when assigned a persona and marking "always scream on death"?

Code: [Select]
// Don't play death scream unless a small ship.
if ( q->builtin_type == MESSAGE_WINGMAN_SCREAM ) {
int t = Ship_info[Ships[Message_shipnum].ship_info_index].flags;
int t2 = SIF_SMALL_SHIP;
int t3 = t & t2;
if (!t3) {
goto all_done;
}
}

Found in void message_queue_process(), missionmessage.cpp

If yes, would it break anything for this to also check for the flag "always scream on death" and if that one is said, it also works for non-small ships? That would take away the need for introducing
an additional flag to get the possibility for capships to have death screams.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Capship death screams
:wtf:

That is one of the strangest pieces of code I've seen in a long time. Why the hell are they declaring everything into ints they only use once?

Anyway, making it a straightforward check of either SIF_SMALL_SHIP or always scream should be fine. That flag is only set if someone has turned it on in FRED anyway.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Capship death screams
Ok, preparing a patch...

Here it is

[attachment has decomposed]
« Last Edit: June 19, 2009, 06:44:02 pm by KeldorKatarn »

  

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Capship death screams
Gotos make baby Jesus cry.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Capship death screams
Have to disagree with you there. In some cases goto can be the most sensible flow handler. The problem is that they are often abused resulting in rather rubbish code. Used sparingly and with a great deal of care there is still some use for goto.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Capship death screams
Well, I didn't put the goto in ;)

What do you say, can this patch be added to trunk? Would help Saga out, we wouldn't have to hack capship death screams in FRED anymore :)

 
Re: Capship death screams
Try doing this without gotos:
Code: [Select]
int parse()
{
    Token   tok;

reading:
    tok = gettoken();
    if (tok == END)
        return ACCEPT;
shifting:
    if (shift(tok))
        goto reading;
reducing:
    if (reduce(tok))
        goto shifting;
    return ERROR;
}

Source: http://david.tribble.com/text/goto.html
STRONGTEA. Why can't the x86 be sane?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Capship death screams
What do you say, can this patch be added to trunk?

I only came here to make sure I got your name correct on the log entry. :D

I edited the patch cause the way they had it (which you'd copied) was rather silly.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Mongoose

  • Rikki-Tikki-Tavi
  • Global Moderator
  • 212
  • This brain for rent.
    • Steam
    • Something
Re: Capship death screams
Have to disagree with you there. In some cases goto can be the most sensible flow handler. The problem is that they are often abused resulting in rather rubbish code. Used sparingly and with a great deal of care there is still some use for goto.
I'd still be wary of it. :p

 
Re: Capship death screams
What do you say, can this patch be added to trunk?

I only came here to make sure I got your name correct on the log entry. :D

I edited the patch cause the way they had it (which you'd copied) was rather silly.

Well I used the two temporary booleans to introduce some names that actually show what's going on. Kept the line shorter and made the if-clause easier to understand for someone
else. Doesn't matter if you got rid of them and put the statements right into the if however. As long as the functionality is there we're happy =)

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Capship death screams
Well the nice thing about ship flags is that they are pretty self explanatory anyway.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Capship death screams
True enough ;)