DooMBoy Posted November 25, 2002 I'm just curious, exactly what happens when you load a wad into ZDoom? 0 Quote Share this post Link to post
DooMBoy Posted November 25, 2002 Thank you, Julian, for that insightful post, and for telling me exactly what I already knew! :D 0 Quote Share this post Link to post
Biffy Posted November 27, 2002 DooMBoy said:I'm just curious, exactly what happens when you load a wad into ZDoom? It gets ready to play it for you, er, with you, er, against you. Pfft. 0 Quote Share this post Link to post
DOOM Anomaly Posted November 27, 2002 Ummmm..DooMBoy, please restate the question and clarify what you are trying to ask here, cause the question seems kinda broad. 0 Quote Share this post Link to post
KDarigal Posted November 27, 2002 Step 1: ZDoom opens it using one of the standard C file-open calls (durrr, fopen()?). Step 2: It reads the first four bytes to ensure that the file is either an IWAD or a PWAD. If not, you get an error and ZDoom probably quits. Step 3: Having completed step 2 successfully, ZDoom reads the next four bytes to determine the beginning of the WAD directory. Step 4: Starting at the location in the file just given by the result of step 3 (fseek() this time, I think), it starts reading in the entire WAD directory, which consists of entry-name/location pairs (8 bytes for the entry name, 4 for the location). ...if you need more info, I'll try and figure out what goes on afterwards, but this is enough for now. 0 Quote Share this post Link to post
boris Posted November 27, 2002 KDarigal said:Step 1: ZDoom opens it using one of the standard C file-open calls (durrr, fopen()?). Well, I guess ZDoom uses C++ classes and methods to do that. 0 Quote Share this post Link to post
Quasar Posted November 27, 2002 Actually I don't think Randy has cpp'ized the wad code yet. I could check again though :P 0 Quote Share this post Link to post
DooMBoy Posted November 27, 2002 Hey, KDarigal, thanks for the info! I am enlightened! :) 0 Quote Share this post Link to post
Biffy Posted November 27, 2002 DooMBoy said:Hey, KDarigal, thanks for the info! I am enlightened! :) Of what use shall you now make of your enlightment, DooMBoy? :) 0 Quote Share this post Link to post
Enjay Posted November 27, 2002 KDarigal said:Step 2: It reads the first four bytes to ensure that the file is either an IWAD or a PWAD. If not, you get an error and ZDoom probably quits. Not sure about that one (like I would know) but Zdoom can read other files too. As, apparently can most ports, even the original doom.exe If you present Zdoom with a file format it understands, it will read it and apply it: eg, zdoom -file d_runnin.mp3 will happily load an mp3 called D_RUNNIN.MP3 and play it as the music on MAP01 eg2, zdoom -file mapinfo.txt will load a text file containing mapinfo style information and append it to any mapinfo information already present. etc etc... In addition, it supports other FPS game files to a certain extent: It supports Blood format files to load the sounds for the Blood Bath Announcer. It can read Build format maps and let you inspect them. 0 Quote Share this post Link to post
DooMBoy Posted November 27, 2002 Biffy said:Of what use shall you now make of your enlightment, DooMBoy? :) I shall store it away in my brain, so that I might use this info when another person asks this very same question about a year from now :) 0 Quote Share this post Link to post
Captain Red Posted November 28, 2002 Enjay said: It can read Build format maps and let you inspect them. I did no know that! How do you load up, say, the first duke nukem 3d map? 0 Quote Share this post Link to post
DOOM Anomaly Posted November 28, 2002 DooMBoy said:I shall store it away in my brain[...]..hmph, good luck finding one. 0 Quote Share this post Link to post
DooMBoy Posted November 28, 2002 Speak for yourself, you always refer to yourself in the third person like a friggin' caveman. 0 Quote Share this post Link to post
DOOM Anomaly Posted November 28, 2002 DooMBoy said:Speak for yourself, you always refer to yourself in the third person like a friggin' caveman. DooMBoy find wrong with it? 0 Quote Share this post Link to post
Fletcher` Posted November 29, 2002 I am not amused. Seriously, even I don't act that stupid. And mind you, I do have my moments... 0 Quote Share this post Link to post
Captain Red Posted November 29, 2002 Settle down children. don't make me bring pinky here... 0 Quote Share this post Link to post
DOOM Anomaly Posted November 29, 2002 ravage said:I am not amused. Seriously, even I don't act that stupid. And mind you, I do have my moments... Well, not to antagonize anyone here, but, If I actually did care what anyone thinks of me, Do you think I would be like this?? Didn't think so. Warn me as you will, but I go here as I do in everything else: Till The bitter end. 0 Quote Share this post Link to post
myk Posted November 29, 2002 I think you could scare some newbies with that "We are not amused" title. More so combined with the hooded skull avatar. 0 Quote Share this post Link to post
DOOM Anomaly Posted November 29, 2002 myk said:I think you could scare some newbies with that "We are not amused" title. More so combined with the hooded skull avatar. I have a animated gif of the hereskull Dee-Lee thingy I did, it changes appearances, but I have no where to host it. But hey, I'd love to scare off annoying newbs, but by doing that I would have to radicate of myself, so, hmm... 0 Quote Share this post Link to post
Fletcher` Posted November 29, 2002 DOOM Anomaly said:I have a animated gif of the hereskull Dee-Lee thingy I did, it changes appearances, but I have no where to host it. But hey, I'd love to scare off annoying newbs, but by doing that I would have to radicate of myself, so, hmm... You don't need a host, check profile options. You can upload directly from your comp. See my new fish? 0 Quote Share this post Link to post
DOOM Anomaly Posted November 29, 2002 ravage said:You don't need a host, check profile options. You can upload directly from your comp. See my new fish? yes, but then its the matter of, I gotta figure out how. 0 Quote Share this post Link to post
fraggle Posted November 30, 2002 1. The source port opens the file for reading. Like Mdenham says, this is done with standard OS calls such as fopen. 2. The 'header' of the file is read. This basically just says the type of wad (IWAD/PWAD), the location of the directory in the file and the number of entries. 3. Part of WAD files is the "directory" which lists all the data which is stored in the file. You can see the directory by loading the WAD in WinTex/NWT. The doom port reads the whole directory into memory. Smart ports store it in a hash table. A hash table is a way of sorting through data such that you can look up things stored in it very quickly. So, if I want to find information about the lump named "TITLEPIC", I can search the hash table for the entry named "TITLEPIC" and find it almost instantly. The original doom used a linear search which is much less efficient (a linear search means searching through every entry in the list until you find the one you want). I believe the boom team quoted something around a 200-300% increase in framerate from just switching to a hashtable. Some ports still use a linear search. 4. Some ports sort things into namespaces (sprites, flats etc) based on the ?_START..?_END lumps and keep different lists for different types of data. 5. Consecutively loaded wads are stored in a "chain". When searching for a lump, the WAD code searches through each entry in the chain until it finds a match. New WADs are placed at the start of the chain. In this way, WADs can be used as "patches" which replace things loaded earlier (like the IWAD). 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.