DieHard Wolfers Forum Index DieHard Wolfers
A Wolfenstein 3d Fan Community


  Hosted by: MCS & Areyep.com - Designed by: BrotherTank

Original Yahoo Forum - Die Hard Archives

AReyeP HomepageAreyep Homepage DieHard Wolfenstein BunkerDieHard Wolfenstein Bunker Log inLog in RegisterRegister Banlist FAQFAQ Search ForumsSearch

  Username:    Password:      Remember me       

"Jumping" enemies
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page BottomView Next Topic
Post new topicReply to topic
Author Message
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 582
Location: New Jersey, USA
usa.gif

PostPosted: Sat Apr 28, 2007 4:37 am
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I've noticed a phenomenon in some mods where guards will "shift", or do a "mini-transport" when they are chasing you. The prominent example that comes to mind is Ben Blaufarb's Operation:Panzerschiff, and it occurs when you are shooting guards in pusuit of you. At first, I attributed this to the coding Ben added to splatter blood when you shoot the guards.

However, my current project also suffers from this when the "real" Hitler emerges from the mecha-suit. The changes I made to the Hitler code: 1) removed the Slurpie sound from the hitlerdie3 statetype, 2) made the mechaHitler respond to sound (MCS tutorial). I didn't touch the hitlerchase statetypes.

What could cause this erratic behavior? And of course, how can this be fixed?

Note: This is NOT the "gliding guard" phenomenon mentioned (and solved) by Chris Chokan. I have applied his fix, but it does not affect my particular problem.

Andy
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Sat Apr 28, 2007 10:38 am
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

By chance, are you talking about the effect where Mechahitler dies and spawns the real Hitler and then sort of jumps back to where he spawned after walking a little?

_________________
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Jul 2019

Topics: 46
Posts: 2331
Location: USA
usa.gif

PostPosted: Sat Apr 28, 2007 10:49 am
   Subject: Re: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I think that's what he means and I've noticed it too. Something about the distance getting reset when it shouldn't, or something like that.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 582
Location: New Jersey, USA
usa.gif

PostPosted: Sat Apr 28, 2007 11:05 am
   Subject: Re: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dugtrio17 wrote:
By chance, are you talking about the effect where Mechahitler dies and spawns the real Hitler and then sort of jumps back to where he spawned after walking a little?


Yes, that's the one. I guess it's a known bug unrelated to anything I may have changed. Fixing it would be nice anyway! Very Happy

Does this also affect other guards or bosses in the original Wolfenstein?
MCS
Site Administrator
<B>Site Administrator</B>


Joined: 01 Mar 2003
Last Visit: 15 Jul 2013

Topics: 20
Posts: 243
Location: Amsterdam, the Netherlands
netherlands.gif

PostPosted: Sat Apr 28, 2007 11:13 am
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I couldn't imagine that it has something to do with the changes you made, so I just checked and the faulty behaviour shows in the original game as well.

You could try this cheap fix in the T_Chase function:

::: CODE :::
   //
      // fix position to account for round off during moving
      //
      if (ob->obclass != realhitlerobj)
      {

         ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;   
         ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;
      }


I also noticed that the "real" hitler sometimes just stops walking and starts moving stationary after a while, and I clearly remember that this quirk was in the original too... oh those memories Smile
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 582
Location: New Jersey, USA
usa.gif

PostPosted: Sat Apr 28, 2007 11:41 am
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Martin,

I applied your cheap fix, and now Hitler can walk through walls! Shocked
Sounds like an excellent feature for another mod perhaps, but not what I had in mind! Laughing
Hitler does not "jump around" anymore though.

MCS wrote:
I also noticed that the "real" hitler sometimes just stops walking and starts moving stationary after a while, and I clearly remember that this quirk was in the original too... oh those memories


Noticed this too, and it occurred again as I tested your fix.

Andy
MCS
Site Administrator
<B>Site Administrator</B>


Joined: 01 Mar 2003
Last Visit: 15 Jul 2013

Topics: 20
Posts: 243
Location: Amsterdam, the Netherlands
netherlands.gif

PostPosted: Sat Apr 28, 2007 12:29 pm
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Quote:
now Hitler can walk through walls!


Well I never... so that's were he went... Laughing

I'll investigate tomorrow, and I'll keep you informed, unless someone beats me to it
MCS
Site Administrator
<B>Site Administrator</B>


Joined: 01 Mar 2003
Last Visit: 15 Jul 2013

Topics: 20
Posts: 243
Location: Amsterdam, the Netherlands
netherlands.gif

PostPosted: Mon Apr 30, 2007 8:29 am
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK, here's what I've found so far.

To prevent the jumping, add the lines in red in KillActor function in WL_STATE.C:

::: CODE :::
void KillActor (objtype *ob)
{
   int   tilex,tiley;

   if (ob->obclass != mechahitlerobj)
   {
      tilex = ob->tilex = ob->x >> TILESHIFT;      // drop item on center
      tiley = ob->tiley = ob->y >> TILESHIFT;
   }


To prevent Hitler from getting stuck after a while, add the line in red in A_HitlerMorph function in WL_ACT2.C

::: CODE :::
void A_HitlerMorph (objtype *ob)
{
   unsigned   far *map,tile,hitpoints[4]={500,700,800,900};

   ob->flags &= ~FL_NONMARK;

   SpawnNewObj (ob->tilex,ob->tiley,&s_hitlerchase1);
   new->speed = SPDPATROL*5;


I played around with it for a little while and didn't notice any side effects. At least I didn't manage to get a rendez-vous with him within some obscure wall or something Smile

Let me know if it works for you. If so, this may be merged into the "bugs in original Wolf" thread I suppose.

BTW Same goes for the spectres in Spear of Destiny's final level.

_________________
-= Fortune awaits those who search =-
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 582
Location: New Jersey, USA
usa.gif

PostPosted: Mon Apr 30, 2007 12:11 pm
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Martin,

You da man! Cool

It works perfectly, no problems after about a dozen tests.

What was actually happening in each of these cases? To me it looks like the location where the mecha-corpse was dropped interfered with the newly-morphed Fuehrer, and the second one I can't even guess ... Embarassed


Andy
MCS
Site Administrator
<B>Site Administrator</B>


Joined: 01 Mar 2003
Last Visit: 15 Jul 2013

Topics: 20
Posts: 243
Location: Amsterdam, the Netherlands
netherlands.gif

PostPosted: Mon Apr 30, 2007 2:01 pm
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm not very good in explaining these things, but I'll give it a try...

Re the jumping:

When an actor gets killed, the coordinates are adjusted in KillActor in order to place dropped items such as guns, ammo and keys in the right position.

In the T_Chase function, there are some lines that adjust the coordinates as well, in order to "fix position to account for round off during moving" (in fact I'm talking about the two lines mentioned above in my "cheap fix", apparently I was looking in the right direction there but approached the matter from the wrong side)

Now the latter seems to reverse the effect of the former adjustment in KillActor. For "normal" guards and bosses this is no problem, as they get killed only once, and after being treated by KillActor they'll never see T_Chase again.

But things are different for both Hitler and the Spear spectres, seen they're going to both routines multiple times (in fact the Hitlers are the very same object that upon killing of the "mecha" type is connected to a different obclass and new statetype).
And it's here where the phenomenon pops up: first adjustment is applied, then they start moving and when the reversing occurs they'll pop back to their original spot. Upon subsequential calls for T_Chase things will return back to normal.

The fix posted above makes sure that the adjustment will be skipped for mechahitler, so the movement of the "real" one will not be affected.

Re the stopping movement:

Normally, the actorat value of a tile occupied by an actor is set to a value higher than zero, in order to prevent other actors from crossing that tile. After the movement from the actor to a different tile has been completed, the engine sets the value of the "from" tile back to zero in order to make it accessible again, UNLESS the FL_NONMARK flag for that actor has been set.

Again, KillActor comes into play here, since it sets the FL_NONMARK flag for every dead actor automatically. And again, no problem for normal enemies but a big one for respawned ones... Go figure, Hitler starts walking and starts blocking his own path until he's totally surrounded by his self-blocked squares and locked himself in completely... same story for the spectres...

The fix above will reset the FL_NONMARK flag before the mecha is transformed to the real one.

Phew, hope this makes any sense Andy... at least it was fun to investigate Smile

P.S. For the sake of completion, here's the corrected code for the spectres:

::: CODE :::
void A_Dormant (objtype *ob)
{
   long   deltax,deltay;
   int   xl,xh,yl,yh;
   int   x,y;
   objtype   *tile;

   deltax = ob->x - player->x;
   if (deltax < -MINACTORDIST || deltax > MINACTORDIST)
      goto moveok;
   deltay = ob->y - player->y;
   if (deltay < -MINACTORDIST || deltay > MINACTORDIST)
      goto moveok;

   return;
moveok:

   xl = (ob->x-MINDIST) >> TILESHIFT;
   xh = (ob->x+MINDIST) >> TILESHIFT;
   yl = (ob->y-MINDIST) >> TILESHIFT;
   yh = (ob->y+MINDIST) >> TILESHIFT;

   for (y=yl ; y<=yh ; y++)
      for (x=xl ; x<=xh ; x++)
      {
         tile = actorat[x][y];
         if (!tile)
            continue;
         if (tile && tile<objlist)
            return;
         if (((objtype *)tile)->flags&FL_SHOOTABLE)
            return;
      }

   ob->flags |= FL_AMBUSH | FL_SHOOTABLE;
   ob->flags &= ~FL_ATTACKMODE;
   ob->flags &= ~FL_NONMARK;
   ob->dir = nodir;

   ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;
   ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;


   NewState (ob,&s_spectrewait1);
}

Enjoy,
MCS.
Andy_Nonymous
Moderator
<B>Moderator</B>


Joined: 02 Apr 2003
Last Visit: 17 Feb 2015

Topics: 99
Posts: 582
Location: New Jersey, USA
usa.gif

PostPosted: Mon Apr 30, 2007 3:18 pm
   Subject: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Martin,

Your explanation makes perfect sense. Nice work, and this definitely belongs in the "bugs in original Wolf" thread. Thumbs Up

Andy
Aryan_Wolf3D
DieHard Guard
DieHard Guard


Joined: 21 Jul 2011
Last Visit: 19 Aug 2019

Topics: 6
Posts: 254

blank.gif

PostPosted: Wed Mar 13, 2019 11:25 am
   Subject: Re: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

In case anyone still cares about this old problem, I've found that a better fix is to simply remove the red parts of these lines:

::: CODE :::
      tilex = ob->tilex = ob->x >> TILESHIFT;      // drop item on center
      tiley = ob->tiley = ob->y >> TILESHIFT;

The actor's tile coordinates don't need to be updated when he dies, only the tile coordinates where the object is needed to be placed. This will also fix the bug mentioned here.

_________________
"Way too many #ifdefs in the code!" - John Carmack
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 16 Jul 2019

Topics: 56
Posts: 2234
Location: Canada
blank.gif

PostPosted: Wed Mar 13, 2019 12:25 pm
   Subject: Re: "Jumping" enemies
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Nice one AryanWolf3D! Awesome to figure out why the guard was sometimes leaving two spots on actorat too. Very Happy
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers View Previous TopicRefresh this PageAdd Topic to your Browser FavoritesSearch ForumsPrint this TopicE-mail TopicGoto Page TopView Next Topic
Page 1 of 1
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 11236 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Black & White Effect - Tutorial
Author: Guest
10 299 Thu Mar 17, 2005 6:24 pm
Dugtrio17 View latest post
No new posts [Info] Tricks - Dogs that shoot - Modifying Behaviour
Author: Guest
19 288 Sat Mar 20, 2004 7:31 am
Dugtrio17 View latest post
No new posts [Info] Making Guards Always Face You - Rotating guards
Author: CoolMario
3 88 Wed Jul 30, 2003 9:31 am
Codetech84 View latest post
No new posts [Info] Assigning Static Objects problem.
Author: Guest
1 104 Sun Jul 06, 2003 1:25 pm
Guest View latest post
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
   You cannot delete your posts in this forum
You cannot vote in polls in this forum


Copyright ©2003-2008 DieHard Wolfers
A Modified subBunker Theme by BrotherTank
Powered by phpBB © 2001, 2005 phpBB Group