Commit graph

14995 commits

Author SHA1 Message Date
Robert Müller 9932bd76fb Update menu music state when the config variables change via console 2022-06-26 22:43:32 +02:00
Robert Müller 525527feb7 Add IsPlaying to sounds client component 2022-06-26 22:43:32 +02:00
Robert Müller b4a82b1b87 Reduce visibility of engine sound members and methods 2022-06-26 22:43:32 +02:00
Robert Müller 757d7d0068 Change m_SoundEnabled from int to bool 2022-06-26 22:43:32 +02:00
Robert Müller 82425f20d7 Handle WavpackUnpackSamples failure 2022-06-26 22:43:31 +02:00
Robert Müller a8949cb96b Fix log message context 2022-06-26 22:43:31 +02:00
Robert Müller d3e4ebf66a Simplify loop body and reduce duplicate code
It's not necessary to handle both channels separately so the loop can be simplified. The function `Int2Short` is replaced with equivalent `clamp`.
2022-06-26 22:43:31 +02:00
Robert Müller 1fb46b760c Code style: rename variable id to NextID 2022-06-26 22:43:31 +02:00
Robert Müller 4bc88712b9 Refactoring: move variable declarations in engine sound 2022-06-26 22:43:30 +02:00
Robert Müller 3db3f0af9c Code style: remove unnecessary indentation 2022-06-26 22:43:30 +02:00
Robert Müller 939c51bae1 Add IsPlaying to engine sound
To check if a specific sample is currently being played back.
2022-06-26 22:43:30 +02:00
bors[bot] 80e6391525
Merge #5507
5507: Fix heap-use-after-free in `CGameWorld::RemoveEntity` r=def- a=Robyt3

Entities have a pointer to their parent entity. If the parent entity is freed first, then freeing the child will cause access to the already freed parent (at `pEnt->m_pParent->m_DestroyTick = GameTick();`).

This is fixed by adding a child pointer and clearing the child and parent pointers when either child or parent is freed.

I can consistently get the crash in `CGameWorld::RemoveEntity` with the integration test at fbfd938f32 (10/10 runs crashed). With these changes I get no crashes anymore (0/10 runs crashed).

Closes #5478. Closes #4317. Closes #4328. Closes #4390. Not sure about #3179.

## 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
- [X] Considered possible null pointers and out of bounds array indexing
- [X] Changed no physics that affect existing maps
- [X] 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-26 18:33:10 +00:00
Robert Müller 8eb1f6888d Refactoring: use CGameWorld::Clear in CGameWorld::CopyWorld 2022-06-26 12:51:17 +02:00
Robert Müller 2df4c4c668 Fix heap-use-after-free in CGameWorld::RemoveEntity
Entities have a pointer to their parent entity. If the parent entity is freed first, then freeing the child will cause access to the already freed parent.

This is fixed by adding a child pointer and clearing the child and parent pointers when either child or parent is freed.
2022-06-26 11:28:23 +02:00
bors[bot] 1e31db257f
Merge #5420
5420: Improvments for new HUD r=def- a=C0D3D3V

for testing set `#define CLIENT_VERSIONNR 16020`
Some of the changes are only available in the next version

Impressions: https://youtu.be/E770vGp4KKY

Implements a few of the recommendations from https://github.com/ddnet/ddnet/issues/5159 and Discord
- removes all player capability messages send by the server, that are now displayed in the HUD
- ~~remove `cl_ddrace_hud` and cl_show_freeze_bars~~, 
- Added option `cl_freezebars_alpha_inside_freeze` setting to change the opacity if the player is inside a freeze tile (default visible 100%)
- Added option `cl_show_jumps_indicator`
- We send now the real weapon the player is holding if he is frozen
    -> for that we added a new particle "snow flakes" or frozen flakes :D that are spawned over the tees body, to indicate he is frozen.
    -> new extras.png asset (+ corresponding asset tab, that can potentially be used for all sorts of extras for our mod, e.g. material particles, but in the future maybe also for other mods using a similar structure like it is for entities)
- stars are no longer send to new clients, because it is duplication to the freezebar, and we decided to not allow to disable it 
- also ninja stars are no longer send. They are not vanilla, and we now have a ninja bar in the new HUD.
- display target angle from 0 to 360 (looks mirrored on the x-axis to the normal trigonometry circle, but that is just how the world coordinates are) 
- dummy action display is increased in size ( but only the border margin :D not the icons. so the icons are still the same size as the icons on the left side)
- allow the server to also show old HUD elements (see https://github.com/ddnet/ddnet/pull/5427 for screenshots)


fixes #5149
fixes #198
closes #5159

fixes #2252   ~~(But not clear if we should also display the weapon, still investigating)~~
- we do no longer display a weapon inside freeze, instead we have nice freeze particles

## 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
- [x] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] 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-06-26 07:57:33 +00:00
Dennis Felsing fc2d419050 Version 16.2 2022-06-26 09:48:01 +02:00
bors[bot] 6315af0729
Merge #5504
5504: Remove useless typedef in c++ r=Jupeyy a=Chairn

## 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-26 06:49:01 +00:00
bors[bot] 0179dfd5e2
Merge #5499
5499: Use [[fallthrough]] attribute rather than comment r=def- a=Chairn

We could even add implicit fallthrough warning, but it is triggered in external json.c

## 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-25 21:49:43 +00:00
bors[bot] c5bf24692b
Merge #5502
5502: Add missing capability for GLES backend r=def- a=Jupeyy

<!-- 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: Jupeyy <jupjopjap@gmail.com>
2022-06-25 21:30:11 +00:00
Chairn a3a85bee5f Remove useless typedef in c++ 2022-06-25 21:05:54 +02:00
bors[bot] fbfd938f32
Merge #5503
5503: Improve rendering of demo list icons, remove duplicate code r=Jupeyy a=Robyt3

I first tried adapting and using `CMenus::DoButton_Icon` like `DoIcon` on upstream to reduce duplicate code in the menus. Later I moved/renamed this method to `CRenderTools::RenderIcon`, to also use it in the editor.

Changes to demo list:
- Show the icons as part of the name column
- Improve spacing/centering of icons in columns
- Grey out icon if demo is not loaded or not valid
- Clamp the number of demo markers to valid range (I have an old version 3 demo that incorrectly shows more than a million markers otherwise, which would not fit the char buffer used for rendering the number)

The visual changes are mostly consistent with upstream. Upstream also renders demo icons in green when the demo has markers, but I don't see a good motivation for that especially with a separate markers column already existing.

Before:

![demo old](https://user-images.githubusercontent.com/23437060/175780176-edbd3d98-a257-4982-b590-f32cdb3b1cf3.png)

After:

![demo new](https://user-images.githubusercontent.com/23437060/175780178-64c694b4-d2ae-4b87-8601-47725355454f.png)

Closes #1576. There's likely more duplicate code but I don't think we need this issue open anymore to remind us of that, unless it list more actionable examples of duplicate code that should be refactored.

## 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-25 16:49:14 +00:00
Robert Müller 42532f3149 Use CRenderTools::RenderIcon in editor file dialog 2022-06-25 17:16:20 +02:00
Robert Müller fb91881765 Move CMenus::DoIcon to CRenderTools::RenderIcon
As this method only renders and doesn't provide an interactive element, the naming `Render` as well as the placement in `CRenderTools` fits better.

This also allows the method to be used in the editor.
2022-06-25 17:15:55 +02:00
Robert Müller 25ad47bed2 Use DoIcon for ingame player GUI icons 2022-06-25 16:57:25 +02:00
Robert Müller 87cb948166 Clamp number of demo timeline markers to valid range 2022-06-25 16:57:25 +02:00
Robert Müller 5184cf5523 Add greyed out demo icon for invalid or not loaded demos 2022-06-25 16:57:24 +02:00
Robert Müller f727199060 Render demo file icon in name column, remove DoIcon centering 2022-06-25 16:36:09 +02:00
Jupeyy eb3406c4cf Add missing capability for GLES backend 2022-06-25 16:11:04 +02:00
c0d3d3v 706a06d4d4
clamp m_Armor, to prevent value correction on client side 2022-06-25 16:06:22 +02:00
c0d3d3v 4281df2429
Add new textures by ravie; Also add no gun hit for teleport gun 2022-06-25 16:05:38 +02:00
Chairn a50ddb75ff clang-format 2022-06-25 15:30:39 +02:00
Chairn 5f5b80ae57 Use [[fallthrough]] attribute rather than comment 2022-06-25 15:21:44 +02:00
Robert Müller 97e36fa4be Add optional color parameter to DoIcon 2022-06-25 13:43:40 +02:00
Robert Müller a530ce89d6 Rename DoButton_Icon to DoIcon and remove unused return value
As the function renders an icon and not a button.
2022-06-25 13:38:04 +02:00
c0d3d3v d78b3decd5
Revert to using conditions for the version check for capability chat messages; Remove ExcludeClientVersionAndHigher from CGameContext::SendChatTarget 2022-06-25 12:33:49 +02:00
c0d3d3v 6d098d866a
Remove ExcludeClientVersionAndHigher from CGameTeams::TeamMask; Add CGameContext::ClientsMaskExcludeClientVersionAndHigher 2022-06-25 11:16:59 +02:00
bors[bot] a62250792c
Merge #5490
5490: Try to fix dump_local_console (fixes #5488) r=heinrich5991 a=def-

Untested, but my hunch is that by not cutting off the last part the text
file will be correctly recognized as valid utf8

<!-- 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-25 09:08:12 +00:00
bors[bot] 937a9cc0e2
Merge #5495
5495: Fix Android build r=heinrich5991 a=Jupeyy

- Video recorder off
- small fix in logger.cpp

Tested on Java-17

## 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: Jupeyy <jupjopjap@gmail.com>
2022-06-25 08:54:11 +00:00
Jupeyy a22a8dce1c Fix Android build 2022-06-25 10:43:24 +02:00
c0d3d3v dd1cdfcf2c
Add to some of the Sprite Arrays the array prefix 2022-06-25 10:39:39 +02:00
c0d3d3v ed2c514aa7
Change help text of cl_asset_extras 2022-06-25 10:28:54 +02:00
bors[bot] fda0eccf37
Merge #5494
5494: Be upfront about completeness of the autogenerated code documentation r=def- a=heinrich5991

## 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-25 07:37:28 +00:00
heinrich5991 d29b22a96e Be upfront about completeness of the autogenerated code documentation 2022-06-25 02:21:54 +02:00
bors[bot] a0cdefa3b5
Merge #5492 #5493
5492: Mention code browser in readme r=heinrich5991 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 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)


5493: integration test: print log diff for easier result check r=heinrich5991 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 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-25 00:04:01 +00:00
Dennis Felsing 0081e99fc7 integration test: print log diff for easier result check 2022-06-25 01:39:59 +02:00
Dennis Felsing a6fa123532 Mention code browser in readme 2022-06-25 01:30:06 +02:00
bors[bot] 562962f843
Merge #5491
5491: Move twping to tools directory r=heinrich5991 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 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-24 23:29:42 +00:00
Dennis Felsing 4d43567948 Move twping to tools directory 2022-06-25 01:28:05 +02:00
Dennis Felsing 83267ed0a7
Update src/game/client/components/console.cpp
Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-25 01:19:40 +02:00
Dennis Felsing 5dd2e5083b
Update src/game/client/components/console.cpp
Co-authored-by: Robert Müller <robytemueller@gmail.com>
2022-06-25 01:19:32 +02:00