Skip to content

Commit

Permalink
src: the great #include massacre of 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaricchi committed May 17, 2024
1 parent be7905d commit 8b37d1c
Show file tree
Hide file tree
Showing 395 changed files with 1,025 additions and 1,067 deletions.
2 changes: 1 addition & 1 deletion src/aniplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*/

#include "aniplayer.h"

#include "list.h"
#include "global.h"
#include "stageobjects.h"

void aniplayer_create(AniPlayer *plr, Animation *ani, const char *startsequence) {
Expand Down
1 change: 0 additions & 1 deletion src/aniplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
// Similar examples occur throughout the code so if you want context, you can just look there.
//
#include "resource/animation.h"
#include "stageobjects.h"
#include "list.h"

typedef struct AniQueueEntry AniQueueEntry;
Expand Down
2 changes: 2 additions & 0 deletions src/arch_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

#include "arch_switch.h"
#include "renderer/glcommon/debug.h"
#include "util/env.h"
#include "util/io.h"

#include <unistd.h>
#include <switch/services/applet.h>
Expand Down
2 changes: 1 addition & 1 deletion src/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#include "taisei.h"

// WARNING: This file intentionally shadows the standard header!
#include "util/assert.h"
#include "util/assert.h" // IWYU pragma: export
7 changes: 5 additions & 2 deletions src/audio/audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
*/

#include "audio.h"

#include "backend.h"
#include "resource/resource.h"
#include "events.h"
#include "global.h"
#include "resource/bgm.h"
#include "resource/resource.h"
#include "resource/sfx.h"
#include "global.h"
#include "stage.h"
#include "util/kvparser.h"

#define LOOPTIMEOUTFRAMES 10
#define DEFAULT_SFX_VOLUME 100
Expand Down
3 changes: 2 additions & 1 deletion src/audio/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

#include "backend.h"
#include "util.h"

#include "util/env.h"

#undef A
#define A(x) extern AudioBackend _a_backend_##x;
Expand Down
3 changes: 2 additions & 1 deletion src/audio/null/audio_null.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

#include "../backend.h"
#include "util.h"

#include "util/env.h"

static bool audio_null_init(void) {
if(strcmp(env_get("TAISEI_AUDIO_BACKEND", ""), "null")) { // don't warn if we asked for this
Expand Down
2 changes: 1 addition & 1 deletion src/audio/sdl/audio_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
#include "../backend.h"
#include "../stream/mixer.h"

#include "util.h"
#include "rwops/rwops_autobuf.h"
#include "config.h"
#include "util/io.h"

#define AUDIO_FREQ 48000
#define AUDIO_FORMAT AUDIO_F32SYS
Expand Down
1 change: 1 addition & 0 deletions src/audio/stream/mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "mixer.h"

#include "util.h"
#include "../backend.h"

Expand Down
4 changes: 3 additions & 1 deletion src/audio/stream/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

#include "stream.h"
#include "stream_opus.h"
#include "util.h"

#include "log.h"
#include "util/miscmath.h"

#define PROCS(stream) (*NOT_NULL((stream)->procs))
#define PROC(stream, proc) (NOT_NULL(PROCS(stream).proc))
Expand Down
2 changes: 2 additions & 0 deletions src/audio/stream/stream_opus.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/

#include "stream_opus.h"

#include "log.h"
#include "util.h"

#include <opusfile.h>
Expand Down
1 change: 1 addition & 0 deletions src/audio/stream/stream_pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "stream_pcm.h"

#include "log.h"
#include "util.h"

static ssize_t astream_pcm_read(AudioStream *stream, size_t buffer_size, void *buffer) {
Expand Down
16 changes: 10 additions & 6 deletions src/boss.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,20 @@
*/

#include "boss.h"

#include "audio/audio.h"
#include "dynstage.h"
#include "entity.h"
#include "global.h"
#include "portrait.h"
#include "stage.h"
#include "stagetext.h"
#include "stagedraw.h"
#include "entity.h"
#include "util/glm.h"
#include "portrait.h"
#include "stages/stage5/stage5.h" // for unlockable bonus BGM
#include "stageobjects.h"
#include "dynstage.h"
#include "stages/stage5/stage5.h" // for unlockable bonus BGM
#include "stagetext.h"
#include "util/env.h"
#include "util/glm.h"
#include "util/graphics.h"

#define DAMAGE_PER_POWER_POINT 500.0f
#define DAMAGE_PER_POWER_ITEM (DAMAGE_PER_POWER_POINT * POWER_VALUE)
Expand Down
9 changes: 5 additions & 4 deletions src/boss.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
#pragma once
#include "taisei.h"

#include "util.h"
#include "difficulty.h"
#include "move.h"
#include "taisei.h"

#include "aniplayer.h"
#include "color.h"
#include "projectile.h"
#include "coroutine/taskdsl.h"
#include "difficulty.h"
#include "entity.h"
#include "coroutine.h"
#include "resource/resource.h"

#define BOSS_HURT_RADIUS 16
Expand Down
4 changes: 3 additions & 1 deletion src/camcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@

#include "camcontrol.h"

#include "events.h"
#include "global.h"
#include "stagetext.h"
#include "coroutine.h"
#include "util/glm.h"
#include "video.h"
#include "entity.h"
#include "coroutine/taskdsl.h"

#define CAMCTRL_MOVE_SPEED 0.1
// for scroll wheel move speed adjustment
Expand Down
15 changes: 9 additions & 6 deletions src/cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
*/

#include <getopt.h>

#include "cli.h"

#include "cutscenes/cutscene.h"
#include "cutscenes/scenes.h"
#include "difficulty.h"
#include "util.h"
#include "log.h"
#include "stage.h"
#include "plrmodes.h"
#include "stageinfo.h"
#include "util.h"
#include "util/env.h"
#include "util/io.h"
#include "version.h"
#include "cutscenes/cutscene.h"
#include "cutscenes/scenes.h"

#include <getopt.h>

struct TsOption { struct option opt; const char *help; const char *argname; };

Expand Down
3 changes: 2 additions & 1 deletion src/color.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

#include "color.h"
#include "util/stringops.h"

#define COLOR_OP(c1, op, c2) do { \
(c1)->r = (c1)->r op (c2)->r; \
Expand Down Expand Up @@ -184,7 +185,7 @@ bool color_equals(const Color *clr, const Color *clr2) {
);
}

char* color_str(const Color *clr) {
char *color_str(const Color *clr) {
return strfmt(
"RGBA(%f, %f, %f, %f) at %p",
clr->r,
Expand Down
26 changes: 13 additions & 13 deletions src/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#pragma once
#include "taisei.h"

#include "util.h"
#include "util/miscmath.h"

typedef union Color3 {
struct { float r, g, b; };
Expand Down Expand Up @@ -51,37 +51,37 @@ Color* color_hsla(Color *clr, float h, float s, float l, float a)
void color_get_hsl(const Color *c, float *out_h, float *out_s, float *out_l)
attr_nonnull(1);

Color* color_add(Color *clr, const Color *clr2)
Color *color_add(Color *clr, const Color *clr2)
attr_nonnull(1) attr_returns_nonnull;

Color* color_sub(Color *clr, const Color *clr2)
Color *color_sub(Color *clr, const Color *clr2)
attr_nonnull(1) attr_returns_nonnull;

Color* color_mul(Color *clr, const Color *clr2)
Color *color_mul(Color *clr, const Color *clr2)
attr_nonnull(1) attr_returns_nonnull;

Color* color_mul_alpha(Color *clr)
Color *color_mul_alpha(Color *clr)
attr_nonnull(1) attr_returns_nonnull;

Color* color_mul_scalar(Color *clr, float scalar)
Color *color_mul_scalar(Color *clr, float scalar)
attr_nonnull(1) attr_returns_nonnull;

Color* color_div(Color *clr, const Color *clr2)
Color *color_div(Color *clr, const Color *clr2)
attr_nonnull(1) attr_returns_nonnull;

Color* color_div_alpha(Color *clr)
Color *color_div_alpha(Color *clr)
attr_nonnull(1) attr_returns_nonnull;

Color* color_div_scalar(Color *clr, float scalar)
Color *color_div_scalar(Color *clr, float scalar)
attr_nonnull(1) attr_returns_nonnull;

Color* color_lerp(Color *clr, const Color *clr2, float a)
Color *color_lerp(Color *clr, const Color *clr2, float a)
attr_nonnull(1) attr_returns_nonnull;

Color* color_approach(Color *clr, const Color *clr2, float delta)
Color *color_approach(Color *clr, const Color *clr2, float delta)
attr_nonnull(1) attr_returns_nonnull;

Color* color_set_opacity(Color *clr, float opacity)
Color *color_set_opacity(Color *clr, float opacity)
attr_nonnull(1) attr_returns_nonnull;

/*
Expand All @@ -91,5 +91,5 @@ Color* color_set_opacity(Color *clr, float opacity)
bool color_equals(const Color *clr, const Color *clr2)
attr_nonnull(1, 2);

char* color_str(const Color *clr)
char *color_str(const Color *clr)
attr_nonnull(1) attr_returns_allocated;
4 changes: 3 additions & 1 deletion src/common_tasks.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
*/

#include "common_tasks.h"

#include "audio/audio.h"
#include "random.h"
#include "util/glm.h"
#include "stage.h"
#include "util/glm.h"

void common_drop_items(cmplx pos, const ItemCounts *items) {
for(int i = 0; i < ARRAY_SIZE(items->as_array); ++i) {
Expand Down
8 changes: 5 additions & 3 deletions src/common_tasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#pragma once
#include "taisei.h"

#include "coroutine.h"
#include "item.h"
#include "move.h"
// IWYU pragma: always_keep

#include "coroutine/taskdsl.h"
#include "entity.h"
#include "global.h"
#include "item.h"
#include "move.h"
#include "util/glm.h"

DECLARE_EXTERN_TASK(
Expand Down
10 changes: 7 additions & 3 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
*/

#include "config.h"
#include "global.h"
#include "version.h"
#include "util/strbuf.h"

#include "bitarray.h"
#include "gamepad.h"
#include "global.h" // IWYU pragma: keep
#include "util/kvparser.h"
#include "util/strbuf.h"
#include "version.h"
#include "vfs/public.h"

#define CONFIG_FILE "storage/config"

Expand Down
18 changes: 0 additions & 18 deletions src/coroutine.h

This file was deleted.

6 changes: 5 additions & 1 deletion src/coroutine/coevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
* Copyright (c) 2012-2024, Andrei Alexeyev <akari@taisei-project.org>.
*/

#include "internal.h"
#include "coroutine/coevent.h"
#include "coroutine/coevent_internal.h"
#include "coroutine/cotask_internal.h"

#include "util.h"

void coevent_init(CoEvent *evt) {
static uint32_t g_uid;
Expand Down
6 changes: 4 additions & 2 deletions src/coroutine/coevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@

#include "dynarray.h"

#include "cotask.h"

typedef enum CoEventStatus {
CO_EVENT_PENDING,
CO_EVENT_SIGNALED,
CO_EVENT_CANCELED,
} CoEventStatus;

typedef struct BoxedTask BoxedTask;

typedef struct CoEvent {
DYNAMIC_ARRAY(BoxedTask) subscribers;
uint32_t unique_id;
Expand All @@ -40,6 +40,8 @@ typedef COEVENTS_ARRAY(
finished
) CoTaskEvents;

#include "cotask.h"

void coevent_init(CoEvent *evt);
void coevent_signal(CoEvent *evt);
void coevent_signal_once(CoEvent *evt);
Expand Down
Loading

0 comments on commit 8b37d1c

Please sign in to comment.