DaggerXL is a Modern Daggerfall Engine Recreation for current Operating Systems and hardware – essentially it is a remake in the spirit of a port. It will ultimately fully emulate the game of Daggerfall and then optionally enhance it by refining existing features and adding new gameplay elements that were originally intended. The game will make use of hardware acceleration providing higher resolutions, color depth, greatly improved visibility, better texture filtering, enhanced performance and more. In addition DaggerXL will support full modability, similar to more modern Elder Scrolls games, using custom tools.

Post news Report content RSS feed October 20, 2013 - Daggerfall Code Map

I’ve been working feverishly on the Beta lately and have decided to take a step back and look and what’s been accomplished. While it’s hard to say, linearly, how far along things are – going through the code just doesn’t work that way – I can show a “map” of the code as seen so far.

Posted by on

I’ve been working feverishly on the Beta lately and have decided to take a step back and look and what’s been accomplished. While it’s hard to say, linearly, how far along things are – going through the code just doesn’t work that way – I can show a “map” of the code as seen so far.

For many of the files (21 of them) I know the actual name used, which I will provide. For other files, I don’t know the real name but do know about the functionality provided (to varying levels).

Numerical values shown are the first 3 numbers of the in-memory hex addresses – for example 0x16F4C7 “LoadCell()” would be shown as 16F. This is a high level map, so only file names are shown.

MAP:
Start Address | Code File or Description
————————————————————–
130 | main game loop (3D view) – file name unknown (yet)
132 | archive.c
134 | engsupp.c
13D | maploads.c
144 | career.c
147 | automap.c
155 | fs2df.c
15A | intro.c
15D | init.c
15D | text.c
166 | parse.c
16B | quests.c
16E | LoadCell and support – file name unknown (yet)
178 | char.c
18C | disk.c
192 | weapon.c
19B | loadsave.c
19C | support.c
1A0 | interface.c
1A5 | objlib.c
1A6 | maplogic.c
——————————–
Files names below this point are unknown but functionality is.
——————————–
1B0 | c-lib (malloc, free, fopen, fread, fclose, memset, rand,etc.)
1E0 | 3D rendering functionality
240 | mouse and font functionality

This includes sound support but I’ve re-written most of that already to support OpenAL.

I should also mention that most c-lib functions are not being written based off of the Daggerfall code – instead the modern equivalents are used (DOS based file system support, for example, isn’t very useful on Windows).

The major exception to this is rand() – since it must act exactly like vanilla Daggerfall, otherwise dungeon textures will be wrong. Yes, you read that right – here’s why:

code:
word textureTableSrc[5]=  //0x28617C
{ 119, 120, 122, 123, 124 };
word textureTableCur[5];  //0x286186

void InitializeTextureTable()
{
  int r0 = rand();
  srand( curLocationRec->locationID>>16 );
  byte r = randByte();
  int r2 = _texRandTable[ r ];

  memcpy(textureTableCur, textureTableSrc, 10);
  for (int i=0; i<5; i++)
  {
    byte n = random_range(0, 4);
    if ( n == 2 )
    {
      n += 2;
    }
    n += textureTableSrc[r2];
    textureTableCur[i]= n;
  }

  srand(r0);
}

 

textureTableCur[] now contains texture file indices which are used to texture the various dungeon sections (modulo 5). As you can tell, if the random number generator is even slightly different, the dungeons will be textured completely differently. As it is, it works because the random number seed is based off the location ID – but note that the generator is re-seeded at the end so things like loot, random encounters, etc. are not affected by the locationID as well. :)

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.

Icon
Elder Scrolls II: Daggerfall
Developer
XL Engine Dev
Contact
Send Message
Homepage
Xlengine.com
Release date
Mod watch
Start tracking
News
Browse
News
New
Post news
Share
Related Games
Related Groups
XL Engine Dev
XL Engine Dev Developer