Commit graph

14857 commits

Author SHA1 Message Date
Robert Müller 0a4b1b9a7b Organize generated protocol includes 2022-06-17 17:39:24 +02:00
Robert Müller da5ec5a0d2 Include <iterator> instead of <array> for std::size
As `std::size` nominally resides in `<iterator>`.
2022-06-17 17:39:24 +02:00
bors[bot] d4f0e5cf5e
Merge #5445
5445: Fix editor value scrollers not working and panning being slow r=heinrich5991 a=Robyt3

Accumulate the mouse deltas and reset them at the end of the frame to fix editor panning being slowed down and value scrollers (layer width etc.) not working anymore.

Closes #5441.

And minor cleanup.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-17 03:01:14 +00:00
bors[bot] d44b11d0a8
Merge #5446
5446: Gender-neutral language r=def- a=kaitlynia

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: effyn <effyn@tutanota.com>
2022-06-16 22:44:07 +00:00
effyn 6691d71da7 Gender-neutral language 2022-06-16 15:12:25 -07:00
Robert Müller c318dca703 Remove accidentally added double type 2022-06-16 21:01:51 +02:00
Robert Müller d9f4e1475e Update comment 2022-06-16 21:01:23 +02:00
Robert Müller 405ae97203 Fix editor value scrollers not working and panning being slow 2022-06-16 20:47:59 +02:00
bors[bot] 29e8ec4815
Merge #5444
5444: Fix shader code vector size not being updated after copy r=def- a=Robyt3

Oops, I tried to be smart with `reserve` instead of `resize` but of course that wouldn't set the actual size of the vector after I copy in the data. 

Closes #5442.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-16 18:01:06 +00:00
Robert Müller 82e8ab5236 Fix shader code vector size not being updated after copy 2022-06-16 19:54:27 +02:00
bors[bot] 79de5409a5
Merge #5424
5424: no-goalshud r=heinrich5991 a=luk51

<s>do it using getgameinfo from gameclient introducting a new flag for ddrace</s>
use the same conditions as in the goalshudrender function, so don't render when empty

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Lukas Kitsche <lukaskitsche@posteo>
2022-06-16 14:33:56 +00:00
Lukas Kitsche 379d93ae7b no goals hud when empty 2022-06-16 16:28:50 +02:00
bors[bot] 2dac4921f6
Merge #5432
5432: Added new translations + fixed current one r=heinrich5991 a=crqch

Completed the translation of polish langauge (for now), fixed one translation, which wasn't correct (missing verb)

Co-authored-by: crqch <48185508+crqch@users.noreply.github.com>
2022-06-16 14:10:40 +00:00
bors[bot] 992723d71e
Merge #5430
5430: Add `io_read_all` and `io_read_all_str` to system, add `IStorage::ReadFile` and `ReadFileStr` r=heinrich5991 a=Robyt3

- `io_read_all` reads all bytes from a file handle into a new buffer. It should only need one allocation per file in cases where the actual file size matches the expected file size. Otherwise it falls back to doubling the buffer size if the actual file size is larger than expected to avoid TOCTOU problems.
- `io_read_all_str` reads all bytes from a file handle into a new buffer and also ensures that the buffer is null-terminated and contains no other null-characters.
- `mem_has_null` is a utility used by `io_read_all_str` to ensure that no null-characters exist in the bytes read from the file.
- `IStorage::ReadFile` and `ReadFileStr` are storage wrappers around `io_read_all` and `io_read_all_str`

The system functions are the same as on upstream (https://github.com/teeworlds/teeworlds/pull/3141) when `@heinrich5991` last reviewed them, with an additional check for the result of `io_length` added, as this can return -1 on error (0af8f7796c (diff-d169179e18778d751b412fb173b338885f6db0c4d268c54ddf0e8488a2f7049cR271-R277)).

- Remove duplicate `Kernel()->RequestInterface<IEngineTextRender>()` in client.
- Fix potential memory leak of font data when default font already exists.
- Fix memory leak in editor when loading opus file fails.
- No need for `IOFLAG_SKIP_BOM` on json files because the json parser already does it: b8a82f71aa/src/engine/external/json-parser/json.c (L228-L236)

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-16 13:44:49 +00:00
crqch e53107bb32
Fix Leak IP not visible 2022-06-16 12:38:16 +02:00
bors[bot] edab7c0e8c
Merge #5412
5412: Add translations for 16.2 r=Jupeyy a=def-

Translated German while at it
![Screenshot 2022-06-14 at 20 31 27](https://user-images.githubusercontent.com/2335377/173663119-60c6c63b-2131-40fa-adc8-bb955199455a.png)
![Screenshot 2022-06-14 at 20 31 08](https://user-images.githubusercontent.com/2335377/173663124-d2d18be2-95ba-4e02-97f7-27ad3aead77b.png)


## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-06-16 09:19:01 +00:00
Dennis Felsing 1ec691265f Add translations for 16.2 2022-06-16 11:02:14 +02:00
bors[bot] 36a624cca5
Merge #5436
5436: Update simplified_chinese.txt r=def- a=Cheeser0613

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Cheeser0613 <54943099+Cheeser0613@users.noreply.github.com>
2022-06-16 08:39:21 +00:00
Robert Müller dc52377fc5 Use ReadFile to read shader 2022-06-16 10:19:38 +02:00
Robert Müller de2744cb2a Use ReadFile to read opus sounds in editor 2022-06-16 10:19:37 +02:00
Robert Müller 0a463320cf Use ReadFile to load server maps 2022-06-16 10:19:37 +02:00
Robert Müller 5d49ee3684 Use ReadFile to load updater index json 2022-06-16 10:19:37 +02:00
Robert Müller ceca44ea23 Use io_read_all to load icon font 2022-06-16 10:19:37 +02:00
Robert Müller 74d7d4fe78 Use ReadFile to load wv/opus sound files 2022-06-16 10:19:37 +02:00
Robert Müller 7050022b08 Use ReadFile in CServerBrowser::LoadDDNetInfoJson 2022-06-16 10:19:36 +02:00
Robert Müller 93536b8977 Use io_read_all to load font files 2022-06-16 10:19:36 +02:00
Robert Müller c1c8797f84 Add IStorage::ReadFile and ReadFileStr:
Storage wrappers around `io_read_all` and `io_read_all_str`.
2022-06-16 10:19:36 +02:00
Robert Müller c7fb013607 Add io_read_all, io_read_all_str and mem_has_null:
- `io_read_all` reads all bytes from a file handle into a new buffer. It should only need one allocation per file in cases where the actual file size matches the expected file size. Otherwise it falls back to doubling the buffer size if the actual file size is larger than expected to avoid TOCTOU problems.
- `io_read_all_str` reads all bytes from a file handle into a new buffer and also ensures that the buffer is null-terminated and contains no other null-characters.
- `mem_has_null` is a utility used by `io_read_all_str` to ensure that no null-characters exist in the bytes read from the file.
2022-06-16 10:19:36 +02:00
bors[bot] e442798d6c
Merge #5435
5435: Update traditional_chinese.txt r=def- a=Cheeser0613

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Cheeser0613 <54943099+Cheeser0613@users.noreply.github.com>
2022-06-16 08:17:28 +00:00
Cheeser0613 2bc223217e
Update simplified_chinese.txt 2022-06-16 13:30:38 +08:00
Cheeser0613 0f21f9a131
Update traditional_chinese.txt 2022-06-16 13:29:07 +08:00
crqch fe51c7348b
Added new translations + fixed current one 2022-06-15 21:41:43 +02:00
bors[bot] d6d3b2d392
Merge #5431
5431: Fix wrongly corrected naming introduced in #5391 r=Robyt3 a=Chairn

Sorry 😭 

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Chairn <chairn.nq@hotmail.fr>
2022-06-15 19:35:46 +00:00
Chairn b80af9beb3 Fix wrongly corrected naming introduced in #5391 2022-06-15 21:09:57 +02:00
bors[bot] b8a82f71aa
Merge #5429
5429: More vector naming format r=heinrich5991 a=Chairn

Following of https://github.com/ddnet/ddnet/pull/5391

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Chairn <chairn.nq@hotmail.fr>
2022-06-15 17:41:08 +00:00
Chairn c9345e7d32 More vector naming format 2022-06-15 19:37:37 +02:00
bors[bot] 3920b48f5e
Merge #5428
5428: Separate editor update and render to fix slow joystick input r=def- a=Robyt3

Split `IEditor::UpdateAndEditor` into `OnUpdate` and `OnRender` and call the various input and UI methods in the same order as in the gameclient. This fixes the joystick input being slow in the editor. Closes #5422.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-15 16:56:58 +00:00
Robert Müller eb7e210fc1 Separate editor update and render to fix slow joystick input 2022-06-15 17:37:22 +02:00
bors[bot] e7a668bb7b
Merge #5426
5426: '*Char' -> '*pChr' r=heinrich5991 a=ChillerDragon

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: ChillerDragon <ChillerDragon@gmail.com>
2022-06-15 12:45:09 +00:00
ChillerDragon 2cc54c55de '*Char' -> '*pChr' 2022-06-15 14:39:13 +02:00
bors[bot] c04aaac64a
Merge #5423
5423: Rename joystick to controller (settings, configs) (fixes #5419) r=Robyt3 a=def-

Also added one Localize

<!-- What is the motivation for the changes of this pull request -->

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
2022-06-15 11:39:36 +00:00
Dennis Felsing 34d3ddd9c2 Rename joystick to controller (settings, configs) (fixes #5419)
Also added one Localize
2022-06-15 13:05:14 +02:00
bors[bot] 3cafdb33e1
Merge #5421
5421: Add missing `CursorType != IInput::CURSOR_NONE` check in editor r=def- a=Robyt3

Fixes the editor crash. `CURSOR_NONE` is returned when the cursor was not moved. Closes #5418. Closes #5417.

## Checklist

- [X] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-15 10:44:42 +00:00
Robert Müller 7472e99dcf Add missing CursorType != IInput::CURSOR_NONE check in editor 2022-06-15 12:08:20 +02:00
bors[bot] 9bac36f87c
Merge #5415
5415: Also set mouse settings to defaults r=def- a=Robyt3



## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-14 22:15:37 +00:00
Robert Müller 518bed35ab Also set mouse settings to defaults 2022-06-14 23:41:21 +02:00
bors[bot] 24f712bc53
Merge #5414
5414: Use DoScrollbarOption for mouse sens., name settings consistently r=def- a=Robyt3

Use logarithmic `DoScrollbarOption` for mouse sens. options.

Name mouse/joystick ingame/UI sens. settings more consistently.

Old:

![settings_controls_old](https://user-images.githubusercontent.com/23437060/173692598-f40658e7-9a9f-44eb-8b0d-0966c8ced864.png)

New:

![settings_controls_new](https://user-images.githubusercontent.com/23437060/173692601-61f65fe7-afa7-4031-8116-075c665d76d1.png)

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-14 21:37:46 +00:00
Robert Müller 1a04efe180 Use DoScrollbarOption for mouse sens., name settings consistently 2022-06-14 23:27:42 +02:00
bors[bot] 89e0450359
Merge #5374
5374: Joystick support 🕹️ r=def- a=Robyt3

Port all the joystick support from vanilla:

- Joystick controls
  - support for up to 12 axis (we are using the low level SDL interface so we don't differentiate between X/Y axis, sliders etc.)
  - two axis can be used for X and Y cursor movement
  - cursor input ingame can be relative or absolute
  - support for binding up to 12 joystick buttons
  - support for binding up to 2 hats (each has 8 directions)
  - support for binding axis movement to controls (so you can move with one control stick and aim with the other)
  - multiple joysticks can be connected at the same time, but only one can be actively used, the selected joystick will be remembered based on a GUID
- Joystick UI integration
  - allow moving the UI cursor with the specified joystick axis
  - change `CComponent::OnMouseMove` to `OnCursorMove` to handle joystick separately with its own sensitivity settings
  - remove premultiplied mousesens everywhere
- Joystick settings menu (also: separate mouse and movement settings)
![screenshot_2022-06-08_22-46-08](https://user-images.githubusercontent.com/23437060/172713929-9db75dfe-8408-4d06-827d-cdb162872514.png)
![screenshot_2022-06-08_22-46-10](https://user-images.githubusercontent.com/23437060/172713932-8945feb3-5f41-434c-b555-f92beb22db58.png)
![screenshot_2022-06-08_22-46-11](https://user-images.githubusercontent.com/23437060/172713935-19bb5a47-97dd-4a1e-86e9-a3569bd557ff.png)

Other changes:

- Remove the old unused joystick implementation (with config variable `inp_joystick`).
- Remove an unused parameter.
- Add `CUIEx::DoScrollbarOption` and `IScrollbarScale`
  - renders label, current value and scrollbar
  - with linear and logarithmic scale implementations
  - used for the sensitivity and tolerance settings
  - could eventually be used for most scrollbar settings to reduce duplicate code
  - has flags for:
     - `SCROLLBAR_OPTION_INFINITE`: The scrollbar can be moved all the way to the right for another value that represents ∞. Internally this value is 0.
     - `SCROLLBAR_OPTION_NOCLAMPVALUE`: The scrollbar allows values outside the specified min/max range, e.g. the sensitivity settings can technically be as high as 100000 when set with the console.
- Add `CUIEx::DoScrollbarOptionLabeled`
  - a `DoScrollbarOption` for selecting from a finite number of options with a scrollbar
  - used for switching between relative and absolute input
  - might see more use in the future

Reference: https://github.com/teeworlds/teeworlds/pulls?q=is%3Apr+joystick

## Checklist

- [X] Tested the change ingame
- [X] Provided screenshots if it is a visual change
- [X] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-14 18:01:11 +00:00
bors[bot] caf889d04a
Merge #5406
5406: Remove namespace tw r=Jupeyy a=heinrich5991

It didn't have a clear role, it just acted as a distinguisher between
two functions with the same name.

Rename `tw::time_get` to `time_get_nanoseconds` and delete the old
`time_get_nanoseconds`. Move `CCmdlineFix` and the typed
`net_socket_read_wait` function to the global namespace.

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: heinrich5991 <heinrich5991@gmail.com>
2022-06-14 17:46:17 +00:00