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 Static Objects (Improved and simpler!)
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
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 30 Nov 2017

Topics: 24
Posts: 506

blank.gif

PostPosted: Sat Jan 01, 2005 7:12 pm
   Subject: [Code] Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

I once wrote a tutorial on how to create animated static objects. However, I later realized that the method I used was a bit pointless and limited because animations were determined by an added object flag. By simply using the static object's sprite number to determine the animation, you can have many different kinds of animations for your static objects... and there's no need to add any object flags or item types at all.

Just as an example, I'm going to create a slow 2-frame animation (cycling between the water puddle and green barrel graphics) and a fast 4-frame animation (cycling through the treasure graphics).

Open WL_DRAW.C and look for these lines:
::: CODE :::

//
// place static objects
//
   for (statptr = &statobjlist[0] ; statptr !=laststatobj ; statptr++)
   {
      if ((visptr->shapenum = statptr->shapenum) == -1)
         continue;                  // object has been deleted

      if (!*statptr->visspot)
         continue;                  // not visable


Beneath that, add this:
::: CODE :::

      switch (statptr->shapenum)
      {
      case SPR_STAT_0:
         visptr->shapenum+=(frameon>>4)%2; // slow animation with 2 frames
         break;
      case SPR_STAT_29:
         visptr->shapenum+=(frameon>>2)%4; // fast animation with 4 frames
         break;
      }


Save and compile. That's it! Now the puddle of water and the gold cross will be animated as described. You can do this with any static object, just add more cases with the "SPR_" assigned to your static object in WL_ACT1. And you can create your own animations by changing the numbers in the "(frameon>>#)%#".

I hope this made sense and will be useful to someone.

WSJ.
Guest




Last Visit:





PostPosted: Thu Jan 20, 2005 8:51 am
   Subject: Re: Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I`d like to know if there is a way to make directional sprites animated since when i write SPR_TRANS_1 in there the directional sprite doesn`t become animated.


Animated writing

Hello
WSJ
DieHard Officer
DieHard Officer


Joined: 17 Apr 2004
Last Visit: 30 Nov 2017

Topics: 24
Posts: 506

blank.gif

PostPosted: Thu Jan 20, 2005 11:24 pm
   Subject: Re: Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK, I found a solution... In order to make it work, you can add a separate parameter to Ripper's "Scale3DShape" so that it will load the sprite number separately, thus allowing the animation code to be used.

Open WL_SCALE.C and go to the "Scale3DShape" function. Replace this line:
::: CODE :::
void Scale3DShape(statobj_t *ob)


with this line:

::: CODE :::
void Scale3DShape(statobj_t *ob, int shapenum)


Go down to these lines:

::: CODE :::

      Scale3DShaper(viewx2,viewx1,ob->shapenum,(unsigned)height2,
         (unsigned)height1,ny2,ny1,nx2,nx1);
   else
      Scale3DShaper(viewx1,viewx2,ob->shapenum,(unsigned)height1,
         (unsigned)height2,ny1,ny2,nx1,nx2);


Replace both occurances of "ob->shapenum" with "shapenum" (no quotes)

Open WL_DRAW.C and go to the "DrawScaleds" section. Replace this line:

::: CODE :::
void Scale3DShape(statobj_t *ob);


with this line:

::: CODE :::
void Scale3DShape(statobj_t *ob, int shapenum);


Now search for this:

::: CODE :::
Scale3DShape(farthest->transsprite);


and replace it with this:

::: CODE :::
Scale3DShape(farthest->transsprite,farthest->shapenum);


I think that should do the trick...
Guest




Last Visit:





PostPosted: Fri Jan 21, 2005 11:19 am
   Subject: Re: Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

It works very well.

Your the best WSJ
ZuljinRaynor
DieHard Officer
DieHard Officer


Joined: 17 Jan 2004
Last Visit: 30 May 2018

Topics: 19
Posts: 559

usa.gif

PostPosted: Sun Jan 23, 2005 10:47 am
   Subject: Re: Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Does this allow now animated sprites and pick-up objects?
Guest




Last Visit:





PostPosted: Sun Jan 23, 2005 10:59 am
   Subject: Re: Animated Static Objects (Improved and simpler!)
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Yes i think so even though i didn`t try
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 3272 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 2410 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2710 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 3622 Sun Oct 26, 2003 1:21 am
Guest View latest post
No new posts [Help] Different Enemy Dying Frames/Views
Author: Guest
7 609 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