The XL Engine is and will remain free, donations are purely optional but greatly appreciated.

Recent Comments

In the spirit of providing small but more frequent updates as progress is made, here is another – smaller update.

It turns out that I missed some code for region loading, so I’ve been filling in the blanks for the last few days.

The core missing functionality was the “map table” which contains simple data for all the locations inside a specific region – loading using the following function:

LoadMapTable(int region) – which loads data from “MAPTABLE.XXX”, where XXX = region number.

Its part of functionality that loads a new region of the map – such as the Daggerfall province (region 17). First it frees all the data from the old region then loads the maptable, then applies flags which are supplied from MAPSAVE.XXX, again XXX = region number. Interestingly MAPSAVE files are contained inside “mapsave.sav” which turns out to have the same archive format as the BSA files. Why not just call it mapsave.BSA then? I have no idea, lol. Anyway its a bit more complicated then that – but you get the idea. :)

Now that the map table is in place, several missing variables can be filled out allowing me to completely finish the Cell and Region loading code, which was only partially complete before. Which means that tomorrow I can go back to working on the actual use of that data.

Here’s some useful code for you:

** func_13DF8F(newRegion)   //eax
   LoadMapTable(int region) //eax
push ebp
mov ebp,esp
push ebx,ecx,edx,esi,edi
sub esp,00000004
mov [ebp-0018],eax   <- Loads the "region" into a local variable
mov eax,[ebp-0018]   <- Copies the local variable back to the register
call 00133DD49       <- Calls the useful function: _LoadMapTable(region)
lea esp,[ebp-0014]
pop edi,esi,edx,ecx,ebx,ebp

Things like this in the Daggerfall code just make me shake my head. :lol:

5 Responses to “Missing Code”

  • Seboss:

    Is that piece of assembler hand-crafted code or output from a compiler? If so, isn’t it surprising the compiler did not optimize the redundant copying away?

    • luciusDXL:

      I’m pretty sure it was generated by the compiler – I’ve seen the hand crafted assembly and it does look different. So the poor DOS-era compiler probably explains the first, smaller, issue. The main head scratcher is why the useful function wasn’t called directly – it does the same register preservation (i.e. pushes and pops), so literally nothing is gained by this setup. I think the C code literally looked like this:

      LoadMapTable(int region)

      but probably with different function names and maybe some comments.

  • daggeruser129:

    For those of us following along at home, where in the disassembly can we find this? I tried with disnasm but can’t find any function calls like 1333DD49 or anything at 13DF8F, though it’s possible I’m not disassembling FALL.EXE correctly. What tool do you use to disassemble?

Leave a Reply

The XL Engine is and will remain free, donations are purely optional but greatly appreciated.