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] Taking screenshots inside Wolf
Page 1 of 2 Goto page 1, 2  Next
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: Tue Dec 14, 2004 12:06 pm
   Subject: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

Hi people!

It's time to end all the problems of making screenshots of silly dos boxes or just to make things easier.
The following few lines will let you take 256-color screenshot (a bitmap file named "WSHOTxxx.BMP" (replace xxx with the next available number) inside your current wolf directory) by pressing <TAB>+<Z> in debug mode (or <TAB>+<Y> if you have a "qwertz" keyboard like me):

Go to the end of the DebugKeys function inside WL_DEBUG.C and add the following code above "return 0;":

::: CODE :::
   else if(Keyboard[sc_Z])
   {
      char *fname="WSHOT000.BMP";
      int file;
      byte far *wolfpal=(byte far *)&gamepal;
      int i,x;
      unsigned long col;
      byte bmpheads[54]={'B','M',0x8e,0x3f,0,0,0,0,0,0,0x36,4,0,0,
         40,0,0,0,0x40,1,0,0,200,0,0,0,1,0,8,0,0,0,0,0,
         0,0xfa,0,0,0xc4,0x0e,0,0,0xc4,0x0e,0,0,0,0,0,0,0,0,0,0};
      for(i=0;i<1000;i++)
      {
         fname[7]=i%10+'0';
         fname[6]=(i/10)%10+'0';
         fname[5]=i/100+'0';
         file=open(fname,O_BINARY | O_RDONLY);
         if(file==-1) break;
         close(file);
      }

      // overwrites WSHOT999.BMP if all wshot files exist

      file=open(fname,O_CREAT| O_BINARY | O_WRONLY, S_IREAD | S_IWRITE | S_IFREG);
      if(file==-1)
      {
         CenterWindow(22,3);
         US_Print("Unable to create file:\n");
         US_Print(fname);
         VW_UpdateScreen();
         IN_Ack();
         return 1;
      }
      write(file,bmpheads,sizeof(bmpheads));
      for(i=0;i<256;i++)                              // 1024 bytes palette
      {
         col=(((((unsigned long)wolfpal[i*3])<<10)+
               (((unsigned long)wolfpal[i*3+1])<<2))<<8)+
               (((unsigned long)wolfpal[i*3+2])<<2);
         write(file,&col,4);
      }
      for(i=199;i>=0;i--)
      {                                               // 64000 bytes image data
         for(x=0;x<320;x++)
         {
            byte mask=x&3,pix;
            VGAREADMAP(mask);
            pix=*(byte far *)(0xa0000000L+(long)displayofs+(long)i*80+(long)(x>>2));
            write(file,&pix,1);
         }
      }
      close(file);
      CenterWindow (18,2);
      US_PrintCentered ("Screenshot taken");
      VW_UpdateScreen();
      IN_Ack();
      return 1;
   }

That's it ;D
The bitmap files will have a fixed size of 63.5 KB.
If you use our BMP2GIF (inside "Downloads") on these files, you'll get GIF files of aprox. 20 KB, which is very useful for screenshots for the internet.

Greets
Ripper

EDIT: Due to some bugs in the Borland C 3.1 compiler (yes, the compiler really produced code, that sets the second digit to the value of the first one...) I changed the calculation of the filename as Adam suggested and used another function to create the new file. Also I added an error message to appear, when the programm is unable to create the file, so you know it didn't work. I used Borland C++ 4.02, so I didn't noticed those problems at first...

SECOND EDIT: Added Adam's file creation bugfix, because my version created the bitmaps in text mode... *DOH*


Last edited by Ripper on Thu May 26, 2005 5:01 am; edited 2 times in total
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Tue Dec 14, 2004 12:28 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

/me rushes to try it out...
OK, rush is a relative term.. I have to wait until this evening.. Sad

EDIT: OK, tried it anyway. The BMP was fine, but the names didn't act right... the filenames went: WSHOT000.BMP, WSHOT011.BMP, then WSHOT022.BMP.
Instead of 000, 001, 002

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
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 Dec 14, 2004 12:54 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If you have a look at how the filename is built, you'll see that this shouldn't be possible:
Are you sure Windoofy didn't play a trick on you again? Wink
For me it works alright (I hope it's not some strange XP sh*t again......)
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Tue Dec 14, 2004 12:56 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

LOL, I know... I'm staring at my code and your code in disbelief... How can it be?!?!

Let me try again...

EDIT: To get it to work properly, I had to change that part to:
::: CODE :::
         fname[7]=i%10+'0';
         fname[6]=(i/10)%10+'0';
         fname[5]=(i/100)+'0';

No clue what was going on there.

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


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Tue Dec 14, 2004 3:47 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OMG Ripper, you are the best ever, thanks!!! I will test this out! Very Happy Very Happy

EDIT: :\ It's not making any BMPS in my wolf directory.

_________________
Steam: http://steamcommunity.com/id/stormx312


Last edited by KyleRTCW on Tue Dec 14, 2004 3:59 pm; edited 1 time in total
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: Tue Dec 14, 2004 3:55 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The things Adam said happened to me on XP too. I didn't try 98 yet. Razz
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Tue Dec 14, 2004 4:31 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

If you use I ngame messages, after a message pop ups, the nyou take a screenshot, the text dissappears
Here's a Quick fix for those using In-Game Messages:

Modify:
::: CODE :::
CenterWindow(18,2);
US_PrintCentered ("Screenshot taken");


to

::: CODE :::
CenterWindow(18,2);
fontnumber=0;
SETFONTCOLOR(0x0,0x0);

US_PrintCentered ("Screenshot taken");

_________________
Steam: http://steamcommunity.com/id/stormx312
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 Dec 14, 2004 5:42 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK, I just updated the tutorial above.
Using the original compiler I was able to reproduce first Kyle's problem with nothing working at all except that stupid message box and then the wrong numbering.
It doesn't really make any sense, that the previous code didn't work, so I guess, the open function perhaps didn't have as much memory as it wanted to have.
The wrong digit stuff was incorrectly compiled code as the compiler saved the first ir%10 value and just used it for the second digit, too, although ir was altered...

Hope it works now for everyone *sigh*
thejosh
I am Death Incarnate
I am Death Incarnate


Joined: 26 Apr 2003
Last Visit: 22 Nov 2009

Topics: 4
Posts: 150

blank.gif

PostPosted: Tue Dec 14, 2004 7:56 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Works great ! I'm using XP and I didn't notice any problems Very Happy

_________________
thejosh Official procrastinator
Lair of the Mantis
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Wed Dec 15, 2004 3:25 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ripper, I'm glad to report that the above code does work for me on Windows XP Smile
Thanks so much for saving us the hassle of having to get into that crappy, choppy, DosBOX!! Beer

Kyle Mr Green

_________________
Steam: http://steamcommunity.com/id/stormx312
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 Dec 15, 2004 7:21 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ah great, now I'm reliefed ;D (stupid compiler......)
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: Wed Dec 15, 2004 7:21 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Just wanted to say yet another "Great Work" on another badly needed piece of coding. I'm sure that many will find it usefull.

Greg
BrotherTank
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: Thu Dec 16, 2004 2:29 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

How would I get F12 to do this so you can take screenshots like in other games without any parameters. (I know how to make it not need debugmode but [sc_F12] doesn't work.)
KyleRTCW
DieHard Officer
DieHard Officer


Joined: 30 Jul 2003
Last Visit: 09 Nov 2017

Topics: 45
Posts: 510
Location: Ohio
usa.gif

PostPosted: Thu Dec 16, 2004 3:15 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Edit : Nevermind, MCS put a fix up.

_________________
Steam: http://steamcommunity.com/id/stormx312


Last edited by KyleRTCW on Thu Dec 16, 2004 3:17 pm; edited 2 times in total
MCS
Site Administrator
<B>Site Administrator</B>


Joined: 01 Mar 2003
Last Visit: 15 Jul 2013

Topics: 20
Posts: 243
Location: Amsterdam, the Netherlands
netherlands.gif

PostPosted: Thu Dec 16, 2004 3:16 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

In ID_IN.H, locate this line:

#define sc_F12 0x59

and change it to

#define sc_F12 0x58

Enjoy,
MCS.
wolf3dbreaker
I am Death Incarnate
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009

Topics: 31
Posts: 196
Location: Philippines
philippines.gif

PostPosted: Wed Apr 13, 2005 6:01 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ripper: There appears to be a bug. When I use a different kind of pallete, the file gives off a garbled screen. Any fix for this?

_________________
Gone from the community for a while. Will be back on July
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Wed Apr 13, 2005 9:02 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I wonder if this is why this code doesn't work in Orb also... I'll have to test this out sometime!

_________________
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: Thu Apr 14, 2005 3:08 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I've found problems when opening new files while in game... you have to open them when it initializes the paging manager (if I remember well)
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Thu Apr 14, 2005 6:25 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, the problem I seem to be having is that the file size is not what it should be. I have tried this tutorial in clean code and it works. It still doesn't work in Orb's fresh code build.


@wolf3dbreaker: Is this similar to what you get?

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
wolf3dbreaker
I am Death Incarnate
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009

Topics: 31
Posts: 196
Location: Philippines
philippines.gif

PostPosted: Thu Apr 14, 2005 4:29 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Adam Biser wrote:
Well, the problem I seem to be having is that the file size is not what it should be. I have tried this tutorial in clean code and it works. It still doesn't work in Orb's fresh code build.


@wolf3dbreaker: Is this similar to what you get?


Adam. That is exactly how my problem looks like. I'm trying to find a fix for it. It's probably on the &gamepal part of the code. It gives a garbled screen shot.

_________________
Gone from the community for a while. Will be back on July
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Thu Apr 14, 2005 5:22 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, I've looked at the file in a hex editor. The BMP header information and palette data are correct. The problem seems to be in the writing of the rows, which is strange because each row should be 320, but sometimes it becomes more than that (hence the slant).

EDIT: Well, the different palette is not the problem. I went back to the original palette and the same thing happened. What tutorials have you applied? I have Ripper's no-scalers, shading, textured flats.... the no-scalers might be the culprit, but I don't know.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 15:24 ago.

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

PostPosted: Thu Apr 14, 2005 7:39 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I remember coming across a similar problem when reading a picture file in QB. I'm not saying for sure that this is the same problem here, but with my problem, it turned out the engine that loaded and saved the picture had a bug in the file routine.

Check out the first horizontal line of pixels. Now check the next line. That's where it starts mis-aligning - by one pixel. The very last pixel of the first line is hacked off, and the first pixel of the next line actually appears on the very top right of the screen (The second pixel of Line #2 appears on Coordinates 1,0 - where the first pixel should be). Since every single line written is shy of that last pixel on the right, it keeps slanting and slanting until you get the image you see before you.

When the picture file was re-written, it was stored the way you currently see it displayed.

Your best bet is to write a piece of code that will add an extra dot at the end of each line of pixels written to the picture file (starting with the color "00"; you can fix the empty space later), and try to paste it together that way.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Thu Apr 14, 2005 8:37 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, as you can see, the slant is not constant. And the slant direction (and file size) tell me that there are extra pixels being written per screen row, which is strange since we have the loop set for 320.

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


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

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

PostPosted: Thu Apr 21, 2005 4:28 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

On a semi-related note, has anyone ever tried pressing Enter after pressing Tab-P? I looked at the function and wondered why there was so much stuff (as you'd really only need IN_Ack() or a short LastScan check to pause the screen). That PicturePause() function seems to try and store your display screen into a memory buffer before it quits; among other things. You can use it during Intermission screens and some Menu screens by pressing P-Enter while you're in debugmode too. I tried extracting the raw image data in PicturePause() by adding something like this below "_fmemcpy (dest,buffer,64000)":

i = open(audioname,O_CREAT | O_BINARY | O_WRONLY,S_IREAD | S_IWRITE | S_IFREG);
write(i,&buffer,64000);


Don't think this works right, though, as it never extracts from the correct offset in memory; but maybe I have to do something extra to push it into a different kind of memory. Once we could figure that all out, you'd just have to replace the data from your AUDIO.* file over the last 64000 bytes in any wolf 320x200 256 colour image, then flip it upsidedown/backwards, and it should show the screen with no garble. If that works in Orb, maybe that would help narrow down the problem. With a few little tweaks in the same vein as what Ripper did, it probably wouldn't be too hard to make TIFs/BMPs automatically with Tab-P-Enter. Interesting, isn't it?

Adam Biser wrote:
I have Ripper's no-scalers, shading, textured flats.... the no-scalers might be the culprit, but I don't know.

I'm pretty sure it's not the scalers tutorial; as the screenshots work here with it. My guess is that there's something in the 320 loop which shifts pix to a different spot when you're using one of the tutorials; or that one of the ASM memory variables inside VGAREADMAP is assigned to a different number which throws everything off. The only global part of pix I see is displayofs; but if something changes it, you'd think that would be just as noticable while playing the game (unless the tutorial compensates for it somehow with something else). Another array going out of bounds and into one of those might be another reason, but probably less likely.

Anyway, my knowledge is pretty limited. There's still alot about Ripper's 320/200 loop that I don't really understand. Like, why are we shifting x by 2 bits (dividing it by 4?), and why is everything getting turned into a byte variable? Doesn't seem like either of those would help you find the memory location of where to grab each consecutive dot from. I undertand that everything needs to be flipped to make the picture, and it needs a starting point, but what's up with the rest of the stuff in his pix equation? Maybe you could explain some parts of Ripper's loop to your level of understanding Adam, even if it is only slightly more logical and informative? Laughing
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Thu Apr 21, 2005 8:20 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OK Here's how I think the 320/200 loop works, as with all of the screen draw routines, I believe. This is just the most condensed occurrence.
::: CODE :::
 for(i=199;i>=0;i--)
      {                                               // 64000 bytes image data
         for(x=0;x<320;x++)
         {
            byte mask=x&3,pix;
            VGAREADMAP(mask);
            pix=*(byte far *)(0xa0000000L+(long)displayofs+(long)i*80+(long)(x>>2));
            write(file,&pix,1);
         }
      }

OK, we start at 0,199 - the bottom left corner of the screen - because that's how BMP's are formatted: bottom row first. From what I understand, there are 4 "planes" to the screen. We switch planes using "mask" and the VGAREADMAP call. So now we are able to pick which plane we need using x&3, which makes "mask" cycle from 0 to 3 repeatedly. x>>2 is there because each plane is 320/4=80 bytes wide. So the 5th pixel from the left is found on plane 1 (5&3=1), pixel 1 (5>>2=1). See what I mean? As to why all this hocus pocus has to take place, I don't know.

I'll look around the pause code like you mentioned. The funky this is that that sometimes the row in the BMP is 321 or more, which is just stranger than anything.

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


Joined: 11 Mar 2003
Last Visit: 30 Oct 2017

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

PostPosted: Thu Apr 21, 2005 9:55 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

4 planes... of course!

Gee, I should have thought of that; remembering all those pics you posted for vgagraphs in the past.
Now all that mask&3 / x>>2 stuff (and the references to 80) make ALOT more sense. Thanks for that info Adam. Smile

Here's something that might make you laugh: I always just assumed that the pix equation stored the result into pix, much like x=1. That line of code never made any sense to me because of that, since pix was only a byte (and a memory location would obviously be more than a byte). Then I started to think "what if the result of the equation changes the pointer location of pix to somewhere else in memory, which would get called back later so you could find the colour of the dot"; which I thought could lead to some kind of conflict if the memory location of pix got into the picture. But, then I thought "hey, if the pointer got into the picture, it could just grab the colour of that dot since pix is a byte". Then I realized, holy shit, that's exactly what it's doing! Haha, pretty damn cool discovery to my pointer-virgin antics.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Fri Apr 22, 2005 11:26 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Heh, I didn't understand all the 80's in other draw routines until I typed "320/4=80" in the last post then it all came together.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
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: Fri Apr 22, 2005 3:54 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Well, about "all this hocus pocus" Mr Green
pix=*(byte far *)(0xa0000000L+(long)displayofs+(long)i*80+(long)(x>>2));

Video memory starts at the memory position A000:0000 which leads to a hex representation of 0xa0000000.
Then the starting offset of the screen you currently see on your monitor is displayofs.
i*80 chooses the pixel row and x>>2 together with the VGAREADMAP command the pixel column.

But about this problem (which doesn't really make any sense at all):
Here are some debug variations, which could help finding the problem (I guess the problem will be found within the write function or some stupid compiler error... did you already find out for which people this works and for which it doesn't? Perhaps it's compiler dependent?):

::: CODE :::
for(i=199;i>=0;i--)
      {                                               // 64000 bytes image data
         for(x=0;x<320;x++)
         {
            byte mask=x&3,pix;
            VGAREADMAP(mask);            // also try uncommenting this line
            pix=(byte)(i*320+x);             // produce sequential numbers to see where numbers are doubled or whatever
            write(file,&pix,1);
         }
      }


::: CODE :::
for(i=199;i>=0;i--)
      {                                               // 64000 bytes image data
         for(x=0;x<319;x++)
         {
            byte mask=x&3,pix;
            VGAREADMAP(mask);
            pix=*(byte far *)(0xa0000000L+(long)displayofs+(long)i*80+(long)(x>>2));
            write(file,&pix,1);
         }
         pix=0xff;
         write(file,&pix,1);   // write a fixed right bound  (I guess this won't help that much)
      }


@Chris: TAB-P does basically the same as my routine except, that it messes up the whole memory to get a 64K buffer to be filled with the image data (MK_FP(0xa000,displayofs) is the same as (byte far *)(0xa0000000L+(long)displayofs)).
You also don't need any fmemcpy, as the for loops already put the image data into the buffer (dest is set to buffer + the plane number).
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 12 Dec 2017

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

PostPosted: Wed May 25, 2005 10:29 am
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I did some testing and found out that this is happening because the file is being created in TEXT mode instead of BINARY mode and therefore every 0x0A that is written becomes 0x0D, 0x0A.

Does replacing:
::: CODE :::
file=creat(fname,S_IREAD|S_IWRITE);

with
::: CODE :::
file=open(fname,O_CREAT| O_BINARY | O_WRONLY, S_IREAD | S_IWRITE | S_IFREG);

have any negative implications? My screenshots now work perfectly with that line changed.

EDIT: Changed the whole post once I found out what was happening.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
wolf3dbreaker
I am Death Incarnate
I am Death Incarnate


Joined: 09 Jun 2003
Last Visit: 29 Sep 2009

Topics: 31
Posts: 196
Location: Philippines
philippines.gif

PostPosted: Wed May 25, 2005 7:17 pm
   Subject: Re: [Code] Taking screenshots inside Wolf
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Well, no bugs for me here. Thanks mate! I almost broke my code just to find a fix for his bug Laughing

_________________
Gone from the community for a while. Will be back on July
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 2 Goto page 1, 2  Next
Jump to:  

Related topics
 Topics   Replies   Views   Last Post 
No new posts [Code] Blood Splatz Tutorial - Blood Splatters
Author: Dugtrio17
45 11219 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 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
 
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