Page 1 of 1

ThrustThing improvement

Posted: Sat Jan 15, 2005 8:30 am
by Graf Zahl
http://forum.zdoom.org/viewtopic.php?t=4885


Anti-credits for Randy? No, that must not be so here's a remedy:

Code: Select all

FUNC(LS_ThrustThing)
// ThrustThing (angle, force, nolimit, tid)
{
	if (arg3!=0)
	{
		AActor * victim;

		angle_t angle = BYTEANGLE(arg0) >> ANGLETOFINESHIFT;

		FActorIterator iterator (arg3);

		while ( (victim = iterator.Next ()) )
		{
			victim->momx += arg1 * finecosine[angle];
			victim->momy += arg1 * finesine[angle];
			if (!arg2)
			{
				victim->momx = clamp<fixed_t> (victim->momx, -MAXMOVE, MAXMOVE);
				victim->momy = clamp<fixed_t> (victim->momy, -MAXMOVE, MAXMOVE);
			}
		}
		return true;
	}
	else if (it)
	{
		angle_t angle = BYTEANGLE(arg0) >> ANGLETOFINESHIFT;

		it->momx += arg1 * finecosine[angle];
		it->momy += arg1 * finesine[angle];
		if (!arg2)
		{
			it->momx = clamp<fixed_t> (it->momx, -MAXMOVE, MAXMOVE);
			it->momy = clamp<fixed_t> (it->momy, -MAXMOVE, MAXMOVE);
		}
		return true;
	}
	return false;
}
Yes, the parameter ordering is less than optimal but this really doesn't necessitate a new line special, does it? ;)

Posted: Sat Jan 15, 2005 8:49 am
by Cutmanmike
*hug*

Re: ThrustThing improvement

Posted: Sat Jan 15, 2005 9:31 pm
by randi
Graf Zahl wrote:Yes, the parameter ordering is less than optimal but this really doesn't necessitate a new line special, does it? ;)
I think it should, just to keep in line with the naming convention. Specials that start with Thing_ take a TID as a parameter. Specials that end with Thing instead are applied to the activator.

Posted: Sun Jan 16, 2005 3:37 am
by Graf Zahl
So what about ThrustThingZ that violates this convention?

Posted: Sun Jan 16, 2005 3:43 am
by Graf Zahl
Is this better?

Code: Select all

FUNC(LS_Thing_Thrust)
// Thing_Thrust (tid, angle, force)
{
   if (arg0!=0)
   {
      AActor * victim;

      angle_t angle = BYTEANGLE(arg1) >> ANGLETOFINESHIFT;

      FActorIterator iterator (arg0);

      while ( (victim = iterator.Next ()) )
      {
         victim->momx += arg2 * finecosine[angle];
         victim->momy += arg2 * finesine[angle];
      }
      return true;
   }
   else if (it)
   {
      angle_t angle = BYTEANGLE(arg1) >> ANGLETOFINESHIFT;

      it->momx += arg2 * finecosine[angle];
      it->momy += arg2 * finesine[angle];
      return true;
   }
   return false;
} 
At least it has the advantage of not having to support that nolimit compatibility parameter! ;)

Posted: Sun Jan 16, 2005 7:09 pm
by MasterOFDeath

Code: Select all

it->momy += arg2 * finesine[angle];
Heh, mommy.(Sorry, just had too. :P)

Posted: Mon Jan 17, 2005 7:28 pm
by HotWax
I'm pretty sure it's short for momentum y. :roll:

Posted: Wed Jan 26, 2005 7:46 pm
by randi
Graf Zahl wrote:So what about ThrustThingZ that violates this convention?
That wasn't me! Carnevil did it, so blame him! O-)

To keep it congruent with ThrustThingZ, I'll add the TID parameter to the end of ThrustThing.

Posted: Wed Jan 26, 2005 8:14 pm
by Graf Zahl
randy wrote:
Graf Zahl wrote:So what about ThrustThingZ that violates this convention?
That wasn't me! Carnevil did it, so blame him! O-)

I'd rather blame Raven for not doing it right in the first place! :P

Posted: Thu Jan 27, 2005 8:31 am
by Cutmanmike
Yes, now this could add some fun to my next platform map :twisted:

Posted: Thu Jan 27, 2005 9:32 am
by Graf Zahl
... and now it would be possible to do the jumping key trick in one of the Doom64 maps!

Posted: Thu Jan 27, 2005 1:42 pm
by Cutmanmike
jumping key?

Posted: Thu Jan 27, 2005 3:14 pm
by Graf Zahl
Yes, a key that jumps away when the player approaches it. It's a really cool effect.

Posted: Fri Jan 28, 2005 4:41 am
by Cutmanmike
I can't say i've seen that. Doom64 had some of the most annoying, confusing maps in the history of doom. But at least it had a new last boss.

Posted: Fri Jan 28, 2005 5:14 am
by Graf Zahl
In the Doom64 TC it's the yellow key in the southern part of MAP25. If you approach it it jumps up the ledge.