Commit graph

106 commits

Author SHA1 Message Date
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
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
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
8847d79dfd
credits: shout out more FOSS projects that we use 2023-09-08 00:38:17 +02:00
Andrei Alexeyev
4639b6c6c4
credits: expand background so text doesn't overflow 2023-09-08 00:38:17 +02:00
Andrei Alexeyev
fa7c1489be
credits: unlock bgm when entered 2023-06-08 01:51:01 +02:00
Andrei Alexeyev
9794e45ee5
credits: disable demoplayer 2023-06-08 01:50:28 +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
3dc0faec9e
renderer/api: rename ClearBufferFlags to BufferKindFlags 2023-04-10 06:47:55 +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
e739ffa133
credits: don't use old timer macros 2023-02-24 05:37:58 +01:00
Andrei Alexeyev
aa9929e469
pbr: add environment light modulation support 2023-01-18 14:52:37 +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
Alice D
8a3a82c7ed
fix typo in credits 2023-01-14 15:19:08 -05:00
Alice D
0a8875a703
update credits 2023-01-14 09:53:29 -05:00
Andrei Alexeyev
0adaf17d5f
sprite: handle virtual paddings transparently
Most client code no longer needs to care about paddings at all, aside
from some very special cases involving dynamic creation of padded
sprites. So far we only have one known example of this in portrait_render().

This should let us optimize most of our sprites with autotrimming in the
future.

Additionally, support for deprecated offset_{x,y} keys in sprite files
has been removed.
2022-11-27 20:14:05 +01:00
Alice D
54e212d6c5
update credits with correct info 2022-02-06 15:21:04 -05:00
Lukas Weber
1260dcc0c3
credits: new background 2022-01-28 18:06:45 +02:00
laochailan
a157b88f92
stage6: new PBR background 2022-01-28 18:06:45 +02:00
Andrei Alexeyev
9db1160670
credits: fix deprecations 2021-02-22 15:22:53 +02:00
laochailan
7fa35409d8 stage3d: store fovy, aspect, near and far as parameters to the camera
this means glm_mat_proj_perspective is no longer meant to be called by the stage code. The parameters are set to sensible defaults of the pbr stages.

I found that the old stages use STAGE3D_DEFAULT_ASPECT which is somehow stretched. I did not change the behavior but added a FIXME comment to lines that should at some point just be deleted to use the correct default aspect.

I did not fix the extra stage code to avoid conflicts.
2021-01-21 05:20:15 +02:00
Alice D
8f3b3fa0bc
Stage 6 Restructure (#248)
* basic stage 6 structure (nothing here yet)

* it compiles and runs (needs testing)

* reindent

* missing import

* fix baryons

* import cleanups

* moving spells from elly.c to their spellcard sources

* code review changes, and some additional cleanup

* more PR changes, removing more dead code

* clean up some imports, move functions to spellcards

* remove dual initalization
2020-08-28 09:08:30 +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
Andrei Alexeyev
89ecc0c55e
Establish more-or-less consistent resource getter functions
Deprecate old ad-hoc stuff like get_sprite, r_texture_get, etc.
2020-06-09 04:33:22 +03:00
Andrei Alexeyev
f5f8f9fb49
Get rid of custom min() and max() functions
Use the standard fmin() and fmax() for floating point values, and ours
imin(), imax(), umin(), umax() for integers.
2020-05-09 09:16:07 +03:00
Andrei Alexeyev
0cbc86c66e
Add generic type-safe facility for dynamic arrays (#207)
Replace most ad-hoc opencoded dynamic arrays across the codebase
2020-04-05 05:51:00 +03:00
Martin Herkt
f60e0b1df3
Update email 2020-04-02 18:40:55 +02:00
Andrei Alexeyev
39a5f7d209
credits: Add Adam, Haru; retime; allow skip if any ending achieved 2020-03-04 22:26:53 +02:00
Alice
ed065eb38e
New story and dialogue (main story complete!) (#186)
* new story doc for Taisei Project

* more romanization fixes

* new Reimu script, yay

* accidentally stomped on some dashes

* typo in iku's dialogue

* marisa dialogue, complete!

* formatting fixes, and some timing changes

* youmu script! all three routes complete!

* youmu typoes

* remove trailing whitespaces, use smartquotes, move a couple of words around

* good/bad endings complete!

* remove unneccesary whitespaces

* revert --

* story doc typo

* formatting issues, a couple of word changes

* smart-quotes

* typoes and minor grammar changes to dialogue/story/endings

* one last typo in Marisa's dialogue

* correct smartquotes on STORY.txt
2020-03-04 22:26:50 +02:00
Andrei Alexeyev
8aad971114
clear up some ancient 3D confusion 2020-02-22 08:56:41 +02:00
Andrei Alexeyev
3bd884cd1b
Stage3D improvements
* More consistent function names
* No need to register models, just pass what you want to draw to
stage3d_draw()
* Optimize vector math
2020-02-01 03:24:17 +02:00
Andrei Alexeyev
49dcd7c8d7
Remove Lalasa's contributions (by request)
This replaces the story and dialogue contents with stubs, as well as
removes Lalasa's entry from the credits, by her own request.

Fixes #179
2019-10-31 13:04:30 +02:00
Andrei Alexeyev
9d3bf87559
Refactor matrix stack API to get rid of matrix mode (#177)
This replaces the r_mat_foo functions with specialized r_mat_{mv,tex,proj}_foo counterparts that operate explicitly on the modelview, texture, and projection matrix stacks respectively.
2019-10-12 15:02:15 +03:00
Andrei Alexeyev
f79f8574a9
update FOSS acknowledgements 2019-09-24 15:58:49 +03:00
Andrei Alexeyev
31ea0d409c
replace Yukkuri Reimu with Yukkuri Kyouko 2019-08-22 23:00:13 +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
c2cd91463c
New character art by Afensorm + other visual tweaks (#170)
* implement player spellcard declarations on bomb

* stagedraw: move "bottom text" to a separate (higher) layer

* update boss spell declaration effect

* import afensorm's character portrait art

* improve dialog visuals

* acknowledge afensorm in credits and COPYING

* 'alphamap' functionality; effects for wriggle and youmu portraits

* update afens art

* add cirno alphamap

* dialog: draw active speaker above other other

* charselect: use r_draw_sprite
2019-07-03 20:50:43 +03:00
Andrei Alexeyev
b0856ce07d
Switch audio assets to Opus (#167)
* Switch BGMs to Opus

* Switch SFX to Opus; use floating-point mixing

* opus sfx: support resampling via SDL_AudioStream

* bump SDL2 version requirement to 2.0.6

2.0.5 doesn't have the SDL_AudioStream API, and is ancient anyway.
2019-05-11 09:46:26 +03:00
Andrei Alexeyev
2cdc06b941
fix credits 2019-04-24 11:43:31 +03:00
Andrei Alexeyev
d5e66f9a06
fix a bunch of missing preloads 2019-04-23 00:09:58 +03:00
Andrei Alexeyev
82a9a0223b
refactor crazy memory allocations in 3d background code 2019-03-11 17:08:54 +02:00
Andrei Alexeyev
a63e8f4a69
Add a basic music room 2019-03-11 01:21:43 +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
fa802dbd94
Some refactoring
* Added (and fixed) a few useful warnings
    * Removed some dead code
    * Cleaned up the build system files a bit
    * Once again separated ZIP support from data packaging
    * Converted macOS cross-compilation options into cross-file properties
2019-01-24 22:24:43 +02:00