Commit graph

12440 commits

Author SHA1 Message Date
Kp 2ee7337290 Remove unused arguments to handle_mve_segment_setpalette 2023-05-06 19:26:19 +00:00
Kp 01abb4366e Remove unused arguments to handle_mve_segment_initvideomode 2023-05-06 19:26:19 +00:00
Kp cc83ee76e3 Remove unused arguments to handle_mve_segment_audioframedata 2023-05-06 19:26:19 +00:00
Kp 4d4a66ca38 Remove unused arguments to handle_mve_segment_displayvideo 2023-05-06 19:26:19 +00:00
Kp f83361f91f Remove unused arguments to handle_mve_segment_initvideobuffers 2023-05-06 19:26:19 +00:00
Kp d69daa609b Remove unused arguments to handle_mve_segment_startstopaudio 2023-05-06 19:26:19 +00:00
Kp f33b99e22c Remove unused arguments to handle_mve_segment_initaudiobuffers 2023-05-06 19:26:19 +00:00
Kp 0905aa6002 Remove unused arguments to handle_mve_segment_createtimer 2023-05-06 19:26:19 +00:00
Kp cfda77a03e Remove unused arguments to handle_mve_segment_endofchunk 2023-05-06 19:26:19 +00:00
Kp 61268545ff Remove unused arguments to handle_mve_segment_endofstream 2023-05-06 19:26:19 +00:00
Kp 6c41168e4d Call movie handlers directly via switch
Remove the use of function pointers, since there is only one set of
destinations.
2023-05-06 19:26:19 +00:00
Kp 60a36a881f Move bmread texture_count into local scope 2023-04-29 16:10:28 +00:00
Kp e5a8393cc3 Pass context to set_texture_name 2023-04-29 16:10:28 +00:00
Kp 5b4bf16bfa Remove support for -DSWAP_0_255
This has been broken since b1c5307eb1
changed the type of gr_palette from `uint8_t[256*3]` to
`array<rgb_t, 256>`.  Remove it, since no one has reported it in 10
years.
2023-04-23 21:45:31 +00:00
Kp f37845b483 Move Descent 2 specific automap colors to d2x 2023-04-23 21:45:31 +00:00
Kp cd604744da Use explicitly defaulted destructor for MVEFILE 2023-04-23 21:45:31 +00:00
Kp d9f2d6d08c Use enum class for mve_opcode 2023-04-23 21:45:31 +00:00
Kp e85270c079 Remove unused MVE_rmPrepMovie parameter track
This was never inspected.  Change callers not to pass it.
2023-04-23 21:45:31 +00:00
Kp 03a06d71d5 Merge branch 'd2-superlaser-no-penalty' into master 2023-04-22 15:02:12 +00:00
Kp 5534e10d74 Add further comments around the laser damage penalty logic
Due to original game bugs, which Rebirth intentionally replicates in
order to match the balance of the original game, the logic looks odd.
Add comments explaining that the oddity is intentional.
2023-04-22 15:02:12 +00:00
Kp c98b30ca23 Reduce console colors to in-range values
`gr_find_closest_color` takes inputs in the range [0, 63].  Clamp input
values to fit in that range.
2023-04-22 14:56:35 +00:00
Kp e55bd77472 Document type of gr_find_closest_color_15bpp input 2023-04-22 14:56:35 +00:00
Kp 44086eb539 Remove unused macro BM_RGB 2023-04-22 14:56:35 +00:00
AlumiuN d93787d942 Fix inaccurate handling of D2 super laser damage with quad-lasers (as D2 was bugged and didn't apply the intended penalty to them) 2023-04-21 12:16:54 +12:00
Kp 697ef5c32a Use std::array for last_palette_loaded_pig 2023-04-15 19:11:14 +00:00
Kp 0b066d23b4 Use enum class for load_palette arguments 2023-04-15 19:11:14 +00:00
Kp f10a79f157 Pass menu_filename to nm_draw_background1 2023-04-15 19:11:14 +00:00
Kp fcca2693f9 Use uint8_t for movie::paused 2023-04-15 19:11:14 +00:00
Kp c49598d5f5 Merge commit 'clang-warnings' into master 2023-04-08 20:12:32 +00:00
Kp 51bb01f9f4 Merge commit 'sdl2-audio-Windows' into master 2023-04-08 20:12:07 +00:00
Kp a4be0001e0 Merge commit 'physfsrwops_seek-sdl2' into master 2023-04-08 20:11:38 +00:00
Kp 8c718335b8 Merge commit 'windows-shift-alt-f4' into master 2023-04-08 20:10:52 +00:00
Kreeblah 980c03b9ae
Fix Apple Clang errors and warnings 2023-04-06 16:42:49 -07:00
Arne de Bruijn 0de6290cd6 Make sure SDL2 uses specified audio format
Use extended open function Mix_OpenAudioDevice to set allowed_changes
to 0.
Prevents higher pitched sound on Windows.
2023-04-06 19:27:43 +02:00
Arne de Bruijn 4c371734b5 Fix physfsrwops_seek for SDL2
SEEK_CUR and SEEK_END were not handled correctly.
2023-04-06 19:23:02 +02:00
Arne de Bruijn 4832fc319e Support Alt+Shift+F4 with SDL2 on Windows 2023-04-05 19:16:16 +02:00
Kp ae3f4ab533 Return computed filename from removeext 2023-04-02 10:15:20 +00:00
Kp 488278ddfe Fix build for sdlimage=0
Fixes: 2ded2b2d0c ("Make kmatrix background optional")
2023-03-25 12:41:29 +00:00
Kp 841ebcc11d Merge commit 'ppc-build-template' into master 2023-03-23 01:14:37 +00:00
Kp b7e96e0dac Reduce list copying in environment overrides
Prefer creating a copy explicitly, then appending or extending it as
needed, rather than using `__add__` and allowing it to duplicate the
sequence.  `__add__` has two undesirable properties in this script:

- Using `A + B + C` can create multiple temporaries unnecessarily.
- `A + B` typically requires that `A` and `B` be the same type of
  sequence, but this script does not need to require that.  Using an
  explicit copy+extend allows `A` and `B` to be different types of
  sequence.

Make use of the latter property to turn some member variables that were
`list` for the sake of `__add__`'s type requirement into `tuple`, since
they are never rewritten.
2023-03-23 01:14:37 +00:00
Kp 9b9a9712e4 Improve output in compile_commands.json
The link line is not used by clang, but is recorded in the hope that it
is useful for other tools.  Stabilize the output by requesting the
`str`, not the `repr`, of the input nodes.  `repr` in scons-4.4
generates a bare Python repr, rather than any useful text.  In addition
to not being useful, the bare repr exposes the memory address of the
`SCons.Node.FS.File`, which can vary from run to run even with no
changes to the code, causing needless rebuilds of the compilation
database.  The `str` of a node is its filename, which is stable across
runs.
2023-03-23 01:14:37 +00:00
Arne de Bruijn 769164a55b Fix SConstruct for scons 4.5.0+
env['CPPDEFINES'] may return a deque object in scons 4.5.0+ (see
SCons/scons#4321).
Explicitly convert it to a list where needed.

Tested with scons 4.4.0, 4.5.0, 4.5.1 and 4.5.2.
2023-03-22 10:52:33 +01:00
Kp 189ac23f61 Prefer V.copy over V[:] for creating shallow copies of sequences
According to `timeit`, this is slightly faster.  Also, `.copy()` will
work when `V` is a `collections.deque`, but `[:]` fails in that case.

SCons issue https://github.com/SCons/scons/issues/3876 (first released
in SCons 4.5.0) changed the storage of the `CPPDEFINES` variable from a
`list` to a `deque`, which broke use of `env.get(name, [])[:]`, since
`deque` cannot copy itself using `[:]`.  Switch to using `.copy()` to
obtain a shallow copy.

```
>>> # timing comparison
>>> timeit.timeit(stmt='a.copy()', setup='a = [1, 2, 3, 4]')
0.05652548000216484
>>> timeit.timeit(stmt='a[:]', setup='a = [1, 2, 3, 4]')
0.06801111809909344
```

```
>>> # deque cannot copy using slice notation
>>> a = [1, 2, 3]
>>> from collections import deque
>>> b = deque([1, 2, 3])
>>> a.copy()
[1, 2, 3]
>>> a[:]
[1, 2, 3]
>>> b.copy()
deque([1, 2, 3])
>>> b[:]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sequence index must be integer, not 'slice'
```

Reported-by: Kreeblah <https://github.com/dxx-rebirth/dxx-rebirth/issues/704>
2023-03-19 23:39:45 +00:00
Kp 5a5f10ff4f Print shell subcommands in reusable form
Switch from showing the Python tuple, which is unambiguous but hard to
run at a prompt, to showing the output of `shlex.join`, which is
normally correct for use at a shell prompt, and should still be
reasonably unambiguous.
2023-03-18 19:23:17 +00:00
Kp 4580811252 Use Python f-strings for SConstruct formatting 2023-03-18 19:23:17 +00:00
Kp 89e89c8afb Move global constants from mglobal.cpp to cglobal.cpp
These constants can be useful in unit tests, so move them out to their
own file.
2023-03-12 10:40:25 +00:00
Kp 6add766bb3 Generate build failure string in one step 2023-03-11 19:02:48 +00:00
Kp 2c25c15b74 Remove obsolete snapshot ebuild 2023-03-04 13:03:28 +00:00
Kp b5a8f72e6e Add python3_11 to PYTHON_COMPAT 2023-03-04 13:03:28 +00:00
Kp 114cdef1d2 Remove unused argument to parse_bmhd
clang-15 warns for a write-only parameter.  The parameter is only used
in a debug print, which has been commented out since the code was
originally imported.  Remove the parameter and the commented print.
2023-02-26 18:42:12 +00:00