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       

[Code] Different Door Sides - Ripper
Page 1 of 1
DieHard Wolfers Forum Index -> Code Tutorials 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
Ripper
Code Master - Developer
Code Master - Developer


Joined: 15 Mar 2003
Last Visit: 30 Sep 2008

Topics: 21
Posts: 527
Location: Germany
blank.gif

PostPosted: Sat Jul 26, 2003 9:09 am
   Subject: [Code] Different Door Sides - Ripper
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

If you want to have multiple door frames depending on the door type you're using, here's what you gotta do (this short tutorial shows you how to add one frame for all locked doors and the elevator):

First add the new door frame textures (one bright and one darker) after the last texture (probably after the dark locked door texture) and then open up your source code. Now go to the top of the WL_DRAW.C file and change the DOORWALL line to the following:

::: CODE :::
#define DOORWALL   (PMSpriteStart-10)

(for more frames replace the "8" by 8+[the number of new frames]*2, i.e. 8+4*2 or simply 16)

Now replace the HitVertWall function by this function:

::: CODE :::
void HitVertWall (void)
{
   int         wallpic;
   unsigned   texture;
   byte tile;

   texture = (yintercept>>4)&0xfc0;
   if (xtilestep == -1)
   {
      texture = 0xfc0-texture;
      xintercept += TILEGLOBAL;
   }
   wallheight[pixx] = CalcHeight();

   if (lastside==1 && lastintercept == xtile && lasttilehit == tilehit)
   {
      // in the same wall type as last time, so check for optimized draw
      if (texture == (unsigned)postsource)
      {
      // wide scale
         postwidth++;
         wallheight[pixx] = wallheight[pixx-1];
         return;
      }
      else
      {
         ScalePost ();
         (unsigned)postsource = texture;
         postwidth = 1;
         postx = pixx;
      }
   }
   else
   {
   // new wall
      if (lastside != -1)            // if not the first scaled post
         ScalePost ();

      lastside = true;
      lastintercept = xtile;

      lasttilehit = tilehit;
      postx = pixx;
      postwidth = 1;

      if (tilehit & 0x40)
      {                        // check for adjacent doors
         ytile = yintercept>>TILESHIFT;
         tile = tilemap[xtile-xtilestep][ytile];
         if (tile & 0x80)
         {
            switch(doorobjlist[tile & 0x7f].lock)
            {
               case dr_lock1:
               case dr_lock2:
               case dr_lock3:
               case dr_lock4:
               case dr_elevator:
                  wallpic = DOORWALL+9;
                  break;
               case dr_normal:
               default:
                  wallpic = DOORWALL+3;
                  break;
            }
         }
         else
            wallpic = vertwall[tilehit & ~0x40];
      }
      else
         wallpic = vertwall[tilehit];

      *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);
      (unsigned)postsource = texture;

   }
}

and the HitHorizWall function by that:

::: CODE :::
void HitHorizWall (void)
{
   int         wallpic;
   unsigned   texture;
   byte tile;

   texture = (xintercept>>4)&0xfc0;
   if (ytilestep == -1)
      yintercept += TILEGLOBAL;
   else
      texture = 0xfc0-texture;
   wallheight[pixx] = CalcHeight();

   if (lastside==0 && lastintercept == ytile && lasttilehit == tilehit)
   {
      // in the same wall type as last time, so check for optimized draw
      if (texture == (unsigned)postsource)
      {
      // wide scale
         postwidth++;
         wallheight[pixx] = wallheight[pixx-1];
         return;
      }
      else
      {
         ScalePost ();
         (unsigned)postsource = texture;
         postwidth = 1;
         postx = pixx;
      }
   }
   else
   {
   // new wall
      if (lastside != -1)            // if not the first scaled post
         ScalePost ();

      lastside = 0;
      lastintercept = ytile;

      lasttilehit = tilehit;
      postx = pixx;
      postwidth = 1;

      if (tilehit & 0x40)
      {                        // check for adjacent doors
         xtile = xintercept>>TILESHIFT;
         tile = tilemap[xtile][ytile-ytilestep];
         if(tile & 0x80)
         {
            switch(doorobjlist[tile & 0x7f].lock)
            {
               case dr_lock1:
               case dr_lock2:
               case dr_lock3:
               case dr_lock4:
               case dr_elevator:
                  wallpic = DOORWALL+8;
                  break;
               case dr_normal:
               default:
                  wallpic = DOORWALL+2;
                  break;
            }
         }
         else
            wallpic = horizwall[tilehit & ~0x40];
      }
      else
         wallpic = horizwall[tilehit];

      *( ((unsigned *)&postsource)+1) = (unsigned)PM_GetPage(wallpic);
      (unsigned)postsource = texture;
   }

}

That's it!

The result will look like this:


You should be able to simply adjust this to your needs Wink

Greets ;D
Ripper
gerolf
DieHard Wolfer
DieHard Wolfer


Joined: 28 Jan 2010
Last Visit: 11 Dec 2017

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

PostPosted: Tue Apr 19, 2011 7:00 pm
   Subject: Re: [Code] Different Door Sides - Ripper
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

what would i do to make it have different sides for the Elevator door only?

_________________
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Tutorials 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 [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2381 Fri Feb 11, 2005 9:18 pm
Zombie_Plan View latest post
No new posts [Code] Adding a Frames per Second Counter - Darkone
Author: BrotherTank
0 1703 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 1969 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2700 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 607 Tue Jul 29, 2003 3:00 pm
Codetech84 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