Commit graph

15353 commits

Author SHA1 Message Date
Robert Müller 21fe945ca7 Make file link absolute, add fs_is_relative_path
This fixes links not opening for relative paths, as links like `file://temp/skins` cannot be resolved by the shell.
2022-08-20 20:56:46 +02:00
bors[bot] 6a5d99daf1
Merge #5749
5749: Editor: added the possibility to duplicate layers r=def- a=archimede67

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

Suggested by Pulsar a few years ago, I finally had the motivation to do it. We can now duplicate any non-special layer (tiles, quads and sounds) thanks to a button just above the delete button.

![image](https://user-images.githubusercontent.com/13364635/185260070-cd5b4c8f-5827-457c-b505-176751003dbc.png)

For each duplicated layers, all the necessary properties are duplicated, for example name, color, flags, etc.
For a tile layer, all the placed tiles are copied. Same goes for a sound layer, all sources are copied. And for the quads layer, all the quads are duplicated.

## 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 (especially base/) or added coverage to integration test
- [x] 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: Corantin H <archi0670@gmail.com>
2022-08-19 13:25:44 +00:00
Corantin H 29a3baaa75 Editor: added the possibility to duplicate layers 2022-08-19 13:20:50 +02:00
bors[bot] ecc5ca5602
Merge #5750
5750: List symlinks in list_dir r=def- a=Patiga

This functionality was lost in 082e26d5b
In my case I have a lot of symlinks in the maps folder (Downloads, ddnet-maps, map_archive)

On windows, I have neither tested this behavior before nor after this patch. Could someone maybe try it out there?

<!-- 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 (especially base/) or added coverage to integration test
- [ ] 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: Patiga <dev@patiga.eu>
2022-08-18 12:08:31 +00:00
Patiga b580b83d31 List symlinks in list_dir
This functionality was lost in 082e26d5b
In my case I have a lot of symlinks in the maps folder (Downloads,
ddnet-maps, map_archive)
2022-08-18 12:51:22 +02:00
bors[bot] f092f9e6a9
Merge #5747
5747: Update Korean translations by CHaBek r=def- a=cwh7435

<!-- 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 (especially base/) or added coverage to integration test
- [ ] 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: CHaBek <44938972+cwh7435@users.noreply.github.com>
2022-08-17 07:30:46 +00:00
CHaBek d35a6747e5
Update Korean translations by CHaBek 2022-08-17 11:06:34 +09:00
bors[bot] faa352e04f
Merge #5745
5745: Improve "couldn't open..." error messages by listing target r=def- a=Robyt3

Also print the exact file/link that could not be opened.

## 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 (especially base/) or added coverage to integration test
- [ ] 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-08-16 16:15:52 +00:00
Robert Müller f0b0d4c163 Improve "couldn't open..." error messages by listing target 2022-08-16 17:35:47 +02:00
bors[bot] 12273bd0d6
Merge #5743
5743: Smooth console completion scrolling r=def- a=Robyt3

More smoothly scroll selected console completion option into view.

See videos at https://github.com/teeworlds/teeworlds/pull/3054.

The smooth scrolling logic is extracted in `CUI::DoSmoothScrollLogic` so it can eventually be reused for smooth input scrolling (see https://github.com/teeworlds/teeworlds/pull/3150).

## 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 (especially base/) or added coverage to integration test
- [ ] 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-08-15 22:31:12 +00:00
bors[bot] 8d873d82bb
Merge #5738
5738: Update french.txt r=def- a=archimede67

<!-- 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 (especially base/) or added coverage to integration test
- [ ] 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: archimede67 <archi0670@gmail.com>
2022-08-15 22:08:19 +00:00
Robert Müller f0c74f72ba Smooth console completion scrolling 2022-08-15 23:20:37 +02:00
archimede67 82c86cec6b
Better words 2022-08-15 16:36:02 +02:00
bors[bot] 96c1e930f8
Merge #5742
5742: Update brazilian_portuguese.txt r=def- a=rffontenelle

This updates translations for Brazilian Portuguese.

## 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 (especially base/) or added coverage to integration test
- [ ] 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: Rafael Fontenelle <rffontenelle@users.noreply.github.com>
2022-08-15 13:37:10 +00:00
bors[bot] 4f7a7b4e5a
Merge #5249
5249: Extract server main() to its own file, do some small cleanup r=def- a=Kaffeine

I need to use `CServer` class from some custom `main()`. It turned out to be a good reason to start cleaning this up. The first step is extracting server `main()` to its own file.

I'm open to all ideas on how to handle `InterruptSignaled` (I've added an external getter function, somewhy it was the first that came to mind).

## 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: Alexander Akulich <akulichalexander@gmail.com>
2022-08-15 13:12:46 +00:00
Rafael Fontenelle 6daeeaa06c
Update brazilian_portuguese.txt 2022-08-15 10:11:47 -03:00
Alexander Akulich 670f284194 Use GAME_NAME definition for engine initialization 2022-08-15 16:07:27 +03:00
Alexander Akulich 8ac84948c5 Extract server main() to its own file
Also extract CServerLogger to own files.
2022-08-15 16:07:27 +03:00
Alexander Akulich ec16daa4b4 CCharacter: Drop non-const IsAlive() getter 2022-08-15 15:05:59 +03:00
Alexander Akulich 301355d588 engine/server.h: Remove outdated comment 2022-08-15 15:05:59 +03:00
archimede67 33e54729b1
Update french.txt 2022-08-15 13:03:23 +02:00
bors[bot] b0a44546d5
Merge #5698
5698: Update hungarian language file (by Cellegen) r=def- a=def-

<!-- 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 (especially base/) or added coverage to integration test
- [ ] 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-08-14 12:10:35 +00:00
Dennis Felsing 1a2b52c0f5 Update hungarian language file (by Cellegen) 2022-08-14 13:57:15 +02:00
bors[bot] 4826eb1df0
Merge #5730
5730: Move `CUIRect` to separate file, move `CRenderTools::DrawUIRect/4` to `CUIRect::Draw/4`, merge `CUIEx` into `CUI` r=def- a=Robyt3

Adopt UI refactorings from upstream:
- move `CUIRect` into a separate file
  - this allows some includes of `ui.h` to be removed, most importantly in `render.h`
- move `CRenderTools::DrawUIRect/4` to `CUIRect::Draw/4`
  - this object orientied calling style makes it easier to write the code

The `CUIEx` class is merged into the `CUI` class, as there is no need for two different UI classes anymore.

## 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 (especially base/) or added coverage to integration test
- [ ] 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-08-14 11:55:24 +00:00
bors[bot] cebcc885ab
Merge #5735
5735: Minor refactoring of editor IO r=def- a=Robyt3

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

## 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 (especially base/) or added coverage to integration test
- [ ] 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-08-14 11:24:15 +00:00
Robert Müller 813522f1fc Add/use temporary variables to improve readability 2022-08-14 13:12:21 +02:00
Robert Müller 45a20ff277 Only load and unload normal tile layer data if necessary 2022-08-14 13:12:21 +02:00
bors[bot] 72a14d4334
Merge #5731
5731: small fix for #5729 r=def- a=C0D3D3V

fixes  #5729

## 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 (especially base/) or added coverage to integration test
- [ ] 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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
2022-08-13 13:47:21 +00:00
c0d3d3v 780c4db7dd
do an int check for m_FreezeEnd instad of float, becuase it is int 2022-08-13 15:43:38 +02:00
c0d3d3v 0aa46b54ea
small fix for #5729 2022-08-12 22:38:13 +02:00
Robert Müller 51fb3e9a22 Merge CUIEx class into CUI
There is no need to separate the UI in two classes anymore, as the dependency on `CRenderTools` has been removed.
2022-08-12 19:59:19 +02:00
Robert Müller 95550fd6a9 Move CRenderTools::DrawUIRect/4 to CUIRect::Draw/4
Use `ColorRGBA` instead of `vec4` for `Draw4`.
2022-08-12 19:37:08 +02:00
Robert Müller 7b390808bc Replace ui.h include with ui_rect.h, organize other includes 2022-08-12 19:37:08 +02:00
Robert Müller 680dd052d7 Add documentation for CUIRect::Inside 2022-08-12 19:37:07 +02:00
Robert Müller 49164dfcdf Improve argument names of CUIRect::Inside 2022-08-12 19:37:07 +02:00
Robert Müller b50309dd5c Move CUIRect class into its own files 2022-08-12 19:37:07 +02:00
bors[bot] 8828838f68
Merge #5709
5709: Move round rectangle and circle drawing methods from `CRenderTools` to `IGraphics`, and refactor them r=def- a=Robyt3

The methods for drawing rectangles with rounded corners and circles are not really game related so they are moved to the engine to untangle the dependencies between the client classes.

This will enable future refactoring and improvements from upstream:
- removing the dependence of `CRenderTools` on `CUI`
- merging `CUIEx` into `CUI`
- porting `CScrollRegion` and `CListBox` from upstream

## 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 (especially base/) or added coverage to integration test
- [ ] 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-08-12 15:58:11 +00:00
Robert Müller 4005b82743 Move CRenderTools::DrawUIElRect to CUIElement::SUIElementRect::Draw
This method draws a particular UI element rectangle so it should be a member method.
2022-08-12 17:42:05 +02:00
Robert Müller 3b1ef5642b Refactor DrawRect* methods:
- use `CORNER_*` constants and add missing constants
- fix array variable names
- use `size_t`
- extract duplicate computation into constant
- use `ColorRGBA` instead of `vec4`
2022-08-12 17:42:05 +02:00
Robert Müller 2a21cd6eab Move all DrawRect* methods from CRenderTools to IGraphics
As the methods do not depend on any game components they are moved to the engine graphics interface.
2022-08-12 17:42:05 +02:00
Robert Müller 7b20009980 Move CUI::CORNER_* enum to IGraphics::CORNER_*
Entirely automatic replacement in preparation for moving rect drawing methods from `CRenderTools` to `IGraphics`.
2022-08-12 17:42:04 +02:00
Robert Müller 9ad097da4d Refactor DrawCircle:
- improve argument names
- remove duplicate computation by adding `SegmentsAngle`
- rename variable `Array` to `aItems`
- use `std::size` and `size_t`
- remove unnecessary temporary variables
2022-08-12 17:42:03 +02:00
Robert Müller 237fdc76db Move CRenderTools::DrawCircle to IGraphics::DrawCircle
As this method does not depend on any game components it is be moved to the engine graphics interface.
2022-08-12 17:42:03 +02:00
bors[bot] 249f6800ff
Merge #5728
5728: Refactor `CGraph` r=def- a=Robyt3

Various refactorings to `CGraph`. Most of them are cherry-picked from upstream.

## 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 (especially base/) or added coverage to integration test
- [X] 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-08-12 15:05:42 +00:00
Robert Müller 967c92f5d6 Encapsulate CGraph member variables
Make the member variables private and add `SetMin` to replace a usage of the member variables in `CDebugHud`. For completeness/symmetry, `SetMax` is also added.
2022-08-12 16:13:23 +02:00
Robert Müller 8c88005a42 Rename variables Array to aLineItems / aColorVertices 2022-08-12 16:13:03 +02:00
Robert Müller 11e60d32f0 Reuse CGraph::InsertAt in Add to reduce duplicate code 2022-08-12 16:13:03 +02:00
Robert Müller 44ca1f0d7b Use size_t for indices, replace unused return value with assert
The return value of `CGraph::InsertAt` was not checked. All uses of the function pass a correct index, so the return value is replaced with an assertion.
2022-08-12 16:13:03 +02:00
Robert Müller 3daa177830 Remove restriction for CGraph::MAX_VALUES to be a power of two
By using `% MAX_VALUES` instead of `& (MAX_VALUES - 1)` to wrap the index. Both work the same, but the latter only does for powers of two.
2022-08-12 16:13:03 +02:00
Robert Müller b314db5454 Use CGraph::MAX_VALUES instead of magic value in debughud 2022-08-12 16:13:02 +02:00