Back to the Korax Forum Archives


Forum

KRPG travel mode displays wrong map names

Tue, 28 Feb 2012 13:27:35

RambOrc

Quoting an e-mail conversation below. [quote="RambOrc":2i4ds88i]I'm having a new problem with mapinfo.txt in data.pk3, some map entries like map13 don't behave as expected. I have a wadfile with a custom map13, if I use the startup attribute +map map13 I can start in this map and the game displays the custom map name from mapinfo. However, if I add 13 as a travel point in the map builder, it names and points to the heresiarch's seminary. [quote="Crimson Wizard":2i4ds88i]Allright, it looks like I missed this when was writing help topics for mapbuilder app. At first "Map" parameter was supposed to store actual map name, but later I met some problems with Vavoom API it seems, which did not allow me to use map name directly. Unfortunately, it looks like I couldn't find a way to make a string in Vavoom progs be read from an array of bytes :/. So i decided to use map index in the travel map format. Now, the question is, what IS the "map index"...I guess its an order in which map is listed in "mapinfo" script. Quite inconvenient, indeed. But at the moment I don't see another way. [quote="RambOrc":2i4ds88i]After nearly losing my mind, I have finally found out what's causing the problem... I am gonna kill you!!! :p In the end I can make a mapinfo.txt, assign maps in them in the right order, as in "map map13" will take me to map13 from the wadfile, and "map map27" will take me to map27 from the wadfile etc, and if I specify these right map numbers in the krpg map builder, I enter the right locations as well - BUT the game displays the wrong names for most locations in travel mode, because it obviously reads the MAPINFO lump in hexen.wad and NOT what's in data.pk3! [quote="Crimson Wizard":2i4ds88i]Erm... I guess it is not a map order after all... <!-- s:P --><img src="{SMILIES_PATH}/orc4.gif" alt=":P" title="Razz" /><!-- s:P --> I guess it is "warptrans" parameter. map 27 "HERESIARCH'S SEMINARY" has warptrans = 13 ....... XD [quote="RambOrc":2i4ds88i]so that you can see what I can see, I've uploaded my uncut working folder at <!-- m --><a class="postlink" href="http://orcishweb.com/downloads/koraxdev/ScatteredEvil/krpg_2012-02-12.zip">http://orcishweb.com/downloads/koraxdev ... -02-12.zip</a><!-- m --> , just extract it and use krpg_semain.bat to start up [quote="Crimson Wizard":2i4ds88i]Allright, the situation is even worse than I expected. Travel map contents are being written in the log, the list follows the line "TM_LoadAndParseDataLump : Data.Num = ..." As you may see, in the first two entries map ids and title match perfectly: map 0, id = 11, name = map11, title = Thystes map 1, id = 12, name = map12, title = Joral This data matches your mapinfo script. Later though it starts to desync: map 2, id = 23, name = map23, title = Leamaner's Chapel map 3, id = 14, name = map14, title = Viona map 4, id = 17, name = map17, title = Xyleg's Farm map 5, id = 13, name = map13, title = Ocadia while in your mapinfo "Leamaner's Chapel" is map 24, "Viona" is map 28, "Xyleg's Farm" is map 32 and "Ocadia" is map 27 At first I expected that maps are registered by engine in direct order (from mapinfo), but now this makes no sense. I failed to see any pattern here so far. I'll have to investigate further in the engine source. Will have more info in following hours. [quote="RambOrc":2i4ds88i]To me, it seems like it reads entries from both mapinfo files, but the one in the original hexen.wad has precedence, i.e. the entries from data.pk3 are only read when the number in question is not present in the original mapinfo, neither as map number nor as warptrans number. [quote="Crimson Wizard":2i4ds88i]Not sure.... Still checking. I just wanted to note that the engine/progs version you are using are outdated. I have game logic files made about 10 months later than those in your game package. [quote="RambOrc":2i4ds88i]As long as they work with our stuff, I'll gladly use them, just send me the download link. [quote="Crimson Wizard":2i4ds88i]You seem to be correct. It was obvious that maps are read in the direct order starting from Hexen.wad and following to the wads added afterhand, but there is an exception for those maps which NUMBER is not unique. In that case engine substitutes map data. Since Hexen maps are out of order, custom maps with matching numeration become out of order too. There's however an interesting point. Vavoom mapinfo format does not require NUMBERS for maps. In fact, it does not even store them, but, instead, it forms map file name as ("map" + NUMBER). That is, if you have like: map 1 ... it will be translated to map01 This is made for compatibility with Hexen. However you do not have to do this. You may skip numbering and write map file name directly, like, for example: map map01 "Something" or even map mymap "Something" In fact, it appears that the numbering is limited by 99 by the engine rules. That means if you use numbers, you won't be able to add 100th map. But if you use direct naming, you will. The map filename is limited to have 8 characters though (standard for doom-compatible engine, that should be well known for you). This leads to an interesting conclusion. Hexen has total of 49 maps in its mapinfo (yes, I've counted them <!-- s:) --><img src="{SMILIES_PATH}/orc2.gif" alt=":)" title="Smile" /><!-- s:) --> ). If you remake the game the way you don't use map numbers and don't use map filenames matching those in Hexen, you can set warptrans indices starting from 50, this might work. Like: map mapse001 "Praevian Forest" warptrans 50 map mapse002 "" warptrans 51 etc Lot of work to rename all maps you have indeed... Other solution would be to add a function to get proper map title from warptrans id. That would be much less work, but a) we have to an answer from either Firebrand or Janis; b) you'll have to use updated progs, since engine was updated. OR I may hack the engine myself, but that will still take some time for me to gather needed libraries and figure how to build that <!-- s;) --><img src="{SMILIES_PATH}/orc9.gif" alt=";)" title="Wink" /><!-- s;) -->. [quote="RambOrc":2i4ds88i]questions/suggestions/etc.: 1) How difficult would it be to read the names from the travel map lump created by the krpg map builder? I've added all names there anyway before adding the map numbers. 2) Haven't finished formatting and thus haven't uploaded yet, but I have a version of the concept document listing every single dungeon and town map for KRPG/SE and the last number is around 80, meaning even with the limited map numbering scheme there is still over 10% reserve as of now. Also, the number of maps accessible through the travel interface is ca. 50 and I don't foresee a significant increase any more (there are maybe 2-3 visually distinct points on the map that could still be added as travel points, if at all). 3) I may have made an error but when I tried naming a map something like "maptown1" and then saving the wadfile, a) it couldn't be opened by DB2 any more and b) no matter whether I used maptown1 or town1 in krpg map builder, the game didn't allow me to enter or exit from/to the travel map. 4) Map editors (probably not only DB2 and Wadauthor but others as well) often accept only a two-digit number for linedefs/objects/etc. that refer to another map. 5) Best might be to publish this discussion on the forum as a thread and let Janis or FB answer. This issue only affects the travel mode display (if you zone in to any of the maps and press tab, it displays the name I specified in my custom mapinfo in data.pk3), and as such rather a cosmetic than a basic functionality problem. It's sucky to have a random name pop up instead of the real name of the location you are about to enter, but at least you get to the right place compared to the visuals of the travel map, thus for the moment as far as this goes I could release a public beta with a list of known errors, saying they should consult the attached high-res map for the names of locations. Unless the possibility I mentioned under 1) is feasible, in which case the problem would be solved. [quote="Crimson Wizard":2i4ds88i]1) That was my initial intention (although I later I thought it is better to get everything from the same source - that is mapinfo). However, Vavoom API does not provide a way to create strings from the binary data I read from the file. In fact, it does not even have a "character" variable type, so I can't assign it char by char. On other hand, it may be possible to write strings (map names) to separate text file and parse it as script in game. But that would be awkward, so I'd rather count it as a last option. 3) How did you rename it (by what tool?). I've just renamed a random map to "MAPTOWN1" right from DB2 and it could see it pretty well. What game configuration do you use in DB2? b) No no, you can't do that. Map builder treats (and saves) "Map" field as a number. The fact that user can type text there may be confusing (my fault). I'll note this again: "Map" property in krpg map builder correspond to "warptrans" number from MAPINFO. You should leave travel map as is, but change map name in MAPINFO, e.g.: map maptown1 "Praevian Forest" warptrans 50 4) Hmm, should not be like that. It should be one-byte number, that is a number ranging from 0 to 255. At least I could set map 255 to linedef in DB2. 5) Well, I PMed Firebrand couple of days ago, waiting for an answer now... Further replies will be here on the board.
Wed, 07 Mar 2012 14:28:36

Firebrand

Hi! I've read Crimson Wizard's PM, I'll try to make some free time this weekend to check the problem in the code and let you know if something can be done for fixing this <!-- s:) --><img src="{SMILIES_PATH}/orc2.gif" alt=":)" title="Smile" /><!-- s:) -->. Take care!
Thu, 15 Mar 2012 17:57:58

Crimson Wizard

Come on, Firebrand... here's the code that would solve our troubles: <!-- sorccrazy2 --><img src="{SMILIES_PATH}/orccrazy2.gif" alt="orccrazy2" title="orccrazy2" /><!-- sorccrazy2 --> @ mapinfo.cpp :
//==========================================================================
//
//	P_GetTranslatedMapName
//
//==========================================================================

const char* P_GetTranslatedMapName(int map)
{
	guard(P_GetTranslatedMapName);
	for (int i = MapInfo.Num() - 1; i >= 0; i--)
	{
		if (MapInfo.WarpTrans == map)
		{
			return MapInfo.GetName();
		}
	}
	// Not found
	return "";
	unguard;
}
@ mapinfo.h :
const char* P_GetTranslatedMapName(int);
@ vc_object.h :
DECLARE_FUNCTION(P_GetTranslatedMapName)
@ pr_cmds.cpp :
IMPLEMENT_FUNCTION(VObject, P_GetTranslatedMapName)
{
	P_GET_INT(map);
	RET_STR(P_GetTranslatedMapName(map));
}

Back to the Korax Forum Archives