Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

OBT/CBT2 Map Loading

Joined
Jan 4, 2007
Messages
1,600
Reaction score
217
Hey everyone,

I was wondering: has anyone managed to load the new Gunz 2 maps (OBT/CBT2 pvp_mansion2) yet?

I'm trying to get it to work but it just shows me the objects in the map...

0fHGm - OBT/CBT2 Map Loading - RaGEZONE Forums
 

Attachments

You must be registered for see attachments list
2D > 3D
Member
Joined
Dec 19, 2008
Messages
2,413
Reaction score
1,193
Christina had all the new assets running from the PWE RaiderZ stuff, I highly doubt that it is much different in the GunZ II files.
 
Junior Spellweaver
Joined
Feb 4, 2008
Messages
122
Reaction score
148
The objects that you load are the 0x5012 version, the others are 0x5013, doing small changes you can load them.

Code:
 bool EluLoader::ReadMesh5013(Loader::FileLoader &File, Loader::EluMesh &Mesh){
    char tmp_name[128];
    // Read the name
    memset(tmp_name, 0, 128);
    File.Read(tmp_name, File.ReadUInt());
    tmp_name[127] = 0;
    Mesh.Name = tmp_name;


    int flags = File.ReadInt();


    //Read the parent name
    memset(tmp_name, 0, 128);
    File.Read(tmp_name, File.ReadUInt());
    tmp_name[127] = 0;
    Mesh.ParentName = tmp_name;


    //Read world matrix
    File.Read(Mesh.WorldMatrix, 16 * sizeof(float));


    Skip(File, 16);


    //Vertex
    Mesh.vCount = File.ReadUInt();
    Mesh.Vertex = ReadVec3(File, Mesh.vCount);


    //Texture Coord
    Mesh.tCount = File.ReadUInt();
    Mesh.TexCoord = ReadVec3(File, Mesh.tCount);


    unsigned int nUnk1 = File.ReadUInt();
    Skip(File, nUnk1 * sizeof(Vec3));


    //Normal
    Mesh.nCount = File.ReadUInt();
    Mesh.Normal = ReadVec3(File, Mesh.nCount);




    //Tangent
    Mesh.tgCount = File.ReadUInt();
    Mesh.Tangent = ReadVec4(File, Mesh.tgCount);


    //TexCoord 2
    Mesh.t2Count = File.ReadUInt();
    Mesh.TexCoord2 = ReadVec3(File, Mesh.t2Count);






    //Read indices
    unsigned int nTriangles = File.ReadUInt();
    if (nTriangles > 0)
    {
        Mesh.iCount = File.ReadUInt();
        nTriangles = File.ReadUInt();


        Mesh.vIndex = new unsigned short[Mesh.iCount];
        Mesh.nIndex = new unsigned short[Mesh.iCount];
        Mesh.tIndex = new unsigned short[Mesh.iCount];
        Mesh.tgIndex = new unsigned short[Mesh.iCount];


        Mesh.vMat = new unsigned short[nTriangles];


        for (int i = 0; i < nTriangles; ++i)
        {
            unsigned int nVert = File.ReadUInt();
            for (int j = 0; j < nVert; ++j)
            {
                Mesh.vIndex[i*3 + j] = File.ReadUShort();
                Mesh.tIndex[i*3 + j] = File.ReadUShort();
                Mesh.tgIndex[i*3 + j] = File.ReadUShort();
                Mesh.nIndex[i*3 + j] = File.ReadUShort();


                Skip(File, 4);
            }
            Mesh.vMat[i] = File.ReadUShort();
        }
    }


    Skip(File, File.ReadUInt() * sizeof(Vec3));
    Skip(File, 4);


    Mesh.bvCount = File.ReadUInt();
    for (int i = 0; i < Mesh.bvCount; ++i)
    {
        unsigned int bInfluence = File.ReadUInt();
        // short index, index; float Weight
        Skip(File, bInfluence * 8);
    }


    Skip(File, 4);


    //Skip(File, 12 * File.ReadUInt());
    //---------------------------------------------
    Mesh.SubIndexCount = File.ReadUInt();
    Mesh.vIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.nIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.tIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.t2Index2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.tgIndex2 = new unsigned short[Mesh.SubIndexCount];
    for (int i = 0; i < Mesh.SubIndexCount; ++i)
    {
        ///Skip(File, 8);
        Mesh.vIndex2[i] = File.ReadUShort();
        Mesh.nIndex2[i] = File.ReadUShort();
        Mesh.tIndex2[i] = File.ReadUShort();
        Mesh.t2Index2[i] = File.ReadUShort();
        Mesh.tgIndex2[i] = File.ReadUShort();
        Skip(File, 2);
    }
    //----------------------------------------------


    Skip(File, (64 + 2) * File.ReadUInt());


    //Mat ID list
    Mesh.MatCount = File.ReadUInt();
    if (Mesh.MatCount > 0)
    {
        Mesh.Mats = new EluMatID[Mesh.MatCount];
        File.Read(Mesh.Mats, Mesh.MatCount * sizeof(EluMatID));




        Mesh.bMVis = new bool[Mesh.MatCount];
        for (int i  = 0; i < Mesh.MatCount; ++i)
            Mesh.bMVis[i] = true;
    }


    //Skip(File, 2 * File.ReadUInt());
    //-----------------------------------------------
    Mesh.IndexCount = File.ReadUInt();
    Mesh.Index = new unsigned short[Mesh.IndexCount];
    File.Read(Mesh.Index, 2*Mesh.IndexCount);
    //-----------------------------------------------


    //boundig box
    File.Read(Mesh.bBox, 2*sizeof(Vec3));
    return true;
}


bool EluLoader::ReadMesh5012(Loader::FileLoader &File, Loader::EluMesh &Mesh)
{
    char tmp_name[128];
    // Read the name
    memset(tmp_name, 0, 128);
    File.Read(tmp_name, File.ReadUInt());
    tmp_name[127] = 0;
    Mesh.Name = tmp_name;


    //Read the parent name
    memset(tmp_name, 0, 128);
    File.Read(tmp_name, File.ReadUInt());
    tmp_name[127] = 0;
    Mesh.ParentName = tmp_name;


    Skip(File, 12);


    //Read world matrix
    File.Read(Mesh.WorldMatrix, 16 * sizeof(float));


    Skip(File, 8);


    //Vertex
    Mesh.vCount = File.ReadUInt();
    Mesh.Vertex = ReadVec3(File, Mesh.vCount);


    //Normal
    Mesh.nCount = File.ReadUInt();
    Mesh.Normal = ReadVec3(File, Mesh.nCount);


    //Tangent
    Mesh.tgCount = File.ReadUInt();
    Mesh.Tangent = ReadVec4(File, Mesh.tgCount);




    int i = File.ReadUInt();


    //Texture Coord
    Mesh.tCount = File.ReadUInt();
    Mesh.TexCoord = ReadVec3(File, Mesh.tCount);


    //TexCoord 2
    Mesh.t2Count = File.ReadUInt();
    Mesh.TexCoord2 = ReadVec3(File, Mesh.t2Count);


    




    //Read indices
    unsigned int nTriangles = File.ReadUInt();
    if (nTriangles > 0)
    {
        Mesh.iCount = File.ReadUInt();
        nTriangles = File.ReadUInt();


        Mesh.vIndex = new unsigned short[Mesh.iCount];
        Mesh.nIndex = new unsigned short[Mesh.iCount];
        Mesh.tIndex = new unsigned short[Mesh.iCount];
        Mesh.tgIndex = new unsigned short[Mesh.iCount];


        Mesh.vMat = new unsigned short[nTriangles];


        for (int i = 0; i < nTriangles; ++i)
        {
            unsigned int nVert = File.ReadUInt();
            for (int j = 0; j < nVert; ++j)
            {
                Mesh.vIndex[i*3 + j] = File.ReadUShort();
                Mesh.tIndex[i*3 + j] = File.ReadUShort();
                Mesh.tgIndex[i*3 + j] = File.ReadUShort();
                Mesh.nIndex[i*3 + j] = File.ReadUShort();


                Skip(File, 4);
            }
            Mesh.vMat[i] = File.ReadUShort();
        }
    }


    Skip(File, File.ReadUInt() * sizeof(Vec3));
    Skip(File, 4);


    Mesh.bvCount = File.ReadUInt();
    for (int i = 0; i < Mesh.bvCount; ++i)
    {
        unsigned int bInfluence = File.ReadUInt();
        // short index, index; float Weight
        Skip(File, bInfluence * 8);
    }


    Skip(File, 4);


    //Skip(File, 12 * File.ReadUInt());
    //---------------------------------------------
    Mesh.SubIndexCount = File.ReadUInt();
    Mesh.vIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.nIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.tIndex2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.t2Index2 = new unsigned short[Mesh.SubIndexCount];
    Mesh.tgIndex2 = new unsigned short[Mesh.SubIndexCount];
    for (int i = 0; i < Mesh.SubIndexCount; ++i)
    {
        ///Skip(File, 8);
        Mesh.vIndex2[i] = File.ReadUShort();
        Mesh.nIndex2[i] = File.ReadUShort();
        Mesh.tIndex2[i] = File.ReadUShort();
        Mesh.t2Index2[i] = File.ReadUShort();
        Mesh.tgIndex2[i] = File.ReadUShort();
        Skip(File, 2);
    }
    //----------------------------------------------


    Skip(File, (64 + 2) * File.ReadUInt());


    //-----------------------------------------------
    Mesh.IndexCount = File.ReadUInt();
    Mesh.Index = new unsigned short[Mesh.IndexCount];
    File.Read(Mesh.Index, 2*Mesh.IndexCount);
    //-----------------------------------------------


    //Mat ID list
    Mesh.MatCount = File.ReadUInt();
    if (Mesh.MatCount > 0)
    {
        Mesh.Mats = new EluMatID[Mesh.MatCount];
        File.Read(Mesh.Mats, Mesh.MatCount * sizeof(EluMatID));


        Mesh.bMVis = new bool[Mesh.MatCount];
        for (int i  = 0; i < Mesh.MatCount; ++i)
            Mesh.bMVis[i] = true;
    }


    


    //boundig box
    File.Read(Mesh.bBox, 2*sizeof(Vec3));
    return true;
}

This code isn't for RS3 but you can adapt it.
I hope it helps you load the rest of the map.
 
Back
Top