Home » MODDING HQ 1.13 » v1.13 Coding Talk » Strategic Map load in source code
Strategic Map load in source code[message #339037]
|
Tue, 20 January 2015 16:37
|
|
Drecouse |
|
Messages:8
Registered:November 2011 |
|
|
Hey guys!
I'm searching the current 1.13 source code to find the part which loads the strategic map (and the corresponding tactical maps) into the game when it starts. Could somebody, who knows the source, tell me in which file and where it is? Thanks in advance.
Report message to a moderator
|
Private
|
|
|
Re: Strategic Map load in source code[message #339043 is a reply to message #339037]
|
Tue, 20 January 2015 22:08
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
BOOLEAN SetCurrentWorldSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ ) loads a sector, that should get you starting. Note that only sector can ever be loaded at a time, other sectors are meanwhile stored in the map and map modification files.
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
Re: Strategic Map load in source code[message #339047 is a reply to message #339046]
|
Wed, 21 January 2015 00:27
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Hmm. So you are merely interested in the picture. That is different...
The strategic map picture seems to be in INTERFACE\\b_map_1024x768.pcx (or so, there are several ones for different resolutions). I don't know how to open or edit them at the moment, but as it has been done (like in AIMNAS), this can be done.
In case you are referring to loading a different version of a sector ingame... that should be possible, though far from trivial. I don't think that is possible without at least heavy debugger use. One can replace the temporary map files in the savegame folder, but unless you really, REALLY know how maps work, that is a surefire way to crash the game and/or corrupt savegames.
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
|
Re: Strategic Map load in source code[message #339050 is a reply to message #339048]
|
Wed, 21 January 2015 01:23
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
Yoiks. Not trying to rain on your parade, but that would be very, VERY hard. For starters, all sector IDs are stored in an UINT8 - which doesn't take numbers higher than 255, thus does not allow maps bigger than 16x16. If you want to rewrite that, expect at least a week running over the entire code and replacing UINT8 with UINT16 (this will break the game in numerous places). As all enemy groups, mercs, towns, inventories etc. have sector coordinates, you have to remap those too.
An alternative would be to have a second 16x16 map as you intend - but then you still have to tell the code everywhere a sector is mentioned whether map A or B is used, basically in the entire code. Note that sector manipulation code is relatively pristine, you'll find undocumented, dubious code there that hasn't been touched for over a decade ;)
Loading an alternate version of a sector you already visited (to, say, simulate ongoing destruction/construction of buildings) would be somewhat easier (and often asked for in the last years).
I can't tell you not to do this (it is good that more people volunteer for coding on our beloved game), but unless you have a truly epic frustration tolerance I wouldn't recommend this.
Hmm.
If you are looking for relatively easy code in 1.13, I'd go to the Laptop websites or the trait system - there's simply enough of both to get good examples. Be warned, however, that 1.13 isn't exactly good C++, it's more C with a bit of C++ mixed in.
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
Re: Strategic Map load in source code[message #339064 is a reply to message #339059]
|
Wed, 21 January 2015 14:26
|
|
Drecouse |
|
Messages:8
Registered:November 2011 |
|
|
Okay, i think for some days i will be really determined to start and complete this project, after that probably i will abandon this, but until that I will have finally something interesting to do . Here i shall write down how i planned to do this. If anything would be incorrect or there would be an easier solution please correct me:
1. I would like to create some buttons on the strategic map interface to navigate between the maps and with this change the map picture. (I think that's the easiest part.)
2. I have to learn how the saving functions work and then add a new variable for every possible object (merc, npc, item, etc.) which will determine which map it belongs to. (I hope these are in classes or structs.) Then i have to modify the loading functions to understand the changes.
3. Every place where an object is created must be modified to add the new variable which will determine what map it belongs to.
Then of course there is no solution yet for the quests, and enemy movement (how the enemy would move and attack if we leave the current map, it shouldn't be discarded but i don't see other solution except somehow handling all the maps parallel). And all these changes should be made with ini variables for the different maps to be able to easily create a new one, and should be handled in different folders.
[Updated on: Wed, 21 January 2015 16:44] Report message to a moderator
|
Private
|
|
|
Re: Strategic Map load in source code[message #339065 is a reply to message #339059]
|
Wed, 21 January 2015 14:28
|
|
Flugente |
|
Messages:3507
Registered:April 2009 Location: Germany |
|
|
@CVB: We can have max 256 maps per level. There are 4 levels (normal level and 3 underground levels), so 1024 max maps. However, a lot of vital strategic functions does not work underground - pathing, facilities, helicopter, reinforcements, and so on. It is similar to the tactical roof level insofar as that a lot of functionality has been cut, simply because the original devs didn't want with that additional complication.
Given that, it would be surprisingly easy to add even more underground levels - but as these are so limited in their functionality, I neither see the need nor gain.
All the sectors on the map we cannot access are empty. By creating a new map with the editor and correctly adding it to the xmls, yes, we can add new sectors. If I recall, AIMNAS uses a few sectors that have no equivalent in stock 1.13, and other mods do that too. What limits us from using all 256 sectors is the simple fact that creating new maps is hard work (note how good smeagol is in creating new maps, and it'll still be years before he's finished mapping Aruclo). Codewise, all necessary work has long been done.
[Updated on: Wed, 21 January 2015 14:29]
I know now that it could never work between us, as much as we wanted to, it could never be! Not because you're a rabbit, but because you're black.
If you want, you can donate to me. This will not affect how and what I code, and I will not code specific features in return. I will be thankful though.Report message to a moderator
|
|
|
|
|
|
|
Re: Strategic Map load in source code[message #339094 is a reply to message #339075]
|
Thu, 22 January 2015 16:31
|
|
Drecouse |
|
Messages:8
Registered:November 2011 |
|
|
Okay first part what i have planned (Toggle SpoilerOkay, i think for some days i will be really determined to start and complete this project, after that probably i will abandon this, but until that I will have finally something interesting to do big grin. Here i shall write down how i planned to do this. If anything would be incorrect or there would be an easier solution please correct me:
1. I would like to create some buttons on the strategic map interface to navigate between the maps and with this change the map picture. (I think that's the easiest part.)
2. I have to learn how the saving functions work and then add a new variable for every possible object (merc, npc, item, etc.) which will determine which map it belongs to. (I hope these are in classes or structs.) Then i have to modify the loading functions to understand the changes.
3. Every place where an object is created must be modified to add the new variable which will determine what map it belongs to.
Then of course there is no solution yet for the quests, and enemy movement (how the enemy would move and attack if we leave the current map, it shouldn't be discarded but i don't see other solution except somehow handling all the maps parallel). And all these changes should be made with ini variables for the different maps to be able to easily create a new one, and should be handled in different folders. ) is here: "https"://www.sendspace.com/file/gru7lk
It's really basic just simply a new button which adds another 3 to the game. With these you can type in numbers like 00, 01, 02, 10 ... 22. This will determine what picture the game will load. And of course some ini variables in the JA2_Options.ini under Strategic Interface Settings. Here anybody can add new Maps easily up to 9. (The forum didn't allowe me to post a link so just remove the "-s.) (Based on 7720)
[Updated on: Thu, 22 January 2015 16:33] Report message to a moderator
|
Private
|
|
|
|
|
|
|
Goto Forum:
Current Time: Sat Jan 25 09:52:46 GMT+2 2025
Total time taken to generate the page: 0.01173 seconds
|