Commit graph

27 commits

Author SHA1 Message Date
Andrei Alexeyev
8b37d1cbf2
src: the great #include massacre of 2024 2024-05-17 14:11:48 +02:00
Andrei Alexeyev
be7905d6a3
src: run upkeep 2024-05-17 04:58:47 +02:00
Andrei Alexeyev
c15934f666
dynarray: get rid of memset and add optional initializer arg to dynarray_append 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
c2810e228d
all: use re()/im() macros 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
a08d68a91a
demoplayer: ignore suspend/resume requests when not initialized
This fixes a nasty interaction between the intro sequence and the
demoplayer introduced in 3ff62045. The cutscene tries to suspend the
demoplayer for its duration and then resume it later. When the
suspension counter hits 0, the demoplayer event handlers are installed
globally. And then AFTER that happens, the demoplayer is actually
initialized, resetting the suspension counter and installing the event
handlers AGAIN. When the demoplayer is then suspended (e.g. by starting
the actual demo playback), only one set of those handlers is removed,
which has the effect of the demoplayer remaining active even in-game.
Eventually, it tries to play a demo while a game is already running,
at which point all hell breaks loose.

Fix this by making suspend and resume no-ops until the demoplayer has
been properly initialized.

Fixes #371
2023-09-10 06:41:32 +02:00
Andrei Alexeyev
b57445900f
gamepad: overhaul analog stick handling
* Use correctly scaled radial deadzones instead of naive per-axis
  deadzones
* Option to adjust the "maximum zone" (upper deadzone)
* Option to remap square input into circular. Unfortunately there's no
  nice way to detect which type the controller reports. We assume
  circular by default.
* A more sensible sensitivity setting
* Use a larger minimum deadzone when emulating key presses (e.g. in
  menus)
* Adjusted key repeat to be less aggressive
2023-07-12 00:13:19 +02:00
Andrei Alexeyev
a9ccc5a91f
replay/demoplayer: reduce inter-demo wait time 2023-06-22 08:04:51 +02:00
Andrei Alexeyev
b7f47e6580
replay/tsrtool: add a basic CLI replay editor 2023-06-17 21:53:48 +02:00
Andrei Alexeyev
ba8ef49030
replay/struct: define gflags and sflags via X-macros 2023-06-17 21:53:48 +02:00
Andrei Alexeyev
086b68e9fd
replau/read: wrap common args in context struct; add flag to ignore errors 2023-06-17 21:53:24 +02:00
Andrei Alexeyev
100036c676
replay: add replay_save_syspath() 2023-06-17 21:53:24 +02:00
Andrei Alexeyev
f272ec5911
replay/state: add skip_frames counter for playback 2023-06-17 21:53:24 +02:00
Andrei Alexeyev
eede63333a
replay: introduce REPLAY_STRUCT_VERSION_TS104000_REV1
* Use zstd instead of zlib compression
* Remove plr_focus field
* Add skip_frames field for demos
2023-06-17 21:53:24 +02:00
Andrei Alexeyev
e74c3f60ea
replay/play: fix --rereplay mode 2023-06-17 21:53:24 +02:00
Andrei Alexeyev
9dade8ad33
resource: lifetime management redesign (WIP) 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
ad295005db
resource: more consistent API function names 2023-04-29 20:01:50 +02:00
Andrei Alexeyev
57a08d4c7a
replay/demoplayer: automatic "demo" playback when idling in menus
Currently the game comes with no demos; place your own replays into
$userdir/resources/demos if you want to test this.
2023-04-07 16:08:50 +02:00
Andrei Alexeyev
b91c10b1f9
replay: add replay_load_vfspath 2023-04-07 16:08:50 +02:00
Andrei Alexeyev
886ba290a9
util/callchain: split from eventloop 2023-04-07 16:08:49 +02:00
Andrei Alexeyev
b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
Andrei Alexeyev
3c7283f1c7
player: refactor power handling
Separate concepts of "stored" and "effective" power.
2022-10-03 20:53:22 +02:00
Andrei Alexeyev
2151d3e729
replay: avoid silly gcc7 warning 2022-02-18 07:44:25 +02:00
Andrei Alexeyev
351f91a573
stage: add replay-based quicksave/quickload functionality
Disabled in story mode on non-developer builds
2022-01-09 14:11:26 +02:00
Andrei Alexeyev
085137843b
replay: use dynarray to store stages 2022-01-09 14:03:55 +02:00
Andrei Alexeyev
8d2ee76710
replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
Andrei Alexeyev
9666bae1bc
Fix gcc11 warnings 2021-07-18 19:09:12 +03:00
Andrei Alexeyev
173c8c3cc6
replay: general refactor
* Split replay.c into multiple files under replay/; improve logical
  separation of replay-related code.
* Separate replay playback state from data.
* Get rid of global static replay struct and avoid unnecessary replay
  copying.
* Replay playback and recording are now independent and may occur
  simultaneously, although this functionality is not yet exposed. This
  enables replay "re-recording" while synthesizing new desync check
  events, possibly at a different rate from the original replay.
* Rate of recorded desync check events can now be controlled with the
  TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY environment variable. The default
  value is 300 as before.
* Probably other stuff I forgot about.
2021-06-16 01:43:10 +03:00