[Done] ThrustThing improvement

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

ThrustThing improvement

Post 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? ;)
User avatar
Cutmanmike
Posts: 11351
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

*hug*
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: ThrustThing improvement

Post 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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

So what about ThrustThingZ that violates this convention?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post 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! ;)
User avatar
MasterOFDeath
... in rememberance ...
Posts: 2024
Joined: Sat Apr 03, 2004 10:58 am

Post by MasterOFDeath »

Code: Select all

it->momy += arg2 * finesine[angle];
Heh, mommy.(Sorry, just had too. :P)
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

I'm pretty sure it's short for momentum y. :roll:
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Post 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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post 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
User avatar
Cutmanmike
Posts: 11351
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

Yes, now this could add some fun to my next platform map :twisted:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

... and now it would be possible to do the jumping key trick in one of the Doom64 maps!
User avatar
Cutmanmike
Posts: 11351
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

jumping key?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post by Graf Zahl »

Yes, a key that jumps away when the player approaches it. It's a really cool effect.
User avatar
Cutmanmike
Posts: 11351
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post 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.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49225
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Post 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.
Post Reply

Return to “Closed Bugs [GZDoom]”