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] Scrolling wall textures - Like in Doom
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
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Sun Dec 12, 2004 10:26 pm
   Subject: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

You've seen them in Doom, now you can have them in Wolf3D, and it's actually pretty painless...

Open WL_DRAW.C and add this code BEFORE HitVertWall():
::: CODE :::
unsigned ScrollTexture(unsigned texture, boolean vertical)
{
   if (tilehit & 0x40) // don't scroll the door sides.
   {   // check for adjacent doors
      if (vertical)
      {   if ( tilemap[xtile-xtilestep][yintercept>>TILESHIFT]&0x80 )
            return texture;
      }
      else
      {
         if ( tilemap[xintercept>>TILESHIFT][ytile-ytilestep]&0x80 )
            return texture;
      }
   }
   switch (MAPSPOT(xtile,ytile,1))
   {
      case 8:// left to right, fast
         return texture+(((frameon/2)%64)*0xfc0) &0xfc0;
      case 9:// left to right, medium
         return texture+(((frameon/3)%64)*0xfc0) &0xfc0;
      case 10:// right to left, fast
         return texture-(((frameon/2)%64)*0xfc0) &0xfc0;
      case 11:// right to left, medium
         return texture-(((frameon/3)%64)*0xfc0) &0xfc0;
      default:
         return texture;
   }
}

Then inside of HitVertWall(), add the red line in front of the black one:
::: CODE :::
   texture = ScrollTexture(texture,1);
   wallheight[pixx] = CalcHeight();

And for HitHorizWall(), add the red line in front of the black one:
::: CODE :::
   texture = ScrollTexture(texture,0);
   wallheight[pixx] = CalcHeight();

Now, to make a wall scroll, just place the appropriate object code above the wall tile. You find these codes in the switch statement. ie: object code 8 will make the wall scroll from left to right at a fast pace.
You slow down the scroll speed by increasing the divisor value. You change the scroll direction by changing the + to a - (as seen in 10 and 11).

You can also try vertical scrolling, but it won't look as good.
::: CODE :::
         return texture+(((frameon/2)%64));

The problem here is that parts of the adjoined textures in memory can sometimes be seen as it scrolls and the texture will sort of click over once it reaches the bottom. If you try it, you'll see what I mean.

I do not think that this will cause a drop in the FPS. If you use wall decals, I think that the decal will scroll along with the texture.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
TexZK
DieHard SS
DieHard SS


Joined: 07 Feb 2004
Last Visit: 17 Oct 2016

Topics: 19
Posts: 370
Location: Northern Italy
italy.gif

PostPosted: Mon Dec 13, 2004 11:58 am
   Subject: Re: [Tutorial] Scrolling wall textures
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Sooooooo simple!?!?!?!? It looks like the wall patches tutorial!
I'll merge them!

Thanks Adam!!!
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Mon Dec 13, 2004 12:19 pm
   Subject: Re: [Tutorial] Scrolling wall textures
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Have fun, but both methods use an object to modify the wall.
Glad you like it. Very Happy

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
ZuljinRaynor
DieHard Officer
DieHard Officer


Joined: 17 Jan 2004
Last Visit: 30 Apr 2011

Topics: 19
Posts: 559
Location: New Jersey, USA
usa.gif

PostPosted: Mon Dec 13, 2004 12:47 pm
   Subject: Re: [Tutorial] Scrolling wall textures
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

What is this really? Scrolling Wall Textures? You mean like those "Flesh Walls" in Doom going <------< like that?
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Mon Dec 13, 2004 12:48 pm
   Subject: Re: [Tutorial] Scrolling wall textures
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yes, that's what I mean. A screenshot just wouldn't have worked for this..

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Dec 14, 2004 9:26 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I don't know if you found this or not Adam using the original Wolf3d code... but in my code (using the Darkone Raycastor)... you can't use two of these modifiers side by side... doing so has strange effects... it grabs other graphics or sometimes trashed/garbled images as part of the slide...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Tue Dec 14, 2004 9:32 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That's the reason why vertical scrolling looks bad, but the horizontal scrolling seemed OK with the original code. I had 3 in a row, and 1 more diagonally and they scrolled smoothly. I'll check again, but I'm pretty sure it was only scrolling one texture (not half and half).

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Tue Dec 14, 2004 10:08 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
That's the reason why vertical scrolling looks bad, but the horizontal scrolling seemed OK with the original code. I had 3 in a row, and 1 more diagonally and they scrolled smoothly. I'll check again, but I'm pretty sure it was only scrolling one texture (not half and half).


I think I've figured out why it doesn't work right in the Darkone Raycastor code... it's due to the same problem we found in the Patches... the "lasttilehit"... there should be a check to make sure the texture is the same as the last one used by the routine or it tries to grab the texture stored in the last defined "lasttilehit"... thus it gives the garbled image...

I'm working on converting it over and make it work in the Darkone code...

Greg
BrotherTank
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Dec 15, 2004 9:39 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Got it all figured out Adam...

For some reason it must be a seperate routine or function called from the CheckIntersection routine in Darkone's raycastor code. If you just incorperate the texture shift within the original code, it gives some very strange results, but moving it external to the routine works fine. Got me stumped on that one...

The reason I just incorperated it into the Darkone Raycastor code is because it uses 1 single routine in replacement of the HitVertWall and HitHorzonWall routines in the orginal code.

Anyhow, it's working now... great effect...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Wed Dec 15, 2004 9:41 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@BTank: Good deal. Thanks. How does vertical scrolling look with that engine? I imagine about the same as the original. (ie: You start to see the edge of the next/prior texture and *click* it goes away as the top of the texture appears at the top)

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 14 Sep 2016

Topics: 153
Posts: 2256
Location: Ontario
canada.gif

PostPosted: Wed Dec 15, 2004 9:45 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yep...

I'm playing with that now... for some reason it is shifting the image either right or left (depending on direction of scroll Smile yes, I enabled up and down). I'm trying to figure out why it's doing it as it seems it's playing with the width of the texture to be drawn...

If I find an answer, I'll definitely keep everyone informed...

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 21 Jul 2017

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

PostPosted: Wed Dec 15, 2004 9:51 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK, let me try to explain this... it's actually a twisted optical illusion, if you ask me.
Let's say the texture bytes are 0 to 4095...
As it is scrolling horizontally, we guarantee the post to be drawn always starts at the top pixel (a multiple of 64) using "&0xfc0".
Now, with vertical scrolling, we don't do this nice alignment. we say the top pixel goes from 0 to 63.
When the tpo pixel is 63, the bottom right pixel is 4095 + 63, out of range (in the next texture).

Think of the texture as a line of pixels being cut up into posts. When the top pixel of one post goes up 1, it becomes the bottom of the next post to the left, or runs off the edge.

See what I mean?

The only way to do smooth vertical scrolling would be to alter the texture (ala some code similar to wall patches) so that we rearrange the pixels post-by-post. Which, come to think of it, wouldn't be too hard.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Ringman
DieHard Wolfer
DieHard Wolfer


Joined: 31 Jul 2003
Last Visit: 14 Dec 2016

Topics: 54
Posts: 1165
Location: up my nose
usa.gif

PostPosted: Wed Dec 15, 2004 5:32 pm
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It would be interesting for you to make Pulsating lights like in hexen using this method, but it may not look right without pulsating lights on floors. Be great for a scifi mod.

Awesome as usual Adam! Too Cool

_________________
One day I saw upon a stair a little man who wasn't there. He wasn't there again today. My gosh I'd wish he'd go away.
Matte
Registered User
Registered User


Joined: 22 Oct 2006
Last Visit: 03 Feb 2011

Topics: 2
Posts: 12
Location: Jämtland
sweden.gif

PostPosted: Sun Feb 04, 2007 10:04 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How do I add the scrolling walls to my game? Do I add them in FloEdit with the codes you said?

_________________
Wolfen-Terror almost finished. Visit http://projectwargentine.110mb.com/Wolfen-Terror.html for more info.
Anonymous
Guest



Last Visit:





PostPosted: Sun Feb 04, 2007 10:09 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I don't know how to do this in Floedit but you need to add objects with ids from 8 to 11.
You have to put these objects over the walls you want to scroll.
With Adam`s code objects 8 and 9 make the wall scroll from left to right and 10-11 make the wall scroll from right to left.
Matte
Registered User
Registered User


Joined: 22 Oct 2006
Last Visit: 03 Feb 2011

Topics: 2
Posts: 12
Location: Jämtland
sweden.gif

PostPosted: Sun Feb 04, 2007 10:15 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks for the fast reply! I got it to work with Floedit.

_________________
Wolfen-Terror almost finished. Visit http://projectwargentine.110mb.com/Wolfen-Terror.html for more info.
Matte
Registered User
Registered User


Joined: 22 Oct 2006
Last Visit: 03 Feb 2011

Topics: 2
Posts: 12
Location: Jämtland
sweden.gif

PostPosted: Tue Feb 06, 2007 9:08 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Now I stumbled upon another problem, does anybody know how to get this to work with 128x128 graphics?

_________________
Wolfen-Terror almost finished. Visit http://projectwargentine.110mb.com/Wolfen-Terror.html for more info.
Anonymous
Guest



Last Visit:





PostPosted: Tue Feb 06, 2007 9:47 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I haven't tested this so make a backup although it probably should work
From Adam`s original code replace the parts in red
::: CODE :::

unsigned ScrollTexture(unsigned texture, boolean vertical)
{
   if (tilehit & 0x40) // don't scroll the door sides.
   {   // check for adjacent doors
      if (vertical)
      {   if ( tilemap[xtile-xtilestep][yintercept>>TILESHIFT]&0x80 )
            return texture;
      }
      else
      {
         if ( tilemap[xintercept>>TILESHIFT][ytile-ytilestep]&0x80 )
            return texture;
      }
   }
   switch (MAPSPOT(xtile,ytile,1))
   {
      case 8:// left to right, fast
         return texture+(((frameon/2)%64)*0x3f80) &0x3f80;
      case 9:// left to right, medium
         return texture+(((frameon/3)%64)*0x3f80) &0x3f80;
      case 10:// right to left, fast
         return texture-(((frameon/2)%64)*0x3f80) &0x3f80;
      case 11:// right to left, medium
         return texture-(((frameon/3)%64)*0x3f80) &0x3f80;
      default:
         return texture;
   }
}
Matte
Registered User
Registered User


Joined: 22 Oct 2006
Last Visit: 03 Feb 2011

Topics: 2
Posts: 12
Location: Jämtland
sweden.gif

PostPosted: Tue Feb 06, 2007 10:07 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks again Flamer46!

It worked perfectly!

I changed the 64's to 128's too.

_________________
Wolfen-Terror almost finished. Visit http://projectwargentine.110mb.com/Wolfen-Terror.html for more info.
Military
DieHard Guard
DieHard Guard


Joined: 10 Oct 2015
Last Visit: 18 Jul 2017

Topics: 20
Posts: 278

blank.gif

PostPosted: Fri May 26, 2017 11:47 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Would this code need some adjustments to work with Wolf4SDL? I copied the code to my project and it's having no effect whatsoever.

I'm now thinking that Wolf4SDL could really use some sort of debug console/log. Something you could call from anywhere and write comments and variable values into. So you could tell which part of the code is not working.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 11 Jul 2017

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

PostPosted: Fri May 26, 2017 2:17 pm
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Military wrote:
Would this code need some adjustments to work with Wolf4SDL? I copied the code to my project and it's having no effect whatsoever.

You probably need to re-add frameon++ into SDL first: http://diehardwolfers.areyep.com/viewtopic.php?p=101111#101111
Military
DieHard Guard
DieHard Guard


Joined: 10 Oct 2015
Last Visit: 18 Jul 2017

Topics: 20
Posts: 278

blank.gif

PostPosted: Sat May 27, 2017 4:48 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

That helped, thanks!

Though now there's a one pixel/less than one pixel seam on the far left side of every row of scrolling textures.

Tricob
Moderator
<B>Moderator</B>


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

Topics: 160
Posts: 7935
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat May 27, 2017 6:31 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Are you using that tutorial by Chris that connects walls that are apart by the corners? This is probably what you're seeing.
Military
DieHard Guard
DieHard Guard


Joined: 10 Oct 2015
Last Visit: 18 Jul 2017

Topics: 20
Posts: 278

blank.gif

PostPosted: Sun May 28, 2017 2:40 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I don't recall any such tutorial, and the seam also appears between two sides of the same wall, so I guess that's not it.

Tricob
Moderator
<B>Moderator</B>


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

Topics: 160
Posts: 7935
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun May 28, 2017 10:53 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If that's the case, then it probably is Chris's tutorial. Many updates of Wolf4SDL have this tutorial already put in.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 11 Jul 2017

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

PostPosted: Sun May 28, 2017 12:20 pm
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yes if you're using the source on AlumiuN's repository it is included. Basically if you see the green code instead of red:
https://github.com/AlumiuN/Wolf4SDL/commit/7ec3514342f75e9a5f1c96cece672645213e3087

Not sure if that version affects scrolling walls but I should put it in a define regardless so you can easily turn it off and on.
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 11 Jul 2017

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

PostPosted: Sat Jun 03, 2017 4:51 pm
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Military: Just to confirm, you checked the code I posted, and yours was similar to one without the green... or?
Military
DieHard Guard
DieHard Guard


Joined: 10 Oct 2015
Last Visit: 18 Jul 2017

Topics: 20
Posts: 278

blank.gif

PostPosted: Sun Jun 04, 2017 4:01 am
   Subject: Re: [Code] Scrolling wall textures - Like in Doom
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

I checked it now, and my version doesn't include the added code from there.
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] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 10427 Tue Mar 11, 2008 12:02 am
AlumiuN View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2228 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 1573 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 1835 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2521 Sun Oct 26, 2003 1:21 am
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