Commit Graph
100 Commits
Author SHA1 Message Date
ac-stefandaurhat 6ec9d3cf80 fix seedlen 2020-11-03 12:52:37 +01:00
ac-stefandaurhat f8d3e968ed fix clang warnings 2020-02-08 14:33:18 +01:00
ac-stefandaurhat 4fe1b97d00 removed huge unnecessary file
The file packages/models/playermodels/RVSF/07_Blue-Red.psd had a filesize
of over nine megabyte - and was of no use to the game. It made all recent
game packages 9MB bigger than they had to be. That's about the size of
all game textures combined...
If someone still needs the file, check it out from an older commit.
2020-02-02 08:34:46 +01:00
ac-stefandaurhat 7b5c91a3da temporary win10 hotfix changes
Some changes to allow the current experimental branch to be used for a
hotfix release for win10 users.

The latest win10-update broke compatibility with SDL1.2 - and apparently
MS is not going to fix it. This hotfix allows win10 users to use our
experimental SDL2-based client.

It is quite incompatible with the 1.2.0.2 release - but it's good enough
to be played in pubs.

Coopedit will not work and quite a few custom maps won't work properly.
This is due to lots of changes in the map file format and does not mean,
that those custom maps can not be played in future game releases - they
just need to be reworked. See akimbo2 to check out the reworked maps, btw.
The old official maps and most conservative custom maps should be fine.

Due to some physics changes, players of the hotfix client will have some
advantages and some disadvantages compared to the regular clients, so DO
NOT USE THE HOTFIX CLIENT TO PLAY COMPETITIVELY.

By default, if an incompatible map is loaded in multiplayer, the client
will disconnect automatically. This can be disabled (disconnectonmaperror),
but will probably get you marked as cheater, because on incompatible maps,
model clipping may not work properly. Just stick to compatible maps...
2018-02-10 11:28:51 +01:00
ac-stefandaurhat 135f9f4a90 fully automatic keymap generation
If a key is not listed in keymap.cfg but SDL provides a good enough name
for the corresponding scancode, a keymap entry is generated automatically.

If a key can't be found when adding a bind, it is checked, if SDL can
resolve the key name. The resolved keybind is then used to recreate the
keymap entry - and the bind can succeed.

Some SDL names for scancodes may not be usable as keymap names: if the
name contains (, ), $ or ", it will be rejected. Also, SDL does not
provide names for all scancodes. Scancode names provided by SDL can be
platform-dependant, therefore recreating the bind may fail on a different
platform.

However, the feature should work fine with most nonstandard keys - and the
information written to clientlog can be used to amend keymap.cfg
2018-02-10 11:28:50 +01:00
ac-stefandaurhat e5077d0226 use both keycodes and scancodes of keypress events
If a keycode can not be found on the list from keymap.cfg a second search
is done for the scancode. This should be helpful to assign
layout-dependent keys with rare keycodes.

Also: use a hash table for the keys (instead of a list).

Add two new scan codes for dead keys on german layouts: LEFTOF1 and
LEFTOFDEL.
2018-02-10 11:28:50 +01:00
ac-stefandaurhat 19bb560dd2 more SDL2-related backports from sauer
* use keyrepeat and textinput switch code from sauer (on windows, opening
  a console with "t" also produced a "t" as text otherwise)
* screenw and screenh are now cubescript-variables that always reflect
  the actual resolution of the screen or the window

DOCREF screenw screenh
2018-02-10 11:28:49 +01:00
ac-stefandaurhat f0f8eac770 remove most platform dependent exceptions for SDL2 code
* switch travis to trusty
* new parameter fullscreendesktop: uses desktop resolution for fullscreen
* "colorbits" removed, since it's no longer supported
* scr_w/scr_h no longer necessarily reflect the true display resolution
  (with fullscreendesktop = 1 and fullscreen = 1, scr_w and scr_h are
  ignored)
* desktopw and desktoph are now guaranteed to have nonzero values
* fallback to old mouse behaviour when SDL_SetRelativeMouseMode fails
* require a click into the window to grab the mouse
* scr_w/scr_h default to desktop resolution on first run

thx sauerbraten :)

DOCREF fullscreendesktop colorbits
2018-02-10 11:28:49 +01:00
ac-stefandaurhat e75dfbe4c7 fix/finish SDL2 port
* implement gamma
* menu keys fixed
* add support for horizontal mousewheel and some more mouse buttons
* fix keyrepeat
* fix window resizing
* fix compiler warnings
* use SDL to access clipboard
* remove X11-dependency
* some surplus SDL headers removed
* fix setdesktopres
* fix vsync
* improve fullscreentoggle on linux
* remove togglegrab
2018-02-10 11:28:49 +01:00
ac-stef 45bded0150 fix zipmod
avoid tripping asserts in VC
2017-11-22 20:25:34 +01:00
ac-stef 059ea1e992 fix omitunchangeddefaults 2017-08-05 10:49:10 +02:00
ac-stef 2220bbc5e2 font rendering optimisations 2017-08-05 10:49:10 +02:00
ac-stef db2607cabb fix embedded scores in screenshots
embed game description and player scores in png and jpg comments

update enet.lib
2017-07-20 16:07:42 +02:00
ac-stef 58ff110908 fix remip for some border cases in editing
some cases need a little more area remipped - and in edit mode, we don't
need to be stingy
2017-07-19 21:00:27 +02:00
ac-stef 00ba55ecac fix singleplayer hitsounds
(for hitsound 1)
2017-07-19 18:22:11 +02:00
ac-stef 8bb71ee839 fix direction for moving entities by scrollwheel
the same mousewheel direction now always moves an entity away from or
towards the player

  entproperty

    if 100 is added to the attribute index parameter, the sign of the
    increment value is changed

  editaxis

    returns a value for the main axis of player orientation (X:11, Y:12,
    Z:13) and adds 100 if the player is looking in the negative
    direction of the axis

DOCREF entproperty editaxis
2017-07-15 17:27:55 +02:00
ac-stef 59c3d1756d add option to grey out menu items
greyed out menu items are a) grey and b) can't be operated

  menuitemgreyedout 0|1

    menu items added after this command are greyed out (1) or not (0)

DOCREF menuitemgreyedout
2017-07-09 11:30:29 +02:00
ac-stef cb51e9f422 untangle entity rendering
fix unbatched model roll
2017-06-27 15:15:25 +02:00
ac-stef 3a320de948 cleanup cpistol 2017-06-27 15:15:25 +02:00
ac-stef 1fe478aae4 cleanup protocol
...and get master to compile again

DOCREF hudextras mapstats_hud nextGameMode
2017-06-27 15:15:25 +02:00
ac-stef 2fa895ae90 use fov and roll values of remote player during spectating
spectfovremote 0|1
    '1' uses fov and scopefov of the spectated player, '0' uses spectfov
    and the local scopefov, default is '0'

  maxrollremote sets the maximum roll to be shown during spectating

DOCREF spectfovremote
2017-06-27 15:15:25 +02:00
ac-stef 3549310e42 better quantisation of position and velocity vectors 2017-06-27 15:15:25 +02:00
ac-stef 9231b9f0aa actually zoom the scope while spectating
to show off the new highres pos angles :)
2017-06-27 15:15:25 +02:00
ac-stef 0b44cf1c9c reduce compact pos packet size by two more bit 2017-06-27 15:15:25 +02:00
ac-stef 94d0203bc6 cleanup pos packets
* remove roll
* optimise for size
* new protocol data type: unsigned integer with known size
* highres yaw encoding
* double resolution for pitch angles -30°..30°
* half resolution for pitch angles -90°..-30° and 30°..90°
* proper rounding for pitch and yaw values
* same resolution for yaw and pitch for both pos packet types
* restore transmission of the velocity vector
2017-06-27 15:15:24 +02:00
ac-stef 7cddb6c7c6 add debug logging to demo recording
fix server hanging after 5th demo
fix incomplete demo slot cleanup
fix demo file size reporting (enddemorecord can't do it accurately, because
  the file is not complete, yet - so, round to megabytes, where the error
  doesn't show...)
include exact demo file size in "listdemos" report
2017-06-27 15:15:24 +02:00
ac-stef 7fe7e47317 improved demo recording
The demo data is collected, hashed and compressed fully in memory, mostly
in a worker thread.

While in memory, each demo is identified by an unique sequence number,
which is, for example, used to request a download by the client.

If so configured, the demo is written to file by the worker thread.

If F10 is pressed later than two minutes into the next game, instead of
downloading the last game, the current game is scheduled to be
automatically downloaded when it ends.

At the end of a game, all clients and the server sign the demo file.
2017-06-27 15:15:24 +02:00
ac-stef 2f80c5bae5 add channel for less important server messages
(so that the client can choose to not display them)
2017-06-27 15:15:24 +02:00
ac-stef 7d1edd0fa1 cleaned up demo filename nonsense
If a filename does not contain at least mode, map and timestamp (due to
messed up format strings), the default format is used to ensure unique
filenames.

server side: added server parameters

  demo_max_number
    number of demo files to hold in RAM

  demo_save
    enable/disable writing of demos to file

  demo_path
    demo file path and filename prefix

  demo_filenameformat
    format string to assemble demo information to a filename
    %g : gamemode (int)
    %G : gamemode (chr)
    %F : gamemode (full)
    %m : minutes remaining
    %M : minutes played
    %s : seconds remaining
    %S : seconds played
    %h : IP of server
    %H : hostname of server (client only)
    %n : mapName
    %w : timestamp (formatted by demo_timestampformat)

  demo_timestampformat
    timestamp format string (see strftime() for format options)
    if the string starts with 'U', UTC is used - otherwise local time

client side:

changed demonameformat and demotimeformat to SVARs

  demonameformat
    like demo_filenameformat

  demotimeformat
    like demo_timestampformat

removed demotimelocal getdemonameformat getdemotimeformat getdemotimelocal

DOCREF demonameformat demotimeformat
DOCREF demotimelocal getdemonameformat getdemotimeformat getdemotimelocal
2017-06-27 15:15:24 +02:00
ac-stef 2b10bf1e68 misc VS warning fixes 2017-06-27 15:15:24 +02:00
ac-stef 7d698c340c clean up ip byte mangling
for now, censored IPs just show a '0' at the end...
2017-06-27 15:15:24 +02:00
ac-stef df6719439b optionally reverse influence of previously played games modes
a negative modepenalty_weight value makes the server more likely to
suggest games with the same mode as was recently played

default is a positive value to more likely mix it up
2017-06-27 15:15:24 +02:00
ac-stef 00c05ef353 add debug access to server parameters
Server owners can overwrite values on a server, which then don't get
updated from file anymore. With a reset command, all parameters get read
from file again. Implemented as "serverextensions".

serverextension servpar::get parname
  print parname and value

serverextension servpar::set parname:value
  set parname to value
  also disables reading of this parameter from file (otherwise, the
  new value wouldn't last very long)

serverextension servpar::reset
  set all parameters to be read from file again

serverextension servpar::dump
  prints unsorted list of all parameters, values, limits and descriptions
2017-06-27 15:15:24 +02:00
ac-stef daf4b9d24a add server parameters for statistic and diagnostic purposes
Logged server parameters are checked for changes once a minute. If a
change is detected, it is logged.
2017-06-27 15:15:23 +02:00
ac-stef 49232e05e0 new commands to add modeinfo and artist info to maps
mapartist print|set|get|clear

  print:  prints the map artist player ID
  set:  sets the map artist player ID to the currently logged in player
  get:   returns the current map artist player ID
  clear:  erases an existing map artist record in the current map

modeinfo list|get|clear|<modelist> <modeflags>

  list:  lists current modeinfo entries
  get:  returns list of current modeinfo entries
  clear:  erases current list of modeinfo entries
  <modelist> <modeflags>:  specifies flags for a list of modes

DOCREF modeinfo mapartist
2017-06-27 15:15:23 +02:00
ac-stef cefe93ce18 don't autoplay maps from servermaps/incoming 2017-06-27 15:15:23 +02:00
ac-stef 0b656d2380 add server-side player vita database
The server keeps track of every player ID that ever connected successfully.
This database stores the last names and IPs used by the player and the
last countries the connections came from. Some stats are counted, like
"time connected" and "total tks". Most importantly, the database stores
rights (like admin) and restrictions (like ban). All rights and
restrictions are kept as dates (or timecodes), so, for example, if your
ban date is in the future, you are banned - and if it's in the past, you
can play. The collected stats are meant to help server owners at managing
players - especially, if they want to give someone admin rights.

The database is periodically saved to a file and read from that file on
startup. The default file is config/servervita.cfg and one backup is kept
in config/servervita_bak.cfg. During server start, if the regular file
can't be loaded, the backup is tried instead.

While the server is running, it checks periodically for a file named
config/servervita_update.cfg, and if the file exists, it is renamed to
a backup filename including a timecode and read and merged into the
database. The automatic rename makes sure, that a file is only read once.
Using such updates, a server owner can easily give several people admin
rights or for example, add clan tags for a whole list of IDs. (Yes, the
database also stores a clan tag for every ID...)

The database also stores two short comments for every ID. One can only be
read by server admins, but the other one is public. The public reason, for
example, can state a reason for a ban.

One database record takes up 264 bytes of RAM. During autosave, accounts,
that have not been used for a specified time (default 12 months), will
not be written. After a server restart, those old records will be gone.

Currently, there is no process in place, to also clean up old records
from RAM. Maybe, that'll be added later...
2017-06-27 15:15:23 +02:00
ac-stef 035d7caf2f thread-safe and fully buffered logging
Uses own thread to actually write to logs, so the main thread can't be
blocked by a slow logfile. Log entries are buffered in two ringbuffers,
one for the main thread and one for all other threads. The main thread
will copy the second buffer to the main buffer periodically. The main
thread buffer is read from the log worker thread.

Since two buffers are kept, there are now several functions to add a log
entry:

  mlog()
    for main thread functions only: will never block

  tlog()
    other threads only: may block, until main thread copied some entries

  xlog()
    automatically determines, which thread it's been called from and
    then writes to the proper buffer (will block accordingly)

To avoid improper usage, mlog and tlog verify, if they are used correctly.
(Only for debug builds. An assert triggers, if necessary.)
2017-06-27 15:15:23 +02:00
ac-stef dd295bb54a initialise server parameters from commandline
overwrite defaults with commandline parameters before first use
(log level settings used as an example)
2017-06-27 15:15:23 +02:00
ac-stef d6af5be3da add auth to client server connect protocol 2017-06-27 15:15:23 +02:00
ac-stef 0148c5b9a9 add new protocol data type for IP addresses
(to avoid casting IPs to signed integer)

also mute single number debug messages for compound data structures like
string and key: no longer print a debug message for every char of a string
2017-06-27 15:15:23 +02:00
ac-stef f581506960 no more static buffers for iptoa and iprtoa 2017-06-27 15:15:22 +02:00
ac-stef 2147d60934 option to dump maprot suggestions to file 2017-06-27 15:15:22 +02:00
ac-stef 5fee02c77b new maprot
Instead of a list of specific map+mode combinations the maprot now only
contains general rules for maps and game modes. The server then calculates
the list by itself when needed. The server accounts played maps and modes
(and map+mode combinations) and calculates the list specifically not to
overplay maps or modes.

May need further testing.
2017-06-27 15:15:22 +02:00
ac-stef 7486317497 add changeable server parameters
A list of parameters is read from config/serverparameters.cfg once per
minute and the values written to corresponding server data structures.

If the binary is compiled in debug mode, starting a dedicated server
will write a blank config file with all possible parameters and their
descriptions, sorted and grouped into chapters.

The name of the config file can be set with the commandline parameter -A.

So far, syntax errors are not reported. Instead, it's possible to dump
all current values to a file every time something changes.
2017-06-27 15:15:22 +02:00
ac-stef 3376c5e299 detect server config file changes by hashing
Checking only file sizes obviously misses content changes that don't
change the size.
2017-06-27 15:15:22 +02:00
ac-stef 110a209d4e move validmapname
add map name checks to servermap::load()
2017-06-27 15:15:22 +02:00
ac-stef 7dc72aebb1 add basic functions for game mode bitmasks 2017-06-27 15:15:22 +02:00
ac-stef b82a38b2e2 read-ahead for server info files
* poll and read motd and serverinfo along the other server config files
* "en" language setting is now immutable
2017-06-27 15:15:22 +02:00
ac-stef e147000ba2 replace some more strtok
also make sure, randomMT survives concurring use from different threads
2017-06-27 15:15:22 +02:00
ac-stef 5ec04b82e1 delegate checking and loading server config files to own thread
"readserverconfigsthread" gets triggered by poll_serverthreads() once a
minute to check the filesizes of all server config files. Altered files
get loaded into memory.
poll_serverthreads() in the main thread then processes the buffered files
one at a time. During processing, a semaphore is locked, so that other
threads can use the data structures derived from config files - if they
use the semaphore to lock the ressource.
Using the data from main thread can be done without using the semaphore,
since _all_ changes are done in the main thread.
If the main thread wants to update data that is locked by a thread, the
main thread will defer the changes for a minute. The main thread will
never lock.
2017-06-27 15:15:21 +02:00
ac-stef 1c109bfa62 new commandline parameter to specify path for server logfiles
use -H to set path
default is logs/
2017-06-27 15:15:21 +02:00
ac-stef 1d1230544b speed up logging
don't bother processing a line, if the level is too high for any queue
2017-06-27 15:15:21 +02:00
ac-stef 7c54645785 concatenate consecutive identical geoip ranges silently
slightly faster and wastes less RAM
also: better detection of entry overlapping
2017-06-27 15:15:21 +02:00
ac-stef 63668e0dda add support for a geolocation table
including two converter scripts to use Geolite2 and Webnet77 tables
2017-06-27 15:15:21 +02:00
ac-stef ac5229dfba server cleanup
* restrict reading of config files to times when the server is empty
* collect entropy
* remove hint how to convert pre-1.0 blacklists
2017-06-27 15:15:21 +02:00
ac-stef c8c310886a fix parsing of commandline switches for servers
also:
 * -Y now sets the private key for the server
 * -m without argument uses default masterserver URL
 * servers run LAN-only by default (set ms URL and private key to
   register with the master)
 * use generic locale "POSIX"
2017-06-27 15:15:21 +02:00
ac-stef 25deee5287 more versatile disconnect reasons 2017-06-27 15:15:21 +02:00
ac-stef 1ca4ce54eb some server changes
tbc
2017-06-27 15:15:20 +02:00
ac-stef db9bd67be9 protocol bump
no longer compatible with 1.2.0.2

also: nade effect quantisation fixed
2017-06-27 15:15:20 +02:00
ac-stef e29bb2aa2d simplify decision to render corpse
instead of checking for actual gibs, check for "was gibbed"

fixes problems with still existing gibs when the player dies again fast
enough
2017-06-27 13:31:02 +02:00
ac-stef 524988feaa filter unrenderable chars from console input
filter all chars that have no entry in the current font
2017-06-25 18:17:46 +02:00
ac-stef 57093ed70c rewrite doc command parser
- properly break statements into words
- pick statement where cursor is
- detect unmatched braces + indicator
- fix huge memory leak
- add cs ident details
- add debug view (broken into words)
- menu entries for the settings

  docidentverbose 0|1|2|3

    enables ident details or statement analyser

DOCREF docidentverbose
2017-06-23 12:48:17 +02:00
ac-stef ec12d6872e don't change persist flag while alias is pushed
and clean up the stack before removing an alias (memleak!)
2017-06-17 20:50:06 +02:00
ac-stef 4b26df11df update genmapitems
easier than to fix the persistidents vs. push/pop problem :)
2017-06-17 18:37:32 +02:00
ac-stef e96b97a5a5 fix updatefrommaster 2017-06-17 15:33:54 +02:00
ac-stef 03e21b097d fix stuff found by cppcheck
almost 3000 lines of "errors" contained one actual memleak, one actually
unused variable and three actual ambiguous code parts

from cppcheck website: "The goal is to detect only real errors in the
 code (i.e. have zero false positives)." :)

thx for finding five problems in our code
2017-06-17 12:40:35 +02:00
ac-stef f33b9c0dba enable automapconfig whenever config slots are added 2017-06-16 19:20:21 +02:00
ac-stef 2448e90bf2 convmap changes
new tool: list media sources
new stage: check vantage points
new: add single map from menu
new: option to abort maps on stage errors

fixed: make sure, player is alive (to be able to enter edit mode) during
conversions
2017-06-16 16:05:03 +02:00
ac-stef 8235300d77 merge old and new entity copy/paste
- copyent and pasteent now also work with the menu list of copied ents
- pressing editmeta while using pasteent opens the menu
- new switch command (not unlike the old one)
- make expandselection and shrinkselection work with multiple selections

DOCREF switch copyent pasteent
2017-06-15 14:00:54 +02:00
ac-stef 43aea343ad fix at
negative index numbers now return ""

for now, a warning is printed, if that happens

DOCREF at
2017-06-15 01:19:34 +02:00
ac-stef 0b2079660a fix clip entity menu and add entity copy/paste menu
newent7 type attr1 attr2 attr3 attr4 attr5 attr6 attr7

    Works like newent, but can set all seven attributes directly.
    Does not automatically put the camera yaw angle into mapmodel and flag
    entities.

fixed selectionwalk so that the first parameter can be ""

DOCREF newent7
2017-06-15 01:12:33 +02:00
ac-stef e1572dcdee move ++, --, ++f and --f to compatibility.cfg
useless, because of the "failing silently" behaviour

DOCREF ++ -- ++f --f
2017-06-14 19:01:15 +02:00
ac-stef d7277c1aa4 fix permissions for some edit commands
- always allow read-only edittextureslot, editmapmodelslot and
  editmapsoundslot
- allow setvantagepoint when editing offline or spectating offline
- new var editing_sp: 1 during edit mode in singleplayer (offline)
- additional menus for read-only access to map config slots
- new bonus edit scripts: selectmiddle and unclipentclippedmodels

DOCREF edittextureslot editmapmodelslot editmapsoundslot setvantagepoint
DOCREF editing_sp
2017-06-14 16:33:58 +02:00
ac-stef 9bb9cc280b click
shutter sound, cut, edited and compressed

original at: www.freesound.org/people/jgrzinich/sounds/155385/
original license CC0
2017-06-13 14:19:16 +02:00
ac-stef 7aca9ff9d3 expect DT_UNKNOWN 2017-06-13 10:46:15 +02:00
ac-stef 30a0e8608c menu code cleanup and subdirectory support
menuitemmapload mapname action [hoveraction [desc]]

    create menu entry for a map file

  menudirlistsub action dots

    adds subdirectory entries to a menu with a files list
    has to come after the menudirlist command
    <action> is the command to be executed, when the menu entry is chosen
    if <dots> is 1, an entry ".." is added

  enumfiles path [extension]

    lists files in a directory
    if extension is specified, only files of that extension are listed
    if the extension is "dir", only directories are listed

DOCREF menuitemmapload menudirlistsub enumfiles
2017-06-12 20:07:11 +02:00
ac-stef 661ee6eff2 distinguish between files and directories
listfiles now optionally sorts the list and removes doubles
2017-06-12 18:17:15 +02:00
ac-stef 7a02ccd8b7 only load map descriptions and preview pictures when needed
+ memleak fixed
+ possible NULL dereference fixed
2017-06-12 03:24:34 +02:00
ac-stef a5fbccbd7c restore htf flag skins
and re-use flag model files
2017-06-11 21:13:51 +02:00
ac-stef 528d923f81 create map preview pictures during spectating
pressing CTRL+F12 during spectating creates a clean screenshot and saves
it as map preview picture

  modkeypressed

    returns 1, if a CTRL key is pressed and 0, if not

  screenshotpreview [lines]

    creates a screenshot cropped to 4:3 with a given number of lines
    (in the range of 144 to 480, default 240 or last given value)
    and jpeg quality 80

  gotovantagepoint

    now returns 1, if the map actually has a vantage point set

DOCREF screenshotpreview modkeypressed gotovantagepoint
2017-06-11 21:13:50 +02:00
ac-stef 06b9d3103d remove maploaditemlength
and add map name to preview picture

DOCREF maploaditemlength
2017-06-11 17:07:49 +02:00
ac-stef 800e4f3a13 add reset option for loadcrosshair
loadcrosshair reset

    loads all default crosshairs (including teammate and scope)

    short form of "loadcrosshair default default.png ; loadcrosshair
    scope red_dot.png ; loadcrosshair teammate teammate.png"

DOCREF loadcrosshair
2017-06-10 00:15:58 +02:00
ac-stef b2890a3334 allow more edit commands in multiplayer
(editentity, edittextureslot, editmapmodelslot, editmapsoundslot)

the commands are still not allowed to change anything in coop, but
information retrieval is ok
2017-06-09 21:52:55 +02:00
ac-stef fcb3481e23 fix crouch release on death 2017-06-09 20:42:26 +02:00
ac-stef a6bd160a76 disable ktf indicator when minimap is open 2017-06-08 19:28:07 +02:00
ac-stef ef2b91c0ce more cubescript limits
the limits are hardcoded and require recompilation to change

* limit recursion depth
* limit loop iterations
* limit string lengths
* limit push/pop depth
* clean surplus whitespace from config files
* provide context for script errors

(limits accidental crashes, not intentionally malfunctioning code)
2017-06-08 19:00:04 +02:00
ac-stef 2a52dc0069 third option for flag score hud transparency
flagscorehudtransparency 0|1|2

    0: no transparency, icon set "flag gone"
    1: transparency, icon set "flag gone"
    2: transparency, classic icon set (default)

DOCREF flagscorehudtransparency
2017-06-08 00:39:24 +02:00
ac-stef 83d0199867 command cleanup
changed commands:

  strstr haystack needle

    now returns position of needle in haystack (counting from 1)
    or zero, if not found

  substr string start len

    now counts negative length from total length
    "substr text 1 -2" now returns the text without first and last char

  strreplace text search replace

    no longer restricted to 260 char stringlengths

removed commands:

  swapelements, strpos (can be scripted, if required)

DOCREF strstr substr
DOCREF swapelements strpos
2017-06-07 23:20:00 +02:00
ac-stef ffee440fa0 add early string replacement and alias lookup to cubescript
replace tokens starting with @ during scanning/sizing-up of []-blocks

  @word    look up word as in $word
  @(...)   evaluate braces
  @[...]   evaluate braces and look up result
  @"..."   parse quotes

in nested []-blocks, use multiple @ to determine time of replacement
(for example, @@@word is replaced when found inside three nested braces)

in regular $-lookup, $[...] now evaluates the braces before lookup
2017-06-07 18:16:06 +02:00
ac-stef 4d684cfc8e improve alias lookups
now i = 3; echo $(concatword arg $i) works like echo $arg3 :)
2017-06-06 21:41:25 +02:00
ac-stef 0e78c1e9dd fix empty menu footers
thx BrutalSystem
2017-06-06 19:19:57 +02:00
ac-stef dbcb040eeb menu code cleanup
* fix some memory leaks
* rename stuff
* fix crash

Removed commands and variables:

  chmenumdl (replaced by menumdl)

  scorefont (replaced by "menufont score mono")

  menuitemvar (better handled with fully dynamic menus)

Changed commands:

  menufont menu font

    Sets the font for a specific menu. If menu is "", the currently
    initialised menu is used. Example: menufont score mono

  menumdl menu mdl anim rotspeed scale

    Assumes the function of the previous chmenumdl. If menu is "", the
    currently initialised menu is used. Specifies, which model to render
    and how. If only menu is specified, no model is rendered.

DOCREF chmenumdl scorefont menufont menumdl menuitemvar
2017-06-06 13:17:20 +02:00
ac-stef 7948212234 add radio buttons and simplify sliders
- omit step size for sliders with value descriptions
- optionally auto-determine max value by list length

  menuitemslider text min max value display action wrap
  menuitemradio text min max value display action

    text: menu item text
    min: min value
    max: max value (or optionally -1 and set by display string length)
    value: initial value
    display: list of value descriptions or value step size
    action: executed on value changes (new value in arg1)
    wrap: if 1, wrap slider around (radio buttons always wrap)

DOCREF menuitemslider menuitemradio
2017-06-06 13:17:20 +02:00
ac-stef c9ddadd525 per-slider option to wrap around
menuitemslider text min max val step display action wrap

DOCREF menuitemslider
2017-06-05 15:14:40 +02:00
ac-stef 1bf36ca2b3 option to turn off flag score hud transparency
flagscorehudtransparency 0|1

    default: 1

DOCREF flagscorehudtransparency
2017-06-05 01:06:35 +02:00
ac-stef d81071f200 provide HOME for all
...menus
2017-06-04 17:43:44 +02:00
ac-stef e57ece345d rewrite url connect protocol parser
to use existing url parser

valid examples:

  assaultcube://example.org
  assaultcube://example.org:28763
  assaultcube://example.org:28763/?password=secret
  assaultcube://example.org?password=secret
  assaultcube://example.org/?password=secret
  assaultcube://example.org/?port=28763
  assaultcube://example.org?password=secret&port=28763
  assaultcube://example.org?port=28763&password=secret
  assaultcube://11.22.33.44
  assaultcube://11.22.33.44/
  assaultcube://11.22.33.44:28763
  assaultcube://11.22.33.44:28763/?password=secret

* the slash after the host part (example.org) is optional
* the host part can also be an IP address
* password and port in the query part (after '?') have no specific order
2017-06-04 17:43:40 +02:00
ac-stef d5e00f9e89 optionally omit cleaning up vector when closing vector stream
allows reusing the vector

Makefile updates
2017-06-02 14:30:31 +02:00
ac-stef e5b99e6da4 xmap menus
getxmaplist <what>

    Returns a list of all regular xmaps in memory, or, if <what> is "bak"
    the details of a stored backup xmap. Each xmap is listed with nickname
    and description.

DOCREF getxmaplist
2017-05-31 19:59:17 +02:00