Commit graph

1109 commits

Author SHA1 Message Date
Andrei "Akari" Alexeyev
748043c8ca Added the life/bomb fragment items 2017-03-24 21:42:56 +02:00
laochailan
f3b89768e0 simplified indicator shader 2017-03-21 18:16:09 +01:00
laochailan
271461cfd5 make the back color stars go better with the hud 2017-03-21 17:57:19 +01:00
laochailan
3fed0adb2f new item graphics 2017-03-21 17:08:08 +01:00
Andrei "Akari" Alexeyev
263c112e8a Basic support for life/bomb fragments. Not yet used by the game. 2017-03-21 12:10:38 +02:00
Andrei "Akari" Alexeyev
cba35bc687 hud: draw the status text above boss indicator
this is only relevant when watching replays
2017-03-21 04:34:17 +02:00
Andrei "Akari" Alexeyev
d8ac035f29 Record fps stats in replays. Display the player's name and fps when watching 2017-03-21 04:28:35 +02:00
Andrei "Akari" Alexeyev
574ffefa0f fixed a potential segfault 2017-03-20 08:41:04 +02: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
5d1eb2bd68 moved the MKDIR macro to util.h 2017-03-20 07:35:59 +02:00
Andrei "Akari" Alexeyev
ceb5f6b16b Added "Hi-Score" support 2017-03-20 07:29:22 +02:00
Andrei "Akari" Alexeyev
67128fad8f Consistent drawing order of items based on significance
So e.g. a Life will never be obscured behind a Point
2017-03-19 05:09:41 +02:00
Andrei "Akari" Alexeyev
2f5629befa clear bullets and play a sound upon reaching full power 2017-03-19 04:56:55 +02:00
Andrei "Akari" Alexeyev
927a5d68a0 tweaked the ingame menu appearance 2017-03-19 04:32:14 +02:00
Andrei "Akari" Alexeyev
807df43681 Slightly eased the deathbombing window
Also prevented the dying player from being drawn, it seems to look
better.
2017-03-19 04:14:28 +02:00
Andrei "Akari" Alexeyev
37f2506db7 Some changes to bomb mechanics:
* Always reset the number of bombs to initial value on death,
      any additional bombs are lost.
    * Deathbombing now costs 2 bombs (or 1 if the player has only 1)
2017-03-19 04:05:06 +02:00
Andrei "Akari" Alexeyev
6d730f6061 Fixed bomb projectile cancellation
Only cancel enemy projectiles (previously, player projectiles would be
cancelled too, and give you points).
Fire only the basic player projectiles during bombs.
2017-03-19 03:32:11 +02:00
Andrei "Akari" Alexeyev
cd921d0bf5 clamp deadzone to sane values 2017-03-18 06:51:56 +02:00
Andrei "Akari" Alexeyev
8258f6f17e better gamepad deadzone handling 2017-03-18 06:44:42 +02:00
Andrei "Akari" Alexeyev
52286cac7f Rewrote the key=value parser into something more sensible
Also updated the readme
2017-03-16 08:35:31 +02:00
Andrei "Akari" Alexeyev
455039edb4 Implemented a custom assert() that uses the log system if possible
Bonus: no need to include assert.h
2017-03-15 11:21:39 +02:00
Andrei "Akari" Alexeyev
6530a39bd2 log: support for dumping backtraces in debug builds
Enabled only if the environment has the execinfo.h interface.
By default dumps the backtrace only on log_fatal, use.
TAISEI_LOGLVLS_BACKTRACE to customize that behaviour, e.g.:

    TAISEI_LOGLVLS_BACKTRACE=+w taisei

to also enable it for warnings.
2017-03-15 10:42:00 +02:00
Andrei "Akari" Alexeyev
15c2472336 Removed the -s option for release builds, TIL install/strip exists 2017-03-14 02:45:24 +02:00
Andrei "Akari" Alexeyev
6d9078bda2 fixed incorrect resource name 2017-03-13 23:59:49 +02:00
Andrei "Akari" Alexeyev
48f9409b6d fix \n in log_warn call 2017-03-13 23:50:34 +02:00
Andrei "Akari" Alexeyev
27eae32438 free transient resources after credits 2017-03-13 22:16:22 +02:00
Andrei "Akari" Alexeyev
be259e1a09 fix uninitialized values in boss Attacks 2017-03-13 22:12:17 +02:00
Andrei Alexeyev
a6b73d6e27 Merge pull request #74 from laochailan/log
Logging subsystem
2017-03-13 21:13:43 +02:00
Andrei "Akari" Alexeyev
3b83228d50 fixed an assert 2017-03-13 19:16:54 +02:00
Andrei "Akari" Alexeyev
3a957cb3f2 More control over logging output via env variables and macros
In release builds, everything is logged to the log file by default, and
only warnings and errors go to the console (stderr). In debug builds,
all output goes both to the console (stdout/stderr) and the log file.

You can override this behaviour with environment variables. Some
examples:

    Don't log anything to the console at all:
        TAISEI_LOGLVLS_CONSOLE=-a

    Suppress info and debug output in the log file:
        TAISEI_LOGLVLS_FILE=-di

    More verbose console output in release builds:
        TAISEI_LOGLVLS_CONSOLE=+i

    Override defaults and enable all enable the wanted loglevels explicitly:
        TAISEI_LOGLVLS_CONSOLE=-a+diwe

    Redirect debug output to stderr:
        TAISEI_LOGLVLS_STDOUT=-d
        TAISEI_LOGLVLS_STDERR=+d
2017-03-13 18:57:44 +02:00
Andrei "Akari" Alexeyev
b0c959f1c7 log: use timestamps in ms relative to program startup 2017-03-13 18:17:05 +02:00
Andrei "Akari" Alexeyev
3d5344de3b Renamed log_err to log_fatal 2017-03-13 18:03:51 +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
1ac4ff95c4 use SDL_RWops to write the config 2017-03-12 23:40:19 +02:00
Andrei "Akari" Alexeyev
9b0cbe3da1 Fixed improper usage of png_set_read_fn and png_set_write_fn 2017-03-12 23:25:19 +02:00
Andrei "Akari" Alexeyev
d39ab84742 use SDL_RWops to read obj models 2017-03-12 23:23:19 +02:00
Andrei "Akari" Alexeyev
4b132656a5 use SDL_RWops to read png textures 2017-03-12 23:07:21 +02:00
Andrei "Akari" Alexeyev
a787f88cff use SDL_RWops for read_all() 2017-03-12 22:58:19 +02:00
Andrei "Akari" Alexeyev
dafec80119 use SDL_RWops for screenshots 2017-03-12 22:54:34 +02:00
Andrei "Akari" Alexeyev
ecd4fc32ad Deprecate the use of fopen for unicode reasons
Also removed the strncat/strncpy macros and marked them deprecated with
attributes instead.
2017-03-12 22:26:10 +02:00
Andrei "Akari" Alexeyev
4a52d13aea force C locale 2017-03-12 22:17:05 +02:00
Andrei Alexeyev
d37dc20b92 Merge pull request #73 from laochailan/resources
Further enhancements to resources subsystem
2017-03-12 22:09:38 +02:00
laochailan
a14437c78a make texture loader handle paletted, grayscale and rgb 2017-03-12 11:07:34 +01:00
Andrei "Akari" Alexeyev
d3444a5094 properly handle failures to load animations 2017-03-12 01:05:04 +02:00
Andrei "Akari" Alexeyev
47e777b275 parse_keyvalue_stream_cb: hack to make it work with \retarded line-endings 2017-03-12 00:51:24 +02:00
Andrei "Akari" Alexeyev
38e13b9855 Use the key=value format for bgm.conf too 2017-03-11 23:57:03 +02:00
Andrei "Akari" Alexeyev
b78eadc202 remove dirent includes 2017-03-11 23:48:42 +02:00
Andrei "Akari" Alexeyev
7c67159c90 hashtable size parameter for the non-cb parse_keyvalue* functions 2017-03-11 23:47:42 +02:00
Andrei "Akari" Alexeyev
85e7b46026 Use external key=value *.ani files to describe animation parameters 2017-03-11 23:39:38 +02:00
Andrei "Akari" Alexeyev
cceb1aa20d Converted the config parser into reusable utility functions 2017-03-11 23:10:05 +02:00