C++ Game.loadmap with offset

Karain

Jack of all trades
Joined
Jul 9, 2009
Messages
340
Reaction score
125
Location
Egypt
Hello, I was fiddling around with Game.loadmap but i realized there is no way to offset the loaded map like you would do in remere.

Is it easy to add the offset parameters into the source code?

Thanks.
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,557
Reaction score
2,108
Hello, I was fiddling around with Game.loadmap but i realized there is no way to offset the loaded map like you would do in remere.

Is it easy to add the offset parameters into the source code?

Thanks.
Easy? Sort of. There's quite a few changes you need to make in iomap & game.cpp/h. (I recently did exactly this)
My method to solve this was to add a new Position parameter to IO::loadMap and IOMap::parseTileArea + whatever deals with loading map in game.cpp (as well as luascript.cpp for a new function to load map with a position parameter).
Then I just added pos.x pos.y pos.z to the base coordinates that are being loaded inside of parseTileArea.
 

Evil Hero

Legacy Member
Joined
Dec 12, 2007
Messages
1,154
Reaction score
513
Location
Germany
the bigger problem here is that it might break all kind of actions which are performed for static coordinates, so you have to keep that in mind aswell and calculate the offset for such positions aswell.
 

Stigma

Veteran OT User
Joined
Feb 14, 2015
Messages
4,557
Reaction score
2,108
the bigger problem here is that it might break all kind of actions which are performed for static coordinates, so you have to keep that in mind aswell and calculate the offset for such positions aswell.
What do you mean? Example?
 

Evil Hero

Legacy Member
Joined
Dec 12, 2007
Messages
1,154
Reaction score
513
Location
Germany
I mean like you load a certain piece of map which contains a tile which you need to step on and then it removes a wall/door from a specific coordinate let's say (100,100,7) but now instead of loading the map on the default coordinates you load them like x +100, y +100.
If you now walk onto that tile it would ofc remove the wrong wall/door in this case, you should be careful if your server includes such things.
 

Evil Hero

Legacy Member
Joined
Dec 12, 2007
Messages
1,154
Reaction score
513
Location
Germany
I've created an indexing system for training rooms like years back, this might also give you a hint on how to work with offsets and such.
 
Top