Commit graph

307 commits

Author SHA1 Message Date
Andrei Alexeyev
5610ecb6b7
player: use sprite_particle shader for better batching 2024-10-04 16:27:28 +02:00
Andrei Alexeyev
7f570d2338
renderer/common/sprite_batch: remove string fields from SpriteParams 2024-09-22 21:18:31 +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
cc01be15fe
all: use the clamp() macro 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
8f8ca2beca
all: use min/max macros; avoid some unnecessary conversions 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
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
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
9abaf2444d
player: add uncapped_velocity field
Like velocity, but prior to clamping to viewport bounds.
2023-05-30 03:07:23 +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
27dd644791
player: fix move_towards deprecation warnings 2023-02-27 07:10:02 +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
56254dda80
player: fix effective_power_changed event 2022-11-12 02:05:33 +01:00
Andrei Alexeyev
ba1dc70619
player: freeze effective power during surge (experimental) 2022-10-03 20:53:22 +02: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
ed7134718a
player: reset powersurge.bonus struct when activating powersurge
Fixes minor visual bugs when re-activating power surge
2021-10-26 07:11:10 +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
1daf1377d9
player: signal bomb_used after updating all related plr state
This makes it so that player_is_bomb_active() returns true on the first
frame of any of the bomb_used handlers, and generally makes them not see
partially updated state.
2021-06-10 12:15:58 +03:00
Andrei Alexeyev
4b623059d1
player: clean up timestamp-based states
Negative "recovery" is gone: bomb i-frames and recovery i-frames are
now decoupled from each other. Added brief comments explaining what
the timestamps are for.
2021-06-04 03:33:11 +03:00
Andrei Alexeyev
23f623a6a1
boss: misc cleanup; use events to identify attack state 2021-05-19 03:52:07 +03:00
Andrei Alexeyev
bc8628bc62
player: implement part of death effect as a task
This fixes remaining warnings in player.c for now
2021-02-22 01:44:14 +02:00
Andrei Alexeyev
da2f5a3b0e
player: implement powersurge discharge bullet cancel as a task 2021-02-22 01:39:29 +02:00
Andrei Alexeyev
30ebd1d3f5
player: implement powersurge particles as a task
Fixes some deprecation warnings
2021-02-22 01:31:48 +02:00
Andrei Alexeyev
f329a9f016
Extended enemy properties
ENEMY_IMMUNE is now deprecated. Spawning an enemy with ENEMY_IMMUNE hp
sets up the new flags field to match old behavior. The hp value itself
has (almost) no special meaning anymore.
2020-07-09 15:25:57 +03:00
Andrei Alexeyev
b3d3e76d6a
Fix player_add_lives and player_add_bombs
The bug never manifested because these functions are only called with 1
as the argument
2020-07-02 06:09:01 +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
54ca97587c
Rename cmplx32 into cmplxf for better consistency 2020-05-09 09:31:20 +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
a7eb246664
Purge some dead code 2020-04-28 00:13:15 +03:00
Andrei Alexeyev
9f10dfef21
bunch of portrait and dialog-related shuffling around 2020-04-27 22:59:16 +03:00
Alice D
56e64498a6
Player Statistics (#219) 2020-04-26 22:27:13 +03:00
Andrei Alexeyev
83d4197e86
Remove Player.lastmovedir
This is only relevant for YoumuA, so track it there
2020-04-23 00:35:06 +03:00
Andrei Alexeyev
d4fb6ab5bd
player: remove "focus" property and "focus_circle"
focus_circle is replaced with a custom PlayerIndicators entity
(responsible for drawing the focus hitbox/cross and powersurge bar)
2020-04-23 00:17:40 +03:00
Andrei Alexeyev
42956c2ace
Remove Player.slaves 2020-04-22 22:37:04 +03:00
Andrei Alexeyev
e16e2184a3
Refactor entity system (#214)
* Smarter generic entity macros

The list of "core" entities is now defined in one macro, and hardcoded
_Generic dispatch tables are eliminated

* Get rid of "custom" entities

All entities are now "first-class". The list of known entity types has
been moved to known_entities.h. The system no longer needs to know the
definition of all entity structs.

* Refactor guts of ENT_BOX/ENT_UNBOX

Made the functions inline, Box::ent is now a proper pointer type (but
please don't use it directly), ENT_UNBOX returns NULL if the box is
"empty" (references NULL entity)

* Merge TASK_BIND_UNBOXED with TASK_BIND

* s/YoumuMyon/YoumuAMyon for consistency
2020-04-17 10:18:53 +03:00
Andrei Alexeyev
45a4283225
use custom ents for Reimu; cleanup Marisa; etc. 2020-04-06 04:34:55 +03:00
Andrei Alexeyev
431237f0f2
Coroutinize MarisaA (#206) 2020-04-01 23:08:40 +03:00
Andrei Alexeyev
b6a6496c39
Coroutinize ReimuB (#205) 2020-03-25 08:52:18 +02:00
Andrei Alexeyev
01e7ea8a33
Coroutinize ReimuA (#199) 2020-03-13 22:54:07 +02:00
Andrei Alexeyev
a9604b1109
some sprite batching optimizations 2020-03-05 21:14:31 +02:00
Andrei Alexeyev
fb19028ed5
New dialogue system powered by coroutines 2020-03-04 22:26:50 +02:00
Andrei Alexeyev
77a65432d6
fix remaining deprecations (except in legacy stages) 2020-03-04 22:26:48 +02:00
Andrei Alexeyev
9fd9dfcf94
fix some trivial deprecations 2020-03-04 22:26:48 +02:00
Andrei Alexeyev
2647c25c4a
fix and tweak player death effect 2020-03-04 22:26:47 +02:00
Andrei Alexeyev
17f6f159c1
replace remaining GrowFade usage in non-stage code 2020-03-04 22:26:47 +02:00
Andrei Alexeyev
c73b05bdd1
Make animation_get_frame never return transient sprites
Animations now store flipped copies of frames as needed.
2020-03-04 22:26:47 +02:00