Daggerfall:DFRemake/Resource - Dungeon
The resource manager will hold the needed information for one dungeon at a time.
Design Notes
- Although in DF, a Dungeon is composed of multiple blocks, here a Dungeon is a collection of objects (and other records). Blocks are only needed during dungeon creation and it will be easier to store the objects individually.
- Dungeon objects will be hidden/disabled when the player is not in the dungeon.
Objects
Objects within the dungeon include any static 3d object such as walls, rooms, furniture, etc.... Dungeon objects will be stored in one list, RMDungeonObjects() with the following fields.
- DWORD ObjectID: The DarkBasic object ID.
- DWORD RefObjectID: The referenced object ID (dungeon objects will be instanced). The referenced ID is stored so that it can be
properly dereferenced once the dungeon is destroyed (for reference counting).
- DWORD Flags: Various object parameters.
Flats
Flats will be stored in a separate list, RMDungeonFlats(), so they can be quickly accessed. They will use the same fields as objects.
Actions
Actions include things like switches, levers, and platforms that can move. Doors do not use action records.
- DWORD ActionID: The unique value for this action.
- DWORD SourceObjectID: The object that triggers this action.
- DWORD TargetObjectID: This value is 0 if the action has no target object.
- BYTE ActionType: Type of action to perform (translation, rotation, etc...)
- DWORD Flags: Various flags depending on the action type.
- float Duration: How long to perform the action (seconds).
- float Delta: How much action to perform over the duration (depends on the action type).
Lights
The list of lights in the dungeon, RMDungeonLights(), with the following fields.
- DWORD LightID: The DarkBasic light identifier value.
- DWORD Flags: Holds various light parameters.
Exits
A list of dungeon exits, RMDungeonExits(). Although there is usually only one exit in a dungeon, we'll use a list for flexability.
- ObjectID?
- Destination information (exterior location, X/Y/Z?)
Functions
- RMInitDungeon : Initializes the dungeon resource manager at startup.
- RMDestroyDungeon : Destroys the dungeon resource manager at program end.
- RMResetDungeon : Clears the current dungeon information.
- RMLoadDungeonBlock : Loads a dungeon block file and adds it to the current dungeon.
- RMFindDungeonObjectID : Searches dungeon objects for the given object.
- RMMakeDungeonBlockFilename : Create a dungeon block filename for loading from Blocks.bsa.
- RMCreateDungeon : Creates the current dungeon (as set in DFELibrary).
- RMEnableDungeon : Enables and displays the current dungeon.
- RMDisableDungeon : Disables and hides the current dungeon.