Commit graph

4041 commits

Author SHA1 Message Date
Andrei Alexeyev
1ca164eea4
test/renderer: add a basic triangle "hello world" example 2024-05-14 04:37:11 +02:00
Andrei Alexeyev
0ea5f73c3c
build: add basic infra for building tests 2024-05-14 04:37:11 +02:00
Andrei Alexeyev
1914703edf
build: put most sources except main.c into a static lib
Allows building other executables (tests, tools like tsrtool, etc.) that
make use of taisei code in the future.
2024-05-14 04:37:11 +02:00
Andrei Alexeyev
b00f74c6f2
vfs/public: make APIs fail safely if VFS is not initialized 2024-05-13 03:31:48 +02:00
Andrei Alexeyev
dfa615bb77
thread: safely return NULL from thread_create() if threads not initialized 2024-05-13 03:30:19 +02:00
Andrei Alexeyev
83dfe8d5fa
renderer/api: init matrix and state stacks early 2024-05-13 03:29:43 +02:00
Andrei Alexeyev
7ed253f5c6
coroutine/cotask: allow cotask_active() when coroutine system is uninitialized 2024-05-13 03:28:41 +02:00
Andrei Alexeyev
4072d31ffa
lasers/rules: make create_dynamic_laser return MoveParams* in an out-parameter
No need to mess with LaserRuleDynamicData and LaserRuleDynamicTaskData
2024-05-10 01:31:39 +02:00
Andrei Alexeyev
07a0bdf558
lasers: compute segment visibility correctly
The previous naive check had some false negatives
2024-05-09 05:11:17 +02:00
Andrei Alexeyev
e518c7a87d
lasers: support lasers with abrupt angle changes
This requires some look-ahead, so quantize_lasers will now compute all
samples ahead of time before starting to build segments. The samples are
held in a global dynamic array to minimize reallocations.
2024-05-09 05:11:17 +02:00
Andrei Alexeyev
92183e7655
lasers: try to change the quantization sampling step as little as possible 2024-05-08 23:10:23 +02:00
Andrei Alexeyev
c8b017f974
geometry: add paranoid check to lineseg_ellipse_intersect 2024-05-08 16:14:28 +02:00
Andrei Alexeyev
fcc068f0e5
stage: check for radius<=0 in stage_clear_hazards_at 2024-05-08 16:14:24 +02:00
Andrei Alexeyev
071d1163fd
cutscene: allow interrupting already seen cutscenes 2024-05-04 20:07:12 +02:00
Andrei Alexeyev
85f74eb4bf
global: add TAISEI_KIOSK_PREVENT_QUIT env var
Defaults to 1. Set to 0 to be able to close the window in kiosk mode.
This is intended for testing and not recommended for deployment.
2024-05-04 20:07:12 +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
0b2280b7ed
build: remove some leftover debug spam 2024-05-04 09:27:46 +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
208be2bccd
stage: try to quickload when autorestart is enabled for spell stages 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
b95a541479
config: read defaults from optional "config.default" file in resources
Not included by default, intended for custom distributions (for DoKomi
in particular)

Also improve the upgrade mechanism by ignoring settings that were not
changed in the config being parsed.
2024-05-03 04:20:45 +02:00
Andrei Alexeyev
a84e574f4b
bitarray: add a basic packed bitarray type of arbitrary size 2024-05-03 02:35:39 +02:00
Andrei Alexeyev
4986c89680
cli,video: add --width and --height arguments to set initial window size 2024-05-02 00:24:06 +02:00
Andrei Alexeyev
8d5ffe4b91
renderer: remove old r_screenshot() API 2024-05-01 01:07:18 +02:00
Andrei Alexeyev
f11a09649d
gl33: implement sync fallback for framebuffer async read 2024-05-01 01:01:09 +02:00
Andrei Alexeyev
783172861a
renderer: simplify async readback API; use glMapBufferRange
glGetBufferSubData is not available on GLES
2024-05-01 00:19:07 +02:00
Andrei Alexeyev
d03b2eb38c
video: add "framedump" mode; use async readback for screenshots;
The framedump mode captures every frame and saves it as a .png image.
This can be useful for rendering videos.

To activate, set the `TAISEI_FRAMEDUMP` environment variable to a
prefix. A 8-digit frame number followed by ".png" will be appended to
this string to form the filename of each frame.

Example:
	$ mkdir /var/tmp/taisei
	$ export TAISEI_FRAMEDUMP="/var/tmp/taisei/frame-"
	$ taisei -f1 -r /foo/some-replay.tsr
	$ ls /var/tmp/taisei
	frame-00000000.png  frame-00000001.png frame-00000002.png
	...

`TAISEI_FRAMEDUMP_SOURCE` can be set to either "screen" or "viewport".
The default is "screen", which records the whole game screen as it
appears (minus the letterboxing borders). "viewport" makes it record the
stage viewport only. The image is taken directly from the viewport
framebuffer, so elements that are drawn over the viewport will be
missing, such as the dialogue or the pause menu.

`TAISEI_FRAMEDUMP_COMPRESSION` can be set to change the quality of zlib
compression of the png images, ranging from 0 to 9. The default is 1.

Additionally, it's now possible to take screenshots of the game viewport
by pressing Alt+P (by default). This works on the same principle as
`TAISEI_FRAMEDUMP_SOURCE=viewport`, so the same caveats apply. This can
be used to take a clean screenshot of the viewport while the game is
paused.
2024-04-29 01:15:15 +02:00
Andrei Alexeyev
c6d92f7407
renderer: add asynchronous framebuffer readback API
Used to download rendered images from the GPU with minimal (if any)
pipeline stalling. Implemented with PBOs in OpenGL.
2024-04-29 01:15:15 +02:00
Andrei Alexeyev
11090983b7
video: shut down the renderer before destroying the window 2024-04-29 01:15:15 +02:00
Andrei Alexeyev
f5553a2125
renderer/glcommon: add glcommon_get_texture_formats() 2024-04-29 00:53:30 +02:00
Andrei Alexeyev
aff16937e8
stagedraw: add stage_draw_is_initialized() API 2024-04-29 00:42:33 +02:00
Andrei Alexeyev
5a3bd5ec79
taskmanager: fix failing to wait for all tasks before shutting down 2024-04-29 00:41:26 +02:00
Andrei Alexeyev
17815c656b
build: add abort_on_error=1 to devenv ASAN_OPTIONS 2024-04-27 15:08:05 +02:00
Andrei Alexeyev
2e6e890e34
events: fix possible use-after-free
Can happen when a global handler is added during events_poll() if the
array must be resized.
2024-04-27 15:04:06 +02:00
Andrei Alexeyev
b9f1698e84
pixmap: optimize webp decoding
Chunked decoding wastes a lot of time copying buffers, so just load the
entire file into memory.
2024-04-26 16:24:12 +02:00
Andrei Alexeyev
5fa84daa89
stage5: convert boss nonspell2 laser rule to new style 2024-04-23 17:38:22 +02:00
Andrei Alexeyev
ef4c00e269
stage5: convert cathode laser rule to new style 2024-04-23 17:38:22 +02:00
Andrei Alexeyev
b01f5cb0da
stage6: convert maxwell laser rule to new style 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
119c5d1964
stage6: convert TOE laser rule to new style 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
f0680dae55
stages: use new-style rules for common laser types 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
be7ccec5c9
lasers: add an experimental "dynamic" laser rule 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
daa1b38987
lasers: prototype a better interface for position rules 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
e3a4e9065e
ringbuf: add a generic ring-buffer data type 2024-04-23 17:38:21 +02:00
Andrei Alexeyev
34963e21a3
stage: remove v1.4 bug compatibility 2024-04-20 22:05:37 +02:00
Andrei Alexeyev
4a50c85574
stage: fix pause menu related crashes
There were two distinct things going on here:

1. If we receive multiple buffered TE_GAME_PAUSE events in the same
   frame, we'd process all of them and create a pause menu for each.
   This could theoretically overflow the evloop stack and crash the
   game.
2. The `stage_comain` task starts before scheduling the stage main
   loop via `eventloop_enter`. It initializes systems that depend on
   tasks, and then immediatelly enters its per-frame async loop,
   finishing its first iteration before yielding back to `_stage_enter`
   and thus allowing `eventloop_enter` to be finally called. If there is
   a TE_GAME_PAUSE event in the queue at this point, it would be handled
   right there, and a pause menu would be created before the stage main
   loop is scheduled. This messes things up quite a bit, leaking a
   "zombie" pause menu into the evloop stack. After the stage is
   destroyed, the evloop would try to switch to the frame created for
   this menu. The menu's draw function would then attempt to reference
   free'd resources of the destroyed stage, crashing the game. This
   crash has actually been observed and reported (thanks @0kalekale)

To fix #1, the stage now tracks its paused state and refuses to open a
pause menu if one already exists.

To fix #2, `stage_comain` now yields before starting its async loop, to
let the stage set up its main loop early.

Note that because the stage main loop runs all coroutine tasks before
incrementing the frame counter, `stage_comain`'s per-frame logic would
execute twice on frame 0. This is obviously wrong, but this behavior
must be preserved to maintain compatibility with v1.4 replays. For that
reason, the `stage_comain` loop now skips its first YIELD. This hack can
be removed once v1.4 compat is no longer a concern.
2024-04-20 22:03:32 +02:00
Andrei Alexeyev
e54b144973
gl33: fix scissor test 2024-04-11 18:04:22 +02:00
Andrei Alexeyev
94e4d041d4
lasers: fix time values written by quantize_laser() 2024-04-11 17:38:31 +02:00
Andrei Alexeyev
1b95645754
entity: add ENT_ARRAY_ADD_FIRSTFREE(array, ent)
Like ENT_ARRAY_ADD, but tries to scan the array for dead slots first. If
it finds one, it will put the new entity into that slot instead of
adding a new one. Returns the index. The regular ENT_ARRAY_ADD() now
also returns the index as well.
2024-04-11 17:38:02 +02:00
Andrei Alexeyev
863468db1a
entity: fix ENT_ARRAY_FOREACH macros 2024-04-08 06:16:15 +02:00
Andrei Alexeyev
f3cea8b614
lasers: greatly reduce number of quantization samples for simple laserlines 2024-04-04 04:45:33 +02:00