Interpret the values for entity yaw angles and clip entity sizes as
fifths or tenths of cubes or degree.
This makes some entity attributes appear as float values to the user.
The map file still only keeps integer values - but now they are
interpreted differently - for example, a health pack elevation value of 6
now means 0.6 cubes instead of 6.
Note: the scaling factors are hardcoded - use ENTSCALE5 or ENTSCALE10
whereever possible. For generic entity editing, the scaling values are
also stored in entscale[] - but that table can not be changed without
breaking the map format! This scaling is similar to the treatment of the
vdelta values of map cubes.
Interpret the waterlevel value as tenths of a cube.
This makes the waterlevel variable a float value to the user, while the
map file still stores an integer value - but now it is interpreted
differently - for example, a waterlevel value of 123 now means 12.3 cubes
instead of 123. Old map files are converted during loading.
Note: the values of waterlevel and hdr.waterlevel need to be in sync.
DOCREF waterlevel
enumentities <entity type name>
Returns a list of the numbers of all entities of that type. If no such
entities exist or the entity type could not be recognised, the list is
empty.
DOCREF enumentities
Keys 5, 6 and 7 (in combination with the scrollwheel) can be used to alter
the new entity attributes.
Pressing editmeta (LCTRL by default) speeds up the scrolling.
(Parts of the roll code are borrowed from Alejandro V. Garcia's commit
"Model rotations, experimental" from January 2013)
Note: coop edit is now broken between "next" and older clients, but I
don't want to bump the protocol just yet.
To fully build (and use) mapmodel menus, edit mode is required. This
change builds parts of the menus only in edit mode, to avoid errors.
When edit mode is entered, the menus are rebuilt fully.
Not clearing the menu selection in a followup "newmenu" command does not
seem to have negative effects - and keeps the selection.
Initaction ("menuinit") is now executed before the selction focus is set
during menu->open. This avoids old hover commands to be executed before
the menu gets deleted during rebuild.
Now the command specified by menuinit is executed first, and then the
various menu item init commands (for example getting the value for
menuitemtextinput lines).
This may affect some menu init scripts - but I couldn't find any problems.
It only affects menus which use "menuinit" _and_ menu items with
initialisation.
Only in edit mode: get and set camera position. Returns x, y, z, yaw and
pitch. Sets x, y, z, yaw and pitch, if the parameter is not an empty
string.
example:
echo (gotoposition)
"67.7 78.6 5.5 8 0"
gotoposition "" "" "" 180 0
change yaw and pitch to look straight in +y direction
DOCREF gotoposition
Casting a string constant to "char *" causes segfaults if a command tries
to write to it. Now, empty strings are rarely written to, but it is
inconsistent, if command arguments change memory segments depending on the
argument value.
A mapmodel entity is placed at a z-coordinate that is based on the floor
height of map geometry and a z-offset. The z-offset is a sum of the
entity attribute 3 and the third mapmodel slot parameter. The entity
z-offset can range from 0 to 255 while the mapmodel slot parameter can
be any integer including negative numbers. So, to place a mapmodel below
floor height, the mapmodel slot parameter has to be negative.
This script decreases the mapmodel slot parameter by one and increases
the z-offset of every mapmodel which uses that slot also by one. This
means, that all mapmodel are exact in the same place afterwards - but
the entity z-offset now has room to lower the mapmodel by one more cube.
The script requires one parameter: the mapmodel slot number.
If you need more z-offset available, run the script several times.
DOCREF mapmodelzoff
Generates a list of all available skymaps under packages/textures/skymaps
by checking for files with the ending "_ft.jpg".
Note: argument completion does not work properly for arguments with spaces.
automapconfig
Enables the "automatic embedded map config data" feature, which means
with the next map save the map config file gets renamed and the map
config data stored inside the map file.
mapsoundslotusage <map sound slot number>
Returns a list of map entity indices which use a certain map sound slot.
If the sound is unused, it returns an empty string.
deletemapsoundslot <map sound slot number> <"purge">
Deletes an unused map sound slot. If "purge" is specified as second
argument, it also deletes an used slot (including all map entities
which use that sound). Also enables automapconfig.
editmapsoundslot <map sound slot number> <map sound path> <maxuses>
Edits path/name and maxuses parameters of a mapsound slot. Only
non-empty parameters actually change something. The command returns
the resulting data of the map sound slot. If only the map sound slot
number is specified, no changes are made, but the current data is
returned. Therefore the command can be used to get and set parameters.
If anything is changed, automapconfig is enabled.
mapmodelslotusage <mapmodel slot number>
Returns a list of map entity indices which use a certain mapmodel slot.
If the mapmodel is unused, it returns an empty string.
deletemapmodelslot <mapmodel slot number> <"purge">
Deletes an unused mapmodel slot. If "purge" is specified as second
argument, it also deletes an used slot (including all map entities
which use that mapmodel). Also enables automapconfig.
editmapmodelslot <mapmodel slot #> <radius> <height> <z-offset> 0 <path>
Edits the parameters of a mapmodel slot. Only non-empty parameters
actually change something. The command returns the resulting data of
the mapmodel slot. If only the mapmodel slot number is specified, no
changes are made, but the current data is returned. Therefore the
command can be used to get and set parameters.
examples:
editmapmodelslot 33 "" "" -5
sets the z-offset of slot #33 to -5 without affecting other params
echo (editmapmodelslot 33)
print the current parameters of mapmodel slot #33
for example: 0 0 0 0 "makke/lightbulb"
If anything is changed, automapconfig is enabled.
gettexturelist <includes> <excludes> <extensions>
Returns a table of all texture files fitting a certain description.
includes
Optional list of path prefixes to include in the table.
excludes
Optional list of path prefixes to exclude from the table.
extensions
Optional list of filename extensions to include in the table.
All files found under packages/textures are examined. By default, the
command returns a list with two columns: path and filename. If "excludes"
is exactly one path prefix to exclude, the table gets a third column
with path names without that prefix. If "extensions" is exactly one
extension which does not start with the character '.', the table gets
an additional (third or fourth) column containing file names without
that extension.
examples:
echo (gettexturelist)
outputs two columns like "noctua/wall" "wall02.jpg"
echo (gettexturelist "" "map_editor skymaps")
same, but omits skymaps and special textures for the editor
echo (gettexturelist makke)
outputs only textures by makke and adds a third column
like "makke/rattrap" "rb_box_03.jpg" "/rattrap"
echo (gettexturelist "skymaps/" "" "_ft.jpg")
outputs four columns like
"skymaps/egypt" "egypt_ft.jpg" "egypt" "egypt"
"skymaps/humus" "meadow_ft.jpg" "humus" "meadow"
textureslotusage <texture slot number>
Returns a list of mapmodels who use that texture as skin. If no mapmodel
uses the texture, but world geometry does, a string of whitespace is
returned. If the mapmodel is unused, an empty string is returned.
deletetextureslot <texture slot number> <"purge">
Deletes an unused texture slot. If "purge" is specified as second
argument, it also deletes an used slot. All mapmodels that use that
texture as skin are changed to default skin. All world geometry, which
uses the texture, is instead set to use slot #255. Slots below #5 always
require "purge", no matter if they are in use (default slots).
Also enables automapconfig.
edittextureslot <texture slot #> <scale> <path>
Edits the parameters of a texture slot. Only non-empty parameters
actually change something. The command returns the resulting data of
the texture slot. If only the texture slot number is specified, no
changes are made, but the current data is returned. Therefore the
command can be used to get and set parameters.
examples:
edittextureslot 33 "" "arcitool/rohbaubims.jpg"
sets texture name of slot #33
echo (edittextureslot 33)
print the current parameters of texture slot #33
for example: 0 "zastrow/3wood_crate_10.jpg"
If anything is changed, automapconfig is enabled.
deleteentity <entity index/number>
Deletes a map entity. (Note: deleting an entity only marks it as unused.
It will be completely removed after saving and loading the map.)
editentity <entity index/number> <x> <y> <z> <attr1> <attr2> <attr3> <attr4>
Edits a map entity. Edits only parameters given a non-empty value.
Returns the values of all attributes (type, x, y, z, attr1-attr4).
examples:
echo (editentity 33)
prints all attributes of map entity number 33
for example "light 174 172 12 20 255 200 200"
editentity 33 "" 173
changes the y-position of entity 33 to 173
rereadtexturelists
Variable, which is set to "1" when a texture is downloaded. Used to
trigger menu rebuilds.
rereadsoundlists
Variable, which is set to "1" when a sound is downloaded. Used to
trigger menu rebuilds.
DOCREF mapsoundslotusage deletemapsoundslot editmapsoundslot
DOCREF mapmodelslotusage deletemapmodelslot editmapmodelslot
DOCREF textureslotusage deletetextureslot edittextureslot
DOCREF gettexturelist deleteentity editentity
DOCREF automapconfig rereadtexturelists rereadsoundlists
No more spaces in filenames. The only allowed chars are a-z, A-Z, 0-9 and
"-_.()".
An exception are texture filenames, which may also have a prefix command
like "<decal>" included.
Also fixed some memory leaks in media download.
This patch enables an option to keep the map config embedded in the map
file - with autogenerated content. Any changes to map config data will be
written with the map. This includes data by loadnotexture, loadsky,
mapmodel, texture, fog, fogcolour, mapsound and shadowyaw. Once enabled,
all changes with those commands become persistent to the map.
New variables:
mapsoundchanged
Set to "1" with every command that changes mapsound slots. Should be
used to trigger a rebuild of mapsound menus.
New/changed commands:
mapsound
Now returns the number of the created slot.
mapmodel
Now returns the number of the created slot.
texture
Now returns the number of the created slot.
loadsky
Is now a builtin string variable (instead of a command), which means,
that the current value can easily be retrieved or edited.
The skymap name in the argument is now required to start with
"textures/skymaps/" - but that part of the path can be omitted.
examples:
loadsky steini/steini2 (loads textures/skymaps/steini/steini2_*)
loadsky textures/skymaps/steini/steini2 (same)
loadsky ../foo/bar (loads textures/foo/bar_*)
echo $loadsky
getnotexture
Returns the current "notexture" path. (Set by loadnotexture)
dumpmapconfig (available for debug binaries only)
Writes the current automatically generated map config to
dumpmapconfig.txt.
DOCREF mapsoundchanged mapsound mapmodel texture loadsky getnotexture
This commit is incomplete: only the information from menus_edit.cfg was
transferred to model config files. There are 96 more config files to be
created...
This adds a means to store additional attributes for mapmodels, including
a caching mechanism, so the mapmodels don't have to be loaded to access
the information. The goal is, to provide fully automatic mapmodel menus
for map editing who also add information about downloaded mapmodels.
Model attributes are extracted everytime, when a model is loaded. At game
end, all available data is written to config/mapmodelattributes.cfg and
restored at next startup. On release, a file with all (but only) official
models should be included. Since autodownloaded models are usually "loaded"
after download, those are automatically added to the database. If someone
adds models manually to the directories (media pack, w/e), the command
"loadallmapmodels" can be used to try to find all available models. The
only way to delete something from the database, is to delete the file
config/mapmodelattributes.cfg when the game is closed.
The current list of attributes is:
keywords
List of one or more menu topics to list the model under. Check
config/menus_edit.cfg for available keywords. Unknown keywords will
be listed separately.
desc
Short name or description of the model. Will be used as menu entry.
usage
Important information for how to use that specific model.
author
Who created the mapmodel. If it's a derivative of another model, state
the author of the mod (refer to the original author under "license", if
you like). Always use the exact same spelling for the same author, to
allow menus to automatically group models by author.
license
Free-text attribute for license info or info about additional
contributors (or original authors for derivated works).
distribution
One of "official", "autodownload" or "manual". Other values default to
"manual". This is used to determine, if a map contains only original
media or media that can be download automatically.
version
Single numerical value to separate older from newer versions. Defaults
to zero. Higher numbers mean "newer". Maybe someone manages to implement
a versioning system for custom media in the future...
New commands:
mdlattribute <attr> <value>
To be used in model config files. Adds a value for a specified
attribute to the model.
mapmodelregister <modelpath> <attr1> <attr2> ...
Adds values for all attributes to a specific mapmodel. This is used to
restore the cached values from config/mapmodelattributes.cfg during
game start. Does not actually verify of load the model.
mapmodelattributes <modelpath> <attr>
Returns the value of a specific attribute of a mapmodel. If modelpath
is a number, it is interpreted as index for the list of models in the
current map config. If no attribute name is specified, all attributes
are printed to the console instead.
getmapmodelattributes <list of attribute names>
Returns a table of all known mapmodels. Each model is listed with the
modelpath and the values for the requested attributes. To be used
instead of a fixed table in menu_edit.cfg. In addition to attribute
names, the function also allows the keywords "explodekeywords" and
"sortby:" as arguments. If "explodekeywords" is given, all mapmodels
with more than one keyword are listed multiple times, once for each
keyword. If an attribute name is preceeded by "sortby:" the list will
be sorted by this table column. If "sortby:" is used several times,
this first sort will have highest priority. The list is always sorted
by path by default.
example:
getmapmodelattributes sortby: author sortby: desc explodekeywords
loadallmapmodels
Tries to load mapmodels from /all/ paths below packages/models/mapmodels.
Will throw a lot of error messages, because not all directories contain
models to load. This command can be used to build or rebuild the
complete list of all available mapmodels. It is only necessary, if models
are added manually to the directories, since every mapmodel gets added
to the list when it is loaded - which takes care of all automatically
downloaded models.
DOCREF mdlattribute mapmodelregister mapmodelattributes
DOCREF getmapmodelattributes loadallmapmodels
Until now, the mapmodel used the "notexture" texture, which obviously
worked quite well, because it is grey.
Another possible "fix" would be, to just keep using "notexture" and
instead delete skin.jpg.
This fix affects seven current official maps.
For bigger lastmillis and zero basetime in combination with odd values for
as.speed, t can become negative due to rounding errors.
(time: 3404565, as.speed: 43,47826 -> t: -0,00575)
After dropping the flag player1 will see for a very short moment,
before flag position will be updated by server, flag dropped at player1
position. Earlier he could see for this moment flag dropped in a place,
when it was picked up.
The bug caused SIGTRAP during fastforwading demo in debug mode, when other
players disconnected.
These asserts were removed, because they can be triggered because of a bug.
1. In multiplayer this switching isn't allowed, because it was broken
and messed up, for example other players didn't see concurrently
spectating and editing player.
2. In demo mode switching from spectate to edit mode is improved.
3. Several years broken code for edit mode is reverted.