Daggerfall Mod:DFRemake/DFEGetNextDungeonObject

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

integer DFEGetNextDungeonObject ( DWORD MemblockPtr )[edit]

Inputs[edit]

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

Outputs[edit]

Returns 0 if there are no objects left in the current block to iterate through or 1 on success.

Description[edit]

Continues iterating through objects in the current dungeon block, storing information in the given memblock, after an initial call to DFEGetFirstDungeonObject. Memblocks should be allocated with 256 bytes. The memblock structure is as follows:

       DWORD  ObjectValue;    /* The object used (from arch3d.bsa) */
       float  XPos;           /* Position of object in block */
       float  YPos;
       float  ZPos;
       float  XAngle;         /* Angle of object in block */
       float  YAngle;
       float  ZAngle;
       DWORD  GridX;          /* Dungeon grid, most likely not needed */
       DWORD  GridY;

The format will likely be extended as fields as needed.

Example[edit]

  Local Result as Integer
  Local Object as DWORD
  Local XPos   as float
  Local YPos   as float
  Local ZPos   as float

  make memblock 1, 256
  Result = DFEGetFirstDungeonObject(get memblock ptr(1))

  while ( Result )
     Object = memblock dword(1,  0)
     XPos   = memblock float(1,  4)
     YPos   = memblock float(1,  8)
     ZPos   = memblock float(1, 12)
     Print "Dungeon block as object #", ObjectValue, " at position: ", XPos, ", ", YPos, ", ", ZPos

     Result = DFEGetNextDungeonObject(get memblock ptr(1))
  endwhile

  delete memblock 1