Map Reading
Updated 05 Apr 2018
|
Upper levels: - QuArK Information Base - 4. The Source Code - 4.4. Specific Topics |
4.4.6. Map Reading |
[ | - - ]
Reading of maps in the innumerable variants of the .map format is achieved by the ReadEntityList procedure in QkMap.pas. Why EntityList? because that's what a map file is, first the worldspawn entity, then the others. This procedure is driven by the sub-procedure ReadSymbol, which basically pulls a 'token' off the input string (SourceFile), and stores various kinds information about it for later access by the real parsing routines. A slight complexity in the formulation of the procedure is that it is also used for reading entity lists in BSP's, so there is a certain amount of code involved only in that. A slightly peculiar feature of ReadSymbol is that it takes as argument an member of the local type TSymbols, which is what the type of the previously token should have been. This provides a certain amount of automatic syntax error detection. ReadSymbol deposits significant info about the token it has just read in a number of places:
Things are made a bit muddy by the fact that there is a great range of variation in the map format, which I think falls into two major types:
This is attempted to be achieved by returning as Result a gamecode, the Result value is initially set to mjQuake (original Quake, 'mj' stands for French modejeu='gamemode', maybe someday it will be replaced by 'gm'), and reset as things are encountered, and finally fixed up at the end. The latter step is somewhat messy; the idea is that if something inconsistent with the present game-mode is encountered, it switches to the presumably most popular game consistent with what is seen, but this is getting rather messy and the whole thing needs to be rethought. The innards of the map-reading procedure bristle with special-purpose code blocks for reading and interpreting the various kinds of texture positioning info, etc. Some of this involves significant 3d math, there are commentaries and references to sources in the code, see also 'Math Background' and 'Face Formats'in the infobase. |
Copyright (c) 2022, GNU General Public License by The QuArK (Quake Army Knife) Community - https://quark.sourceforge.io/ |
[ Top - ] | -