Commit Graph
7251 Commits
Author SHA1 Message Date
ac-stef a067ea2a0b add timestamp to map files 2015-05-27 15:47:04 +02:00
ac-stef 010a7579be remove ability to write map file format 9
didn't work properly anymore anyway
2015-05-27 15:47:04 +02:00
ac-stef 53f169274a fix end of string for the autogenerated embedded map config 2015-05-27 15:47:04 +02:00
ac-stef 7dc9dd54c9 reload map sound config when sound volume is changed from zero
It's a crowbar fix for a very stupid bug, but anything else would involve
debugging audio code. Sue me.
2015-05-27 15:47:04 +02:00
ac-stef d09ec395ec fix: avoid division by zero from faulty model config files 2015-05-27 15:47:04 +02:00
ac-stef 07facdfcc2 fix: no snprintf on VS 2015-05-27 15:47:04 +02:00
ac-stef 6eb6407684 more details for editinfo
also: break it into two lines
2015-05-27 15:47:04 +02:00
ac-stef f774e4d841 higher resolution for entity attributes
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.
2015-05-27 15:47:04 +02:00
ac-stef ea480a7b0c higher resolution for waterlevel
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
2015-05-18 14:59:41 +02:00
ac-stef b1b789eefc rename transformoldentities
now that old entities also get re-scaled, "transformoldentitytypes" is
more appropriate
2015-05-18 14:59:41 +02:00
ac-stef c6ac0f55f8 fix tracking of unsaved edits for automapcfg
don't flag changes read from config files
2015-05-18 14:59:41 +02:00
ac-stef c4e1155dcc option to write floats as ints when possible
omit the ".0" in values like "3.0"
2015-05-18 14:59:41 +02:00
ac-stef e5fc8b35a2 be extremely pedantic with setvar and getvar in debug mode
This will exit the program, if code tries to access a non-existing
variable or an existing variable of the wrong type.
2015-05-18 14:59:41 +02:00
ac-stef 47367c3e61 new command to list entities of a certain type
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
2015-05-18 14:59:41 +02:00
ac-stef ae82b6b22e add attr5..7, add mapmodel pitch and roll
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.
2015-05-18 14:59:41 +02:00
ac-stef ab10f6bcdb avoid some error messages when building mapmodel menus without edit mode
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.
2015-05-18 14:59:41 +02:00
ac-stef f6f2216f85 keep menu selection during menu rebuild
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.
2015-05-18 14:59:41 +02:00
ac-stef 225f3faa22 add automapconfig support to xmaps 2015-05-18 14:59:41 +02:00
ac-stef 1d06ed1b64 new "Map config operations" menu
Edit and delete mapmodel slots.
2015-05-18 14:59:41 +02:00
ac-stef 618d72cdc4 swap execution order of menuinit and item init
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.
2015-05-18 14:59:41 +02:00
ac-stef b0227a1e19 new command gotoposition
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
2015-05-18 14:59:41 +02:00
ac-stef 37f856983e adjust loadsky parameters
Also, apparently, default_map_settings.cfg had a few CRs too many.
2015-05-18 14:46:03 +02:00
ac-stef 4a5b5cded8 create mapmodel slots automatically from the edit menu
If a mapmodel is placed that does not have a slot assigned yet, it is
assigned one automatically.
2015-05-18 14:46:03 +02:00
ac-stef 03bcae1918 make sure that COMMAND arguments are always in a writeable segment
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.
2015-05-18 14:46:03 +02:00
ac-stef 3733b7e9ba script "mapmodelzoff" to allow negative z-offsets for mapmodels
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
2015-05-18 14:46:03 +02:00
ac-stef fe478d13ca script to set up argument completion for loadsky
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.
2015-05-18 14:46:03 +02:00
ac-stef 5bd9105a8c fix ac_snow map config 2015-05-18 14:46:03 +02:00
ac-stef 8745d002f0 new commands to edit map config items
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
2015-05-18 14:46:03 +02:00
ac-stef 786a6cdce1 filename filtering for media files
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.
2015-05-18 14:46:03 +02:00
ac-stef e318ecd68e integrated automatic embedded map config files
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
2015-05-18 14:46:03 +02:00
ac-stef e3fc073742 add "gotoentity" command
jump to the location of a map entity

DOCREF gotoentity
2015-05-18 14:46:02 +02:00
ac-stef 04e3d946bc updated automatic mapmodel menus 2015-05-17 00:24:39 +02:00
ac-stef a8028b87ba add default mapmodel slot parameters to model config files
The parameters have been extracted from current official map config files.
Only parameter sets different from "0 0 0 0" have been added.
2015-05-17 00:24:39 +02:00
ac-stef 3b8f642a38 add description entries for scripted menu items
This looks ugly, if the descriptions are long. There should be some kind
of linewrap for descriptions.

DOCREF menuitem
2015-05-17 00:24:39 +02:00
ac-stef 42356bccb5 add attributes to previously unlisted mapmodels
These are 96 skeleton config files - to be filled with model descriptions
and menu keywords.
2015-05-17 00:24:39 +02:00
ac-stef f8e582bf7a add attributes to model configs
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...
2015-05-17 00:24:39 +02:00
ac-stef 03f974b2bc additional text attributes for mapmodels
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
2015-05-17 00:24:38 +02:00
ac-stef c04da78554 fix toca/grid6x8
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.
2015-05-17 00:24:38 +02:00
ac-stef bdf3f0f5cb option to crop leading and trailing whitespace for filtertext 2015-05-17 00:24:38 +02:00
ac-stef f86e2c1f4a fix loadcrosshair script in saved.cfg
"c" is already used as "const" and therefore is not allowed as temporary
alias...
2015-05-17 00:24:38 +02:00
ac-stef d55dbb47f4 output error message when temporary alias can not be created 2015-05-17 00:24:38 +02:00
ac-stef 890e13076c print error message if md3skin tries to skin non-existing meshes
the error message includes a list of available mesh names
2015-05-17 00:24:38 +02:00
ac-stef 3e84f11630 cleanup 2015-05-17 00:24:38 +02:00
ac-stef e0e77c4c7b updated ac_power
* dedicated models instead of skinning the mapmodels
* changed clip entities to tag clips where possible
2015-05-17 00:24:38 +02:00
ac-stef 2eca255355 ac_power -> dev_power 2015-05-17 00:24:38 +02:00
ac-stef ad263ea375 avoid triggering ASSERT due to insufficient floating point precision
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)
2015-05-17 00:21:28 +02:00
aurhat 65c2e0f83a Update locally position of dropped flag
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.
2015-05-13 20:43:56 +02:00
aurhat a9bf87b1e7 Indexing fix 2015-05-07 21:27:53 +02:00
aurhat b2da592d6e Save skin choice on quit 2015-05-07 18:58:34 +02:00
aurhat a1107a4318 Fix sound bug and remove wrong asserts for sound
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.
2015-05-05 21:55:13 +02:00