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] Cleaning up GFXV_WL6.H - Adam Biser
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: 13 Jun 2018

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

PostPosted: Tue Oct 12, 2004 9:45 am
   Subject: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

This file has a lot of unnecessary stuff in it that can be removed to make it easier to read and edit.

First off, there's that annoying break in the chunk list that has to be adjusted each time you add a chunk;
::: CODE :::
      GETPSYCHEDPIC,                       // 134

      ORDERSCREEN=136,

Let's get rid of this annoyance. (add the red line, comment or remove the blue text
::: CODE :::
      GETPSYCHEDPIC,                       // 134
      STARTTILE8,
      ORDERSCREEN, //136


Now go to the bottom of the file and remove these lines:
::: CODE :::
#define README_LUMP_START      3
#define README_LUMP_END         9

...
#define NUMFONTM     0
...
#define NUMPICM      0
#define NUMSPRITES   0
...
#define NUMTILE8M    0
#define NUMTILE16    0
#define NUMTILE16M   0
#define NUMTILE32    0
#define NUMTILE32M   0
#define NUMEXTERNS   13

#define STARTFONTM   3
...
#define STARTPICM    135
#define STARTSPRITES 135
#define STARTTILE8   135
#define STARTTILE8M  136
#define STARTTILE16  136
#define STARTTILE16M 136
#define STARTTILE32  136
#define STARTTILE32M 136
#define STARTEXTERNS 136


Now open ID_CA.C and go down to CAL_ExpandGrChunk and change
::: CODE :::
   if (chunk >= STARTTILE8 && chunk < STARTEXTERNS)
   {
   //
   // expanded sizes of tile8/16/32 are implicit
   //

#define BLOCK      64
#define MASKBLOCK   128

      if (chunk<STARTTILE8M)         // tile 8s are all in one chunk!
         expanded = BLOCK*NUMTILE8;
      else if (chunk<STARTTILE16)
         expanded = MASKBLOCK*NUMTILE8M;
      else if (chunk<STARTTILE16M)   // all other tiles are one/chunk
         expanded = BLOCK*4;
      else if (chunk<STARTTILE32)
         expanded = MASKBLOCK*4;
      else if (chunk<STARTTILE32M)
         expanded = BLOCK*16;
      else
         expanded = MASKBLOCK*16;
   }

To this:
::: CODE :::
#define BLOCK      64

   if (chunk == STARTTILE8)
      expanded = BLOCK*NUMTILE8;


Now the only things you have to worry about when you add a VGAGRAPH chunk are: NUMCHUNKS, NUMPICS and the three lump groups, if necessary. The remaining lump groups could be eliminated if you used the actual chunk enum names instead.



EDIT: Also, go into ID_VH.C and remove/comment these functions:
- VW_MeasureMPropString
- VWB_DrawTile8M

And in ID_VH.H remove/comment:
::: CODE :::
void VWB_DrawTile8M (int x, int y, int tile);
void VWB_DrawTile16 (int x, int y, int tile);
void VWB_DrawTile16M (int x, int y, int tile);
...
void VWB_DrawMPic(int x, int y, int chunknum);
...
void VWB_DrawMPropString (char far *string);
void VWB_DrawSprite (int x, int y, int chunknum);

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


Last edited by Adam Biser on Sat Nov 06, 2004 1:36 am; edited 1 time in total
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 14 Jun 2018

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

PostPosted: Sat Nov 06, 2004 1:32 am
   Subject: GFXV_WL6.H
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Nothing like finding easier and/or more proficient ways to deal with sections of the wolf3d code. Smile

Though this didn't get any replies, I think it's quite a fascinating idea. Makes it much easier for people who are constantly changing around VGAGRAPH images. Not sure if this matters, but the invalid filename in the title might throw people off a little - lol. Apart from that, the entire tutorial was pretty easy to follow, and works great; makes the exe 192 bytes smaller too.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Sat Nov 06, 2004 1:38 am
   Subject: Re: Cleaning up GFXV_WL6.H
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

@Chris: Thanks, it made things a lot simpler to handle, I thought.
I corrected the file name, thanks.

_________________
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: 13 Sep 2017

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

PostPosted: Sun Mar 06, 2005 8:06 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I took that a little further Adam... This way whenever I make a change (using WDC as I can insert the graphics into any part of the vgagraph file as I please) it doesn't require me to make other changes. I changed the end of the GFXV_WL6.H file so that it automatically updates the information itself... I changed the bottom to read:

::: CODE :::

//
// Data LUMPs
//
#define README_LUMP_START      (H_BJPIC) 
#define README_LUMP_END         (H_BOTTOMINFOPIC)

#define CONTROLS_LUMP_START   (C_OPTIONSPIC)
#define CONTROLS_LUMP_END      (C_JOY2PIC)

#define LEVELEND_LUMP_START   (L_GUYPIC)
#define LEVELEND_LUMP_END      (L_BJWINSPIC)

#define LATCHPICS_LUMP_START   (KNIFEPIC)
#define LATCHPICS_LUMP_END      (GETPSYCHEDPIC)


//
// Amount of each data item
//
#define NUMCHUNKS    (ENUMEND)
#define NUMFONT      2
#define NUMFONTM     0
#define NUMPICS      (STARTTILE8-3)
#define NUMPICM      0
#define NUMSPRITES   0
#define NUMTILE8     72
#define NUMTILE8M    0
#define NUMTILE16    0
#define NUMTILE16M   0
#define NUMTILE32    0
#define NUMTILE32M   0
#define NUMEXTERNS   (ENUMEND - ORDERSCREEN)  //13
//
// File offsets for data items
//
#define STRUCTPIC    0

#define STARTFONT    1
#define STARTFONTM   3
#define STARTPICS    3
#define STARTPICM    (STARTTILE8)
#define STARTSPRITES (STARTTILE8)
#define STARTTILE8   (STARTTILE8)
#define STARTTILE8M  (STARTTILE8+1)
#define STARTTILE16  (STARTTILE8+1)
#define STARTTILE16M (STARTTILE8+1)
#define STARTTILE32  (STARTTILE8+1)
#define STARTTILE32M (STARTTILE8+1)
#define STARTEXTERNS (STARTTILE8+1)
//
// Thank you for using IGRAB!
//


Not sure if this will help others... but it works great here!

Greg
BrotherTank
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Sun Mar 06, 2005 2:20 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Cool. Worked for me, too. It looks like you didn't get rid of some of the unnecessary #defines, but that doesn't really affect things.
So now you can just add items to the enum without making changes, unless the change is at the start or end of a lump, which it more than likely won't.

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Guest




Last Visit:





PostPosted: Sat Jul 02, 2005 4:45 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I'm really curious about why these code changes solve errors when adding new pictures
( http://diehardwolfers.areyep.com/viewtopic.php?t=3150 and http://diehardwolfers.areyep.com/viewtopic.php?t=3118)

...if someone could explain it to me, thanks in advance.

Are there limits to how many pictures I can add to VGAGRAPH afterwards?
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Sat Jul 02, 2005 8:14 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

The only thing this does is auto-calculates some values for you. The errors that were received were probably caused by someone not calculating them correctly and applying this code corrected that.

As to limitations, I don't know really. Memory will limit the amount, but it depends on how many chunks are loaded at one at one time. If you add a bunch of chunks for the read this screens, you can probably add a lot because those are read one-at-a-time and cleared from memory as soon as they are drawn, I believe.

EDIT: Glad this helped you out.

_________________
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: 13 Sep 2017

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

PostPosted: Sat Jul 02, 2005 8:26 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chogall wrote:
I'm really curious about why these code changes solve errors when adding new pictures...if someone could explain it to me, thanks in advance.


The main reason that people have problems or errors when adding pictures to the vgagraph file is due to the order or place in which they insert graphics... By this I mean that if you look at the above tutorial you will see that there is in fact 4 different areas or sections. Lets say that you add a new graphic to the end of the vga graphic pitcures in the file, then if you try to use it say the readme section it will not be cached.... Thus the errors. Using Floedit, you are limited to adding graphics to the end of the file, whereas WDC will insert graphics anywhere you want (I believe Chaos edit inserts anywhere as well, but I haven't tested it). So in order for your graphics to work properly, without error, you must insert the graphic you require into the proper "data lump" as Id refers to it ("section" as I did in this thread). This will ensure that when you are at each section of the game, the proper graphics are cached into the engine for you to use.

Chogall wrote:
Are there limits to how many pictures I can add to VGAGRAPH afterwards?


I haven't added that many to the file, so I couldn't tell you if there is a limit... or at least should I say, I haven't reached any limit yet...

Greg
BrotherTank
Guest




Last Visit:





PostPosted: Sat Jul 02, 2005 11:21 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I just noticed that the pictures I added for my new weapons don't work anymore (I only tested the picture for the ReadThis-Screen). I probably did something wrong when changing the code. It looks like this :

GETPSYCHEDPIC, // 134

// new images

WEAPONPIC1, // 135
WEAPONPIC2, // 136
READMEPIC1,

// tutorial changes

STARTTILE8,
ORDERSCREEN,
// ORDERSCREEN=138,

// -

ERRORSCREEN, // 137
T_HELPART, // 138
...

Can anyone help me?
BrotherTank
Forum Administrator
<B>Forum Administrator</B>


Joined: 01 Mar 2003
Last Visit: 13 Sep 2017

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

PostPosted: Sat Jul 02, 2005 12:58 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Ok... First this is a great example of what I meant about placement.... The readme pic that you added is located at the end of the Latchpics lump... thus when you go into the readme, that graphic is not cached and will not be available (and also making the program crash because it's outside the cached graphics bounds). To make the readme pic work it must be inserted within the Readme lump...

The two weapons pics will work if you adjust the Latchpic Lump defines... If you used my portion of the code I gave above then change the line:

#define LATCHPICS_LUMP_END (GETPSYCHEDPIC)

to read:

#define LATCHPICS_LUMP_END (WEAPONPIC2)


And if you go back delete the readmepic1 from where you have inserted it now and re-insert the readme graphic into the proper lump (after the H_Bottominfopic), and make it the last pic in the lump then the code would be adjusted from:

#define README_LUMP_END (H_BOTTOMINFOPIC)

to:

#define README_LUMP_END (READMEPIC1)

So the graphics for each lump must be inserted with that lump. You can't cross lumps as to do so will throw off the caching causing your program to crash.

Hope that helps, and yes what you have done is a great example of why the program crashes when inserting graphics and the numbers aren't adjusted properly and/or the graphics being called for are outside the current cached lump.

Greg
BrotherTank
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:32 ago.

Topics: 163
Posts: 8146
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sat Jul 02, 2005 7:00 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Chogall wrote:
Are there limits to how many pictures I can add to VGAGRAPH afterwards?

Yes, but the limits depend on if you mean doing so without changing how the code memory-manages the images in VGAGRAPH. It also depends on how much Conventional (or Main) memory you have on your machine.

Apparently, if you have too many images placed in the VGAGRAPH without re-writing some of the cache routines, you'll get "Out Of Memory!" errors like I did ... any time you completed a level. This happens even if you put a "ClearMemory" command right before the "LevelCompleted" routine is called. Trust me, I figured this out the hard way. Sad
Guest




Last Visit:





PostPosted: Sun Jul 03, 2005 10:40 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Okay, the weapon pictures work again - thanks!

And, by the way, my readme pic works too. Hope it stays this way and the game doesn't crash or something. Maybe I can add some more... I'd like to add a picture for every "section" of the text, but I'm using FloEdit and can't add pictures in the middle of the file Think
Do you think it would be possible to define a new, second lump for the readme?
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 1:32 ago.

Topics: 163
Posts: 8146
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Jul 03, 2005 6:22 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Yes, but the extra lump would be hard-coded into the source code, so FloEdit won't recognize it.

I've had no luck getting WDC to work properly with the VGAGRAPH file, but I think my problem is way too many runtime DLLs for too many versions of compiled VB-executables (Guess you really *can't* run everything in Win98 SE, lol).

I'd recommend you use Chaos Edit instead. It's a lot less of a headache than FloEdit, and will probably place the pictures in parts of the VGAGRAPH file that you want.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Sun Jul 03, 2005 7:13 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
I've had no luck getting WDC to work properly with the VGAGRAPH file

*cough* Still problems with the latest version? Win98SE should have no problems with it. I had no troubles correctly opening the VGAGRAPH file you sent to me.

OT: ReadMe pics can be anywhere, I believe. They are cached independently, drawn, then uncached.

_________________
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: 1:32 ago.

Topics: 163
Posts: 8146
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Sun Jul 03, 2005 7:31 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

OT -

Adam Biser wrote:
*cough* Still problems with the latest version? Win98SE should have no problems with it. I had no troubles correctly opening the VGAGRAPH file you sent to me.


I *guarantee* the problem isn't on your end. Really! Cheesy Grin

It won't run right on my PC because I have runtime DLLs installed for EXEs compiled in *several* versions of Visual Basic. WDC and Krazy Drake are both VB-compiled programs, and they don't run right because I have so many types of VB DLLs installed on my system.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Sun Jul 03, 2005 10:01 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Try the VB link on my site and see if that clears things up... maybe...

_________________
Orb of Dilaaria now has a Facebook page
Star Wars: Bloodlines now has a Facebook page
Guest




Last Visit:





PostPosted: Mon Jul 04, 2005 1:43 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Tricob wrote:
Yes, but the extra lump would be hard-coded into the source code, so FloEdit won't recognize it.


Do I need FE to recognize it? I'd just make the new readme pictures that were added at the end of VGRAGRAPH into a new lump...

By the way, where do I get ChaosEdit? I've searched before but couldn't find it anywhere.
Adam Biser
Utility Developer
Utility Developer


Joined: 06 Jun 2003
Last Visit: 13 Jun 2018

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

PostPosted: Mon Jul 04, 2005 10:48 am
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

FE will probably recognize it, so you needn't worry about that.

ChaosEdit (CE): http://diehardwolfers.areyep.com/viewtopic.php?t=3075

_________________
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: 1:32 ago.

Topics: 163
Posts: 8146
Location: Neo-traditions, Inc.
usa.gif

PostPosted: Mon Jul 04, 2005 7:06 pm
   Subject: Re: [Code] Cleaning up GFXV_WL6.H - Adam Biser
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Adam Biser wrote:
Try the VB link on my site and see if that clears things up... maybe...

Thanks. I've tried fixing the problem myself with no success. Smile
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] Add Text to Screen at Skill Level select - Chris
Author: Chris
3 2742 Tue Sep 28, 2010 6:59 pm
Tricob View latest post
No new posts [Code] Display Different Ammo Types on Statusbar-BrotherTank
Author: BrotherTank
1 2622 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 1909 Sat Mar 13, 2004 2:07 pm
BrotherTank View latest post
No new posts [Code] Changing an Enemies Attack Strength - BrotherTank
Author: BrotherTank
0 2218 Tue Jan 27, 2004 10:29 am
BrotherTank View latest post
No new posts [Code] Changing Weapons -CheckWeaponChange- BrotherTank
Author: BrotherTank
2 2976 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