type of enum from old code - Printable Version
+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: type of enum from old code (/thread-4762.html)
type of enum from old code - akb825 - Nov 23, 2005 09:20 PM
I'm porting Wolfenstein 3D to Mac OS X (the PC version), and I noticed that a lot of the time there are enums that are read or written from the system. I want to have saves backwards compatible to the PC, so I'm swapping the bytes of the save files on big endian Macs. (as in pre-intel) I was wondering, since there is no type specified for the enums, and this was written in 1992 in the time of 16 bit processors, does that mean that they were the equivalent of today's 16 bit shorts?
Edit: what about ints? I'd imagine they'd be the same as the enums
Editx2: I noticed it's set up to read entire sets of structures at once for saved games, which would be somewhat lengthy to change. Would it be worth it to support legacy saved games, or would any game saved within the last 10 years (even using the same executable) end up using 32 bit ints etc.? Or would it stay as 16 bit since that's what it likely was compiled in?
type of enum from old code - Zekaric - Nov 24, 2005 11:16 AM
Most compilers treat enums as int. Wolfy was way back in the dos days to I wouldn't be surprised they are 16 bit ints (shorts). I'm also not too surprised thay just save the structures as is to disk. It might be easiest to make a legacy structure to read (and write?) game data. Then move the information over to a more modern structure with applicable byte swapping.
People still have saved games for wolfenstein?! I personally wouldn't bother too much but if you want to be thorough you'd keep binary compatibility.
type of enum from old code - akb825 - Nov 24, 2005 12:25 PM
After looking thorough it, I think it would end up breaking compatibility with modern ports of Wolf 3D, which would be worse IMO then breaking compatibility with older saves, so I won't bother. Thanks for the info, though.