[RELEASE] u22-v03
This version is submitted to U22 breau.
This commit is contained in:
40
core/loresource/CMakeLists.txt
Normal file
40
core/loresource/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
add_library(loresource
|
||||
font.c
|
||||
language.c
|
||||
music.c
|
||||
set.c
|
||||
sound.c
|
||||
text.c
|
||||
)
|
||||
target_any_sources(loresource
|
||||
font/sans.woff
|
||||
font/serif.woff
|
||||
|
||||
music/biome_boss.mp3
|
||||
music/biome_cavias_camp.mp3
|
||||
music/biome_laboratory.mp3
|
||||
music/biome_metaphysical_gate.mp3
|
||||
music/boss_big_warder.mp3
|
||||
music/boss_greedy_scientist.mp3
|
||||
music/boss_theists_child.mp3
|
||||
music/title.mp3
|
||||
|
||||
sound/bomb.mp3
|
||||
sound/enemy_shoot.mp3
|
||||
sound/enemy_trigger.mp3
|
||||
sound/damage.mp3
|
||||
sound/dodge.mp3
|
||||
sound/dying.mp3
|
||||
sound/guard.mp3
|
||||
sound/player_shoot.mp3
|
||||
sound/player_trigger.mp3
|
||||
sound/reflection.mp3
|
||||
sound/touch_gate.mp3
|
||||
)
|
||||
target_link_libraries(loresource
|
||||
dictres
|
||||
glyphas
|
||||
jukebox
|
||||
math
|
||||
memory
|
||||
)
|
41
core/loresource/font.c
Normal file
41
core/loresource/font.c
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "./font.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "util/glyphas/context.h"
|
||||
#include "util/glyphas/face.h"
|
||||
|
||||
/* resources */
|
||||
#include "anysrc/font/sans.woff.h"
|
||||
#include "anysrc/font/serif.woff.h"
|
||||
|
||||
void loresource_font_initialize(loresource_font_t* font) {
|
||||
assert(font != NULL);
|
||||
|
||||
*font = (typeof(*font)) {0};
|
||||
|
||||
glyphas_context_initialize(&font->glyphas);
|
||||
|
||||
# define load_face_(name) \
|
||||
glyphas_face_initialize_from_buffer( \
|
||||
&font->name, \
|
||||
&font->glyphas, \
|
||||
loresource_font_##name##_woff_, \
|
||||
sizeof(loresource_font_##name##_woff_), \
|
||||
0)
|
||||
|
||||
load_face_(sans);
|
||||
load_face_(serif);
|
||||
|
||||
# undef load_face_
|
||||
}
|
||||
|
||||
void loresource_font_deinitialize(loresource_font_t* font) {
|
||||
assert(font != NULL);
|
||||
|
||||
glyphas_face_deinitialize(&font->sans);
|
||||
glyphas_face_deinitialize(&font->serif);
|
||||
|
||||
glyphas_context_deinitialize(&font->glyphas);
|
||||
}
|
21
core/loresource/font.h
Normal file
21
core/loresource/font.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/glyphas/context.h"
|
||||
#include "util/glyphas/face.h"
|
||||
|
||||
typedef struct {
|
||||
glyphas_context_t glyphas;
|
||||
|
||||
glyphas_face_t sans;
|
||||
glyphas_face_t serif;
|
||||
} loresource_font_t;
|
||||
|
||||
void
|
||||
loresource_font_initialize(
|
||||
loresource_font_t* font
|
||||
);
|
||||
|
||||
void
|
||||
loresource_font_deinitialize(
|
||||
loresource_font_t* font
|
||||
);
|
93
core/loresource/font/LICENSE-SIL.txt
Normal file
93
core/loresource/font/LICENSE-SIL.txt
Normal file
@@ -0,0 +1,93 @@
|
||||
Copyright (c) 2011, Cyreal (www.cyreal.org),
|
||||
with Reserved Font Name "Junge".
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
13
core/loresource/font/README.md
Normal file
13
core/loresource/font/README.md
Normal file
@@ -0,0 +1,13 @@
|
||||
font files
|
||||
====
|
||||
|
||||
All fonts are under **SIL OPEN FONT LICENSE**.
|
||||
Please see LICENSE.txt in the same directory.
|
||||
|
||||
## sans.woff
|
||||
|
||||
[Noto Sans CJK Jp Regular (minimized version)](https://github.com/hirofumii/Noto-Sans-CJK-JP.min)
|
||||
|
||||
## serif.woff
|
||||
|
||||
[Noto Serif CJK Jp Regular (minimized version)](https://github.com/hirofumii/Noto-Serif-CJK-JP.min)
|
BIN
core/loresource/font/sans.woff
Executable file
BIN
core/loresource/font/sans.woff
Executable file
Binary file not shown.
BIN
core/loresource/font/serif.woff
Executable file
BIN
core/loresource/font/serif.woff
Executable file
Binary file not shown.
40
core/loresource/language.c
Normal file
40
core/loresource/language.c
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "./language.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LORESOURCE_LANGUAGE_EACH_(PROC) do { \
|
||||
PROC(JP, jp); \
|
||||
} while (0)
|
||||
|
||||
const char* loresource_language_stringify(loresource_language_t lang) {
|
||||
# define each_(NAME, name) \
|
||||
if (lang == LORESOURCE_LANGUAGE_##NAME) return #name;
|
||||
|
||||
LORESOURCE_LANGUAGE_EACH_(each_);
|
||||
|
||||
assert(false);
|
||||
return NULL;
|
||||
|
||||
# undef each_
|
||||
}
|
||||
|
||||
bool loresource_language_unstringify(
|
||||
loresource_language_t* lang, const char* str, size_t len) {
|
||||
assert(lang != NULL);
|
||||
assert(str != NULL || len == 0);
|
||||
|
||||
# define each_(NAME, name) do { \
|
||||
if (strncmp(str, #name, len) == 0 && #name[len] == 0) { \
|
||||
*lang = LORESOURCE_LANGUAGE_##NAME; \
|
||||
return true; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_LANGUAGE_EACH_(each_);
|
||||
return false;
|
||||
|
||||
# undef each_
|
||||
}
|
20
core/loresource/language.h
Normal file
20
core/loresource/language.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef enum {
|
||||
LORESOURCE_LANGUAGE_JP,
|
||||
} loresource_language_t;
|
||||
|
||||
const char*
|
||||
loresource_language_stringify(
|
||||
loresource_language_t lang
|
||||
);
|
||||
|
||||
bool
|
||||
loresource_language_unstringify(
|
||||
loresource_language_t* lang,
|
||||
const char* str,
|
||||
size_t len
|
||||
);
|
101
core/loresource/music.c
Normal file
101
core/loresource/music.c
Normal file
@@ -0,0 +1,101 @@
|
||||
#include "./music.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util/jukebox/amp.h"
|
||||
#include "util/jukebox/composite.h"
|
||||
#include "util/jukebox/decoder.h"
|
||||
#include "util/jukebox/format.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
#include "util/math/rational.h"
|
||||
|
||||
/* resources */
|
||||
#include "anysrc/music/biome_boss.mp3.h"
|
||||
#include "anysrc/music/biome_cavias_camp.mp3.h"
|
||||
#include "anysrc/music/biome_laboratory.mp3.h"
|
||||
#include "anysrc/music/biome_metaphysical_gate.mp3.h"
|
||||
#include "anysrc/music/boss_big_warder.mp3.h"
|
||||
#include "anysrc/music/boss_greedy_scientist.mp3.h"
|
||||
#include "anysrc/music/boss_theists_child.mp3.h"
|
||||
#include "anysrc/music/boss_theists_child.mp3.h"
|
||||
#include "anysrc/music/title.mp3.h"
|
||||
|
||||
#define LORESOURCE_MUSIC_EACH_(PROC) do { \
|
||||
PROC(biome_boss); \
|
||||
PROC(biome_cavias_camp); \
|
||||
PROC(biome_laboratory); \
|
||||
PROC(biome_metaphysical_gate); \
|
||||
PROC(boss_big_warder); \
|
||||
PROC(boss_greedy_scientist); \
|
||||
PROC(boss_theists_child); \
|
||||
PROC(title); \
|
||||
} while (0)
|
||||
|
||||
static void loresource_music_player_initialize_(
|
||||
loresource_music_player_t* p,
|
||||
const jukebox_format_t* format,
|
||||
const void* buf,
|
||||
size_t len) {
|
||||
assert(p != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
assert(buf != NULL || len == 0);
|
||||
|
||||
*p = (typeof(*p)) {
|
||||
.decoder = jukebox_decoder_new_from_memory_mp3(format, buf, len),
|
||||
.compo = jukebox_composite_new(format, 2),
|
||||
};
|
||||
jukebox_amp_initialize(&p->amp, format);
|
||||
|
||||
jukebox_composite_add_effect(p->compo, (jukebox_effect_t*) p->decoder);
|
||||
jukebox_composite_add_effect(p->compo, (jukebox_effect_t*) &p->amp);
|
||||
jukebox_composite_play(p->compo);
|
||||
}
|
||||
|
||||
static void loresource_music_player_deinitialize_(
|
||||
loresource_music_player_t* p) {
|
||||
assert(p != NULL);
|
||||
|
||||
jukebox_composite_delete(p->compo);
|
||||
jukebox_amp_deinitialize(&p->amp);
|
||||
jukebox_decoder_delete(p->decoder);
|
||||
}
|
||||
|
||||
void loresource_music_initialize(
|
||||
loresource_music_t* music,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format) {
|
||||
assert(music != NULL);
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
*music = (typeof(*music)) {0};
|
||||
|
||||
# define each_(n) do { \
|
||||
loresource_music_player_initialize_( \
|
||||
&music->n, \
|
||||
format, \
|
||||
loresource_music_##n##_mp3_, \
|
||||
sizeof(loresource_music_##n##_mp3_)); \
|
||||
jukebox_mixer_add_effect(mixer, (jukebox_effect_t*) music->n.compo); \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_MUSIC_EACH_(each_);
|
||||
|
||||
# undef each_
|
||||
}
|
||||
|
||||
void loresource_music_deinitialize(loresource_music_t* music) {
|
||||
assert(music != NULL);
|
||||
|
||||
# define each_(n) do { \
|
||||
loresource_music_player_deinitialize_(&music->n); \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_MUSIC_EACH_(each_);
|
||||
|
||||
# undef each_
|
||||
}
|
38
core/loresource/music.h
Normal file
38
core/loresource/music.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/jukebox/amp.h"
|
||||
#include "util/jukebox/composite.h"
|
||||
#include "util/jukebox/decoder.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
#include "util/math/rational.h"
|
||||
|
||||
typedef struct {
|
||||
jukebox_decoder_t* decoder;
|
||||
jukebox_amp_t amp;
|
||||
jukebox_composite_t* compo;
|
||||
} loresource_music_player_t;
|
||||
|
||||
struct loresource_music_t;
|
||||
typedef struct {
|
||||
loresource_music_player_t
|
||||
biome_boss,
|
||||
biome_cavias_camp,
|
||||
biome_metaphysical_gate,
|
||||
biome_laboratory,
|
||||
boss_big_warder,
|
||||
boss_greedy_scientist,
|
||||
boss_theists_child,
|
||||
title;
|
||||
} loresource_music_t;
|
||||
|
||||
void
|
||||
loresource_music_initialize(
|
||||
loresource_music_t* music,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format
|
||||
);
|
||||
|
||||
void
|
||||
loresource_music_deinitialize(
|
||||
loresource_music_t* music
|
||||
);
|
30
core/loresource/music/README.md
Normal file
30
core/loresource/music/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
music
|
||||
====
|
||||
|
||||
## biome_cavias_camp.mp3
|
||||
|
||||
[UNDERGROUND SOUNDS - 99 sounds](https://99sounds.org/underground-sounds/)
|
||||
|
||||
## biome_laboratory.mp3
|
||||
|
||||
[UNDERGROUND SOUNDS - 99 sounds](https://99sounds.org/underground-sounds/)
|
||||
|
||||
## biome_metaphysical_gate.mp3
|
||||
|
||||
original
|
||||
|
||||
## boss_big_warder.mp3
|
||||
|
||||
[loop](https://audius.co/catfoot/loop-86327)
|
||||
|
||||
## boss_greedy_scientist.mp3
|
||||
|
||||
[stay-frozen - Kasane Teto](https://audius.co/catfoot/stay-frozen-kasane-teto-88761) (remixed for LEFTONE)
|
||||
|
||||
## boss_theists_child.mp3
|
||||
|
||||
[revolution - Kasane Teto](https://audius.co/catfoot/revolution-kasane-teto-88758)
|
||||
|
||||
## title.mp3
|
||||
|
||||
[remnant](https://audius.co/catfoot/remnant-84992)
|
BIN
core/loresource/music/biome_boss.mp3
Normal file
BIN
core/loresource/music/biome_boss.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/biome_cavias_camp.mp3
Normal file
BIN
core/loresource/music/biome_cavias_camp.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/biome_laboratory.mp3
Normal file
BIN
core/loresource/music/biome_laboratory.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/biome_metaphysical_gate.mp3
Normal file
BIN
core/loresource/music/biome_metaphysical_gate.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/boss_big_warder.mp3
Normal file
BIN
core/loresource/music/boss_big_warder.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/boss_greedy_scientist.mp3
Normal file
BIN
core/loresource/music/boss_greedy_scientist.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/boss_theists_child.mp3
Normal file
BIN
core/loresource/music/boss_theists_child.mp3
Normal file
Binary file not shown.
BIN
core/loresource/music/title.mp3
Normal file
BIN
core/loresource/music/title.mp3
Normal file
Binary file not shown.
46
core/loresource/set.c
Normal file
46
core/loresource/set.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "./set.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "util/jukebox/format.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
|
||||
#include "./font.h"
|
||||
#include "./language.h"
|
||||
#include "./music.h"
|
||||
#include "./sound.h"
|
||||
#include "./text.h"
|
||||
|
||||
void loresource_set_initialize(
|
||||
loresource_set_t* res,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format,
|
||||
loresource_language_t lang) {
|
||||
assert(res != NULL);
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
*res = (typeof(*res)) {
|
||||
.sound = loresource_sound_new(mixer, format),
|
||||
};
|
||||
loresource_music_initialize(&res->music, mixer, format);
|
||||
loresource_font_initialize(&res->font);
|
||||
loresource_set_change_language(res, lang);
|
||||
}
|
||||
|
||||
void loresource_set_deinitialize(loresource_set_t* res) {
|
||||
assert(res != NULL);
|
||||
|
||||
loresource_font_deinitialize(&res->font);
|
||||
loresource_sound_delete(res->sound);
|
||||
loresource_music_deinitialize(&res->music);
|
||||
}
|
||||
|
||||
void loresource_set_change_language(
|
||||
loresource_set_t* res, loresource_language_t lang) {
|
||||
assert(res != NULL);
|
||||
|
||||
res->lang = lang;
|
||||
loresource_text_optimize(res->lang);
|
||||
}
|
36
core/loresource/set.h
Normal file
36
core/loresource/set.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "util/jukebox/format.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
|
||||
#include "./font.h"
|
||||
#include "./language.h"
|
||||
#include "./music.h"
|
||||
#include "./sound.h"
|
||||
|
||||
typedef struct {
|
||||
loresource_sound_t* sound;
|
||||
loresource_music_t music;
|
||||
loresource_font_t font;
|
||||
|
||||
loresource_language_t lang;
|
||||
} loresource_set_t;
|
||||
|
||||
void
|
||||
loresource_set_initialize(
|
||||
loresource_set_t* res,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format,
|
||||
loresource_language_t lang
|
||||
);
|
||||
|
||||
void
|
||||
loresource_set_deinitialize(
|
||||
loresource_set_t* res
|
||||
);
|
||||
|
||||
void
|
||||
loresource_set_change_language(
|
||||
loresource_set_t* res,
|
||||
loresource_language_t lang
|
||||
);
|
263
core/loresource/sound.c
Normal file
263
core/loresource/sound.c
Normal file
@@ -0,0 +1,263 @@
|
||||
#include "./sound.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util/jukebox/amp.h"
|
||||
#include "util/jukebox/composite.h"
|
||||
#include "util/jukebox/delay.h"
|
||||
#include "util/jukebox/format.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
#include "util/jukebox/sound.h"
|
||||
#include "util/math/algorithm.h"
|
||||
#include "util/math/rational.h"
|
||||
#include "util/memory/memory.h"
|
||||
|
||||
/* resources */
|
||||
#include "anysrc/sound/bomb.mp3.h"
|
||||
#include "anysrc/sound/enemy_shoot.mp3.h"
|
||||
#include "anysrc/sound/enemy_trigger.mp3.h"
|
||||
#include "anysrc/sound/damage.mp3.h"
|
||||
#include "anysrc/sound/dodge.mp3.h"
|
||||
#include "anysrc/sound/dying.mp3.h"
|
||||
#include "anysrc/sound/guard.mp3.h"
|
||||
#include "anysrc/sound/player_shoot.mp3.h"
|
||||
#include "anysrc/sound/player_trigger.mp3.h"
|
||||
#include "anysrc/sound/reflection.mp3.h"
|
||||
#include "anysrc/sound/touch_gate.mp3.h"
|
||||
|
||||
#define LORESOURCE_SOUND_DECL_(PROC) \
|
||||
PROC(bomb); \
|
||||
PROC(enemy_shoot); \
|
||||
PROC(enemy_trigger); \
|
||||
PROC(damage); \
|
||||
PROC(dodge); \
|
||||
PROC(dying); \
|
||||
PROC(guard); \
|
||||
PROC(player_shoot); \
|
||||
PROC(player_trigger); \
|
||||
PROC(reflection); \
|
||||
PROC(touch_gate);
|
||||
|
||||
#define LORESOURCE_SOUND_EACH_(PROC) do { \
|
||||
LORESOURCE_SOUND_DECL_(PROC) \
|
||||
} while (0)
|
||||
|
||||
struct loresource_sound_t {
|
||||
struct {
|
||||
# define each_(n) \
|
||||
jukebox_sound_buffer_t* n
|
||||
|
||||
LORESOURCE_SOUND_DECL_(each_);
|
||||
|
||||
# undef each_
|
||||
} buffers;
|
||||
|
||||
struct {
|
||||
# define each_(n) \
|
||||
jukebox_sound_t* n
|
||||
|
||||
LORESOURCE_SOUND_DECL_(each_);
|
||||
|
||||
# undef each_
|
||||
} sounds;
|
||||
|
||||
struct {
|
||||
jukebox_delay_t* delay;
|
||||
jukebox_composite_t* compo;
|
||||
} combat;
|
||||
struct {
|
||||
jukebox_delay_t* delay;
|
||||
jukebox_composite_t* compo;
|
||||
} env;
|
||||
struct {
|
||||
jukebox_composite_t* compo;
|
||||
} direction;
|
||||
|
||||
struct {
|
||||
jukebox_amp_t amp;
|
||||
jukebox_composite_t* compo;
|
||||
} root;
|
||||
};
|
||||
|
||||
#define LORESOURCE_SOUND_MAX_CONCURRENT_PLAY 32
|
||||
|
||||
static void loresource_sound_initialize_combat_(
|
||||
loresource_sound_t* sound,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format) {
|
||||
assert(sound != NULL);
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
typeof(sound->sounds)* s = &sound->sounds;
|
||||
typeof(sound->combat)* c = &sound->combat;
|
||||
|
||||
c->delay = jukebox_delay_new(format, &rational(5, 100), .1f, .4f);
|
||||
|
||||
c->compo = jukebox_composite_new(format, 7);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->damage);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->dodge);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->guard);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->player_shoot);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->player_trigger);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) s->reflection);
|
||||
jukebox_composite_add_effect(c->compo, (jukebox_effect_t*) c->delay);
|
||||
|
||||
jukebox_composite_play(c->compo);
|
||||
}
|
||||
static void loresource_sound_deinitialize_combat_(loresource_sound_t* sound) {
|
||||
assert(sound != NULL);
|
||||
|
||||
typeof(sound->combat)* c = &sound->combat;
|
||||
|
||||
jukebox_composite_delete(c->compo);
|
||||
jukebox_delay_delete(c->delay);
|
||||
}
|
||||
|
||||
static void loresource_sound_initialize_env_(
|
||||
loresource_sound_t* sound,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format) {
|
||||
assert(sound != NULL);
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
typeof(sound->sounds)* s = &sound->sounds;
|
||||
typeof(sound->env)* e = &sound->env;
|
||||
|
||||
e->delay = jukebox_delay_new(format, &rational(1, 10), .3f, .4f);
|
||||
|
||||
e->compo = jukebox_composite_new(format, 5);
|
||||
jukebox_composite_add_effect(e->compo, (jukebox_effect_t*) s->bomb);
|
||||
jukebox_composite_add_effect(e->compo, (jukebox_effect_t*) s->enemy_shoot);
|
||||
jukebox_composite_add_effect(e->compo, (jukebox_effect_t*) s->enemy_trigger);
|
||||
jukebox_composite_add_effect(e->compo, (jukebox_effect_t*) s->touch_gate);
|
||||
jukebox_composite_add_effect(e->compo, (jukebox_effect_t*) e->delay);
|
||||
|
||||
jukebox_composite_play(e->compo);
|
||||
}
|
||||
static void loresource_sound_deinitialize_env_(loresource_sound_t* sound) {
|
||||
assert(sound != NULL);
|
||||
|
||||
typeof(sound->env)* e = &sound->env;
|
||||
|
||||
jukebox_composite_delete(e->compo);
|
||||
jukebox_delay_delete(e->delay);
|
||||
}
|
||||
|
||||
static void loresource_sound_initialize_direction_(
|
||||
loresource_sound_t* sound,
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format) {
|
||||
assert(sound != NULL);
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
typeof(sound->sounds)* s = &sound->sounds;
|
||||
typeof(sound->direction)* d = &sound->direction;
|
||||
|
||||
d->compo = jukebox_composite_new(format, 1);
|
||||
jukebox_composite_add_effect(d->compo, (jukebox_effect_t*) s->dying);
|
||||
|
||||
jukebox_composite_play(d->compo);
|
||||
}
|
||||
static void loresource_sound_deinitialize_direction_(loresource_sound_t* sound) {
|
||||
assert(sound != NULL);
|
||||
|
||||
typeof(sound->direction)* d = &sound->direction;
|
||||
|
||||
jukebox_composite_delete(d->compo);
|
||||
}
|
||||
|
||||
loresource_sound_t* loresource_sound_new(
|
||||
jukebox_mixer_t* mixer, const jukebox_format_t* format) {
|
||||
assert(mixer != NULL);
|
||||
assert(jukebox_format_valid(format));
|
||||
|
||||
loresource_sound_t* sound = memory_new(sizeof(*sound));
|
||||
*sound = (typeof(*sound)) {0};
|
||||
|
||||
# define each_(n) do { \
|
||||
sound->buffers.n = jukebox_sound_buffer_new_from_memory_mp3( \
|
||||
format, \
|
||||
loresource_sound_##n##_mp3_, \
|
||||
sizeof(loresource_sound_##n##_mp3_)); \
|
||||
sound->sounds.n = jukebox_sound_new( \
|
||||
sound->buffers.n, LORESOURCE_SOUND_MAX_CONCURRENT_PLAY); \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_SOUND_EACH_(each_);
|
||||
|
||||
# undef each_
|
||||
|
||||
sound->root.compo = jukebox_composite_new(format, 4);
|
||||
|
||||
loresource_sound_initialize_combat_(sound, mixer, format);
|
||||
jukebox_composite_add_effect(
|
||||
sound->root.compo, (jukebox_effect_t*) sound->combat.compo);
|
||||
|
||||
loresource_sound_initialize_env_(sound, mixer, format);
|
||||
jukebox_composite_add_effect(
|
||||
sound->root.compo, (jukebox_effect_t*) sound->env.compo);
|
||||
|
||||
loresource_sound_initialize_direction_(sound, mixer, format);
|
||||
jukebox_composite_add_effect(
|
||||
sound->root.compo, (jukebox_effect_t*) sound->direction.compo);
|
||||
|
||||
jukebox_amp_initialize(&sound->root.amp, format);
|
||||
jukebox_composite_add_effect(sound->root.compo, &sound->root.amp.super);
|
||||
|
||||
jukebox_amp_change_volume(&sound->root.amp, 1, &rational(1, 1));
|
||||
jukebox_composite_play(sound->root.compo);
|
||||
|
||||
jukebox_mixer_add_effect(mixer, (jukebox_effect_t*) sound->root.compo);
|
||||
return sound;
|
||||
}
|
||||
|
||||
void loresource_sound_delete(loresource_sound_t* sound) {
|
||||
if (sound == NULL) return;
|
||||
|
||||
jukebox_composite_delete(sound->root.compo);
|
||||
jukebox_amp_deinitialize(&sound->root.amp);
|
||||
|
||||
loresource_sound_deinitialize_combat_(sound);
|
||||
loresource_sound_deinitialize_env_(sound);
|
||||
loresource_sound_deinitialize_direction_(sound);
|
||||
|
||||
# define each_(n) do { \
|
||||
jukebox_sound_delete(sound->sounds.n); \
|
||||
jukebox_sound_buffer_delete(sound->buffers.n); \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_SOUND_EACH_(each_);
|
||||
|
||||
# undef each_
|
||||
|
||||
memory_delete(sound);
|
||||
}
|
||||
|
||||
void loresource_sound_play(loresource_sound_t* sound, const char* name) {
|
||||
assert(sound != NULL);
|
||||
|
||||
# define each_(n) do { \
|
||||
if (strcmp(name, #n) == 0) { \
|
||||
jukebox_sound_play(sound->sounds.n); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
LORESOURCE_SOUND_EACH_(each_);
|
||||
|
||||
# undef each_
|
||||
}
|
||||
|
||||
void loresource_sound_change_master_volume(
|
||||
loresource_sound_t* sound, float v, const rational_t* duration) {
|
||||
assert(sound != NULL);
|
||||
assert(MATH_FLOAT_VALID(v));
|
||||
assert(rational_valid(duration));
|
||||
|
||||
jukebox_amp_change_volume(&sound->root.amp, v, duration);
|
||||
}
|
34
core/loresource/sound.h
Normal file
34
core/loresource/sound.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "util/jukebox/format.h"
|
||||
#include "util/jukebox/mixer.h"
|
||||
#include "util/math/rational.h"
|
||||
|
||||
struct loresource_sound_t;
|
||||
typedef struct loresource_sound_t loresource_sound_t;
|
||||
|
||||
loresource_sound_t* /* OWNERSHIP */
|
||||
loresource_sound_new(
|
||||
jukebox_mixer_t* mixer,
|
||||
const jukebox_format_t* format
|
||||
);
|
||||
|
||||
void
|
||||
loresource_sound_delete(
|
||||
loresource_sound_t* sound /* OWNERSHIP */
|
||||
);
|
||||
|
||||
void
|
||||
loresource_sound_play(
|
||||
loresource_sound_t* sound,
|
||||
const char* name
|
||||
);
|
||||
|
||||
void
|
||||
loresource_sound_change_master_volume(
|
||||
loresource_sound_t* sound,
|
||||
float v,
|
||||
const rational_t* duration
|
||||
);
|
16
core/loresource/sound/README.md
Normal file
16
core/loresource/sound/README.md
Normal file
@@ -0,0 +1,16 @@
|
||||
sound
|
||||
====
|
||||
|
||||
Items whose source is not described are made by catfoot.
|
||||
|
||||
- [bomb.mp3](https://99sounds.org/free-sound-effects/) (edited)
|
||||
- [enemy_shoot.mp3](https://99sounds.org/mangling-audio/)
|
||||
- [enemy_trigger.mp3](https://99sounds.org/mangling-audio/)
|
||||
- [damage.mp3](https://99sounds.org/mangling-audio/)
|
||||
- [dodge.mp3](https://otologic.jp/free/se/throw01.html) (edited)
|
||||
- [dying.mp3](https://99sounds.org/free-sound-effects/) (edited)
|
||||
- guard.mp3
|
||||
- [player_shoot.mp3](https://99sounds.org/mangling-audio/)
|
||||
- [player_trigger.mp3](https://99sounds.org/mangling-audio/)
|
||||
- reflection.mp3
|
||||
- [touch_gate.mp3](https://99sounds.org/mangling-audio/)
|
BIN
core/loresource/sound/bomb.mp3
Normal file
BIN
core/loresource/sound/bomb.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/damage.mp3
Normal file
BIN
core/loresource/sound/damage.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/dodge.mp3
Normal file
BIN
core/loresource/sound/dodge.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/dying.mp3
Normal file
BIN
core/loresource/sound/dying.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/enemy_shoot.mp3
Normal file
BIN
core/loresource/sound/enemy_shoot.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/enemy_trigger.mp3
Normal file
BIN
core/loresource/sound/enemy_trigger.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/guard.mp3
Normal file
BIN
core/loresource/sound/guard.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/player_shoot.mp3
Normal file
BIN
core/loresource/sound/player_shoot.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/player_trigger.mp3
Normal file
BIN
core/loresource/sound/player_trigger.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/reflection.mp3
Normal file
BIN
core/loresource/sound/reflection.mp3
Normal file
Binary file not shown.
BIN
core/loresource/sound/touch_gate.mp3
Normal file
BIN
core/loresource/sound/touch_gate.mp3
Normal file
Binary file not shown.
32
core/loresource/text.c
Normal file
32
core/loresource/text.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#include "./text.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "util/dictres/dictres.h"
|
||||
|
||||
#include "./language.h"
|
||||
|
||||
/* text resource */
|
||||
#include "./text/jp.h"
|
||||
|
||||
#define LORESOURCE_TEXT_SWITCH_BY_LANG(lang, each) do { \
|
||||
switch (lang) { \
|
||||
case LORESOURCE_LANGUAGE_JP: each(loresource_text_jp_); break; \
|
||||
default: assert(false); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
void loresource_text_optimize(loresource_language_t lang) {
|
||||
# define each_(i) dictres_optimize(i)
|
||||
LORESOURCE_TEXT_SWITCH_BY_LANG(lang, each_);
|
||||
# undef each_
|
||||
}
|
||||
|
||||
const char* loresource_text_get(loresource_language_t lang, const char* key) {
|
||||
# define each_(i) return dictres_find(i, key)
|
||||
LORESOURCE_TEXT_SWITCH_BY_LANG(lang, each_);
|
||||
|
||||
assert(false);
|
||||
return NULL;
|
||||
# undef each_
|
||||
}
|
14
core/loresource/text.h
Normal file
14
core/loresource/text.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "./language.h"
|
||||
|
||||
void
|
||||
loresource_text_optimize(
|
||||
loresource_language_t lang
|
||||
);
|
||||
|
||||
const char*
|
||||
loresource_text_get(
|
||||
loresource_language_t lang,
|
||||
const char* key
|
||||
);
|
88
core/loresource/text/jp.h
Normal file
88
core/loresource/text/jp.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "util/dictres/dictres.h"
|
||||
|
||||
static dictres_item_t loresource_text_jp_[] = {
|
||||
{"app_name", u8"LEFTONE"},
|
||||
{"author", u8"catfoot"},
|
||||
|
||||
{"biome_metaphysical_gate", u8"不可視の大門"},
|
||||
{"biome_cavias_camp", u8"収容棟"},
|
||||
{"biome_laboratory", u8"研究棟"},
|
||||
{"biome_boss_theists_child", u8"信者の落胤"},
|
||||
{"biome_boss_big_warder", u8"巨頭の看守"},
|
||||
{"biome_boss_greedy_scientist", u8"貪欲な科学者"},
|
||||
|
||||
{"boss_big_warder_line0", u8"知能すら持たぬ家畜に踏み殺された仲間たちへの哀れみは"},
|
||||
{"boss_big_warder_line1", u8"いまや羨望へとその形を変えた"},
|
||||
|
||||
{"boss_greedy_scientist_line0", u8"その選択はお前自身のものか?"},
|
||||
{"boss_greedy_scientist_line1", u8"胸を張ってそうだと,私達の前で言えるのか?"},
|
||||
|
||||
{"boss_theists_child_line0", u8"全ては計画通りだった"},
|
||||
{"boss_theists_child_line1", u8"しかし空論は未だ宙に浮いたまま"},
|
||||
{"boss_theists_child_line2", u8"それが\"創造主\"の意志だというのか"},
|
||||
|
||||
{"effect_curse", u8"呪縛"},
|
||||
{"effect_amnesia", u8"忘却"},
|
||||
{"effect_lost", u8"喪失"},
|
||||
|
||||
{"stance_missionary_name", u8"宣教師"},
|
||||
{"stance_missionary_desc",
|
||||
u8" あなたは自らの使命を果たすために歩き続ける.\n\n"
|
||||
u8" - 攻撃を受けたとき,信仰をすべて失ったとき,あなたは狂気を徐々に失う.\n"
|
||||
u8" - 狂気をすべて失ったとき,最後に触れた不可視の大門に転送される."},
|
||||
{"stance_missionary_note",
|
||||
u8"「ああ,そうだ,君が見つけてきてくれよ."
|
||||
u8"終幕を望む科学者がきっとどこかにいるはずだ.」"},
|
||||
|
||||
{"stance_philosopher_name", u8"哲学者"},
|
||||
{"stance_philosopher_desc",
|
||||
u8" 鋭く冷たい慧眼は狂気を涵養し,創造主の思惑さえも明るみに引きずり出す.\n\n"
|
||||
u8" - 攻撃を受けた際の狂気の減少量が低下する."},
|
||||
{"stance_philosopher_note",
|
||||
u8"「あらゆる学問が発展したが世界の成り立ちだけが解明されず,誰も興味を持たない."
|
||||
u8"まるで洗脳されたように永遠を希求し,脳髄は脳髄自身を疑わず.」"},
|
||||
|
||||
{"stance_revolutioner_name", u8"革命者"},
|
||||
{"stance_revolutioner_desc",
|
||||
u8" あくまでも優秀な血脈より生まれた意志はあなたに唯一の能動的攻撃手段を授ける.\n\n"
|
||||
u8" - 攻撃を行うことで,僅かなダメージとノックバックを生む弾丸を発砲する."},
|
||||
{"stance_revolutioner_note",
|
||||
u8"「地階の同胞は今までこの境遇に一切の疑問を持たなかった程に愚かだ."
|
||||
u8"しかしそれ故に扇動も容易い.着火するのは少しの血だ.」"},
|
||||
|
||||
{"stance_unfinisher_name", u8"未完走者"},
|
||||
{"stance_unfinisher_desc",
|
||||
u8" 幾度締め上げようと再生する細胞は永遠への敬遠と共に能力をもたらす.\n\n"
|
||||
u8" - 信仰が50%以上残っている場合にあなたの狂気は徐々に回復する.\n"
|
||||
u8" - 信仰をすべて失ったとき,狂気の減少速度が増加する."},
|
||||
{"stance_unfinisher_note",
|
||||
u8"「忌々しい奴らに殺された仲間たちを,昔は気の毒だと思っていたよ."
|
||||
u8"今は妬みしか感じない.」"},
|
||||
|
||||
{"menu_exit", "EXIT"},
|
||||
|
||||
{"title_authors", u8"catfoot"},
|
||||
{"title_buttons", u8"ESC / CLK"},
|
||||
|
||||
{"tutorial_title_dead_by_combat", u8"近接戦闘"},
|
||||
{"tutorial_text_dead_by_combat",
|
||||
u8" 薄弱な意志には能動的攻撃の手段は限られる."
|
||||
u8"凶悪な敵意を跳ね返すことのみがあなたにできるせめてもの抵抗だ.\n\n"
|
||||
u8" - リング上のマーカーが赤色の部分に触れている間,防御をし続けることで相手を攻撃する.\n"
|
||||
u8" - 防御に失敗した場合,ダメージを受ける.\n"
|
||||
u8" - 背後から攻撃を受けた場合,防御が困難になる."},
|
||||
{"tutorial_title_dead_by_curse", u8"呪縛"},
|
||||
{"tutorial_text_dead_by_curse",
|
||||
u8" 世界とは裏腹に意志はより強い意志に惹かれ残留する.\n\n"
|
||||
u8" - あなたが呪縛に苦しめられている間,相手は狂気が尽きようと立ち続ける.\n"
|
||||
u8" - 呪縛の終了時に相手の狂気が残っている場合,あなたの狂気は消滅する."},
|
||||
{"tutorial_title_dead_by_lost", u8"喪失"},
|
||||
{"tutorial_text_dead_by_lost",
|
||||
u8" 悠久の時を信仰なくして立ち続けることはできない.\n\n"
|
||||
u8" - 信仰が全て失われたとき狂気が徐々に減少する."},
|
||||
};
|
||||
|
Reference in New Issue
Block a user