Commit Graph
4020 Commits
Author SHA1 Message Date
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
aurhat 8b144afb4e Upgrade VS project to SDL2
Used SDL2 v. 2.0.5 and SDL2_image v. 2.0.1
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
Jani-Markus Maunusandaurhat f86579533a Ported AC to SDL2 2018-02-10 11:28:48 +01:00
aurhat f53f110926 Fix crash in client compiled in CB 17.12 on Windows
It happened for -O3 compiler flag.
2018-01-27 09:35:07 +01:00
Lee Salzman bda6248d23 always use scissor on reflections 2017-11-29 15:35:10 -05:00
Lee Salzman e58e8f2eb6 clear color and depth of reflection at same time 2017-11-29 15:23:31 -05:00
Jani-Markus Maunusandaurhat aba2657671 Restored old default value for reflectclip 2017-11-29 19:45:26 +01:00
Jani-Markus Maunusandaurhat a2b61a1792 Fixed HUD components appearing in water reflection
Clear the region on which the world is rendered (vertically flipped)
to create the reflection texture - otherwise regions not painted over
still contain data from the previous frame, including some HUD elements
in the bottom-left corner of the screen.
2017-11-29 19:45:16 +01:00
ac-stef 45bded0150 fix zipmod
avoid tripping asserts in VC
2017-11-22 20:25:34 +01:00
aurhat 830f8c0cf7 Cleanup
Thanks DADSGETNDOWN for the report for maps/mapmodel configs.
2017-11-18 14:04:59 +01:00
aurhat d3bd26a62d Fix animation during quicknadethrow attack
1. Before animation of the moving hand for throwing the grenade was cut,
now it's complete, like for normal grenade throw. To do that the code for
switching to previous weapon has changed location. selectweapon() isn't
used there, because if player has more grenades than 1, then after a throw
for a moment a grenade appeared in a hand, and just later previous weapon.
2. The changed code in quicknadethrow() prevents from shooting using right
mouse button, after starting to shoot quickly after grenade throw
(especially when player has more grenades than 1).
3. Also fixed resetting the "quicknade" variable.
2017-10-15 13:49:53 +02:00
aurhat 6ea3c499ce Remove involuntary shooting when switching weapons
It happened in case of automatic weapons.
2017-10-15 13:33:46 +02:00
aurhat d841896e7b Fix shooting during picking up akimbo
It prevents from shooting using right mouse button, when grenade was
activated and player picks up akimbo.
2017-10-15 13:29:50 +02:00
aurhat 4c2c511105 Fix grenade throwing when switching weapons
It fixes the problem that activated grenade disappeared during switching
the weapons, when player tried to throw grenade when time for grenade
cooking was almost finished.
2017-10-15 13:25:42 +02:00
aurhat 1d7dd9df84 Cleanup 2017-10-15 12:14:20 +02:00
aurhat 3e59a6305e Add grenade state of clients
For example that fixes grenade attack animation, when in demo mode player
is spectated from 1st-person position. Till now there were visible
2 incomplete movements of the hand for throwing - first after activating
a grenade, second during throwing. Now there is visible one complete
movement, like in multiplayer.
2017-10-11 00:21:26 +02:00
aurhat 07d8d7657a Remove attack animation of clients during grenade activation 2017-10-09 20:09:42 +02:00
aurhat 323d8e8dd4 Fix rising of fly spectator 2017-09-19 22:41:53 +02:00
aurhat eec68e3253 Fix eyeheight during 3rd-person spectating
During 3rd-person spectating eyeheight of player1 was decreased sometimes
from "above head" of spectated player to his eyeheight.
2017-09-19 22:15:57 +02:00
aurhat a8a7987b8f Disable AR crosshair increasing during spectating
Because shots in a row are calculated only for local player.
2017-09-11 23:49:31 +02:00
aurhat 803517e2ef Improve maps menus
Map message moved on the right.
2017-09-04 22:49:01 +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 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 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 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 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 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 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
aurhat dbaff25341 Cleanup akimbo code 2017-06-11 01:15:53 +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