Commit Graph
4274 Commits
Author SHA1 Message Date
ac-stef 397c441fed more verbose error messages for disabled commands 2016-09-16 17:35:47 +02:00
ac-stef fc3c77868f add hardcoded stairs command for coop
stairs xs ys

  Places stairs in all selections. xs and ys determine the step width
  in x- and y-direction.

DOCREF stairs
2016-09-16 14:06:27 +02:00
ac-stef 4dc54e22b5 allow more edit commands in coop edit
The edit protocol now allows the following commands in multiplayer:

  arch, slope, edittag, edittagclip, selectionrotate, selectionflip

also:

  mapenlarge has been limited to size 10 in multiplayer

  entitiy undelete in multiplayer has been fixed

SV_EDITS, SV_EDITD and SV_EDITE are to be cleaned up with a protocol bump

DOCREF arch slope edittag edittagclip selectionrotate selectionflip
2016-09-16 14:06:27 +02:00
ac-stef 6b15891cfd undo changes back to a specific state
undolevel <level>

  Returns the number of undo steps that can be undone. If argument "level"
  is given, as many steps are undone, until "level" steps remain.

Example, during editing:

  echo (undolevel)
    prints number of previous editing steps, for example "55"

  ... do some editing ...

  undolevel 55
    undoes all changes to restore the previous state (if that state
    is still in memory... keep in mind, undo-space is limited, see
    "undomegs" parameter)

  Unless memory limits delete states, undolevel commands can be undone
  with "redo".

DOCREF undolevel
2016-09-16 14:06:26 +02:00
ac-stef 96a028c263 guess height for selections set by command 2016-09-15 18:15:51 +02:00
ac-stef 1a482e5394 final corner physics fix
if corner sliding doesn't work, try x- and y-slides as well
2016-09-13 21:17:07 +02:00
ac-stef 29a3970b72 fix flyspeed
and a compiler optimisation error

(for clang >= 4, O3 may be reactivated in the makefile)
2016-09-09 22:22:55 +02:00
ac-stef 588e9f9de8 some fixes for OSX 2016-09-08 22:36:46 +02:00
ac-stef 123e2b2b12 cleanup 2016-09-08 01:20:45 +02:00
ac-stef 423df0c66f omit "./" prefix from media file paths in map config files
Ignore it, if "./" prefixes a media path given with a texture, mapmodel
or mapsound command. It's useless and prevents comparing path names.
2016-09-06 19:15:26 +02:00
ac-stef a5470d5ea0 really clear all binds during "resetbinds"
including self-assigned ones

_resetallbinds

  Clears _all_ binds for all keys and all modes. Do not use the command
  manually.

DOCREF _resetallbinds
2016-09-06 18:43:37 +02:00
ac-stef 27754f4a9b cleanup 2016-09-06 17:17:38 +02:00
ac-stef 6de0af1b6f disable water reflection in editmode
with enabled reflection, the editing grid is not visible through the
water surface

as a side-effect also fixes #71
2016-09-04 22:00:57 +02:00
ac-stef cb630bde49 add per-map overrides to disable graphics features
The mapper has now the choice to disable several graphics features on
the client (for his map only, of course). The overrides are stored in
the map header.

mapoverride_nowaterreflect

  If "1", water reflection is disabled. Useful, when odd water colours
  are used to emulate other liquids that are not supposed to be that
  reflective.

mapoverride_limitwaveheight

  If "1", waveheight is capped at 0.1 max. Useful for small water
  areas (like puddles), where higher waves would look weird.

mapoverride_nostencilshadows

  If "1", stencil shadows are disabled. On clients, where stencil shadows
  are otherwise enabled, blob shadows are used instead. If shadows are
  disabled anyway, they stay disabled. Useful for dim maps, where hard
  shadows make no sense.


The player is free to ignore any of those overrides:

ignoreoverride_nowaterreflect

  If "1", mapoverride_nowaterreflect is ignored and regular client
  settings are used.

ignoreoverride_limitwaveheight

  If "1", mapoverride_limitwaveheight is ignored, and "waveheight" is
  used unchanged.

ignoreoverride_nostencilshadows

  If "1", mapoverride_nostencilshadows is ignored.


DOCREF mapoverride_nowaterreflect ignoreoverride_nowaterreflect
DOCREF mapoverride_limitwaveheight ignoreoverride_limitwaveheight
DOCREF mapoverride_nostencilshadows ignoreoverride_nostencilshadows
2016-09-04 17:44:22 +02:00
ac-stef bc2a091f95 show map timestamp in map info menu
also: more stuff in the map settings menu

getmaptimestamp fmt

  Returns the "last written" timestamp of the current map in the requested
  format. If fmt starts with "U", the time is given as UTC, otherwise
  as local time. If fmt is empty, or not given or just the "U", the format
  defaults to "YYYYMMDD_hh.mm.ss". Use "%c" to get something nicer.

DOCREF getmaptimestamp
2016-09-04 15:00:00 +02:00
ac-stef c7c02521ad add thread-safe variant of timestring() 2016-09-04 13:45:14 +02:00
ac-stef 9852b98bf3 unify screenshot code
no need to have the same code three times

also: have jpegenc use our stream lib
2016-09-04 04:42:59 +02:00
ac-stef 07b34ce42c fix mapshots
png and bmp images were mirrored

fix mapshot paths

fix jpeg crash on file creation failure
2016-09-04 01:50:53 +02:00
ac-stef 870900f92f new map settings menu
Containing all persistent per-map settings (stored in map config and
map header).

removed some random number nonsense
2016-09-03 22:48:49 +02:00
ac-stef 05e0bf5b30 new command to retrieve the water colour
getwatercolour

  Returns a string with the four components of the water colour, red,
  green, blue and alpha.

  Example: echo (getwatercolor)  --> 20 25 20 178

setwatercolour what value

  Allows setting the components of the water colour independently. "what"
  is either a keyword "red|green|blue|alpha" or the index number 0..3 and
  determines, which component is set to "value".

  Example:

    watercolour 0 0 0
      sets all colour components to zero

    setwatercolour red 200
      sets the red component to 200

DOCREF getwatercolour setwatercolour
2016-09-03 16:56:10 +02:00
ac-stef a6bffc1858 new command looplisti
same as looplist, but it automatically counts the loops in "i", starting
with 0.

Example:

  a = [u v w] ; b = [x y z]
  looplisti $a m [echo $m (at $b $i) $i]

  u x 0
  v y 1
  w z 2

DOCREF looplisti
2016-09-02 21:58:39 +02:00
ac-stef a8db184eef use mapmrproper to optimise for filesize
needs further testing...

all dev_ maps have been optimised
2016-09-02 00:05:57 +02:00
ac-stef c2ca8706c5 add most visible textures menu
...including the option to sort the most visible textures to the default
slots for special uses (wall, floor, ceiling).

Also: add the information about default texture slots to the menus. Some
mappers may not know, yet.

Also: add a "Pick texture name" option to the edit texture slot menu.

The command sorttextureslots now allows to manually sort the first few
slots by adding the slot number to move to the slots #1, #2, #3...

DOCREF sorttextureslots
2016-09-01 22:59:08 +02:00
ac-stef 6cd5be6225 show how many uses of a texture slot are actually visible
The command textureslotusagelist now returns two values per slot: usage
and visibility. If given the argument "onlymostvisible", instead of the
regular list, a list of only the most used wall, floor, ceiling and upper
wall textures (alternating with the keywords) is returned.

Example:

  echo (textureslotusagelist onlymostvisible)
  --> wall 211 floor 45 ceiling 0 "upper wall" 79

DOCREF textureslotusagelist
2016-09-01 22:59:08 +02:00
ac-stef f65f943050 limit the optimisation of mapmrproper to 4x4 cubes
... which is quite limited, but anything more can trigger lighting
problems in the engine
2016-09-01 22:58:45 +02:00
ac-stef bfb8158069 add cubescript commands for binary arithmetic
The commands &b, |b, ^b and !b perform the operations and, or, xor and not
using binary arithmetic on integer values.

Please keep in mind, that integer values are 32-bit signed values, so
"echo (!b 1)" returns "-2", of course.

The new command "h0 precision value" is modeled after the existing "l0"
command and returns the given value as string of hexadecimal digits,
padded with leading zeros to a given minimum length ("precision").

Examples:

  echo (h0 2 1024)       ->  "400"
  echo (h0 4 1024)       ->  "0400"
  echo (h0 6 1024)       ->  "000400"
  echo (h0 0 (&b 0xe 0x3))  ->  "2"
  echo (h0 0 (|b 0xe 0x3))  ->  "f"
  echo (h0 0 (^b 0xe 0x3))  ->  "d"
  echo (h0 0 (!b 0xe))   ->  "fffffff1"
  echo (h0 0 (* -1 0xe))  ->  "fffffff2"  (for comparison)

Also, the commands for addition and multiplication of integer and float
values have been modified to accept more than two arguments.

Examples:

  echo (* 3 5)   -> "15"
  echo (* 3 5 2)   -> "30"
  echo (* 3 5 2 -1)   -> "-30"
  echo (* 3)   -> "0"  (for compatibility reasons)
  echo (+ 3 5)   -> "8"
  echo (+ 3 5 2)   -> "10"
  echo (+ 3 5 2 -1)   -> "9"
  echo (+f 3.0 5 1.9 -1)   -> "-28.5"
  echo (*f 3.0 5 1.9 -1)   -> "8.9"

DOCREF + * +f *f &b |b ^b !b h0
2016-09-01 15:47:09 +02:00
ac-stef f0dfe2d1a3 pass arguments to and deliver results from script files
When a script file is executed, any additional arguments are passed
as execarg1..execargX to the script. The number of arguments is in
execnumargs and if the script in the file sets the value of execresult,
the exec command returns that value.

Example:

If there is a file testscript.cfg with this content:

  execresult = (* $execarg1 $execarg2)

then the command

  echo (exec testscript.cfg 6 7)

will output "42".

DOCREF exec
2016-08-31 18:53:58 +02:00
ac-stef 75af444844 automatically fix world border violations
whenever the map is saved in edit mode
2016-08-31 17:21:10 +02:00
ac-stef 4b2767a96d cleanup
* removed convertcase
  use toupper (concat A B C D ....) instead

* moved several COMMAND macros to their function bodies

* cleaned up screenshot extension handling

* prefix screenshot argument with "screenshot/" and add correct extension
2016-08-31 17:20:28 +02:00
ac-stef 300d702619 add menu to set notexture
Allows to reset notexture, to set a high-contrast color to find and
fix the areas and to set to a useful default texture.

As useful textures, in addition to rock.jpg and concrete.jpg, the menu
lists the default wall, floor and ceiling textures of the current map,
and also the last watched texture from the texture menu.

Also adds a few checks to detect unconverted map config files and misuse
of the new bright highlight textures.
2016-08-30 22:57:03 +02:00
ac-stef 1310516c14 keep track of map load errors
Collect warnings during load_world() and issue a warning at the end. Most,
but not all warnings already printed a message - which usually scrolls out
of the console quite fast.

The collected value is also given back by the loadmap command, which
allows batch editing scripts for maps stop at problematic maps.

Mapsound errors are not detected, if soundvol is zero. Missing textures are
not flagged, if notexture is set.

The error code is ored together from those elements:

0x0000001  entity attribute overflow
  One or more map entities had attribute values, that are no longer
  supported with map format 10. Rework manually.

0x0000010  map decoder error
  Indicates a damaged map file.

0x0000100  world error -1
  Map is completely solid. Very funny.

0x0000200  world error -2
  Map border is not solid. Fix manually.

0x0001000  missing skymap texture files
0x0002000  missing world texture files (only if no notexture is set)
0x0004000  missing mapmodel files
0x0008000  missing mapsound files

0x0010000  bad mapsound command in map config
0x0020000  bad mapmodel command in map config
0x0040000  bad texture command in map config
0x0080000  bad loadnotexture command in map config

0x0100000  error during loading of mapmodels (see earlier console output)

0x1000000  out of range integer value in map config (for example, "fog 0")
0x2000000  out of range float value in map config
0x4000000  generic cubescript error in map config

The command loadmap is now also available for non-debug builds.

DOCREF loadmap
2016-08-30 20:56:58 +02:00
ac-stef 3ff5e44a39 add counts for used but unconfigured model and sound slots to entstats 2016-08-29 14:11:48 +02:00
ac-stef 867d522879 fix crash on used but unassigned slots during config slot sorting
maybe we should have a warning for such entities...
2016-08-29 13:44:58 +02:00
ac-stef 15c4bbe84f fix player stuck condition
The condition appeared on 32-bit g++ builds with -O3. Apparently, due to
optimisations, the player1 location vector was kept in FPU registers
during collision checks - and the written-to-memory float values gave
different results in the next round.

The fix forces a write to memory and a readback before the collision
checks. An alternative fix would be, to compile physics.cpp with the
switch -ffloat-store, but that would cause a bigger performance hit.
2016-08-28 16:58:56 +02:00
ac-stef e648943d40 fix g++ warnings
g++ 5.4 detects the static bools as "unused", which is true - but also
intentional.

Removing the "static" adds a lot of unused symbols to the global pool,
but it also prevents any compiler from detecting the "not used" status.
2016-08-28 15:11:49 +02:00
ac-stef 41fa9e1b34 add command for raw scripted editing
selectionwalk action beginsel endsel

  The command iterates over all cubes in all selections and executes
  "action" for each cube. The cubes of every selection are framed by
  executions of "beginsel" and "endsel". The action script is allowed
  to make changes to cube attributes, and if it does, an undo point is
  automatically added. "beginsel" and "endsel" are optional.

  While the scripts are executed, several aliases provide further info:

  sw_cursel
    Position and size of the current selection. Valid in all three
    scripts. Holds four integer values for x, y, xs, ys. See command
    "selection" for details.

  (all following aliases are only valid during the execution of the action
   script and provide the attributes of one cube of the map)

  sw_abs_x
  sw_abs_y
  sw_rel_x
  sw_rel_y
    Absolute and relative (within the current selection) coordinates of
    the current cube. Read-only values.

  sw_type
    Type of the current cube. Can be 0..4 for SOLID, CORNER, FHF, CHF and
    SPACE. May be changed to other numerical value or keyword.

  sw_floor
  sw_ceil
    Floor and ceiling heights of the current cube. Range -128..127

  sw_wtex
  sw_ftex
  sw_ctex
  sw_utex
    Texture slot indices for wall, floor, ceiling and upper wall of the
    current cube.

  sw_vdelta
  sw_tag
    Vdelta and tag values of current cube.

  sw_r
  sw_g
  sw_b
    Current light values of current cube. Can be edited, but only with
    temporary effect. Will be reset with the next light recalc.

The command is mostly useful for statistics scripts (like counting cubes
with certain attributes), but is can also be used for scripted editing,
as the following (useless) example shows:

  selectionwalk [ += sw_floor (rnd 2) ]

Further changes:

  The command listoptions now also can return the names of cube types:

    echo (listoptions cubetypes)

  The command countwalls is now implemented as a script instead of a
  builtin command. The script works better, because it doesn't create
  unnecessary undo points.

DOCREF selectionwalk listoptions countwalls
2016-08-27 21:58:02 +02:00
ac-stef 1a4fca5c3c make some editmode options persistent
keep values of showmodelclipping, showladderentities and showplayerstarts
2016-08-27 21:58:02 +02:00
aurhat caa62a1214 Add shortcut in Start menu to profile folder
Also cleanups
2016-08-27 15:29:44 +02:00
ac-stef 422b407e79 misc VS warning fixes 2016-08-27 12:03:23 +02:00
ac-stef fdb683e406 add command and keybind for tag clips
edittagclip type

  Sets tag clip type of all selected cubes.

  type can be numeric 0, 64 or 128 or keyword "none", "clip", or "plclip"

DOCREF edittagclip
2016-08-26 16:45:37 +02:00
ac-stef b7d797d73c new menu for edit mode key binds
Two new commands, menuitemeditkeyinput and menuitemspectkeyinput, both
work the same as menuitemkeyinput - only for edit and spect binds.
The new edit keys menu should also work fine as edit key help :)

menuitem[|edit|spect]keyinput text bindcmd

  Menuitem, that displays "text" and all keys, that bind "bindcmd" - in
  game-, edit- or spect mode.

DOCREF menuitemeditkeyinput menuitemspectkeyinput
2016-08-26 14:34:44 +02:00
ac-stef ebd1c917dc enable the keyboard settings menu to handle multiple binds 2016-08-26 14:31:58 +02:00
ac-stef dbfdb5927b omit unchanged default binds from saved.cfg
omitunchangeddefaultbinds n

  0 print
  1 print, but commented out
  2 omit

The new var _defaultbinds is used to mark default binds in resetbinds.cfg.

DOCREF omitunchangeddefaultbinds
2016-08-26 14:31:33 +02:00
ac-stef daae49273d remove __fontsetting
instead, "curfont" returns name of current font

DOCREF __fontsetting curfont
2016-08-26 14:30:29 +02:00
ac-stef f730106c56 remove go_to
gotoposition does the same and more

DOCREF go_to
2016-08-26 14:30:02 +02:00
ac-stef c4b570e8fd new menus for account management
During startup, it is checked, if the game account needs to be unlocked
by password. If so, the password is asked and applied.

If no game account exists yet, the creation of a new account is offered.

new command "mypubkey": returns public key of game account, or empty
  string, if no account exists or it is unusable (due to missing password,
  for example)

DOCREF mypubkey
2016-08-26 14:28:54 +02:00
ac-stef 989db7d5c8 change behaviour of menuitemtextinput
Now, if the last line of a menu is a text input item, pressing enter in
that line will not only execute the assigned command, but also close the
menu.

With this, menus without the annoying "[OK]"-button can be created.

Also: emptied text input fields don't magically fill up again, when you
deselect them.

DOCREF menuitemtextinput
2016-08-26 14:28:54 +02:00
ac-stef 4a9ae84613 add hashes for map files on server 2016-08-26 14:28:54 +02:00
ac-stef 1f5b3ed92a add basic cert management 2016-08-26 14:28:54 +02:00
ac-stef 400f1a318d add authkey command
authkey manages a list of keys other than the game key (which is managed
by authsetup). For example, this can be server owner keys or clan boss
keys.

authkey clear
  Empties the list and comments out all lines in config/authkeys.cfg.

authkey list
  Lists all authkeys that are currently in memory.

authkey delete keyname
  Deletes the key <keyname> from memory.

authkey new keyname
  Generates a new key with the name <keyname>. If a key of that name
  already exists, it is deleted. The key is added to the list in memory
  and also written to the file config/authkeys.cfg.

authkey add keyname privkey
  Adds a key with the name <keyname> to the list in memory. The privkey
  is a 32-byte hexadecimal string, preferrably generated by authkey new.
  The matching public key is generated automatically from the private key.

authkey selfcert keyname [comment]
  Generates a self-signed certificate for the key <keyname>. Being able to
  create such a cert is proof, that you own the private key of a certain
  public key.

DOCREF authkey
2016-08-26 14:28:54 +02:00