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       

[Info] High resolution weapons - 2 methods
Page 1 of 1
DieHard Wolfers Forum Index -> 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
Guest




Last Visit:





PostPosted: Wed Jul 09, 2003 4:03 pm
   Subject: [Info] High resolution weapons - 2 methods
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hey doods.

Well, we all know that when we make the game play area on screen bigger, which in turn makes the gun blow up and turn all pixelly?

How would you make it 'high resolution', ie not 2x2 pixels but 1x1 so it's nice and not ugly?
Majik Monkee
Pixel Master
Pixel Master


Joined: 23 Jun 2003
Last Visit: 05 Dec 2018

Topics: 81
Posts: 1641
Location: Missouri
usa.gif

PostPosted: Thu Jul 10, 2003 1:28 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

What? Since when can you change the resolution of weapons and sprites? Damn...back to the old drawing board! Embarassed

_________________
"Do or do not. There is no try." ~Yoda~
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 12, 2003 10:24 am
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If you have a look at the sprites of "Operation Bodycount", you'll see, that the weapons are splitted into TWO sprites instead of only one, so that you can have more details in your weapons.

*sometimelater* Hmmm, I got several crashes cause I had stuff in the outer columns of the new weapon sprites... Now my system is ExTReMeLY instable (only had 1% of system resources left a minute ago)...
Unfortunately DarkOne's old bug fix vanished with the crash down of the old dome forum...
Looks like today I won't make it... and then there's no time... *sniff*
Time is a too worthy thing....
Reivax44
Bring 'em On
Bring 'em On


Joined: 25 Apr 2003
Last Visit: 26 Aug 2010

Topics: 3
Posts: 140
Location: Adelaide.
australia.gif

PostPosted: Sat Jul 12, 2003 10:42 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Is it really that important though? It dosen't make the weapons look THAT much better does it? is it worth the bother when you can be working on more crucial parts of your TC?

Cool

_________________
95% of people tip-toe through life hoping to make it safely to DEATH!
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Sun Jul 13, 2003 11:21 am
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Whew! I thought somebody else had already found a way, but now I know it's just someone wanting to know how.
I won't release it, but open the vswap to blake stone planet strike...
you could use nice 64x64 sprites instead of nasty 128x128 ones.
BTW all, I'm back, and I'm posting my "I'm back" post right after I finish browsing through all the topics I missed. Smile

_________________
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Sun Jul 13, 2003 2:05 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ripper wrote:
If you have a look at the sprites of "Operation Bodycount", you'll see, that the weapons are splitted into TWO sprites instead of only one, so that you can have more details in your weapons.

*sometimelater* Hmmm, I got several crashes cause I had stuff in the outer columns of the new weapon sprites... Now my system is ExTReMeLY instable (only had 1% of system resources left a minute ago)...
Unfortunately DarkOne's old bug fix vanished with the crash down of the old dome forum...
Looks like today I won't make it... and then there's no time... *sniff*
Time is a too worthy thing....


I've got the fix here, if you would like, I can post it.... Although, I thought that I already had... along with the other routines of his that were very hard to find...

Greg
BrotherTank
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: Tue Jul 15, 2003 12:00 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks to BrotherTank's post of DarkOne's bug fix, I got that high resolution stuff working!
Although it's probably not the nicest way, it works Wink

The result of this small tut will be, that you'll use two sprites (each standard 64*64), which will be placed side by side, for one weapon frame. That way you'll have a 128*64 pixel weapon, which might cause problems, if you try to double size the maschine gun (fourth weapon) because the "light effects" take up more than 32 pixel.
Now let's go:

First we'll add some new sprites to our vswap! As we'll test the feature first, we'll only add the wait frame of the pistol, the others can be added the same way.
For this we can use these two bitmaps (I know they're not nice, but it's just show the feature!!! Mr Green):



So open your vswap and starting with the first knife sprite add one empty sprite after each weapon sprite. Now go to the first pistol sprite and import the first higher detail sprite there and the second into the next sprite. Save it and open your source code.

Go to the DrawPlayerWeapon function in WL_DRAW.C and change the content of the "if (gamestate.weapon != -1)" block to:
::: CODE :::
      shapenum = weaponscale[gamestate.weapon]*2-SPR_KNIFEREADY+gamestate.weaponframe;
      bufferofs+=((viewheight+1)/4)*80;
      SimpleScaleShape(viewwidth*3/8,shapenum,(viewheight+1)/2);
      SimpleScaleShape(viewwidth*5/8,shapenum+1,(viewheight+1)/2);
      bufferofs-=((viewheight+1)/4)*80;

Now we gotta install DarkOne's sprite bug fix:
Open up the WL_SCALE.C and replace the ScaleShape and SimpleScaleShape functions with these:
::: CODE :::
void ScaleShape (int xcenter, int shapenum, unsigned height)
{
   t_compshape   _seg *shape;
   t_compscale _seg *comptable;
   unsigned scale,srcx,startx,stopx,next_x;
   unsigned far *cmdptr;
   boolean leftvis, rightvis;

   shape=PM_GetSpritePage(shapenum);

   scale=height>>3;                 // low three bits are fractional
   if(!scale || scale>maxscale) return;   // too close or far away
   comptable=scaledirectory[scale];

   *(((unsigned *)&linescale)+1)=(unsigned)comptable;   // seg of far call
   *(((unsigned *)&linecmds)+1)=(unsigned)shape;      // seg of shape

   next_x=slinex=xcenter-scale;
   cmdptr=shape->dataofs;
   startx=shape->leftpix;
   stopx=shape->rightpix;

   for(srcx=0; srcx<=stopx; srcx++, slinex=next_x)
   {
      if(slinex>=viewwidth) break; // off the screen

      slinewidth=comptable->width[srcx];
      next_x+=slinewidth;       // next slinex
      if(srcx<startx) continue; // before the shape

      (unsigned)linecmds=*cmdptr++;

      if(!slinewidth) continue;

      if(slinewidth==1)
      {
         if(slinex<0 || slinex>=viewwidth) continue;

         if(wallheight[slinex]>=height) continue; // obscured by closer wall
         ScaleLine();
      }
      else
      {
         if(slinex<0)
         {
            if(slinewidth<=-slinex) continue; // still off the left edge

            slinewidth-=slinex;
            slinex=0;
         }
         else if(slinex+slinewidth>viewwidth)
            slinewidth=viewwidth-slinex;

         leftvis=(wallheight[slinex]<height);
         rightvis=(wallheight[slinex+slinewidth-1]<height);

         if(leftvis)
         {
            if(rightvis)
               ScaleLine();
            else
            {
               while(wallheight[slinex+slinewidth-1]>=height) slinewidth--;
               ScaleLine();
               break; // the rest of the shape is gone
            }
         }
         else
         {
            if(rightvis)
            {
               while(wallheight[slinex]>=height)
               {
                  slinex++;
                  slinewidth--;
               }
               ScaleLine ();
            }
            else
               continue;      // totally obscured
         }
      }
   }
}

void SimpleScaleShape (int xcenter, int shapenum, unsigned height)
{
   t_compshape   _seg *shape;
   t_compscale _seg *comptable;
   unsigned   scale,srcx,startx,stopx,next_x;
   int         t;
   unsigned   far *cmdptr;
   boolean      leftvis,rightvis;


   shape = PM_GetSpritePage (shapenum);

   scale = height>>1;
   comptable = scaledirectory[scale];

   *(((unsigned *)&linescale)+1)=(unsigned)comptable;   // seg of far call
   *(((unsigned *)&linecmds)+1)=(unsigned)shape;      // seg of shape

   next_x=slinex=xcenter-scale;
   cmdptr=shape->dataofs;
   startx=shape->leftpix;
   stopx=shape->rightpix;

   for(srcx=0; srcx<=stopx; srcx++, slinex=next_x)
   {
      if(slinex>=viewwidth) break; // off the screen

      slinewidth=comptable->width[srcx];
      next_x+=slinewidth;                        // next slinex
      if(srcx<startx) continue; // before the shape

      (unsigned)linecmds=*cmdptr++;

      if(!slinewidth) continue;

      if(slinewidth==1)
      {
         if(slinex<0 || slinex>=viewwidth) continue;

         ScaleLine();
      }
      else
      {
         if(slinex<0)
         {
            if(slinewidth<=-slinex) continue; // still off the left edge

            slinewidth-=slinex;
            slinex=0;
         }
         else if(slinex+slinewidth>viewwidth)
            slinewidth=viewwidth-slinex;

         ScaleLine();
      }
   }
}

That's it!
Now you "only" have to add high resolution sprites for all the other weapon frames *gg*
But the result should look something like this:


Have fun Mr Green
Ripper

EDIT: Edited image links two times as de.vu doesn't seem to allow BMP direct linking... *grml* Third time because of bad layout...


Last edited by Ripper on Mon Oct 04, 2004 7:37 am; edited 3 times in total
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Tue Jul 15, 2003 6:17 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Heh, I just read what you posted, Zach Smile
OK, here's some simple stuff, not all of it, just simple stuff:
You could change scale = height>>1; to scale = (height>>1)/2; which give you a high res sprite in the very center of the screen. Now to move it down...
Or, to get high resolution horizontally and again use just 1 sprite, change
slinewidth+=slinewidth;
and
slinewidth-=slinewidth;
to
slinewidth+=slinewidth/2;
and
slinewidth-=slinewidth/2;
All these changes are of course in Wl_scale.c's SimpleScaleShape function.

Ah... I remember talking about this with Zach on AIM... But that's beside the point. If you'd rather just use 1 sprite instead of 2, don't need that much room, are strapped to the bone for memory (like if you have, say, 20 weapons with 7 frames each, which still isn't that much room, but hey), or just don't want to do too much coding, then that second thing I posted is probably for you. But if you need more room, go with Ripper's method.
It looks like it'd interfere with other things, but it doesn't (or didn't in my tests). If it does, then no problem; if statements to the rescue!
I'll tell you though; if I (or someone else) figures out how to move the sprite down from the first method... damn! Me and Zach have seen that it looks DAMN good! I used WolfenDoom sprites and they look great!

_________________
Guest




Last Visit:





PostPosted: Tue Jul 15, 2003 11:01 pm
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Rather than (height>>1)/2 ... why not (height>>2) ? Does the same thing. Wink

-uso.
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: Wed Jul 16, 2003 6:39 am
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If you had a look at my version, you'd see how it's possible to move the sprite down, as my version doesn't really needs much coding, too.
The only problem is, that you need to install DarkOne's sprite bug fix, if you don't want wolf to crash everytime it tries to display the first frame Mr Green

So, in my version I move the weapon down by inserting this line
::: CODE :::
   bufferofs+=((viewheight+1)/4)*80;

before and this line
::: CODE :::
   bufferofs-=((viewheight+1)/4)*80;

after calling the scale functions.

You will probably need to change these lines a little bit, if you use other sprite heights.
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Wed Jul 16, 2003 9:40 am
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

usotsuki wrote:
Rather than (height>>1)/2 ... why not (height>>2) ? Does the same thing. Wink

-uso.


Symbols confuse me. Smile
And to Ripper: ÜBER thanks for that fix! Very Happy I'm no good when it comes to stuff that technical. I don't know what a bufferof is! Laughing Embarassed Anyway, here's high res sprites, Blake Stone 2 style!
In SimpleScaleShape:
put bufferofs+=((viewheight+1)/4)*80; near the beginning and bufferofs-=((viewheight+1)/4)*80; at the very end. Then change that 1 in height>>1 to a 2 (Thanks there go to uso for shortening things and making it so parenthesis aren't necessary!). Go to your game now, and your gun should be really small. Just draw an image at twice the regular size and badaboom! High res sprites with just one sprite. You could put the bufferofs parts before and after the scale calling in the drawplayerweapon function in Wl_draw.c, but I just decided to do it in simplescaleshape to keep all the editing in one function.
OK, so it isn't much of a tutorial, and there's no nice screenshot to go with it showing that sweet MP40 from ROTT and the MG-whatchamacallit from WolfenDoom, but I'm typing this on my brother's computer, plus I can't do screenshots with XP ( Mad ), so dealeth with it!

Well, there ya go.

_________________
Ringman
DieHard Wolfer
DieHard Wolfer


Joined: 31 Jul 2003
Last Visit: 15 Jul 2019

Topics: 56
Posts: 1180
Location: up my nose
usa.gif

PostPosted: Fri Sep 12, 2003 6:25 pm
   Subject: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I heard something about a high res sprite tutorial. Where is this and does it do what I think it does? Does it make it so you can use sprites that are bigger than 64 by 64. See, I had this idea of making sprites by taking digital pictures of myself in nazi uniforms. However when I try to shrink the sprites down to wolf size they get way to grainy. No matter what I do to the image before or after I shrink it I lose to much detail for you to tell what it is. I've even tried enlarging my head a bit(freaky). Anyway if this does make the sprites bigger than how can I insert them with Floedit? If someone explains this to me I will allow any sprites I make to be freely used.
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Sat Sep 13, 2003 2:06 pm
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

There are 2 methods: Ripper's method and my method (which had some help from ripper Smile ). Ripper's method uses multiple sprites to make a larger image and my method draws one sprite at higher resolution. Of course, these methods are just for weapons, but they could be further developed for other sprites I guess...

_________________
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Sat Sep 13, 2003 4:33 pm
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dugtrio, I just used your High Res Weapon tutorial a few pages back, and I'm wondering if you know how to move the sprite down to the bar so it looks normal. You can post it here or PM me if you don't want it public.
Codetech84
Code Master
Code Master


Joined: 12 Mar 2003
Last Visit: 04 Nov 2018

Topics: 22
Posts: 1283
Location: Rauma - Finland
finland.gif

PostPosted: Sun Sep 14, 2003 12:54 am
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Dugtrio17 wrote:
Of course, these methods are just for weapons, but they could be further developed for other sprites I guess...


I think that would be two awkward to apply to other sprites, if even possible. I don't think it would work.

_________________
Click here to visit KFH Games website!
*UPDATED* Spear of Destiny Reloaded
KFH Games on Facebook
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Sun Sep 14, 2003 11:53 am
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Didja read the last post? Mr Green
Here's the complete tutorial:
Quote:
In SimpleScaleShape (in Wl_scale.c):
put bufferofs+=((viewheight+1)/4)*80; near the beginning and bufferofs-=((viewheight+1)/4)*80; at the very end. Then change that 1 in height>>1 to a 2 (Thanks there go to uso for shortening things and making it so parenthesis aren't necessary!). Go to your game now, and your gun should be really small. Just draw an image at twice the regular size and badaboom! High res sprites with just one sprite. You could put the bufferofs parts before and after the scale calling in the drawplayerweapon function in Wl_draw.c, but I just decided to do it in simplescaleshape to keep all the editing in one function.

_________________
Sockman
Don't Hurt Me
Don't Hurt Me


Joined: 19 Jun 2003
Last Visit: 24 Jun 2008

Topics: 3
Posts: 67
Location: City 17
usa.gif

PostPosted: Sun Sep 14, 2003 12:04 pm
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Thanks, Dugtrio. I must not have read that last post. I'll put you in my credits of course Razz
Dugtrio17
Code Master
Code Master


Joined: 11 Mar 2003
Last Visit: 03 Oct 2013

Topics: 49
Posts: 901
Location: Seattle
usa.gif

PostPosted: Sun Sep 14, 2003 4:58 pm
   Subject: Re: High res sprites?
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

You're welcome Smile To really see how nice the high-res sprites can look, try these images: http://www.freewebs.com/dugtrio17/images.zip
(no knife image included, but there's the pistol, machine gun, and chaingun in there)

_________________
Sporb2000
DieHard SS
DieHard SS


Joined: 27 Dec 2004
Last Visit: 26 May 2009

Topics: 19
Posts: 382
Location: New Zealand - Invercargill
newzealand.gif

PostPosted: Wed Feb 02, 2005 12:46 am
   Subject: Re: High resolution weapons
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK i got the whole full screen thing going but my guns are slightly off - which bits of the code controll the position of the sprites on screnn? and also i got gun bobbing in there but because theres two sprites they dont swing properly and overlap each other - howdjafixit?

_________________
I Like (Brackets)
Sporb2000
DieHard SS
DieHard SS


Joined: 27 Dec 2004
Last Visit: 26 May 2009

Topics: 19
Posts: 382
Location: New Zealand - Invercargill
newzealand.gif

PostPosted: Sun Feb 06, 2005 12:08 am
   Subject: Re: [Info] High resolution weapons - 2 methods
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

OK - i really need some help here - im no code buff like you guys so dont expect me to just pick stuff up like you do in other tutorials , i want to add two full sized sprites side by side so i used the code above .my problem is that instead of doing what i wanted it too it drew sprites small like (which i can fix) but it also displays the sprites in the order the appear in so that means that the frame in the right sector is displayed in the left when you fire - its pretty much just executing the same animation in two sprites rather than the left half of the weapon in the left section and the right half in the right section. i would post the pic of the gun if you like its a single 64X128 gun [/img]

_________________
I Like (Brackets)
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> 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 Sticky: [Info] Help for newbie coders! C++ Tutorial
Author: Dugtrio17
20 11236 Sun Jan 10, 2010 12:26 pm
Fragstein3D View latest post
No new posts [Info] Tricks - Dogs that shoot - Modifying Behaviour
Author: Guest
19 288 Sat Mar 20, 2004 7:31 am
Dugtrio17 View latest post
No new posts [Info] Alarm Sounding in game?? WSJ...??
Author: Guest
7 310 Tue Jun 17, 2003 10:04 pm
Reivax44 View latest post
No new posts [Info] Silent Gun? - Adding a Silencer
Author: Guest
4 194 Fri Apr 18, 2003 8:34 am
BrotherTank View latest post
No new posts [Info] Adding Locked Doors
Author: Guest
3 244 Thu Apr 17, 2003 6:30 am
Ripper 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