Mohaa's .bsp within Unity 3D
Based on the prototype uQuake3 I'm trying to get the moh-bsp to work within Unity3D.
Source: https://github.com/mikezila/uQuake3
This is the error I get
NullReferenceException: Object reference not set to an instance of an object
SharpBSP.BSPHeader.ReadMagic () (at Assets/Scripts/uQuake/Types/BSPHeader.cs:91)
SharpBSP.BSPHeader..ctor (System.IO.BinaryReader BSP) (at Assets/Scripts/uQuake/Types/BSPHeader.cs:31)
SharpBSP.BSPMap.ReadHeader () (at Assets/Scripts/uQuake/Types/BSPMap.cs:82)
So what I get from this is that it goes wrong from the part where it tries to read the 4 first binaries. In Quake 3 the first 4 are 49 42 53 50 (IBSP) while in mohaa it is 32 30 31 35 (2015). What I don't understand is where I change this. I tryed to trace back to the beginning and vice versa but I don't see it anywhere.
Code:
private void ReadMagic()
{
BSP.BaseStream.Seek(0, SeekOrigin.Begin);
Magic = new string(BSP.ReadChars(4));
}
private void ReadVersion()
{
BSP.BaseStream.Seek(4, SeekOrigin.Begin);
Version = BSP.ReadUInt32();
}
I've marked the 91 line which is where unity3D breaks. Any advice/clues on how I could get passed this phase?