twn_util.h: separate internal things away, remove indirect includes in places

This commit is contained in:
2024-10-12 21:16:25 +03:00
parent e70366f82f
commit 1a7322dccf
14 changed files with 45 additions and 44 deletions

View File

@ -3,6 +3,23 @@
#include "twn_types.h"
#include <SDL2/SDL.h>
#include <stdbool.h>
#define MAX SDL_max
#define MIN SDL_min
void cry_impl(const char *file, const int line, const char *title, const char *text);
#define CRY(title, text) cry_impl(__FILE__, __LINE__, title, text)
#define CRY_SDL(title) cry_impl(__FILE__, __LINE__, title, SDL_GetError())
#define CRY_PHYSFS(title) \
cry_impl(__FILE__, __LINE__, title, PHYSFS_getErrorByCode(PHYSFS_getLastErrorCode()))
/* for when there's absolutely no way to continue */
_Noreturn void die_abruptly(void);
/* note: you must free the returned string */
char *expand_asterisk(const char *mask, const char *to);
@ -22,7 +39,7 @@ static inline float fast_sqrt(float x)
static inline Vec2 fast_cossine(float a) {
const float s = sinf(a);
const float s = SDL_sinf(a);
return (Vec2){
.x = fast_sqrt(1.0f - s * s) * (a >= (float)M_PI_2 && a < (float)(M_PI + M_PI_2) ? -1 : 1),
.y = s