Commit Graph
7719 Commits
Author SHA1 Message Date
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 2d55d5dc2a Cleanup new_content map
Fixed paths to models, adjusted map message, map saved
in format 10.
2016-08-27 20:23:38 +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 573e520ca0 argument completion for authsetup and authkey 2016-08-26 14:29:25 +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
ac-stef 381e770210 add authsetup command
authsetup contains all the funtionality needed to generate, load and save
private and public keys, and to lock and unlock the private key with a
password.

Private and public keys are used to authenticate the player to servers,
and are loaded from config/authprivate.cfg. Private keys can be stored
in an "encrypted with password" version - in which case the player has
to enter the password after game start. To prevent brute-force cracking
of the password, the key-derivation function uses a constant time to
encode (usually several seconds). Because of that, the decoding at game
start can be done in the background.

The private key is actually itself a public key generated from the
prepriv key. The prepriv key should be kept away from the computer, either
as hardcopy or on a thumbdrive. The prepriv key is not required to play
the game. It can be used to prove ownership of the private key, in case
the private key gets stolen. It can also be used to regenerate private
and public keys, in case they are lost. The prepriv key can also be
encrypted by its own password.

authsetup
  checks private and public key and returns "1", if they match.

authsetup pre preprivhex [psalthex pwdcfg]
  loads prepriv key into memory. optionally supports encrypted keys.

authsetup priv privhex [salthex pwdcfg]
  loads private key into memory. optionally supports encrypted keys.

authsetup pub pubhex
  loads public key into memory.

authsetup ppass preprivpass
  decrypts prepriv key with password

authsetup pass privpass
  decrypts private key with password

authsetup passd privpass [commandwhendone]
  decrypts private key with password in background. optionally executes
  cubescript command when done.

authsetup needpass
  returns "1" if the private key needs decryption.

authsetup genpre [prelen]
  generates new prepriv key.

authsetup genpriv
  generates private key from prepriv key.

authsetup genpub
  generates public key from private key.

authsetup newppass preprivpass [preprivfilename]
  encrypts prepriv key with new password and saves the result to file.
  The default filename is config/authpreprivate.cfg and an existing file
  gets overwritten - but the former file content is kept and also written,
  each line commented out.

authsetup newpass privpass [privatefilename]
  encrypts private key with new password and saves the encrypted private
  key and the public key to file. The default filename is
  config/authprivate.cfg and an existing file gets overwritten - but the
  former file content is kept and also written, each line commented out.

authsetup unarmed
  sets private and public keys to a fixed value. For testing only.
  Can be used to "log out".

authmemusage, authrounds, authmaxtime are only used, when new passwords are
  created (authsetup new[p]pass). authmemusage is the number of megabytes
  of RAM that are used for the password hash calculation. If authrounds
  is zero (as is default), then the hash algorithm calculates as many
  rounds as possible in the number of milliseconds specified in
  authmaxtime. If authrounds is a positive number, then that is the number
  of rounds to be done, regardless the required time. Note that, since the
  password hash algorithm is not endianness-aware, it is not possible to
  move an encrypted password to a machine with different endianness.
  Moving between 32- and 64-bit machines should be no problem.

  FIXME: the command is not blocked against use in multiplayer. It has to
         be determined later, if this is a problem or feature. Especially
         the background password calculation may be a problem.

DOCREF authsetup cryptodebug authmemusage authrounds authmaxtime
2016-08-26 14:28:54 +02:00
ac-stef 940cc2e3d9 crypto tool functions and ed25519 vector test
* FNV-1a:  very fast, non-cryptographic hash
* bin2hex, hex2bin:  hex ascii parser and hex string formatter
* ed25519test:  vector test for all ed25519 functions
* ed25519speedtest:  yep, that
2016-08-26 14:28:54 +02:00
ac-stef 806e0f4f7e add Ed25519 ECC signature algorithm
The Ed25519 sources were taken from the crypto_sign/ed25519/ref
subdirectory of the SUPERCOP benchmarking tool.
The Ed25519 software is in the public domain.

Contributors (in alphabetical order)
    Daniel J. Bernstein, University of Illinois at Chicago
    Niels Duif, Technische Universiteit Eindhoven
    Tanja Lange, Technische Universiteit Eindhoven
    Peter Schwabe, National Taiwan University
    Bo-Yin Yang, Academia Sinica
2016-08-26 14:28:53 +02:00
ac-stef b080d634fc add memory-heavy key derivation function
* basically a hash function that delivers keylen bytes calculated
  from password and salt
* uses a lot of memory and a quite complex algorithm, to make
  brute-force offline-attacks on short passwords as hard as possible
* last line of defense against "evil little brothers"
2016-08-26 14:28:53 +02:00
ac-stef 8c7baa979c add SHA512 hash function and an entropy collector
SHA512 was adapted from a few public domain sources and pseudocode from
wikipedia. The entropy collector gathers entropy from keyboard events and
mouse movement - and, just for fun, from screenshots.
The entropy pool is saved at program exit and reloaded at program start.
Entropy is used to re-seed the pseudorandom generator (not that it would
make a difference).
2016-08-26 14:28:53 +02:00
ac-stef a45d926919 remove current auth system
* fix tiger hash for bigendian (we use the byte output, not the chunks)
* remove all ECC functions and comment out all calls to it
2016-08-26 14:28:53 +02:00
ac-stef 9230561697 remove illegal chars from map config files
from now on, the server's going to be very pedantic about this...
2016-08-26 14:28:53 +02:00
ac-stef 652a097c91 sync worker threads with mainloop 2016-08-26 14:28:53 +02:00
ac-stef 89f1f69eec readmapsthread
server: load all maps into memory, scan for more maps
in the background
2016-08-26 14:27:51 +02:00
ac-stef c70808e5a4 more detailed entstats
Shows some results of the new map quality checks. tbc
2016-08-26 14:08:56 +02:00
ac-stef 6454a645ae new map checks and statistics menu
Visualise the results of "mapareacheck".
2016-08-26 14:08:56 +02:00
ac-stef 084be76825 new command mapareacheck
Calculate some key values to determine map geometry viability.

mapareacheck <what>
  Returns different sets of statistics, depending on the keyword "what":

  vdelta
    Returns table of numbers of cubes within a certain range of vdelta
    differences (steepness)". First entry is "0..2 cubes steep", next is
    "2..4" and so on.

  steepest
    Returns the coordinates of the steepest heightfield cube.

  total
    Returns the number of non-solid cubes on the map.

  pprest
    Returns the number of cubes _not_ visible from one of the probe
    positions.

  pp (default)
    Returns a table of all (currently 64) probe points of the map. Each
    probe point is listed with:
      - x-coordinate
      - y-coordinate
      - floor height
      - area visible
      - volume of visible area
      - average height in visible area

DOCREF mapareacheck
2016-08-26 14:08:56 +02:00
ac-stef 77b7e9bb87 new entity type "dummy"
Adds a new entity type for use in scripts. The entity does not affect
rendering or physics and is not saved to map files.
2016-08-26 14:08:56 +02:00
ac-stef a33577c039 sort mapmodel entities during map save
* sort colored lights behind white ones to avoid a light bug
* sort all clipped entities to the end of the list to speed up physics
* sort all pickups and playerstarts to use smaller index numbers to
  use less bandwidth
2016-08-26 14:08:55 +02:00
ac-stef c54eb7f173 calcmapareastats()
new metrics to assess map geometry
2016-08-26 14:08:55 +02:00
ac-stef e1ce0979d0 rewrite calculation of map geometry bounding box
and rename client-side struct "mapdims" to clmapdims (to avoid confusion
with server-side data)
2016-08-26 14:08:55 +02:00
ac-stef 48e2ce3863 new command sortmapsoundslots
...and some options for sortmapmodelslots and sorttextureslots

All three commands now accept three modifier keywords as arguments:
  nosort     do not sort the list alphabetically
  nomerge    do not merge any slots
  mergeused  merge used and unused (identical) slots freely
By default, the list is sorted and only unused identical slots are merged.
The keywords can be combined in any order. "nomerge" takes priority over
"mergeused".

Examples:

  sortmapmodelslots
    Sort the mapmodel slot list alphabetically and merge unused identical
    slots. Merging an unused slot is pretty much the same as deleting it,
    so this command sorts the list and removes unneeded double entries.

  sortmapmodelslots nosort
    Merges (deletes) unused double entries in the mapmodel slot list.

  sorttextureslots nosort mergeused
    Merges double entries in the texture slot list. If two identical
    entries are used in the map, all uses are mapped to the new combined
    slot. This leaves no visual changes on the map. Should be avoided, if
    texture slots have been renamed manually - and the the renaming isn't
    finished yet.

  sortmapsoundslots mergeused
    Sorts the mapsound slot list and merges all double entries.

DOCREF sortmapmodelslots sorttextureslots sortmapsoundslots
2016-08-25 11:48:45 +02:00
ac-stef 2ebf328bb8 limit number of mapsound slots
(hardcoded)

no reason why we need more mapsound slots than texture and mapmodel slots
combined...
2016-08-25 00:55:04 +02:00
ac-stef 71c65c90ca fix lighting error on edifice
16x16 mip doesn't render properly - had to break it up

thx BrutalSystem
2016-08-24 19:13:16 +02:00
ac-stef a4e84cbf20 cleanup 2016-08-24 12:38:33 +02:00
ac-stef 5813fd4e02 fix corner bounces
try really hard to avoid the seams between corner cubes

possibly overkill, but it's working...
2016-08-23 18:47:40 +02:00
ac-stef 5561d78f05 reduce bumps during cornerslide
backpedal 1/42 of a microstep to get out of the way of rounding errors

(clip ents are not supposed to have seams, but at least GCC builds
with -O3 seem to also require a little here - so, 1/333 for clips)
2016-08-23 18:46:27 +02:00
ac-stef 42cbd10e1d fix cornerslide speed
instead of using a constant (and always wrong) speed, use the same part
of the movement vector that x- and y- slides use

(sadly, this fix seems to raise problems with the previous "fix sliding
along corners" commit, which seems to have liked the constant speed...)
2016-08-23 11:44:09 +02:00
ac-stef af1144b45d optionally show ladder entities in edit mode
If enabled, render ladder entities as blue wireframes.


DOCREF showladderentities
2016-08-23 00:42:00 +02:00
Alejandro V. Garciaandaurhat c1252941ba Add missing mapmodel
Supplement to ace4d2b
2016-08-22 23:04:35 +02:00
ac-stef bffb588ba9 cleanup physics
should not break anything
2016-08-22 18:12:33 +02:00
ac-stef 7f0eb74f1c fix sliding along corners
fixes getting "stuck" while sliding along a 45° wall made out of
single corner cubes (most of the time)
2016-08-22 17:02:59 +02:00
ac-stef 50764a86cf fix rotated clip entity collision checks
* properly rotate the player hitbox
* add "corner bounce" (doesn't work flawlessly - but it's probably as
  good as possible with this kind of physics engine)
2016-08-22 16:24:34 +02:00
ac-stef 612a6291f1 new command sortmapmodelslots
* sorts all mapmodel slots alphabetically
* combines (merges) slots with the same model and parameters

DOCREF sortmapmodelslots
2016-08-22 15:08:20 +02:00