Commit graph

18 commits

Author SHA1 Message Date
laochailan
0b8f9e7a14
fix a typo in a disappointed comment 2017-11-19 11:17:33 +01:00
laochailan
847f18d0ed
workaround for SDL_Mixer 2.0.2
[angry complaints about upstream]
2017-11-19 11:13:42 +01:00
Andrei Alexeyev
8eb17210a4
add menu and stage5boss bgms; revamp bgms (details below)
- Re-normalize all BGMs to the same volume
    - Merge intro/loop parts into a single file
    - For BGMs with intros, specify the loop point in the .bgm file

closes #99
2017-11-18 03:45:26 +02:00
Andrei Alexeyev
3fb9edf0fa
audio(SDL_mixer): we only care about ogg 2017-11-17 01:41:01 +02:00
laochailan
5958c193cc
add missing error message 2017-11-05 19:36:37 +01:00
Andrei Alexeyev
d8389ea550
audio: play_sound* api change
replaced play_sound_cooldown with play_sound_ex. it now has a new
parameter: bool replace. if true, the sound will interrupt the previous
instance of itself being played, if any. if used many times in
succession, this effectively allows one to "restart" a sound instead of
letting many instances overlap. this sounds better in some instances,
and avoids flooding the channels.

this is also implicitly true for play_ui_sound now.
2017-10-29 03:30:05 +03:00
Andrei Alexeyev
ffe954f006
WIP stage 3 revamp 2017-10-16 00:07:09 +03:00
Andrei Alexeyev
ff26d13496
fade bgm on stage transition 2017-10-08 09:01:52 +03:00
Andrei Alexeyev
4972f590aa
improve sfx management
pause/restore all game sounds when entering/leaving an ingame menu
stop all game sounds when the stage loop is over
2017-10-08 08:15:43 +03:00
Andrei Alexeyev
05954b2764
mixer: support looping bgms with a separate intro 2017-10-02 03:37:29 +03:00
laochailan
683e0b3274
looping sounds and stage1 shot soundification 2017-09-30 19:33:07 +02: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
Andrei "Akari" Alexeyev
5ad246b791 Added more information to the init log
mainly versions of used libraries
2017-03-20 08:08:09 +02:00
Andrei "Akari" Alexeyev
45da155cb2 Implemented a simple and consistent logging subsystem
The goal of this change is mainly to clean up Taisei's codebase and
improve its console output. I've been frustrated by files littered with
inconsistent printf/fprintf/warnx/errx calls for a long time, and now I
actually did something about it.

All the above functions are now considered deprecated and result in a
compile-time warning when used. Instead, the following macros should be
used:

    log_debug(format, ...)
    log_info(format, ...)
    log_warn(format, ...)
    log_err(format, ...)

As you can see, all of them have the same printf-like interface. But
they have different functionality and purpose:

    log_debug is intended for very verbose and specific information. It
    does nothing in release builds, much like assert(), so don't use
    expressions with side-effects in its arguments.

    log_info is for various status updates that are expected during
    normal operation of the program.

    log_warn is for non-critical failures or other things that may be
    worth investigating, but don't inherently render the program
    non-functional.

    log_err is for when the only choice is to give up. Like errx, it
    also terminates the program. Unlike errx, it actually calls abort(),
    which means the cleanup functions are not ran -- but on the other
    hand, you get a debuggable backtrace. However, if you're trying to
    catch programming errors, consider using assert() instead.

All of them produce output that contains a timestamp, the log level
identifier, the calling function's name, and the formatted message.

The newline at the end of the format string is not required -- no, it is
actually *prohibited*. The logging system will take care of the line
breaks by itself, don't litter the code with that shit.

Internally, the logging system is based on the SDL_RWops abstraction,
and may have multiple, configurable destinations. This makes it easily
extensible. Currently, log_debug and log_info are set to write to
stdout, log_warn and log_err to stderr, and all of them also to the file
log.txt in the Taisei config directory.

Consequently, the nasty freopen hacks we used to make Taisei write to
log files on Windows are no longer needed -- which is a very good thing,
considering they probably would break if the configdir path contains
UTF-8 characters. SDL_RWFromFile does not suffer this limitation.

As an added bonus, it's also thread-safe.

Note about printf and fprintf: in very few cases, the logging system is
not a good substitute for these functions. That is, when you care about
writing exactly to stdout/stderr and about exactly how the output looks.

However, I insist on keeping the deprecation warnings on them to not
tempt anyone to use them for logging/debugging out of habit and/or
laziness.

For this reason, I've added a tsfprintf function to util.c. It is
functionally identical to fprintf, except it returns void. Yes, the name
is deliberately ugly. Avoid using it if possible, but if you must, only
use it to write to stdout or stderr. Do not write to actual files with
it, use SDL_RWops.
2017-03-13 07:45:01 +02:00
Andrei "Akari" Alexeyev
4b4cb5e233 fixed the bgm path function 2017-03-07 03:23:16 +02:00
Andrei "Akari" Alexeyev
ffd623f1a5 Fixed loading resources by name
Also added a basic path function for animations
Added a TAISEI_NOSCAN environment variable, set to 1 to disable
autoloading resources on startup. They will then be loaded as they are
needed, which may cause the game to stutter when that happens.
2017-03-07 03:13:06 +02:00
Andrei "Akari" Alexeyev
ca16c30966 large refactoring WIP
windows & osx untested
bgm untested
too many changes to comment on
2017-03-05 00:39:17 +02:00