Doom Comic
Register | User Profile | Member List | F.A.Q | Privacy Policy | New Blog | Search Forums | Forums Home
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Variable sizes in original source
 
Author
All times are GMT. The time now is 08:13. Post New Thread    Post A Reply
Scet
Mini-Member


Posts: 85
Registered: 05-06


Hi everyone. I'm once again working on my C# port of Doom and have a few questions.

I've been going through the source code and am confused as to the difference between int and short. I know short is 2 bytes, the problem is with int, I thought it was 4 bytes, but in r_defs.h some of the structures stored in the WADs that use 2-byte fields are stored as ints. fixed_t is a typedef for int and vertex_t is stored as two fixed_ts yet in the WAD it's two shorts.

Another one I don't understand is angle_t:

typedef unsigned angle_t;

Is this unsigned short or unsigned int?

Thanks.

Old Post 05-24-08 23:01 #
Scet is offline Profile || Blog || PM || Email || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Graf Zahl
Forum Legend


Posts: 4130
Registered: 01-03


int and unsigned int are 4 bytes. Many values that are stored as shorts in the map are either extended internally or converted to 16.16 fixed point numbers which technically means, the value is shifted 16 bits left.

Old Post 05-24-08 23:04 #
Graf Zahl is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Scet
Mini-Member


Posts: 85
Registered: 05-06


Wow that was fast. Thanks Graf Zahl.

Old Post 05-24-08 23:08 #
Scet is offline Profile || Blog || PM || Email || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
fraggle
Super Moderator


Posts: 4299
Registered: 07-00


It's also worth bearing in mind that the "long" type is also 32 bits. Long is used in several places in the original source, but on some architectures (and in C#) long is 64 bits.

Old Post 05-25-08 00:58 #
fraggle is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Scet
Mini-Member


Posts: 85
Registered: 05-06


I asked because I've worked on some architectures (embedded systems and 16-bit DOS programs) where int was 2-bytes in C, but being used to C# I used int everywhere thinking it would be 4-bytes. Having been written for DOS I thought Doom might have the same problem so I had to be sure.

Thanks guys.

Old Post 05-25-08 02:18 #
Scet is offline Profile || Blog || PM || Email || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
Graf Zahl
Forum Legend


Posts: 4130
Registered: 01-03


Although Doom was for DOS it was 32 bit. Even in 1993 16 bit mode was far too limited for games.

Old Post 05-25-08 08:14 #
Graf Zahl is offline Profile || Blog || PM || Email || Homepage || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
leileilol
dork stalker


Posts: 2379
Registered: 06-04


Yeah my attempts at making real-mode 3D fpses in 1995 were horribly aggravating, having to use very low res textures and wacky hz sounds (8000hz), and even then you're lucky to have it running at all with sound and 3d and not playing like wolfenstein, trying to respect the strict 640kb limit. I sure don't miss those times (in development). Doom would have not been possible without protected mode

Old Post 05-25-08 09:37 #
leileilol is offline Profile || Blog || PM || Search || Add Buddy Report to mod || IP || Edit/Delete || Quote
All times are GMT. The time now is 08:13. Post New Thread    Post A Reply
 
Doomworld Forums : Powered by vBulletin version 2.2.5 Doomworld Forums > Classic Doom > Source Ports > Variable sizes in original source

Show Printable Version | Email this Page | Subscribe to this Thread

 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are OFF
[IMG] code is ON
 

< Contact Us - Doomworld >

Powered by: vBulletin Version 2.2.5
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Forums Directory