Daggerfall Mod:DFRemake/DFEGetNext3dMemblock

The UESPWiki – Your source for The Elder Scrolls since 1995
Jump to: navigation, search

integer DFEGetNext3dMemblock ( DWORD MemblockPtr )[edit]

Inputs[edit]

  • MemblockPtr: The pointer to a memblock from the GET MEMBLOCK PTR command.

Outputs[edit]

Returns -1 if there are no objects left to iterate through. On success the result is a combination of the texture and image indices:

    Bytes 0-1: ImageIndex
    Bytes 2-3: TextureIndex

Description[edit]

Use this function to continue iterating through all faces with the same texture in the current 3d object after an initial call to DFEGetFirst3dMemblock. On success, the given memblock will contain object data for all faces with the same texture image. Memblocks should be allocated with the DFEGet3dSize() function (which will over-allocate which is fine).

Example[edit]

  Local ErrResult  as integer
  Local Size       as DWORD
  Local MemblockID as DWORD
  Local MeshID     as DWORD
  Local LimbIndex  as DWORD
  Local Index      as DWORD
  
  Size = DFEGet3dObjectSize()
  make memblock 1, Size
  
  TexValue   = DFEGetFirst3dMemblock(get memblock ptr(1))
  TexIndex   = TexValue >> 16
  ImageIndex = TexValue && 65535
  
  make mesh from memblock 2, 1
  make object 3, 2, 0
  delete mesh 2
  LimbIndex = 1
  
        `Add all limbs with alternate textures
  for Index = 0 to 1024
     TexValue = DFEGetNext3dMemblock(get memblock ptr(1))
     if (TexValue < 0) then Exit
  
     TexIndex   = TexValue >> 16
     ImageIndex = TexValue && 65535
     print "Texture Limb: " + str$(TexIndex) + ", " + str$(ImageIndex)
  
     make mesh from memblock 2, 1
     add limb 3, LimbIndex, 2
  
     delete mesh 2
     Inc LimbIndex
  next Index
  
   delete memblock 1