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       

Making PacMan ghosts open doors?
Page 1 of 1
DieHard Wolfers Forum Index -> SDL 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
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 01 May 2018

Topics: 64
Posts: 566

blank.gif

PostPosted: Sun Jun 26, 2016 11:18 pm
   Subject: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

For whatever reason, the PacMan ghosts in my SDL mod are not opening doors. How could I change the code so that the ghosts open doors and also continually chase the player down once alerted, like a regular enemy? For whatever reason, it doesn't seem like this was an issue in the DOS version. Last time I used PacMan Ghosts for anything were the spiders in Armageddon and they did open doors.

I tried this in wl_act2.cpp under the T_Ghosts section, but it didn't seem to work.

while (move)
{
if (ob->distance < 0)
{
//
// waiting for a door to open
//
OpenDoor (-ob->distance-1);
if (doorobjlist[-ob->distance-1].action != dr_open)
return;
ob->distance = TILEGLOBAL; // go ahead, the door is now opoen
DEMOIF_SDL
{
TryWalk(ob);
}
}

if (move < ob->distance) ...
gerolf
DieHard Wolfer
DieHard Wolfer


Joined: 28 Jan 2010
Last Visit: 20 Jun 2018

Topics: 162
Posts: 1083
Location: Alabama
usa.gif

PostPosted: Sun Jun 26, 2016 11:23 pm
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I wonder if the code to make the hitler ghost open doors would work with the PacMan ghost?

_________________
Military
DieHard SS
DieHard SS


Joined: 10 Oct 2015
Last Visit: 19 May 2018

Topics: 21
Posts: 303

blank.gif

PostPosted: Mon Jun 27, 2016 2:43 am
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Somehow I distinctly remember pacman ghosts opening doors in an old Wolfenstein version.
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 01 May 2018

Topics: 64
Posts: 566

blank.gif

PostPosted: Mon Jun 27, 2016 7:48 am
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Military wrote:
Somehow I distinctly remember pacman ghosts opening doors in an old Wolfenstein version.


Yeah they did. When I used the spiders in "Armageddon" they did open doors. I distinctly remember testing to make sure they did.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 18 Jul 2018

Topics: 55
Posts: 2135
Location: Canada
blank.gif

PostPosted: Mon Jun 27, 2016 8:51 am
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Hi Barry, looks like you found a bug! Very Happy I think you got the first part right. In T_Ghosts of wl_act2.cpp:

::: CODE :::
void T_Ghosts (objtype *ob)
{
    int32_t move;

    if (ob->dir == nodir)
    {
        SelectChaseDir (ob);
        if (ob->dir == nodir)
            return;                                                 // object is blocked in
    }

    move = ob->speed*tics;

    while (move)
    {
        if (ob->distance < 0)
        {
            //
            // waiting for a door to open
            //
            OpenDoor (-ob->distance-1);
            if (doorobjlist[-ob->distance-1].action != dr_open)
                return;
            ob->distance = TILEGLOBAL;      // go ahead, the door is now open
            DEMOIF_SDL
            {
                TryWalk(ob);
            }
        }


        if (move < ob->distance)
        {
            MoveObj (ob,move);
            break;
        }

Then open wl_state.cpp and try this in the TryWalk() function:

::: CODE :::
        switch (ob->dir)
        {
            case north:
                if (ob->obclass == dogobj || ob->obclass == fakeobj
//                  || ob->obclass == ghostobj
                    || ob->obclass == spectreobj)
                {
                    CHECKDIAG(ob->tilex,ob->tiley-1);
                }
                else
                {
                    CHECKSIDE(ob->tilex,ob->tiley-1);
                }
                ob->tiley--;
                break;

            case northeast:
                CHECKDIAG(ob->tilex+1,ob->tiley-1);
                CHECKDIAG(ob->tilex+1,ob->tiley);
                CHECKDIAG(ob->tilex,ob->tiley-1);
                ob->tilex++;
                ob->tiley--;
                break;

            case east:
                if (ob->obclass == dogobj || ob->obclass == fakeobj
//                  || ob->obclass == ghostobj
                    || ob->obclass == spectreobj)
                {
                    CHECKDIAG(ob->tilex+1,ob->tiley);
                }
                else
                {
                    CHECKSIDE(ob->tilex+1,ob->tiley);
                }
                ob->tilex++;
                break;

            case southeast:
                CHECKDIAG(ob->tilex+1,ob->tiley+1);
                CHECKDIAG(ob->tilex+1,ob->tiley);
                CHECKDIAG(ob->tilex,ob->tiley+1);
                ob->tilex++;
                ob->tiley++;
                break;

            case south:
                if (ob->obclass == dogobj || ob->obclass == fakeobj
//                  || ob->obclass == ghostobj
                    || ob->obclass == spectreobj)
                {
                    CHECKDIAG(ob->tilex,ob->tiley+1);
                }
                else
                {
                    CHECKSIDE(ob->tilex,ob->tiley+1);
                }
                ob->tiley++;
                break;

            case southwest:
                CHECKDIAG(ob->tilex-1,ob->tiley+1);
                CHECKDIAG(ob->tilex-1,ob->tiley);
                CHECKDIAG(ob->tilex,ob->tiley+1);
                ob->tilex--;
                ob->tiley++;
                break;

            case west:
                if (ob->obclass == dogobj || ob->obclass == fakeobj
//                  || ob->obclass == ghostobj
                    || ob->obclass == spectreobj)
                {
                    CHECKDIAG(ob->tilex-1,ob->tiley);
                }
                else
                {
                    CHECKSIDE(ob->tilex-1,ob->tiley);
                }
                ob->tilex--;
                break;

            case northwest:
                CHECKDIAG(ob->tilex-1,ob->tiley-1);
                CHECKDIAG(ob->tilex-1,ob->tiley);
                CHECKDIAG(ob->tilex,ob->tiley-1);
                ob->tilex--;
                ob->tiley--;
                break;

            case nodir:
                return false;

            default:
                Quit ("Walk: Bad dir");
        }
    }

Let me know if that helps.



edit: Here's another way to do it, so that the ghosts will just plow right through the doors as they're opening (closer to DOS).

Add the TryWalk change above in pink (but not the T_Ghosts one), then in wl_state.cpp add this:

::: CODE :::
#ifdef PLAYDEMOLIKEORIGINAL
    #define DOORCHECK                                   \
            if(DEMOCOND_ORIG)                           \
                doornum = temp&63;                      \
            else                                        \
            {                                           \
                doornum = (int) temp & 127;             \
                if (ob->obclass != ghostobj)            \
                {                                       \

                OpenDoor(doornum);                      \
                ob->distance = -doornum - 1;            \
                return true;                            \
                }                                       \

            }
#else

Now at the bottom of the TryWalk() function, remove the "DEMOCOND_ORIG &&" part so it looks like this:

::: CODE :::
#ifdef PLAYDEMOLIKEORIGINAL
    if (doornum != -1)

    {
        OpenDoor(doornum);
        ob->distance = -doornum-1;
        return true;
    }
#endif

    ob->areanumber =
        *(mapsegs[0] + (ob->tiley<<mapshift)+ob->tilex) - AREATILE;

    ob->distance = TILEGLOBAL;
    return true;
}
Barry
DieHard Officer
DieHard Officer


Joined: 27 Aug 2008
Last Visit: 01 May 2018

Topics: 64
Posts: 566

blank.gif

PostPosted: Mon Jun 27, 2016 6:12 pm
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

^^^ Works perfectly. Thanks!

_________________
Atomprojekt Download: http://www.wolfenvault.com/files/barry/ATOM.3.zip
Passage to Hollenteufel Download: http://www.wolfenvault.com/files/barry/PTH.2.zip
gerolf
DieHard Wolfer
DieHard Wolfer


Joined: 28 Jan 2010
Last Visit: 20 Jun 2018

Topics: 162
Posts: 1083
Location: Alabama
usa.gif

PostPosted: Tue Jun 28, 2016 11:17 am
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How come they used to be able to open doors? Or have they always been able to?

_________________
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:49 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Tue Jun 28, 2016 2:44 pm
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

They've always been able to. I remember experiencing that in E6L10, and when I was making an E3L10 map.
stathmk
DieHard SS
DieHard SS


Joined: 21 Oct 2009
Last Visit: 26 Jun 2018

Topics: 83
Posts: 433
Location: Indiana, United States
usa.gif

PostPosted: Sat Jul 02, 2016 7:29 am
   Subject: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If you like Pac-Man, then the Pac-Man 256 game is now freeware:
http://www.grunge.com/11357/best-free-play-games-non-dollars/
https://www.youtube.com/watch?v=uHIEuST3AUM

You have the option of having the level 256 glitch. It reminds me that maybe Chris should make an "All This And Wolf 3D Level 69" style Pac-Man level!?!?
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:49 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat Jul 02, 2016 9:55 am
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT -

stathmk wrote:
I literally dreamed of playing a very simliar Pac-man game. The graphics were more comparable to the first Pac-man arcade game, rather than the 3-D flipping of flat images you see in Pac-man 256. The CEDX mode in Pac-man 256 is the closest mode resembling the dream version of the game.
Matthew
DieHard SS
DieHard SS


Joined: 02 Jul 2007
Last Visit: 13 Jun 2018

Topics: 93
Posts: 467

usa.gif

PostPosted: Wed Aug 03, 2016 10:29 pm
   Subject: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

In the original Wolf3D, ghosts can open doors. There is also a bug that causes ghosts to instantly jump into doors when they start to open them. This occurs because "TryWalk" sets "ob->distance" to "-doornum-1" whenever the actor opens a door, but "T_Ghosts" doesn't take this into account:

::: CODE :::
/*
==================================
=
= TryWalk
=
= Attempts to move ob in its current (ob->dir) direction.
=
= If blocked by either a wall or an actor returns FALSE
=
= If move is either clear or blocked only by a door, returns TRUE and sets
=
= ob->tilex         = new destination
= ob->tiley
= ob->areanumber    = the floor tile number (0-(NUMAREAS-1)) of destination
= ob->distance     = TILEGLOBAl, or -doornumber if a door is blocking the way
=
= If a door is in the way, an OpenDoor call is made to start it opening.
= The actor code should wait until
=    doorobjlist[-ob->distance].action = dr_open, meaning the door has been
=   fully opened
=
==================================
*/

#define CHECKDIAG(x,y)                        \
{                                                   \
   temp=(unsigned)actorat[x][y];                   \
   if (temp)                                       \
   {                                               \
      if (temp<256)                               \
         return false;                           \
      if (((objtype *)temp)->flags&FL_SHOOTABLE)  \
         return false;                           \
   }                                               \
}

#define CHECKSIDE(x,y)                        \
{                                                   \
   temp=(unsigned)actorat[x][y];                   \
   if (temp)                                       \
   {                                               \
      if (temp<128)                               \
         return false;                           \
      if (temp<256)                               \
         doornum = temp&63;                      \
      else if (((objtype *)temp)->flags&FL_SHOOTABLE)\
         return false;                           \
   }                                               \
}


boolean TryWalk (objtype *ob)
{
   int         doornum;
   unsigned   temp;

   doornum = -1;

   if (ob->obclass == inertobj)
   {
      switch (ob->dir)
      {
      case north:
         ob->tiley--;
         break;

      case northeast:
         ob->tilex++;
         ob->tiley--;
         break;

      case east:
         ob->tilex++;
         break;

      case southeast:
         ob->tilex++;
         ob->tiley++;
         break;

      case south:
         ob->tiley++;
         break;

      case southwest:
         ob->tilex--;
         ob->tiley++;
         break;

      case west:
         ob->tilex--;
         break;

      case northwest:
         ob->tilex--;
         ob->tiley--;
         break;
      }
   }
   else
      switch (ob->dir)
      {
      case north:
         if (ob->obclass == dogobj || ob->obclass == fakeobj)
         {
            CHECKDIAG(ob->tilex,ob->tiley-1);
         }
         else
         {
            CHECKSIDE(ob->tilex,ob->tiley-1);
         }
         ob->tiley--;
         break;

      case northeast:
         CHECKDIAG(ob->tilex+1,ob->tiley-1);
         CHECKDIAG(ob->tilex+1,ob->tiley);
         CHECKDIAG(ob->tilex,ob->tiley-1);
         ob->tilex++;
         ob->tiley--;
         break;

      case east:
         if (ob->obclass == dogobj || ob->obclass == fakeobj)
         {
            CHECKDIAG(ob->tilex+1,ob->tiley);
         }
         else
         {
            CHECKSIDE(ob->tilex+1,ob->tiley);
         }
         ob->tilex++;
         break;

      case southeast:
         CHECKDIAG(ob->tilex+1,ob->tiley+1);
         CHECKDIAG(ob->tilex+1,ob->tiley);
         CHECKDIAG(ob->tilex,ob->tiley+1);
         ob->tilex++;
         ob->tiley++;
         break;

      case south:
         if (ob->obclass == dogobj || ob->obclass == fakeobj)
         {
            CHECKDIAG(ob->tilex,ob->tiley+1);
         }
         else
         {
            CHECKSIDE(ob->tilex,ob->tiley+1);
         }
         ob->tiley++;
         break;

      case southwest:
         CHECKDIAG(ob->tilex-1,ob->tiley+1);
         CHECKDIAG(ob->tilex-1,ob->tiley);
         CHECKDIAG(ob->tilex,ob->tiley+1);
         ob->tilex--;
         ob->tiley++;
         break;

      case west:
         if (ob->obclass == dogobj || ob->obclass == fakeobj)
         {
            CHECKDIAG(ob->tilex-1,ob->tiley);
         }
         else
         {
            CHECKSIDE(ob->tilex-1,ob->tiley);
         }
         ob->tilex--;
         break;

      case northwest:
         CHECKDIAG(ob->tilex-1,ob->tiley-1);
         CHECKDIAG(ob->tilex-1,ob->tiley);
         CHECKDIAG(ob->tilex,ob->tiley-1);
         ob->tilex--;
         ob->tiley--;
         break;

      case nodir:
         return false;

      default:
         Quit ("Walk: Bad dir");
      }

   if (doornum != -1)
   {
      OpenDoor (doornum);
      ob->distance = -doornum-1;
      return true;
   }



   ob->areanumber =
      *(mapsegs[0] + farmapylookup[ob->tiley]+ob->tilex) - AREATILE;

   ob->distance = TILEGLOBAL;
   return true;
}


::: CODE :::
/*
=================
=
= T_Ghosts
=
=================
*/

void T_Ghosts (objtype *ob)
{
   long move;


   if (ob->dir == nodir)
   {
      SelectChaseDir (ob);
      if (ob->dir == nodir)
         return;                     // object is blocked in
   }

   move = ob->speed*tics;

   while (move)
   {
      if (move < ob->distance)
      {
         MoveObj (ob,move);
         break;
      }

      //
      // reached goal tile, so select another one
      //

      //
      // fix position to account for round off during moving
      //
      ob->x = ((long)ob->tilex<<TILESHIFT)+TILEGLOBAL/2;
      ob->y = ((long)ob->tiley<<TILESHIFT)+TILEGLOBAL/2;

      move -= ob->distance;


      SelectChaseDir (ob);

      if (ob->dir == nodir)
         return;                     // object is blocked in
   }

}


I wonder if this is because iD Software forgot to include the necessary code in "T_Ghosts", or because they didn't intend ghosts to be able to open doors.

On E1L8 of Temporary Insanity, at one point, there is a long corridor of locked doors that the player can't open. The player has to lure a ghost to open the doors. When the ghost opens the doors, it instantly jumps to the other end of the corridor, opening all the doors.
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 5:49 ago.

Topics: 163
Posts: 8152
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Thu Aug 04, 2016 5:15 pm
   Subject: Re: Making PacMan ghosts open doors?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Matthew wrote:
I wonder if this is because iD Software forgot to include the necessary code in "T_Ghosts", or because they didn't intend ghosts to be able to open doors.
I'm pretty sure the ghosts were never intended to open doors. Most of the code is only written to handle what the original Id levels did, and it certainly didn't have modding in mind when it was officially released.
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> SDL 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 Announcement: Wolf3d & Spear of Destiny Shareware SDL Downloads
Author: BrotherTank
10 14640 Tue Aug 24, 2010 10:18 am
dcbasic View latest post
No new posts Sticky: [Tutorial] Compiling Wolf4SDL with Code::Blocks
Author: dcbasic
90 22956 Wed May 24, 2017 7:53 pm
Falcon*93 View latest post
No new posts [Help] Gun Bobbing in SDL
Author: RichterBelmont12
8 2679 Wed Jul 23, 2008 6:37 pm
Tricob View latest post
No new posts [WOLF4SDL Help] Blake Stone Style doors
Author: Haasboy
3 2836 Sun Jul 20, 2008 7:56 am
Haasboy View latest post
No new posts [SDL] Apply 2nd ScaleFactor to selected (hi-res) vga gfx
Author: Andy_Nonymous
9 4247 Sun Apr 27, 2008 2:30 am
AlumiuN 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