[TUTORIAL+CODE]Adding support to RS3 maps in gunz 1.5

Status
Not open for further replies.
Junior Spellweaver
Joined
Feb 4, 2008
Messages
122
Reaction score
148
In RealSpace2 project:
Remove these files: RBspObject.h and RBspObject.cpp.
Add all files in the MOD folder to the project.
Add the "MOD" folder path to the includes in the project Properties.
Add the "Include" folder path to the includes in the project Properties.


Go to the file in bold:
Add the headers in green (at the top of the file)

pair(red/green) = serach for red -> change to green

Code:
[B]Gunz/ZActor.cpp[/B][COLOR=#ff0000]
[/COLOR]
[COLOR=#ff0000]- RBspObject* r_map = ZGetGame()->GetWorld()->GetBsp();[/COLOR]
[COLOR=#00ff00]+ IBspObject* r_map = ZGetGame()->GetWorld()->GetBsp();[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZCharacter.cpp[/B]

[COLOR=#ff0000]- RBspObject* r_map = ZGetGame()->GetWorld()->GetBsp();[/COLOR]
[COLOR=#00ff00]+ IBspObject* r_map = ZGetGame()->GetWorld()->GetBsp();[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZInterfaceBackground.h[/B]

[COLOR=#ff0000]- RBspObject*    m_pLogin;[/COLOR]
[COLOR=#00ff00]+ IBspObject*    m_pLogin;[/COLOR][COLOR=#ff0000]
[/COLOR]
[COLOR=#ff0000]- RBspObject*    GetChurchEnd() { return m_pLogin; }[/COLOR]
[COLOR=#00ff00]+ IBspObject*    GetChurchEnd() { return m_pLogin; }[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZInterfaceBackground.cpp[/B]

[COLOR=#00ff00]+ #include "BspLoader.h"[/COLOR]

[COLOR=#ff0000]- m_pLogin = new RBspObject();[/COLOR]
[COLOR=#ff0000]- m_pLogin->Open( DIR_LOGIN"/login.rs", descExt);[/COLOR]
[COLOR=#00ff00]+ m_pLogin = BspLoader::Load(DIR_LOGIN"/login.rs", descExt);[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZMapDesc.h
[/B]
[COLOR=#ff0000]- bool Open(RBspObject* pBspObject);[/COLOR]
[COLOR=#00ff00]+ bool Open(IBspObject* pBspObject);[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZMapDesc.cpp[/B]

[COLOR=#ff0000]- bool ZMapDesc::Open(RBspObject* pBspObject)[/COLOR]
[COLOR=#00ff00]+ bool ZMapDesc::Open(IBspObject* pBspObject)[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZShadow.cpp[/B]

[COLOR=#ff0000]-bool ZShadow::setMatrix( RVisualMesh& vmesh, float size_ /* = 100.f  */, RBspObject* p_map /* = 0 */)[/COLOR]
[COLOR=#00ff00]+bool ZShadow::setMatrix( RVisualMesh& vmesh, float size_ /* = 100.f  */, IBspObject* p_map /* = 0 */)[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZShadow.h[/B]

[COLOR=#ff0000]- bool setMatrix( RVisualMesh& vmesh, float size_ = 100.f, RBspObject* p_map  = 0 );[/COLOR]
[COLOR=#00ff00]+ bool setMatrix( RVisualMesh& vmesh, float size_ = 100.f, IBspObject* p_map  = 0 );[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZWorld.cpp[/B]

[COLOR=#00ff00]+ #include "BspLoader.h"[/COLOR][COLOR=#ff0000]
[/COLOR]
[COLOR=#ff0000]- m_pBsp = new RBspObject;
[/COLOR][COLOR=#00FF00]+ m_pBsp = BspLoader::Load(m_szBspName, descExt);
[/COLOR]
[COLOR=#ff0000]- if(!m_pBsp->Open(m_szBspName, descExt, RBspObject::ROF_RUNTIME,ZWorldProgressCallBack,pLoading))[/COLOR]
[COLOR=#00ff00]+ if (!m_pBsp)[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]Gunz/ZWorld.h[/B]

[COLOR=#ff0000]- RBspObject    *m_pBsp;[/COLOR]
[COLOR=#00ff00]+ IBspObject    *m_pBsp;[/COLOR]

[COLOR=#ff0000]- RBspObject    *GetBsp() { return m_pBsp; }[/COLOR]
[COLOR=#00ff00]+ IBspObject    *GetBsp() { return m_pBsp; }[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]RealSpace2/Include/RLenzFlare.h [/B]

[COLOR=#ff0000]- bool        Render( rvector& light_pos, rvector& centre_, RBspObject* pbsp_ );[/COLOR]
[COLOR=#00ff00]+ bool        Render( rvector& light_pos, rvector& centre_, IBspObject* pbsp_ );[/COLOR]

[COLOR=#ff0000]- bool        Render( rvector& centre_ , RBspObject* pbsp_ );        [/COLOR]
[COLOR=#00ff00]+ bool        Render( rvector& centre_ , IBspObject* pbsp_ );[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]RealSpace2/Source/RLenzFlare.cpp[/B]

[COLOR=#ff0000]- bool RLenzFlare::Render( rvector& light_pos_, rvector& centre_, RBspObject* pbsp_  ) [/COLOR]
[COLOR=#00ff00]+ bool RLenzFlare::Render( rvector& light_pos_, rvector& centre_, IBspObject* pbsp_  ) [/COLOR][COLOR=#ff0000]
[/COLOR]
[COLOR=#ff0000]-bool    RLenzFlare::Render( rvector& centre_, RBspObject* pbsp_  )[/COLOR]
[COLOR=#00ff00]+bool    RLenzFlare::Render( rvector& centre_, IBspObject* pbsp_  )[/COLOR]
[COLOR=#ff0000]
[/COLOR]
[B]RealSpace2/Source/RealSpace2.cpp [/B]

[COLOR=#00ff00]+ #include "CustomMap.h"[/COLOR]

 search for: [I]HRESULT hr=g_pd3dDevice->Reset(&g_d3dpp);[/I]
paste:[COLOR=#ff0000] 
[/COLOR][COLOR=#00ff00]+ CustomMap::OnLost(); [/COLOR]before [I]HRESULT hr=g_pd3dDevice->Reset(&g_d3dpp);[/I]
[COLOR=#00ff00]+ CustomMap::OnReset(); [/COLOR]after [I]HRESULT hr=g_pd3dDevice->Reset(&g_d3dpp);[/I]

Include the .lib provided in "lib" folder to gunz project.
Compile everything and copy *.txt and Interface.dll to gunz client folder.

If the client crash when throwing grenades, debug the client find the code where it occurs the "access violation" and add an "if (ptr != NULL)" test.

If you find any bug or client crash (it's probably because I forgot to list some code change).
So you can post the error, where it occurs and I will try fix it and reply with a patch.

How to add RS3 maps: http://forum.ragezone.com/f245/runnable-gunz2-maps-934903/

As this release is open-source any changes/improvements you made in the code you should release it too for free to ragezone community.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Correction:
In ZWorld.cpp: (ZWorld::Create function)

Code:
[COLOR=#000000]previous: Gunz/ZWorld.cpp[/COLOR] 
[COLOR=#00ff00]+ #include "BspLoader.h"
[/COLOR][COLOR=#ff0000]- m_pBsp = new RBspObject;
[/COLOR][COLOR=#ff0000]- if(!m_pBsp->Open(m_szBspName, descExt, RBspObject::ROF_RUNTIME,ZWorldProgressCallBack,pLoading))
[/COLOR][COLOR=#00ff00]+ if (!m_pBsp)

[/COLOR][COLOR=#000000]-----------------------------------------------------
Corrected:

in line:
[/COLOR][COLOR=#ff0000]- m_pBsp = new RBspObject;
[/COLOR][COLOR=#000000]change to :
[/COLOR][COLOR=#00ff00]+ m_pBsp = BspLoader::Load(m_szBspName, descExt);[/COLOR]

Added attachment with Interface.dll src.
 

Attachments

Last edited:
OMG NICE NICE NICE NICE NICE NICE NICE NICE NICE!!! THANKS SO MUCH :thumbup:

grandao - [TUTORIAL+CODE]Adding support to RS3 maps in gunz 1.5 - RaGEZONE Forums
 
Last edited:
Thank you very much, i know that it's hard to you to release what you have done, ty for your hardwork to revive gunz 1 with gunz 2 files
 
I've just ported the entire project over from the DLL to a standalone version that loads directly from MZFileSystem.

As this project is GNU, I will contribute it as soon as the code is a bit more complete and cleaned up/packaged (and separated from my working base to a 1.5 repack)

The idea is that you'd specify a "Data" path and a "Texture" path within the MZFileSystem, and it would load the appropriate assets from those two locations for each location per map.

The effects also have to be loaded from the filesystem to prevent malicious edits, so I will be doing that soon for the contribution. Currently, there's only hardcoded support for "Data" and "Texture" archive files so that has to change.

Everything is pretty much the same, except there's no DLL involved.
 
Time to make RealSpace 3.0 Levels. Sounds like fun.
The code that I did was designed to load maps using plugins, then we can load (multiples) any kind of map format given the right plugin. If you want I can implement an exclusive plugin for you to load any format of your choice, just to see your amazing work without rs2 limitations.


I've just ported the entire project over from the DLL to a standalone version that loads directly from MZFileSystem.

As this project is GNU, I will contribute it as soon as the code is a bit more complete and cleaned up/packaged (and separated from my working base to a 1.5 repack)

The idea is that you'd specify a "Data" path and a "Texture" path within the MZFileSystem, and it would load the appropriate assets from those two locations for each location per map.

The effects also have to be loaded from the filesystem to prevent malicious edits, so I will be doing that soon for the contribution. Currently, there's only hardcoded support for "Data" and "Texture" archive files so that has to change.

Everything is pretty much the same, except there's no DLL involved.
I think the dll approach gives more flexibility (no need to recompile gunz, loosely coupled), but if you as a developer think that this way is better then keep your good work. My main idea was also to create various plugins using IPlugin and IObject interface to load several sorts of maps (I did some tests with DMC4 maps), so without taking into account security I think keep plugin as dlls would be a good choice.
 
The code that I did was designed to load maps using plugins, then we can load (multiples) any kind of map format given the right plugin. If you want I can implement an exclusive plugin for you to load any format of your choice, just to see your amazing work without rs2 limitations.



I think the dll approach gives more flexibility (no need to recompile gunz, loosely coupled), but if you as a developer think that this way is better then keep your good work. My main idea was also to create various plugins using IPlugin and IObject interface to load several sorts of maps (I did some tests with DMC4 maps), so without taking into account security I think keep plugin as dlls would be a good choice.

Hmm, this plugin would make it easier to load UT99 maps into GunZ
There's an open source map viewer that already partly loads UT99 maps
 
Status
Not open for further replies.
Back