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       

The original Wolf3D source code
Page 1 of 1
DieHard Wolfers Forum Index -> Code Crackers 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
Matthew
DieHard SS
DieHard SS


Joined: 02 Jul 2007
Last Visit: 13 Jun 2018

Topics: 93
Posts: 467

usa.gif

PostPosted: Thu Oct 13, 2011 6:39 pm
   Subject: The original Wolf3D source code
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Next PostGoto Bottom of Posts

In the original Wolf3D, it uses a lookup array ("farmapylookup") to store the pre-calculated offset of each row of the map.

Wasn't this pointless? Since the size of the map is a power of 2, calculating the row offsets only requires one left shift operation. Doesn't the array lookup take at least as long as calculating it with a left shift would?
Tricob
Moderator
<B>Moderator</B>


Joined: 14 Mar 2005
Last Visit: 0:13 ago.

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

PostPosted: Fri Oct 14, 2011 7:11 am
   Subject: Re: The original Wolf3D source code
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

I believe the code you're referring to was also mentioned in another thread. It's cool you noticed this without any help, though. Smile

TexZK wrote:
We can also delete the "farmapylookup[]" array by replacing every token with "(whatever_y<<6)". In fact, the values of the array are just multiplies of 64. I've thought this while looking at the texture coordinates, where every row is shifted left by 6. Textrues are 64*64, and maps are too.
Matthew
DieHard SS
DieHard SS


Joined: 02 Jul 2007
Last Visit: 13 Jun 2018

Topics: 93
Posts: 467

usa.gif

PostPosted: Sat Oct 15, 2011 1:02 pm
   Subject: The original Wolf3D source code
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Next PostGoto Bottom of Posts

Actually, I first learned of this a few years ago, when I was porting the "free pushwalls" feature from Wolf4GW (of course it's also in Wolf4SDL) to the DOS Wolf3D. What I have come to realize since then is that using lookup arrays for that was pointless to begin with. It didn't make the game run any faster.

There's also "nearmapylookup", which isn't even used at all. I wonder what that was for.

Those two arrays waste a total of 256 bytes of near memory.



Here are some other things that I've noticed in the original Wolf3D source code:

* Even though there are only 4 weapons that the player can carry, NUMWEAPONS is defined as 5. Was that a mistake, or was there an additional weapon that was cut from the game?

* "attackinfo" is defined as "attackinfo[4][14]", even though it's supposed to be "attackinfo[4][4]". This apparantly results in a significant amount of near memory being wasted.

* The player's health is stored in the "gamestate" structure. There's no need for that -- it would save memory, and make more sense, to use "player->hitpoints".
Chris
DieHard Wolfer
DieHard Wolfer


Joined: 11 Mar 2003
Last Visit: 14 Jun 2018

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

PostPosted: Wed Oct 26, 2011 12:50 pm
   Subject: Re: The original Wolf3D source code
   [ IP : Logged ]
Reply with quote
Goto Top of PostsGoto Previous PostGoto Bottom of Posts

Yes. I think Ripper got rid of those lookup tables completely in Wolf4SDL too for similar reasons.

Matthew wrote:
* The player's health is stored in the "gamestate" structure. There's no need for that -- it would save memory, and make more sense, to use "player->hitpoints".

I agree. From what I remember, I think this idea (moving stuff from gamestate to player->) was used in memboost too.

Matthew wrote:
* "attackinfo" is defined as "attackinfo[4][14]", even though it's supposed to be "attackinfo[4][4]". This apparantly results in a significant amount of near memory being wasted.

Cool. Thanks for pointing this out! Thumbs Up
Display posts from previous:   
Post new topicReply to topic Time synchronized with the forum server time
DieHard Wolfers Forum Index -> Code Crackers 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 Sticky: [Info] Compiling the Source Code...
Author: Guest
52 3004 Sat Feb 10, 2007 12:38 pm
Harry sr View latest post
No new posts Altering the "This Episode is not in the shareware!&quo
Author: Guest
1 71 Mon Aug 30, 2004 1:16 am
TexZK View latest post
No new posts [Code] Run with Stamina - TekZK
Author: BrotherTank
8 2964 Sun May 16, 2004 12:54 am
Codetech84 View latest post
This topic is locked: you cannot edit posts or make replies. [Info] Source code for Darkone's NewWolf Classic
Author: Raistlin
1 1639 Tue Feb 10, 2004 10:18 am
BrotherTank View latest post
No new posts [Info] Slideshows Between Levels? - SoD side of Code
Author: Hair Machine
2 1376 Fri Dec 26, 2003 11:02 am
jamez 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