Commit graph

435 commits

Author SHA1 Message Date
Andrei Alexeyev
5bd284cd3d
menu/common: commit persistent data before starting a new game 2024-10-24 01:23:42 +02:00
Andrei Alexeyev
7f570d2338
renderer/common/sprite_batch: remove string fields from SpriteParams 2024-09-22 21:18:31 +02:00
Andrei Alexeyev
fda8556a39
src: deprecate strdup(), use mem_strdup() explicitly
This fixes a nasty bug that manifests on windows when building without
precompiled headers. util/stringops.h used to silently replace strdup
with a macro that's compatible with mem_free(). This header would
typically be included everywhere due to PCH, but without it the strdup
from libc would sometimes be in scope. On most platforms mem_free() is
equivalent to free(), but not on windows, because we have to use
_aligned_free() there. Attempting to mem_free() the result of a libc
strdup() would segfault in such a configuration.

Avoid the footgun by banning strdup() entirely. Maybe redefining libc
names isn't such a great idea, who knew?
2024-09-10 14:31:55 +02:00
Andrei Alexeyev
0fe465522f
menu: improve grouping in spell practice and stage select 2024-06-14 22:35:24 +02:00
Andrei Alexeyev
fc54f3f8ce
global,mainmenu: enable Quit if quitting is allowed in kiosk mode 2024-06-04 16:31:46 +02:00
Andrei Alexeyev
7548e4892d
gamepad: direction snapping; more flexible configuration options
- The free/restricted axis distinction is gone; the joystick always
  operates in "free" mode.
- Added direction snapping functionality to help aid exact movement in
  cardinal and/or diagonal directions. The snapping angle can be
  adjusted from 0% (disabled) to 100% (similar to the old "restricted"
  mode). The snapping angle can also be biased towards cardinals or
  diagonals.
- When the maximum zone is less than or equals dead zone, moving
  the character will always move at maximum speed (as in the old
  "restricted" mode).
- Most of these settings are now visualized in the options menu and can
  be tested there.
2024-05-27 19:23:59 +02:00
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
858398f556
watchdog: return to main menu and reset config after inactivity in kiosk mode 2024-05-04 20:07:12 +02:00
Andrei Alexeyev
b9d5c741ba
menu/gameovermenu: add "Load Quicksave" entry when available
Also move the logic of action choice handling out of the menu and into
the stage.
2024-05-03 04:20:45 +02:00
Andrei Alexeyev
fa5c0696e3
menu/options: add an option to reload the last saved config 2024-05-03 04:20:45 +02:00
Andrei Alexeyev
8f8ca2beca
all: use min/max macros; avoid some unnecessary conversions 2023-09-28 17:43:14 +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
bd361067df
headers: isolate endings, remove stage.h inc. from plrmodes.h, fix resulting mess 2023-07-30 06:16:17 +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
e49c20d172
resources: add intro bgm 2023-06-26 09:02:46 +02:00
Andrei Alexeyev
a104c10691
menu/options: make it possible to exit text input with gamepad 2023-06-23 11:09:17 +02:00
Andrei Alexeyev
f90c460af1
menu/options: very scuffed "reset to default" option 2023-06-23 10:58:28 +02:00
Andrei Alexeyev
91528ae8f4
menu/options: don't instantly disable gamepad when option is switched off 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
ee2bb877bc
global: basic kiosk mode support 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
eeb99858ca
video: make video_get_mode() safer 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
8bff89e1c1
player,config: add option to auto-activate surge at 6 power (on by default) 2023-06-19 23:39:11 +02:00
Andrei Alexeyev
e949419941
menu/replayview: cleanup events after watching replay 2023-06-17 21:52:44 +02:00
laochailan
a6e29bdc56 preload: update all preloads
endings and extra spells are not completely tested yet.
2023-06-16 22:19:11 -04:00
Andrei Alexeyev
f85b37b2a2
menu/savereplay: disable demoplayer 2023-06-08 01:46:39 +02:00
Andrei Alexeyev
f5d70f8398
menu: add MF_NoDemo MenuFlag
Disables the demoplayer while the menu is active
2023-06-08 01:45:48 +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
0c73a2d9a9
menu: fix use-after-free due to unhandled transition cancel 2023-04-12 06:58:55 +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
71109fd253
transition: more robust handling of "canceled" transitions
Ensure callbacks are always called, but if a transition was overwritten
by another set_transition() call mid-transition, pass a non-NULL
argument as the result. This allows the callback to gracefully cancel
whatever it was meant to do, if needed.
2023-04-07 16:08:50 +02:00
Andrei Alexeyev
27a1a6fc7a
transition: use the callchain system for callbacks 2023-04-07 16:08:49 +02:00
Andrei Alexeyev
886ba290a9
util/callchain: split from eventloop 2023-04-07 16:08:49 +02:00
Andrei Alexeyev
77dc94bb71
menu,renderer,vfs: fix -Wcast-function-type-strict on clang 16 2023-03-22 22:38:52 +01: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
85b2f3205f
menu/options: use draw_menu_list()
This fixes controls menu overflowing the screen in dev builds.
2022-02-16 05:10:21 +02:00
Andrei Alexeyev
6f25a4b7d4
menu/common: add context argument for draw_menu_list() 2022-02-16 05:09:30 +02:00
Andrei Alexeyev
19f99393e7
menu/charprofile: add missing include 2022-01-27 09:03:03 +02:00
Andrei Alexeyev
37b122bd84
menu/replayview: handle multistage replays with unknown stages gracefully 2022-01-27 09:03:03 +02:00
Andrei Alexeyev
66309fbcd0
menu: don't lock up if menu has no selectable items 2022-01-27 09:03:03 +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
Alice D
491cf9d2ce
In-Game Character Profiles (#327) 2021-12-22 23:52:22 +02:00
Andrei Alexeyev
8d2ee76710
replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
Andrei Alexeyev
659ed15e43
Fix some issues found by clang static analysis 2021-06-18 16:11:00 +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
Andrei Alexeyev
42e88e89f8
menu: fix memory leak
The start game sequence didn't properly clean up when cancelling out of
a character selection menu if no difficulty selection was presented
(e.g. spell cards)
2020-12-28 06:28:53 +02:00
Andrei Alexeyev
9b5d515721
Cutscenes (#249)
* WIP cutscenes

* cutscene tweaks

* cutscene: erase background drawing under text

* Make text outlines thicker

* Prepare an interface for adding new cutscenes

* Basic progress tracking for cutscenes

* cutscene: support specifying scene name and BGM

* cutscene: exit with transition after scene ends

* Implement --cutscene ID and --list-cutscenes CLI flags

* fix progress_write_cmd_unlock_cutscenes

* Play intro cutscene before entering main menu for the first time

Also added --intro parameter in dev builds to force playing the intro
cutscene

* Add intro cutscene

* cutscenes: update opening/01 scene

* add Reimu Good End

* remove Bonus Data

* split up a bit of dialogue, revert an image change in intro

* small typo

* most cutscenes complete

* smartquotify

* finish Extra intros

* new cutscenes routed into main game

* fix ENDING_ID

* rough 'mediaroom' menu

* fix cutscene menu crash

* derp

* PR changes

* fixing imports

* more PR fixes

* PR fixes, including updating the script to #255

* add in newlines for readability

Co-authored-by: Alice D <alice@starwitch.productions>
2020-11-28 12:11:10 +02:00
Andrei Alexeyev
40a3f6ead2
Add gameover BGM by RickyRister 2020-06-24 20:51:00 +03:00
Andrei Alexeyev
8480d41b7b
Audio rewrite (#236)
This replaces SDL_mixer with an internal streaming and mixing system,
relying only on basic SDL audio support. It's also a partial refactor of
the audio API, most notably BGM-related. The BGM metadata resource type
is gone, as well as the `.bgm` files. The metadata is now stored inside
the `.opus` files directly, using standard Opus tags.
2020-06-22 17:41:03 +03:00