Commit graph

37 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
4986c89680
cli,video: add --width and --height arguments to set initial window size 2024-05-02 00:24:06 +02:00
Andrei Alexeyev
b3025ad921
cli,main,progress: add --unlock-all flag for dev builds
Permanently unlocks all content
2023-05-29 00:48:50 +02:00
Andrei Alexeyev
e6fffc6b5f
cli: add --populate-cache
Searches the VFS for resources and attempts to load them all, then
exits. Intended to fully populate the persistent cache.
2023-05-08 10:05:21 +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
4750a983c0
cli: fix memleaks when string-arg options used multiple times 2021-06-16 01:45:13 +03:00
Andrei Alexeyev
3d4226ce04
replay/cli: --rereplay option
"Re-records" a replay into a file. TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY
is defaulted to 1 in this mode, but may be overriden as normal. Requires
-r or -R; in case of -R will not stop even if a desync is encountered.
2021-06-16 01:43:10 +03:00
Andrei Alexeyev
b2b7645cab
cli: accept numeric difficulty values 2021-05-06 21:18:42 +03:00
Andrei Alexeyev
8ff5890abe
CLI: add --skip-to-bookmark/-b flag
This simply sets the TAISEI_SKIP_TO_BOOKMARK env variable
2021-05-06 21:13:29 +03: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
00e4837827
Separate StageInfo-related APIs from game-stage code (#227) 2020-05-16 23:41:54 +03:00
Andrei Alexeyev
a842ba7b7d
cli: add --version option 2020-04-23 17:47:42 +03:00
Andrei Alexeyev
7fe3f8ff90
windows: detect intel's shitty driver and fall back to ANGLE 2019-09-21 16:46:22 +03:00
Andrei Alexeyev
5a23fb95fc
make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
Andrei Alexeyev
3055901998
update my email 2019-07-03 21:00:56 +03:00
Andrei Alexeyev
75f7e23ab8
s/Touhou/Tōhō 2019-04-22 23:14:50 +03:00
Andrei Alexeyev
c7ff531a63
fixup includes 2019-03-18 06:41:12 +02:00
Andrei Alexeyev
180f9e3856
Emscripten compatibility (#161)
* Major refactoring of the main loop(s) and control flow (WIP)

run_at_fps() is gone 🦀

Instead of nested blocking event loops, there is now an eventloop API
that manages an explicit stack of scenes. This makes Taisei a lot more
portable to async environments where spinning a loop forever without
yielding control simply is not an option, and that is the entire point
of this change.

A prime example of such an environment is the Web (via emscripten).
Taisei was able to run there through a terrible hack: inserting
emscripten_sleep calls into the loop, which would yield to the browser.
This has several major drawbacks: first of all, every function that
could possibly call emscripten_sleep must be compiled into a special
kind of bytecode, which then has to be interpreted at runtime, *much*
slower than JITed WebAssembly. And that includes *everything* down the
call stack, too! For more information, see
https://emscripten.org/docs/porting/emterpreter.html

Even though that method worked well enough for experimenting, despite
suboptimal performance, there is another obvious drawback:
emscripten_sleep is implemented via setTimeout(), which can be very
imprecise and is generally not reliable for fluid animation. Browsers
actually have an API specifically for that use case:
window.requestAnimationFrame(), but Taisei's original blocking control
flow style is simply not compatible with it. Emscripten exposes this API
with its emscripten_set_main_loop(), which the eventloop backend now
uses on that platform.

Unfortunately, C is still C, with no fancy closures or coroutines.
With blocking calls into menu/scene loops gone, the control flow is
reimplemented via so-called (pun intended) "call chains". That is
basically an euphemism for callback hell. With manual memory management
and zero type-safety. Not that the menu system wasn't shitty enough
already. I'll just keep telling myself that this is all temporary and
will be replaced with scripts in v1.4.

* improve build system for emscripten + various fixes

* squish menu bugs

* improve emscripten event loop; disable EMULATE_FUNCTION_POINTER_CASTS

Note that stock freetype does not work without
EMULATE_FUNCTION_POINTER_CASTS; use a patched version from the
"emscripten" branch here:

    https://github.com/taisei-project/freetype2/tree/emscripten

* Enable -Wcast-function-type

Calling functions through incompatible pointers is nasal demons and
doesn't work in WASM.

* webgl: workaround a crash on some browsers

* emscripten improvements:

    * Persist state (config, progress, replays, ...) in local IndexDB
    * Simpler HTML shell (temporary)
    * Enable more optimizations

* fix build if validate_glsl=false

* emscripten: improve asset packaging, with local cache

Note that even though there are rules to build audio bundles, audio
does *not* work yet. It looks like SDL2_mixer can not work without
threads, which is a problem. Yet another reason to write an OpenAL
backend - emscripten supports that natively.

* emscripten: customize the html shell

* emscripten: force "show log" checkbox unchecked initially

* emscripten: remove quit shortcut from main menu (since there's no quit)

* emscripten: log area fixes

* emscripten/webgl: workaround for fullscreen viewport issue

* emscripten: implement frameskip

* emscripter: improve framerate limiter

* align List to at least 8 bytes (shut up warnings)

* fix non-emscripten builds

* improve fullscreen handling, mainly for emscripten

* Workaround to make audio work in chromium

emscripten-core/emscripten#6511

* emscripten: better vsync handling; enable vsync & disable fxaa by default
2019-03-09 21:32:32 +02:00
Andrei Alexeyev
4159ea1249
'upkeep' target for maintenance tasks; back to include guards; happy new year! 2019-01-23 22:10:43 +02:00
Andrei Alexeyev
58252950d4
add replay verification mode: taisei --verify-replay file.tsr 2018-04-18 02:48:28 +03:00
Andrei Alexeyev
513d613387
Consistent indentation: indent with tabs, align with spaces (#104)
I would've preferred to just go with 4-spaces for indent and no tabs,
but lao is a bit conservative about it. :^)

Still, this is a ton better than mixing different styles all over the
place, especially within the same file.
2018-01-12 20:26:07 +02:00
Andrei Alexeyev
9b7ac2e747
optimize rendering of some additive stuff a bit 2018-01-11 09:33:51 +02:00
Andrei Alexeyev
485c9a8ed6
Happy New Year! 2018-01-04 19:14:31 +02:00
Andrei Alexeyev
ddc15eafc7
format stage ids more consistently 2017-12-31 10:08:07 +02:00
Andrei Alexeyev
29acd5f58a meson: intel intrinsics, various improvements 2017-12-21 03:58:54 +01:00
Andrei Alexeyev
bd910c3444
update credits, fix stuff 2017-10-23 13:48:30 +03:00
Andrei Alexeyev
1992a62592 desperate attempt at refactoring plrmodes 2017-10-10 08:23:36 +03:00
Andrei "Akari" Alexeyev
7c9e54a71d
update copyright and credits 2017-09-12 04:28:15 +03:00
Andrei "Akari" Alexeyev
471f30083e WIP virtual filesystem 2017-04-20 05:02:22 +03:00
laochailan
f1fb2e6ad2 fix cli 2017-04-04 14:30:32 +02:00
Andrei "Akari" Alexeyev
77c6790051 fix replays 2017-04-04 12:10:54 +03:00
Andrei "Akari" Alexeyev
ecc1997852 stage_init_array really does go first 2017-04-03 02:50:48 +03:00
Andrei "Akari" Alexeyev
d41bb02753 Replaced TAISEI_SANIC with --frameskip/-f
and fixed some more cli issues
2017-04-03 02:30:12 +03:00
Andrei "Akari" Alexeyev
b9d0e28fa0 fixed a few CLI issues 2017-04-03 02:10:16 +03:00
laochailan
84021e78bd cli tweaks
- case insensitive difficulty/shotmode
- remove dumprestable
- '-' shortcut for stdin
2017-04-02 16:53:27 +02:00
laochailan
44d2ab8f6c add the files to the commit... 2017-04-02 10:16:52 +02:00