Commit Graph
137 Commits
Author SHA1 Message Date
ac-stef 3a320de948 cleanup cpistol 2017-06-27 15:15:25 +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 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 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 0bd18421f1 optionally not store inputcommand into command history
inputcommand <init> <command> <prompt> <nopersist>

    Opens a custom console buffer with custom prompt, initial buffer text
    and execution script (which gets the input buffer content in alias
    cmdbuf). If nopersist is not zero, the command will not be stored in
    console history.

DOCREF inputcommand
2017-05-31 15:37:08 +02:00
ac-stef e256971725 allow empty strings as result of inputcommand 2017-05-16 13:08:21 +02:00
ac-stef 967fd62077 cleanup 2017-04-26 16:14:39 +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 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 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 32ffd3a4cd replace non-thread-safe functions
replace all uses of strtok, localtime, gmtime and readdir

on platforms without safe versions, use homebrew or unsafe...
2016-02-28 23:14:47 +01:00
aurhat cc2ac85dd5 Improve order of displaying on HUD
Now command console over hudmessages, hudmessages over flag icons/scores
and player's stats.
Also fixed length of the line in command console.
2015-12-13 22:10:30 +01:00
aurhat 957f1e49ca Cleanup
Note: abbreviation of minutes and seconds in HUD messages in ktf is
needed, because for 5:4 aspect ratio messages could not fit in display.
2015-12-13 22:08:16 +01:00
aurhat 9c0f99f2a1 Cleanup
Remarks:
1. Changed order in keycmds lets to keep alphabetical order in saved.cfg .
2. Earlier long information in docs about arguments of command could be
invisible for low aspect ratio (example: "weapon" command), now it's fixed.
2015-07-04 11:30:58 +02:00
aurhat 5de86f9838 Cleanup
Fixed nested list in Cubescript, fixed conopen (now read-only), removed changeteam(),
fixed name of shortcuts for team survivor modes (so it fixes
https://github.com/assaultcube/AC/issues/73 ).

DOCREF ts tsurv btsurv
2015-03-29 14:57:29 +02:00
ac-stef d9b7e0e159 clean up saved.cfg
* combine all weapon attributes in a table
* sort variables and aliases
* group variables
* implement curname as SVAR
* implement cmdbuf as temporary alias
2015-02-23 20:17:43 +01:00
ac-stef 8153813c14 fix string escaping for SVARs
* avoid double richtext conversion for mspmsg
* fix minor memleak in pushident()
* always escape strings for the command buffer
2015-02-23 20:12:47 +01:00
ac-stef d585550315 automatic escaping for strings
* parsed words starting with " will handle richtext
* all strings in saved.cfg that need escaping are escaped
* new command "escape" to escape a string manually

DOCREF escape
2015-02-23 18:56:32 +01:00
ac-stef f75f0c0af4 add optional pre-access function for SVARs
allows a SVAR to be assembled when needed

also:

* mapmsg is now a SVAR
* getmapmsg was removed (now: $mapmsg)
* new editsvar script to edit any SVAR in the console buffer
* nonfunctional menu removed

DOCREF mapmsg getmapmsg editsvar
2015-02-23 18:52:34 +01:00
ac-stef 4b75405829 remove some dead code
and some braind* concepts
2015-02-12 12:54:03 +01:00
ac-stef d4110288da undo TAB-completion with LSHIFT+ESC
New commandline key-combination LSHIFT-ESC.
Resets the commandline to the state before using TAB-completion.
Useful, if TAB-completion wasn't helpful.
2015-02-12 12:19:38 +01:00
ac-stef 3b9075049c omit commands with leading blanks from history
like "HISTCONTROL = ignorespace" in bash
2015-02-12 12:17:04 +01:00
aurhatandac-stef a284064e9f Complete backwards
Use LSHIFT to direct TAB-completion to browse backwards through the
available alternatives.

also: full cleanup of the commandcomplete()-code [by stef]

* fix crashing buffer overflow
* remove some ancient ludicrous code
* ignore more spaces
* browse command- and filename-alternatives in alphabetical order
* clean up nickcomplete
* more comments (sry)
2015-02-12 12:10:22 +01:00
ac-stef 39cbee947d Merge branch 'master' into next 2015-02-08 16:17:04 +01:00
ac-stef 8604c198e9 cleaning up cubescript hooks
- provide a function to easily assemble and execute the command
- context-selective execution of hooks
- restrict potentially exploitable or harmful hooks to singleplayer-modes
2014-11-12 17:06:35 +01:00
ac-stef 3bbe1f9555 fix mandatory client logfile
The logfile can't be created before the commandline arguments are parsed,
because before that, the home directory is unknown. This patch logs
into a memory buffer which is then copied to the logfile as soon as
the logfile is created after processing the commandline arguments.

The memory buffer is created during the initialisation of global variables,
and destroyed after the logfile is created.
2014-10-06 12:43:32 +02:00
ac-stef fabfb73c83 added mandatory client log file
- a client will now write all os console messages to "clientlog.txt"
- at every game start, the log file gets rotated (with five old logs kept)
- commandline parameter "-N" can be used to limit the number of lines
  (after the lines are logged, the file is closed)
2014-09-22 00:24:09 +02:00
ac-stef a0286d2b3f replace textfilter functions with one-fits-all version
* replaces filtertext() with a version with a dozen of single filters
  that can be used in any combination
* defines classes of allowed characters for strings for various uses
  (see protocol.h line 153ff)
* now the allowed charset of, for example, player names is defined
  in one location only
* fixes issue #58
2014-05-24 12:59:19 +02:00
ac-stef 493aefd34b fix: convert xmap path names for windows
* make sure, unsaved edits only count in editmode (otherwise "watercolour"
  in map configs would already be "edits")

* nicer filenames for backup-xmaps

* catch failed xmap file write access

* unsavededits is now flag (!= 0) and counter - to enable scripts to
  detect "new edits".

new commands:

xmap_delete_backup    deletes the backup xmap

xmap_keep_backup    moves the backup xmap to a regular named spot

xmap_rename    changes the nickname of an xmap
2014-05-19 12:31:26 +02:00
ac-stef b0649b5ea5 multiple map buffers for map editing: "xmaps"
An xmap holds everything related to map editing at a certain moment: it is
a map editing snapshot. It contains the name, the header, the geometry,
the entities, the extra headers, the undo/redo data and the cameraposition
from the moment, the snapshot was taken.

Xmaps are held in memory and, if persistentxmaps is set to "1", are saved
at game end and restored at game start.

xmap_list
  lists all xmaps currently in memory

xmap_store <nickname>
  create a snapshot and store it under the given nickname
  (nicknames have to qualify as valid filenames)

xmap_restore <nickname>
  restores the named snapshot. Also creates a backup snapshot of the
  current editing data.

xmap_restore
  restores the last automatic backup snapshot. Automatic snapshots are
  taken, a) before a snapshot is restored, b) before a new map is loaded
  (if there were unsaved edits on the map) and c) when the game ends (if
  there were unsaved edits).

xmap_delete <nickname>
  deletes the named snapshot.

Unsaved edits are flagged in the HUD with an "U" in the lower right
corner of the screen.

The files with the persistent xmaps are stored in mapediting/xmaps. After
they were restored at game start, the files are moved to
mapediting/xmaps/backups. Xmap files are cubescript files.
2014-05-15 17:34:25 +02:00
ac-stef c276c508da fix prompt cursor position
no more 1-char limit on inputcommand prompts
2014-05-14 22:38:29 +02:00
Lucas GAUTHERONandac-stef 8e0796a6ae transparency options for console and votes (resolves #45) 2014-05-14 14:28:54 +02:00
aurhat 88f9448238 Fix of the bug, which causes crash on Windows because of missing "history" file.
After first run of git AC version "config/history" file doesn't exist, what causes crash of  Windows AC version,  which can't find this file.
Commit just adds checking, whether this file exists - "if(!histbuf) return;" in loadhistory() .
Commit fixes also location of some brackets and spaces, in order to keep proper AC style.
2014-04-08 22:23:58 +02:00
Ronald Reagan c64d1e855b Console history save fixes 2014-01-30 17:21:35 -08:00
Ronald Reagan 1caf38e898 Added command line history. New file 'history' used in the config folder 2014-01-23 12:09:05 -08:00
Bukz cf6f3dfb94 prevent accidental message submission, thanks SKB
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7330 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-03-09 22:11:45 +00:00
Bukz 351f4a96dc need this here for some netbooks/etc. that don't have a regular return/enter key
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7250 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-02-22 19:26:11 +00:00
Bukz 24fd7f4b45 new commands findkey & findkeycode
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7154 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2013-02-06 04:18:56 +00:00
aerkefiende 66f8feee3b Replaced every tab with 4 spaces
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6927 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-11-12 22:28:11 +00:00
aerkefiende 19f4558112 Command line now can use the mouse input as well (thanks to Felix-The-Ghost and SKB)
conskip fix (thanks to SKB)
new windows binaries

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6926 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-11-12 21:53:44 +00:00
sireus b33116712c sane(r) command signatures (warning: huge commit)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6908 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-10-06 22:49:49 +00:00
Bukz 01c09eeae1 updated win bins
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6836 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-06-12 15:15:00 +00:00
Bukz e57a13a248 Testing new native alias "KEYPRESS"
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6835 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2012-06-12 11:18:13 +00:00
sireus 77c2dd3944 fixed some issues found by cppcheck
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6740 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-12-19 21:02:57 +00:00
Lucas GAUTHERON 9aa3585477 keybind fixes/cleanups
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6628 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-08-31 17:48:23 +00:00
Lucas GAUTHERON 8da769b0c2 hardcoded bind/specbind/editbind (win client included to keep it compatible with resetbinds.cfg)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6622 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-08-30 18:17:38 +00:00
Lucas GAUTHERON a57446cd4c cubescript fixes and cleanups
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6621 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-08-28 17:20:06 +00:00
Lucas GAUTHERON efe9e55a98 "searchbinds" command
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6620 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-08-28 16:55:49 +00:00
aerkefiende 06f73f4627 Replaced Tabs with 4 spaces in every source file
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6561 e016b1c5-ed68-44aa-a2f7-31cac88cffde
2011-07-31 15:44:57 +00:00