4811: fix bug that sneaked in during refactoring (in #4775) r=def- a=C0D3D3V
Was detected by missing hammer animation at very high ping by texnonik and bencie
## 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
- [ ] 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>
4808: Fix laser clipping. Closes#2176 r=def- a=Kaffeine
I've found this bug in a different mod and fixed it. Then I've got idea to check if any of the upstreams (this and tw)is affected and it turned out that this is already [fixed](f3a1e68df9) in teeworlds.
I've dropped my change and did cherry-pick to reduce the difference between codebases.
Co-authored-by: oy <Tom_Adams@web.de>
4773: Write log to disk on assert r=def- a=Jupeyy
This is a concept to write the full log to disk(inclusive the assert message), when an assert occurs, so it is not lost when no terminal or logfile is present.
Remaining question is:
- Should we really keep the full log in memory, maybe a maximum count of lines?
## 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: Jupeyy <jupjopjap@gmail.com>
4806: Use newer ubuntu with higher clang-tidy version r=Jupeyy a=def-
clang-tidy 10.0 -> 13.0
Should be green, checked locally on Arch with 13.0.1
<!-- 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: def <dennis@felsin9.de>
4790: Don't print binds into F1 by default (fixes#4789) r=heinrich5991 a=def-
<!-- 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 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: def <dennis@felsin9.de>
4805: Add instructions for videorecorder being default (fixes#4804) r=Jupeyy 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: def <dennis@felsin9.de>
4762: Set gfx_opengl_major 1 as default on 32bit x86 r=heinrich5991 a=def-
Multiple reports that BiT3 doesn't load with higher OpenGL
<!-- 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)
4792: Use ipv4 for info2.ddnet.tw requests r=heinrich5991 a=def-
<!-- 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] 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: def <dennis@felsin9.de>
Co-authored-by: Dennis Felsing <dennis@felsin9.de>
4796: Remove unnecessary trailing semicolons after method declarations r=heinrich5991 a=Robyt3
For consistency with upstream (https://github.com/teeworlds/teeworlds/pull/2840) and
> to fix warnings in some IDEs and code analyzers.
I didn't find an option for clang format/tidy to enforce this.
## 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>
4795: Fix binds, fix sounds and demo playback for violent gametypes, do some small refactor r=def- a=Kaffeine
<!-- What is the motivation for the changes of this pull request -->
## 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
- [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)
## Bug fixes
### Binds
Default binds (from `CBinds::SetDefaults()`) and the binds loaded from config file are stored in `m_aapKeyBindings[0][key]` while the menu binder store the new binds in `m_aapKeyBindings[1][key]` which results in this:
![image](https://user-images.githubusercontent.com/374839/157233980-a8445e9f-4198-4264-891e-ecb5b67c3210.png)
### Default tuning
It seems that:
1. DDNet re-set tuning params to what meets DDNet needs (e.g. for pulling-beam shotgun) 76cb097997/src/game/client/gameclient.cpp (L3010-L3014)
2. Tuning is saved to the demo if it is custom 76cb097997/src/game/client/gameclient.cpp (L1583-L1590)
This results in incorrect demo playback. Shotgun bullets look like this:
![image](https://user-images.githubusercontent.com/374839/157225950-c7ee31db-57be-41ec-80f6-b50f51576b03.png)
I don't see any negative effect on DDRace demo playback — there should not be any, because servers send DDNet tuning and the client correctly record them.
### Sounds
DDNet provides an option to disable jetpack and crying freezed tee sounds.
76cb097997/src/game/client/gameclient.cpp (L918-L923)
However we should not apply those options for DM/TDM and some other gametypes, because those sounds are critical and not any more annoying than others. E.g. `pain_long` is used if the taken damage is 3+: 93f5bf632a/src/game/server/entities/character.cpp (L777-L780)
## Refactor
[CI: Relax 'package-file' mask](df5c48d675) is my personal request — the file is changed regularly and I always have rebase conflicts here.
The relaxed mask 'll let me to *not* carry this commit in the fork, freeing my time for more fixes.
Co-authored-by: Alexander Akulich <akulichalexander@gmail.com>
On 'traumatic' game types (e.g. vanilla dm, tdm, ctf) it is critical to
hear SOUND_GUN_FIRE (because someone seems to shooting at you).
It is not any less important to head SOUND_PLAYER_PAIN_LONG which takes
its place whenever the character taken damage > 2 (because you need to
know whether someone was hit).
- Replace hardcoded constants (namely '2') with enum value.
- Use the map type constants instead of bool-to-int casts.
This is a step toward support of more map types: e.g. we can have smaller
map versions with some mapres omitted for newer DDNet client versions.
The default bindings are set up via calls like Bind(KEY_A, "+left"); which
expands to Bind(KEY_A, "+left", /* FreeOnly */ false, /* ModifierCombination */ 0);
On the other hand, CMenusKeyBinder code does this: if(!Mask) Mask = 1 << MODIFIER_NONE;
This leads to a bug — binds which just set from the user input events are saved
in e.g. m_aapKeyBindings[1]['a'], and the default binds are still there
in m_aapKeyBindings[0]['a'] which leads to binds duplication in the UI.
4793: use TEAM_SPECTATORS and SPEC_FREEVIEW instead of -1 r=def- a=C0D3D3V
In some places TEAM_SPECTATORS and SPEC_FREEVIEW were forgotten to be used instead of -1
## 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
- [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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
4784: fix 4781 and refactor of the client id for server demos r=def- a=C0D3D3V
#Fixes #4781
I took the opportunity and directly refactored the code a bit, to be exact I replaced the -1 with the enum `SERVER_DEMO_CLIENT`, I can also change the identifier if we want to call it something else. Further I normalized the corresponding `>= 0` conditions to `> SERVER_DEMO_CLIENT`.
## 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
- [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>
4775: Refactoring of players OnRender function r=def- a=C0D3D3V
Does anyone else feel that the code here: ff085a4545/src/game/client/components/players.cpp (L660-L709) is somewhat obfuscated? I do not think that the compactness of the code at this point increases the readability :D
## 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
- [ ] 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>
4788: Add size checks to CVariableInt::Pack and ::Unpack, refactoring r=def- a=Robyt3
- Refactor `CVariableInt::Pack` some more according to upstream:
- avoid right shift of negative number
- rewrite loop smarter
- Add size parameters to `CVariableInt::Pack` and `CVariableInt::Unpack`. Adjust tests and add tests with too small buffer sizes.
## Checklist
- [x] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [X] 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
- [ ] 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 <robert.mueller@uni-siegen.de>
Co-authored-by: Robert Müller <robytemueller@gmail.com>
4783: Some network refactoring r=def- a=heinrich5991
In preparation to the proxy code, I refactored the network code a little, unifying its interface across operating systems and making our use of recvmmsg invisible to the caller.
## 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: heinrich5991 <heinrich5991@gmail.com>
Previously, only Linux used an internal buffer (for optimized
receiving). Now all OSs use an internal buffer so that the call to
`net_udp_recv` behaves the same on all platforms.
4782: Remove some redundant variable, spell out the condition instead r=def- a=heinrich5991
<!-- 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: heinrich5991 <heinrich5991@gmail.com>