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] Animated Walls - Darkone
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
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Sat Apr 19, 2003 12:42 pm
   Subject: [Code] Animated Walls - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Darkone's Animated Walls Routine - Edited for Understanding

Life is a Motion

The purpose of this tutorial is to make wall animation in Wolf3D.

First we’ll define object code which would be used for animation. We’ll do this in “WL_DEF.H”:

Look For

::: CODE :::

//
// tile constants
//

#define ICONARROWS    90
#define PUSHABLETILE  98
#define EXITTILE            99          // at end of castle
#define AREATILE            107         // first of NUMAREAS floor tiles
#define NUMAREAS            37
#define ELEVATORTILE  21
#define AMBUSHTILE          106
#define ALTELEVATORTILE     107

// And Add this line

#define ANIMTILE            100



You now must edit your Mapedit or Floedit definitions to allow for this new toggle. There are 5 speeds and each one must be defined in your mapeditor to use them.

100 = Slow
101 = Normal
102 = Quick
103 = Quicker
104 = Quickest

Their purpose is to make wall animation: when there is an animation modifier on the same tile as wall Wolf3D would display an animation of 3 frames (looped) – frame 1: actual wall graphics (as if without modifier) frames 2 and 3: the graphics after original graphics. It opens endless possibilities in wolf editing. Of course you can make longer animation, or shorter.

Now to edit the actual Code.... We are modifying the file “WL_DRAW.C”:

Look for the HitVertWall (void) function and make your's look like the following:

::: CODE :::

void HitVertWall (void)
{
    int               wallpic;
    unsigned    texture;

    texture = (yintercept>>4)&0xfc0;

    if (xtilestep == -1)
    {
          texture = 0xfc0-texture;
          xintercept += TILEGLOBAL;
    }

    wallheight[pixx] = CalcHeight();

// Animated Wall Mod Code

    switch(*(mapsegs[1]+farmapylookup[ytile]+xtile))
    {
    case ANIMTILE:
          tilehit+=(frameon>>6)%3;
          break;
    case ANIMTILE+1:
          tilehit+=(frameon>>5)%3;
          break;
    case ANIMTILE+2:
          tilehit+=(frameon>>4)%3;
          break;
    case ANIMTILE+3:
          tilehit+=(frameon>>3)%3;
          break;
    case ANIMTILE+4:
          tilehit+=(frameon>>2)%3;
          break;
    }

// End Animated Wall Code

    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;
                if ( tilemap[xtile-xtilestep][ytile]&0x80 )
                      wallpic = DOORWALL+3;
                else
                      wallpic = vertwall[tilehit & ~0x40];
          }
          else
                wallpic = vertwall[tilehit];

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

          (unsigned)postsource = texture;
    }



Ok... Now we must edit the HitHorizWall function as well... So edit your HitHorizWall function to look like this:

::: CODE :::


void HitHorizWall (void)
{
    int               wallpic;
    unsigned    texture;

    texture = (xintercept>>4)&0xfc0;

    if (ytilestep == -1)
     {
          yintercept += TILEGLOBAL;
      }
    else
     {
          texture = 0xfc0-texture;
      }

    wallheight[pixx] = CalcHeight();

// Animated Wall Mod Code

    switch(*(mapsegs[1]+farmapylookup[ytile]+xtile))
    {
    case ANIMTILE:
          tilehit+=(frameon>>6)%3;
          break;
    case ANIMTILE+1:
          tilehit+=(frameon>>5)%3;
          break;
    case ANIMTILE+2:
          tilehit+=(frameon>>4)%3;
          break;
    case ANIMTILE+3:
          tilehit+=(frameon>>3)%3;
          break;
    case ANIMTILE+4:
          tilehit+=(frameon>>2)%3;
          break;
    }

    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;
                if ( tilemap[xtile][ytile-ytilestep]&0x80 )
                      wallpic = DOORWALL+2;
                else
                      wallpic = horizwall[tilehit & ~0x40];
          }
          else
          {
                wallpic = horizwall[tilehit];
           }

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

}



That’s it. Just draw an animation (of 3 frames) add it to wolf data files as a sequential wall textures, make a map in your favorite map editor, setting animation flag (just like you set push (secret) wall flag) and there we go: flashing lights, computer screens, fire in fireplace…

Note: there is no performance hit with such an animation, you can even make each and every tile on the map animated and engine wouldn’t even notice this.. and you may use all animation frames as a separate wall textures

Last note: I hope this thing helped you on your way to create the best Wolf3D conversion ever made. If so, just drop me a line on DarkOne@navigators.lv. I wish to see your work!

-------------------------

Enjoy

Greg
BrotherTank
Zero X. Diamond
DieHard Guard
DieHard Guard


Joined: 22 Mar 2004
Last Visit: 29 Jun 2012

Topics: 25
Posts: 265
Location: The Planet of the Tiny Hut People
ussr.gif

PostPosted: Mon Dec 13, 2004 6:37 pm
   Subject: Re: [Code] Animated Walls - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

EDIT: Nevermind, I figured it out. ><

_________________
Hooray for vaporware!
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

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

PostPosted: Sun Jul 03, 2005 9:04 pm
   Subject: Re: [Code] Animated Walls - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just a short note. If you have Brothertank's 64+ Walls or Door Sides Check enabled, copy/paste the section in red below this line in HitVertWall and HitHorizWall (instead of replacing the original functions entirely):

::: CODE :::
    wallheight[pixx] = CalcHeight();

// Animated Wall Mod Code

    switch(MAPSPOT(xtile,ytile,1))
    {
    case ANIMTILE:
          tilehit+=(frameon>>6)%3;
          break;
    case ANIMTILE+1:
          tilehit+=(frameon>>5)%3;
          break;
    case ANIMTILE+2:
          tilehit+=(frameon>>4)%3;
          break;
    case ANIMTILE+3:
          tilehit+=(frameon>>3)%3;
          break;
    case ANIMTILE+4:
          tilehit+=(frameon>>2)%3;
          break;
    }

// End Animated Wall Code

This code will also work if you got rid of the farmapylookup table, since it checks what MAPSPOT is defined to first.

Thanks to Deathshead for pointing this out. Wink
MacGyver
Don't Hurt Me
Don't Hurt Me


Joined: 12 Oct 2006
Last Visit: 17 Sep 2007

Topics: 13
Posts: 71
Location: Finland
finland.gif

PostPosted: Fri Oct 20, 2006 4:31 pm
   Subject: Re: [Code] Animated Walls - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

BrotherTank wrote:
Darkone's Animated Walls Routine - Edited for Understanding

[
You now must edit your Mapedit or Floedit definitions to allow for this new toggle. There are 5 speeds and each one must be defined in your mapeditor to use them.

100 = Slow
101 = Normal
102 = Quick
103 = Quicker
104 = Quickest

Just draw an animation (of 3 frames) add it to wolf data files as a sequential wall textures, make a map in your favorite map editor, setting animation flag (just like you set push (secret) wall flag) and there we go: flashing lights, computer screens, fire in fireplace…



In plain english please. I underlined the things I didn't realize. Razz
insurrectionman
DieHard Mutant
DieHard Mutant


Joined: 07 May 2005
Last Visit: 09 Dec 2017

Topics: 86
Posts: 752
Location: Wisconsin
usa.gif

PostPosted: Fri Oct 20, 2006 6:04 pm
   Subject: Re: [Code] Animated Walls - Darkone
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Okay, depends on which map editor you use, but the "100-104" are in the objects plane. In WDC you insert these definitions into Objects and make a little object or something. Then you can use this object by placing it over a wall and that wall will animate 4 frames. Hoped that helped a bit.

_________________
I'm back! I missed this community!
Youtube Channel: TreeSapThief

New Site: http://www.treesapthief.com
Twitter: @treesapthief
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] 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 [Code] Removing Signon, PG13, or Intro Screens - Chris
Author: Chris
6 1723 Thu Oct 16, 2003 1:43 pm
Sockman 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