diff --git a/doc/meson.build b/doc/meson.build
index 4c539867..75ed4a59 100644
--- a/doc/meson.build
+++ b/doc/meson.build
@@ -52,7 +52,7 @@ if get_option('docs')
foreach f : txt_docs
custom_target(f,
- command : [eolconv, host_eol_style, '@INPUT@', '@OUTPUT@'],
+ command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : f,
output : f,
install : true,
@@ -63,7 +63,7 @@ if get_option('docs')
foreach f : rst_docs
name = f.split('.')[0] + '.html'
custom_target(name,
- command : [eolconv, host_eol_style, '@INPUT@', '@OUTPUT@'],
+ command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : rst_to_html.process(f),
output : name,
install : true,
@@ -74,7 +74,7 @@ if get_option('docs')
if angle_enabled and host_machine.system() == 'windows'
custom_target(f,
- command : [eolconv, host_eol_style, '@INPUT@', '@OUTPUT@'],
+ command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'LICENSE.ANGLE',
output : 'LICENSE.txt',
install : true,
diff --git a/meson.build b/meson.build
index 34ce7825..1a5e6689 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('taisei', 'c',
license : 'MIT',
- version : 'v1.2',
+ version : 'v1.3-dev',
meson_version : '>=0.45.0',
default_options : [
'c_std=c11',
@@ -9,101 +9,56 @@ project('taisei', 'c',
'buildtype=release',
'strip=true',
'b_lto=true',
- 'b_ndebug=true',
+ 'b_ndebug=if-release',
]
)
-ver_fb = get_option('version_fallback').strip()
-version_fallback = ver_fb != '' ? ver_fb : meson.project_version()
+cc = meson.get_compiler('c')
+python3 = import('python3').find_python()
+macos_app_bundle = get_option('macos_bundle') and host_machine.system() == 'darwin'
-common_taiseilib_args = [
- '--rootdir', meson.source_root(),
- '--fallback-version', version_fallback
-]
-
-common_taiseilib_defs = [
- '-DMESON_BUILD_TYPE=@0@'.format(get_option('buildtype')),
- '-DMESON_BUILD_ROOT=@0@'.format(meson.build_root()),
- '-DMESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
-]
-
-scripts_dir = 'scripts'
-
-version_script = find_program(join_paths(scripts_dir, 'version.py'))
-version_command = [version_script, common_taiseilib_args]
-
-preprocess_script = find_program(join_paths(scripts_dir, 'configure-file.py'))
-preprocess_args = common_taiseilib_args + common_taiseilib_defs
-preprocess_command = [preprocess_script, preprocess_args]
-
-preprocessor = generator(preprocess_script,
- arguments: preprocess_args + ['@EXTRA_ARGS@', '--depfile', '@DEPFILE@', '@INPUT@', '@OUTPUT@'],
- output: '@BASENAME@',
- depfile: '@BASENAME@.d',
-)
-
-eolconv = find_program(join_paths(scripts_dir, 'eolconv.py'))
-host_eol_style = host_machine.system() == 'windows' ? 'crlf' : 'lf'
-
-taisei_version_result = run_command(version_command, '{string}')
-
-if taisei_version_result.stderr() != ''
- warning(taisei_version_result.stderr().strip())
-endif
-
-if taisei_version_result.returncode() != 0
- error('Version script exited with code @0@'.format(
- taisei_version_result.returncode()
- ))
-endif
-
-taisei_version_string = taisei_version_result.stdout().strip()
+subdir('scripts')
config = configuration_data()
-cc = meson.get_compiler('c')
-python3 = import('python3').find_python()
+taisei_c_args = cc.get_supported_arguments(
+ '-Wall',
+ '-Wpedantic',
+ '-Werror=implicit-function-declaration',
-taisei_c_warnargs = []
-taisei_c_args = []
+ #
+ # Keep the rest sorted
+ #
-foreach flag : [
- '-Werror=implicit-function-declaration',
- ]
- if cc.has_argument(flag)
- taisei_c_args += flag
- endif
-endforeach
-
-foreach flag : [
- '-Wpedantic',
- '-Wparentheses',
- '-Wtype-limits',
- '-Wstrict-prototypes',
- '-Wlong-long',
- '-Winit-self',
- '-Wnull-dereference',
- '-Wformat-pedantic',
- '-Wgcc-compat',
- '-Wfloat-overflow-conversion',
- '-Wfloat-zero-conversion',
- '-Wfor-loop-analysis',
- '-Wimplicit-fallthrough',
- '-Wsometimes-uninitialized',
- '-Wunneeded-internal-declaration',
- '-Wunreachable-code',
- '-Wunreachable-code-loop-increment',
- '-Wgnu',
- '-Wcast-align',
- '-Wcast-align=strict',
- '-Wno-long-long',
- ]
- if cc.has_argument(flag)
- taisei_c_warnargs += flag
- endif
-endforeach
-
-taisei_c_args += taisei_c_warnargs
+ '-Wabsolute-value',
+ '-Wcast-align',
+ '-Wcast-align=strict',
+ '-Wclobbered',
+ '-Wduplicated-branches',
+ '-Wduplicated-cond',
+ '-Wfloat-overflow-conversion',
+ '-Wfloat-zero-conversion',
+ '-Wfor-loop-analysis',
+ '-Wformat-pedantic',
+ '-Wformat-security',
+ '-Wgcc-compat',
+ '-Wgnu',
+ '-Wignored-qualifiers',
+ '-Wimplicit-fallthrough',
+ '-Winit-self',
+ '-Wlogical-op',
+ '-Wmissing-prototypes',
+ '-Wno-long-long',
+ '-Wnull-dereference',
+ '-Wparentheses',
+ '-Wshadow=compatible-local',
+ '-Wsometimes-uninitialized',
+ '-Wstrict-prototypes',
+ '-Wtype-limits',
+ '-Wunneeded-internal-declaration',
+ '-Wunreachable-code',
+ '-Wunreachable-code-loop-increment',
+)
static = get_option('static')
@@ -144,18 +99,28 @@ if host_machine.system() == 'windows'
taisei_deps += cc.find_library('shlwapi')
endif
+package_data = get_option('package_data')
+enable_zip = get_option('enable_zip')
+package_data = (package_data == 'auto' ? enable_zip : package_data == 'true')
+
+if enable_zip
+ if not dep_zip.found()
+ error('ZIP support enabled but libzip not found')
+ endif
+
+ taisei_deps += dep_zip
+endif
+
+if package_data and not enable_zip
+ error('ZIP support must be enabled for data packaging to work')
+endif
+
if dep_sdl2_mixer.found() and get_option('enable_audio') != 'false'
taisei_deps += dep_sdl2_mixer
elif get_option('enable_audio') == 'true'
error('Audio support enabled but SDL2_mixer not found')
endif
-if dep_zip.found() and get_option('package_data') != 'false'
- taisei_deps += dep_zip
-elif get_option('package_data') == 'true'
- error('Data packaging enabled but libzip not found')
-endif
-
config.set('TAISEI_BUILDCONF_USE_ZIP', taisei_deps.contains(dep_zip))
have_posix = cc.has_header_symbol('unistd.h', '_POSIX_VERSION')
@@ -172,8 +137,6 @@ config.set('TAISEI_BUILDCONF_HAVE_TIMESPEC', have_timespec)
config.set('TAISEI_BUILDCONF_HAVE_INT128', cc.sizeof('__int128') == 16)
config.set('TAISEI_BUILDCONF_HAVE_LONG_DOUBLE', cc.sizeof('long double') > 8)
-macos_app_bundle = get_option('macos_bundle') and host_machine.system() == 'darwin'
-
if macos_app_bundle
bundle_dir = 'Taisei.app'
datadir = join_paths(bundle_dir, 'Contents', 'Resources')
@@ -184,9 +147,9 @@ if macos_app_bundle
meson.add_install_script(
python3.path(),
join_paths(meson.source_root(), 'scripts', 'macos-install-dylibs.py'),
- get_option('macos_lib_path'),
- get_option('macos_tool_path'),
- get_option('macos_tool_prefix'),
+ ':'.join(meson.get_cross_property('macos_lib_path', [])),
+ ':'.join(meson.get_cross_property('macos_tool_path', [])),
+ meson.get_cross_property('macos_tool_prefix', ''),
)
else
datadir = get_option('datadir')
@@ -243,7 +206,7 @@ angle_enabled = get_option('install_angle')
if host_machine.system() == 'windows'
custom_target('COPYING.txt',
- command : [eolconv, 'crlf', '@INPUT@', '@OUTPUT@'],
+ command : [eolconv_command, host_eol_style, '@INPUT@', '@OUTPUT@'],
input : 'COPYING',
output : 'COPYING.txt',
install : true,
@@ -268,6 +231,10 @@ endif
systype = (have_posix ? 'POSIX (@0@)' : '@0@').format(host_machine.system())
systype = '@0@, @1@, @2@'.format(systype, host_machine.cpu_family(), host_machine.cpu())
+if meson.is_cross_build()
+ systype = '@0@ (cross-compiling)'.format(systype)
+endif
+
summary = '''
Summary:
@@ -307,10 +274,7 @@ subdir('external')
subdir('resources')
subdir('doc')
subdir('xdg')
-subdir('scripts')
subdir('atlas')
subdir('src')
message(summary)
-
-run_command(find_program(join_paths(scripts_dir, 'dump-build-options.py')), meson.build_root())
diff --git a/meson_options.txt b/meson_options.txt
index ebd74155..cfd3b77b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,14 +8,21 @@ option(
'enable_audio',
type : 'combo',
choices : ['auto', 'true', 'false'],
- description : 'Enable audio support (needs SDL2_mixer)'
+ description : 'Enable audio support (requires SDL2_mixer)'
+)
+
+option(
+ 'enable_zip',
+ type : 'boolean',
+ value : 'true',
+ description : 'Enable loading of game data from ZIP packages (requires libzip)'
)
option(
'package_data',
type : 'combo',
choices : ['auto', 'true', 'false'],
- description : 'Package the game’s assets into a compressed archive instead of bundling plain files (needs libzip)'
+ description : 'Package the game’s assets into a compressed archive (requires enable_zip)'
)
option(
@@ -86,24 +93,6 @@ option(
description : 'Make a macOS application bundle on install (ignored on other platforms)'
)
-option(
- 'macos_lib_path',
- type : 'string',
- description : 'List of paths (separated like the PATH environment variable) from where required runtime libraries will be copied into the bundle (useful for cross-compiling)'
-)
-
-option(
- 'macos_tool_path',
- type : 'string',
- description : 'List of paths (separated like the PATH environment variable) from where macOS-specific utilities (such as otool and install_name_tool) can be found. This is prepended to PATH (useful for cross-compiling)'
-)
-
-option(
- 'macos_tool_prefix',
- type : 'string',
- description : 'Names of macOS-specific tools are prefixed with this string (useful for cross-compiling)'
-)
-
option(
'docs',
type : 'boolean',
@@ -115,7 +104,7 @@ option(
'shader_transpiler',
type : 'boolean',
value : false,
- description : 'Enable shader trans-compilation. Requires shaderc'
+ description : 'Enable shader trans-compilation (requires shaderc)'
)
option(
diff --git a/misc/Info.plist.in b/misc/Info.plist.in
index ad803f7c..0a14a50f 100644
--- a/misc/Info.plist.in
+++ b/misc/Info.plist.in
@@ -23,6 +23,6 @@
CFBundleVersion
${VERSION({major}.{minor}.{patch}.{tweak})}
NSHumanReadableCopyright
- © 2011-2018, Taisei Project
+ © 2011-2019, Taisei Project
diff --git a/misc/meson.build b/misc/meson.build
index 4b9627ec..364fe154 100644
--- a/misc/meson.build
+++ b/misc/meson.build
@@ -15,7 +15,7 @@ endif
if angle_enabled and host_machine.system() == 'windows'
angle_launcher = 'taisei-angle.bat'
custom_target(angle_launcher,
- command : [eolconv, host_eol_style, '--no-bom', '@INPUT@', '@OUTPUT@'],
+ command : [eolconv_command, host_eol_style, '--no-bom', '@INPUT@', '@OUTPUT@'],
input : angle_launcher,
output : angle_launcher,
install : true,
diff --git a/resources/meson.build b/resources/meson.build
index ef58a396..ced6b6fa 100644
--- a/resources/meson.build
+++ b/resources/meson.build
@@ -3,7 +3,7 @@ subdir('shader')
dirs = ['bgm', 'gfx', 'models', 'sfx', 'shader', 'fonts']
-if taisei_deps.contains(dep_zip)
+if package_data
archive = '00-taisei.zip'
pack_exe = find_program('../scripts/pack.py')
pack = custom_target('packed data files',
@@ -11,9 +11,8 @@ if taisei_deps.contains(dep_zip)
'@OUTPUT@',
meson.current_source_dir(),
'@DEPFILE@',
- '@INPUT@'
+ dirs,
],
- input : dirs,
output : archive,
depfile : 'pack.d',
install : true,
diff --git a/scripts/dump-build-options.py b/scripts/dump-build-options.py
index ca11dd95..ad60d897 100755
--- a/scripts/dump-build-options.py
+++ b/scripts/dump-build-options.py
@@ -3,15 +3,14 @@
from taiseilib.common import (
run_main,
in_dir,
- meson_introspect, meson,
- add_common_args,
)
+import os
import subprocess
def main(args):
- with in_dir(args[1]):
+ with in_dir(os.environ['MESON_BUILD_ROOT']):
with open('saved_options.json', 'wb') as outfile:
outfile.write(subprocess.check_output(['meson', 'introspect', '--buildoptions']))
diff --git a/scripts/meson.build b/scripts/meson.build
index 6e499ebe..72042168 100644
--- a/scripts/meson.build
+++ b/scripts/meson.build
@@ -1,4 +1,47 @@
+ver_fb = get_option('version_fallback').strip()
+version_fallback = ver_fb != '' ? ver_fb : meson.project_version()
+
+common_taiseilib_args = [
+ '--rootdir', meson.source_root(),
+ '--fallback-version', version_fallback
+]
+
+common_taiseilib_defs = [
+ '-DMESON_BUILD_TYPE=@0@'.format(get_option('buildtype')),
+ '-DMESON_BUILD_ROOT=@0@'.format(meson.build_root()),
+ '-DMESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
+]
+
+version_script = find_program(files('version.py'))
+version_command = [version_script, common_taiseilib_args]
+
+taisei_version_result = run_command(version_command, '{string}')
+
+if taisei_version_result.stderr() != ''
+ warning(taisei_version_result.stderr().strip())
+endif
+
+if taisei_version_result.returncode() != 0
+ error('Version script exited with code @0@'.format(
+ taisei_version_result.returncode()
+ ))
+endif
+
+taisei_version_string = taisei_version_result.stdout().strip()
+
+preprocess_script = find_program(files('configure-file.py'))
+preprocess_args = common_taiseilib_args + common_taiseilib_defs
+preprocess_command = [preprocess_script, preprocess_args]
+preprocessor = generator(preprocess_script,
+ arguments: preprocess_args + ['@EXTRA_ARGS@', '--depfile', '@DEPFILE@', '@INPUT@', '@OUTPUT@'],
+ output: '@BASENAME@',
+ depfile: '@BASENAME@.d',
+)
+
+eolconv_command = find_program(files('eolconv.py'))
+host_eol_style = host_machine.system() == 'windows' ? 'crlf' : 'lf'
+
if get_option('buildtype').contains('debug')
dist_version_string = '@0@-@1@'.format(taisei_version_string, get_option('buildtype'))
else
@@ -6,7 +49,7 @@ else
endif
if macos_app_bundle
- dmg_command = find_program('./macos-gen-dmg.py')
+ dmg_command = find_program(files('macos-gen-dmg.py'))
dmg_filename = 'Taisei-@0@-macOS.dmg'.format(dist_version_string)
dmg_target = run_target('dmg',
command: [dmg_command, join_paths(meson.build_root(), dmg_filename), meson.build_root()],
@@ -14,7 +57,7 @@ if macos_app_bundle
endif
if host_machine.system() == 'windows'
- nsis_command = find_program('./win-gen-nsis.py')
+ nsis_command = find_program(files('win-gen-nsis.py'))
nsis_filename = 'Taisei-@0@-setup-@1@.exe'.format(dist_version_string, host_machine.cpu_family())
nsis_outpath = join_paths(meson.build_root(), nsis_filename)
@@ -47,20 +90,20 @@ if host_machine.system() == 'windows'
)
endif
-zip_command = find_program('./gen-zip.py')
-
+zip_command = find_program(files('gen-zip.py'))
zip_filename = 'Taisei-@0@-@1@-@2@.zip'.format(dist_version_string, host_machine.system(), host_machine.cpu_family())
zip_outpath = join_paths(meson.build_root(), zip_filename)
-
zip_target = run_target('zip',
command: [zip_command, meson.build_root(), zip_outpath],
)
-gen_atlas_command = find_program('./gen-atlas.py')
-gen_atlases_command = find_program('./gen-atlases.py')
+gen_atlas_command = find_program(files('gen-atlas.py'))
+gen_atlases_command = find_program(files('gen-atlases.py'))
-upkeep_command = find_program('./upkeep.py')
+upkeep_script = find_program(files('upkeep.py'))
+upkeep_command = [upkeep_script, common_taiseilib_args]
+upkeep_target = run_target('upkeep', command: upkeep_command)
-upkeep_target = run_target('upkeep',
- command: [upkeep_command, common_taiseilib_args],
-)
+postconf_script = find_program(files('dump-build-options.py'))
+# meson.add_postconf_script(postconf_script.path())
+run_command(postconf_script)
diff --git a/src/audio_mixer.c b/src/audio_mixer.c
index f4a27d68..72f2fbdf 100644
--- a/src/audio_mixer.c
+++ b/src/audio_mixer.c
@@ -368,11 +368,11 @@ typedef struct CustomFadeout {
int counter;
} CustomFadeout;
-void custom_fadeout_free(int chan, void *udata) {
+static void custom_fadeout_free(int chan, void *udata) {
free(udata);
}
-void custom_fadeout_proc(int chan, void *stream, int len, void *udata) {
+static void custom_fadeout_proc(int chan, void *stream, int len, void *udata) {
CustomFadeout *e = udata;
assert(AUDIO_FORMAT == AUDIO_S16SYS); // if you wanna change the format, you get to implement it here. This is the hardcoded default format in SDL_Mixer by the way
diff --git a/src/boss.c b/src/boss.c
index e54bee7e..ba94ad98 100644
--- a/src/boss.c
+++ b/src/boss.c
@@ -81,7 +81,7 @@ static inline bool healthbar_style_is_radial(void) {
return config_get_int(CONFIG_HEALTHBAR_STYLE) > 0;
}
-const Color* boss_healthbar_color(AttackType atype) {
+static const Color* boss_healthbar_color(AttackType atype) {
static const Color colors[] = {
[AT_Normal] = { 0.50, 0.50, 0.60, 1.00 },
[AT_Move] = { 1.00, 1.00, 1.00, 1.00 },
@@ -385,6 +385,7 @@ static void draw_spell_warning(Font *font, float y_pos, float f, float opacity)
static void draw_spell_name(Boss *b, int time, bool healthbar_radial) {
Font *font = get_font("standard");
+
complex x0 = VIEWPORT_W/2+I*VIEWPORT_H/3.5;
float f = clamp((time - 40.0) / 60.0, 0, 1);
float f2 = clamp(time / 80.0, 0, 1);
@@ -442,7 +443,7 @@ static void draw_spell_name(Boss *b, int time, bool healthbar_radial) {
float a = clamp((global.frames - b->current->starttime - 60) / 60.0, 0, 1);
snprintf(buf, sizeof(buf), "%u / %u", p->num_cleared, p->num_played);
- Font *font = get_font("small");
+ font = get_font("small");
draw_boss_text(ALIGN_RIGHT,
(VIEWPORT_W - 10) + (text_width(font, buf, 0) + 10) * pow(1 - a, 2),
@@ -652,7 +653,7 @@ void draw_boss_hud(Boss *boss) {
}
}
-void boss_rule_extra(Boss *boss, float alpha) {
+static void boss_rule_extra(Boss *boss, float alpha) {
if(global.frames % 5) {
return;
}
@@ -1197,7 +1198,7 @@ Attack* boss_add_attack(Boss *boss, AttackType type, char *name, float timeout,
return a;
}
-void boss_generic_move(Boss *b, int time) {
+static void boss_generic_move(Boss *b, int time) {
Attack *atck = b->current;
if(atck->info->pos_dest == BOSS_NOMOVE) {
diff --git a/src/credits.c b/src/credits.c
index 11c81903..bb5cfc5c 100644
--- a/src/credits.c
+++ b/src/credits.c
@@ -310,12 +310,7 @@ static void credits_draw_entry(CreditsEntry *e) {
*/
r_color(RGBA_MUL_ALPHA(1, 1, 1, fadein * fadeout));
-
- if(yukkuri) {
- r_mat_translate(0, (-h_body) * 0.5, 0);
- } else {
- r_mat_translate(0, (-h_body) * 0.5, 0);
- }
+ r_mat_translate(0, h_body * -0.5, 0);
for(int i = 0; i < e->lines; ++i) {
if(yukkuri && !i) {
diff --git a/src/enemy.c b/src/enemy.c
index 1eb9559d..eeb4a1b5 100644
--- a/src/enemy.c
+++ b/src/enemy.c
@@ -98,7 +98,7 @@ Enemy *create_enemy_p(EnemyList *enemies, complex pos, float hp, EnemyVisualRule
return e;
}
-void* _delete_enemy(ListAnchor *enemies, List* enemy, void *arg) {
+static void* _delete_enemy(ListAnchor *enemies, List* enemy, void *arg) {
Enemy *e = (Enemy*)enemy;
if(e->hp <= 0 && e->hp != ENEMY_IMMUNE && e->hp != ENEMY_BOMB) {
diff --git a/src/item.c b/src/item.c
index f9cb5c10..0753b6f1 100644
--- a/src/item.c
+++ b/src/item.c
@@ -100,7 +100,7 @@ void delete_items(void) {
}
}
-complex move_item(Item *i) {
+static complex move_item(Item *i) {
int t = global.frames - i->birthtime;
complex lim = 0 + 2.0*I;
@@ -109,7 +109,6 @@ complex move_item(Item *i) {
if(i->auto_collect) {
i->pos -= (7+i->auto_collect)*cexp(I*carg(i->pos - global.plr.pos));
} else {
- complex oldpos = i->pos;
i->pos = i->pos0 + log(t/5.0 + 1)*5*(i->v + lim) + lim*t;
complex v = i->pos - oldpos;
diff --git a/src/laser.c b/src/laser.c
index 26e50090..8ec18859 100644
--- a/src/laser.c
+++ b/src/laser.c
@@ -314,7 +314,7 @@ static void lasers_ent_postdraw_hook(EntityInterface *ent, void *arg) {
}
}
-void* _delete_laser(ListAnchor *lasers, List *laser, void *arg) {
+static void* _delete_laser(ListAnchor *lasers, List *laser, void *arg) {
Laser *l = (Laser*)laser;
if(l->lrule)
@@ -326,7 +326,7 @@ void* _delete_laser(ListAnchor *lasers, List *laser, void *arg) {
return NULL;
}
-void delete_laser(LaserList *lasers, Laser *laser) {
+static void delete_laser(LaserList *lasers, Laser *laser) {
_delete_laser((ListAnchor*)lasers, (List*)laser, NULL);
}
diff --git a/src/main.c b/src/main.c
index b5f10c0c..7b68516f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -111,7 +111,7 @@ static void log_lib_versions(void) {
log_info("Using libpng %s", png_get_header_ver(NULL));
}
-void log_system_specs(void) {
+static void log_system_specs(void) {
log_info("CPU count: %d", SDL_GetCPUCount());
// log_info("CPU type: %s", SDL_GetCPUType());
// log_info("CPU name: %s", SDL_GetCPUName());
diff --git a/src/menu/charselect.c b/src/menu/charselect.c
index 636525a0..cd700dae 100644
--- a/src/menu/charselect.c
+++ b/src/menu/charselect.c
@@ -8,21 +8,22 @@
#include "taisei.h"
+#include "charselect.h"
#include "menu.h"
#include "options.h"
#include "common.h"
#include "global.h"
#include "video.h"
-void set_player(MenuData *m, void *p) {
+static void set_player(MenuData *m, void *p) {
progress.game_settings.character = (CharacterID)(uintptr_t)p;
}
-void set_shotmode(MenuData *m, void *p) {
+static void set_shotmode(MenuData *m, void *p) {
progress.game_settings.shotmode = (ShotModeID)(uintptr_t)p;
}
-void create_shottype_menu(MenuData *m) {
+static void create_shottype_menu(MenuData *m) {
create_menu(m);
m->transition = NULL;
@@ -35,11 +36,10 @@ void create_shottype_menu(MenuData *m) {
}
}
-void char_menu_input(MenuData*);
-void draw_char_menu(MenuData*);
-void free_char_menu(MenuData*);
+static void char_menu_input(MenuData*);
+static void free_char_menu(MenuData*);
-void update_char_menu(MenuData *menu) {
+static void update_char_menu(MenuData *menu) {
for(int i = 0; i < menu->ecount; i++) {
menu->entries[i].drawdata += 0.08*(1.0*(menu->cursor != i) - menu->entries[i].drawdata);
}
@@ -179,7 +179,7 @@ void draw_char_menu(MenuData *menu) {
r_cull(cull_saved);
}
-bool char_menu_input_handler(SDL_Event *event, void *arg) {
+static bool char_menu_input_handler(SDL_Event *event, void *arg) {
MenuData *menu = arg;
MenuData *mod = menu->context;
TaiseiEvent type = TAISEI_EVENT(event->type);
@@ -217,14 +217,14 @@ bool char_menu_input_handler(SDL_Event *event, void *arg) {
return false;
}
-void char_menu_input(MenuData *menu) {
+static void char_menu_input(MenuData *menu) {
events_poll((EventHandler[]){
{ .proc = char_menu_input_handler, .arg = menu },
{ NULL }
}, EFLAG_MENU);
}
-void free_char_menu(MenuData *menu) {
+static void free_char_menu(MenuData *menu) {
MenuData *mod = menu->context;
destroy_menu(mod);
free(mod);
diff --git a/src/menu/common.c b/src/menu/common.c
index d134cb1b..24195e8e 100644
--- a/src/menu/common.c
+++ b/src/menu/common.c
@@ -8,6 +8,7 @@
#include "taisei.h"
+#include "common.h"
#include "global.h"
#include "menu.h"
#include "savereplay.h"
diff --git a/src/menu/difficultyselect.c b/src/menu/difficultyselect.c
index ef5d41f8..ca6e7154 100644
--- a/src/menu/difficultyselect.c
+++ b/src/menu/difficultyselect.c
@@ -18,11 +18,11 @@
// FIXME: put this into the menu struct somehow (drawdata is a bad system)
static Color diff_color;
-void set_difficulty(MenuData *m, void *d) {
+static void set_difficulty(MenuData *m, void *d) {
progress.game_settings.difficulty = (Difficulty)(uintptr_t)d;
}
-void update_difficulty_menu(MenuData *menu) {
+static void update_difficulty_menu(MenuData *menu) {
menu->drawdata[0] += (menu->cursor-menu->drawdata[0])*0.1;
for(int i = 0; i < menu->ecount; ++i) {
diff --git a/src/menu/mainmenu.c b/src/menu/mainmenu.c
index aa1cf6fe..41b1bb0d 100644
--- a/src/menu/mainmenu.c
+++ b/src/menu/mainmenu.c
@@ -24,22 +24,6 @@
#include "version.h"
#include "plrmodes.h"
-void enter_stagepractice(MenuData *menu, void *arg) {
- MenuData m;
-
- do {
- create_difficulty_menu(&m);
-
- if(menu_loop(&m) < 0) {
- return;
- }
-
- global.diff = progress.game_settings.difficulty;
- create_stgpract_menu(&m, global.diff);
- menu_loop(&m);
- } while(m.selected < 0 || m.selected == m.ecount - 1);
-}
-
static MenuEntry *spell_practice_entry;
static MenuEntry *stage_practice_entry;
@@ -70,7 +54,14 @@ static void begin_main_menu(MenuData *m) {
start_bgm("menu");
}
-static void update_main_menu(MenuData *menu);
+static void update_main_menu(MenuData *menu) {
+ menu->drawdata[1] += (text_width(get_font("big"), menu->entries[menu->cursor].name, 0) - menu->drawdata[1])/10.0;
+ menu->drawdata[2] += (35*menu->cursor - menu->drawdata[2])/10.0;
+
+ for(int i = 0; i < menu->ecount; i++) {
+ menu->entries[i].drawdata += 0.2 * ((i == menu->cursor) - menu->entries[i].drawdata);
+ }
+}
void create_main_menu(MenuData *m) {
create_menu(m);
@@ -87,7 +78,7 @@ void create_main_menu(MenuData *m) {
#endif
add_menu_entry(m, "Replays", enter_replayview, NULL);
add_menu_entry(m, "Options", enter_options, NULL);
- add_menu_entry(m, "Quit", menu_commonaction_close, NULL)->transition = TransFadeBlack;;
+ add_menu_entry(m, "Quit", menu_commonaction_close, NULL)->transition = TransFadeBlack;
stage_practice_entry = m->entries + 2;
spell_practice_entry = m->entries + 3;
@@ -99,15 +90,6 @@ void draw_main_menu_bg(MenuData* menu) {
fill_screen("menu/mainmenubg");
}
-static void update_main_menu(MenuData *menu) {
- menu->drawdata[1] += (text_width(get_font("big"), menu->entries[menu->cursor].name, 0) - menu->drawdata[1])/10.0;
- menu->drawdata[2] += (35*menu->cursor - menu->drawdata[2])/10.0;
-
- for(int i = 0; i < menu->ecount; i++) {
- menu->entries[i].drawdata += 0.2 * ((i == menu->cursor) - menu->entries[i].drawdata);
- }
-}
-
void draw_main_menu(MenuData *menu) {
draw_main_menu_bg(menu);
draw_sprite(150.5, 100, "menu/logo");
diff --git a/src/menu/menu.c b/src/menu/menu.c
index fa08b27b..1879f080 100644
--- a/src/menu/menu.c
+++ b/src/menu/menu.c
@@ -49,7 +49,7 @@ void create_menu(MenuData *menu) {
menu->input = menu_input;
}
-void close_menu_finish(MenuData *menu) {
+static void close_menu_finish(MenuData *menu) {
menu->state = MS_Dead;
if(menu->selected != -1 && menu->entries[menu->selected].action != NULL) {
diff --git a/src/menu/options.c b/src/menu/options.c
index e102648e..6f78935f 100644
--- a/src/menu/options.c
+++ b/src/menu/options.c
@@ -17,19 +17,19 @@
// --- Menu entry <-> config option binding stuff --- //
-void bind_init(OptionBinding *bind) {
+static void bind_init(OptionBinding *bind) {
memset(bind, 0, sizeof(OptionBinding));
bind->selected = -1;
bind->configentry = -1;
}
-OptionBinding* bind_new(void) {
+static OptionBinding* bind_new(void) {
OptionBinding *bind = malloc(sizeof(OptionBinding));
bind_init(bind);
return bind;
}
-void bind_free(OptionBinding *bind) {
+static void bind_free(OptionBinding *bind) {
int i;
if(bind->values) {
@@ -39,14 +39,14 @@ void bind_free(OptionBinding *bind) {
}
}
-OptionBinding* bind_get(MenuData *m, int idx) {
+static OptionBinding* bind_get(MenuData *m, int idx) {
MenuEntry *e = m->entries + idx;
return e->arg == m? NULL : e->arg;
}
// BT_IntValue: integer and boolean options
// Values are defined with bind_addvalue or bind_setrange
-OptionBinding* bind_option(int cfgentry, BindingGetter getter, BindingSetter setter) {
+static OptionBinding* bind_option(int cfgentry, BindingGetter getter, BindingSetter setter) {
OptionBinding *bind = bind_new();
bind->type = BT_IntValue;
bind->configentry = cfgentry;
@@ -58,7 +58,7 @@ OptionBinding* bind_option(int cfgentry, BindingGetter getter, BindingSetter set
}
// BT_KeyBinding: keyboard action mapping options
-OptionBinding* bind_keybinding(int cfgentry) {
+static OptionBinding* bind_keybinding(int cfgentry) {
OptionBinding *bind = bind_new();
bind->configentry = cfgentry;
@@ -68,7 +68,7 @@ OptionBinding* bind_keybinding(int cfgentry) {
}
// BT_GamepadKeyBinding: gamepad action mapping options
-OptionBinding* bind_gpbinding(int cfgentry) {
+static OptionBinding* bind_gpbinding(int cfgentry) {
OptionBinding *bind = bind_new();
bind->configentry = cfgentry;
@@ -78,7 +78,7 @@ OptionBinding* bind_gpbinding(int cfgentry) {
}
// BT_GamepadAxisBinding: gamepad axis mapping options
-OptionBinding* bind_gpaxisbinding(int cfgentry) {
+static OptionBinding* bind_gpaxisbinding(int cfgentry) {
OptionBinding *bind = bind_new();
bind->configentry = cfgentry;
@@ -104,7 +104,7 @@ static int bind_gpdev_set(OptionBinding *b, int v) {
}
// BT_GamepadDevice: dynamic device list
-OptionBinding* bind_gpdevice(int cfgentry) {
+static OptionBinding* bind_gpdevice(int cfgentry) {
OptionBinding *bind = bind_new();
bind->configentry = cfgentry;
@@ -122,7 +122,7 @@ OptionBinding* bind_gpdevice(int cfgentry) {
}
// BT_StrValue: with a half-assed "textbox"
-OptionBinding* bind_stroption(ConfigIndex cfgentry) {
+static OptionBinding* bind_stroption(ConfigIndex cfgentry) {
OptionBinding *bind = bind_new();
bind->type = BT_StrValue;
bind->configentry = cfgentry;
@@ -132,7 +132,7 @@ OptionBinding* bind_stroption(ConfigIndex cfgentry) {
}
// BT_Resolution: super-special binding type for the resolution setting
-void bind_resolution_update(OptionBinding *bind) {
+static void bind_resolution_update(OptionBinding *bind) {
bind->valcount = video.mcount;
for(int i = 0; i < video.mcount; ++i) {
@@ -143,7 +143,7 @@ void bind_resolution_update(OptionBinding *bind) {
}
}
-OptionBinding* bind_resolution(void) {
+static OptionBinding* bind_resolution(void) {
OptionBinding *bind = bind_new();
bind->type = BT_Resolution;
bind->selected = -1;
@@ -152,7 +152,7 @@ OptionBinding* bind_resolution(void) {
}
// BT_Scale: float values clamped to a range
-OptionBinding* bind_scale(int cfgentry, float smin, float smax, float step) {
+static OptionBinding* bind_scale(int cfgentry, float smin, float smax, float step) {
OptionBinding *bind = bind_new();
bind->type = BT_Scale;
bind->configentry = cfgentry;
@@ -165,7 +165,7 @@ OptionBinding* bind_scale(int cfgentry, float smin, float smax, float step) {
}
// Returns a pointer to the first found binding that blocks input. If none found, returns NULL.
-OptionBinding* bind_getinputblocking(MenuData *m) {
+static OptionBinding* bind_getinputblocking(MenuData *m) {
int i;
for(i = 0; i < m->ecount; ++i) {
OptionBinding *bind = bind_get(m, i);
@@ -176,20 +176,21 @@ OptionBinding* bind_getinputblocking(MenuData *m) {
}
// Adds a value to a BT_IntValue type binding
-int bind_addvalue(OptionBinding *b, char *val) {
+static int bind_addvalue(OptionBinding *b, char *val) {
b->values = realloc(b->values, ++b->valcount * sizeof(char*));
b->values[b->valcount-1] = malloc(strlen(val) + 1);
strcpy(b->values[b->valcount-1], val);
return b->valcount-1;
}
-void bind_setvaluerange(OptionBinding *b, int vmin, int vmax) {
+attr_unused
+static void bind_setvaluerange(OptionBinding *b, int vmin, int vmax) {
b->valrange_min = vmin;
b->valrange_max = vmax;
}
// Called to select a value of a BT_IntValue type binding by index
-int bind_setvalue(OptionBinding *b, int v) {
+static int bind_setvalue(OptionBinding *b, int v) {
if(b->setter)
return b->selected = b->setter(b, v);
else
@@ -197,7 +198,7 @@ int bind_setvalue(OptionBinding *b, int v) {
}
// Called to get the selected value of a BT_IntValue type binding by index
-int bind_getvalue(OptionBinding *b) {
+static int bind_getvalue(OptionBinding *b) {
if(b->getter) {
if(b->selected >= b->valcount && b->valcount) {
b->selected = 0;
@@ -213,7 +214,7 @@ int bind_getvalue(OptionBinding *b) {
}
// Selects the next to current value of a BT_IntValue type binding
-int bind_setnext(OptionBinding *b) {
+static int bind_setnext(OptionBinding *b) {
int s = b->selected + 1;
if(b->valrange_max) {
@@ -227,7 +228,7 @@ int bind_setnext(OptionBinding *b) {
}
// Selects the previous to current value of a BT_IntValue type binding
-int bind_setprev(OptionBinding *b) {
+static int bind_setprev(OptionBinding *b) {
int s = b->selected - 1;
if(b->valrange_max) {
@@ -240,11 +241,11 @@ int bind_setprev(OptionBinding *b) {
return bind_setvalue(b, s);
}
-void bind_setdependence(OptionBinding *b, BindingDependence dep) {
+static void bind_setdependence(OptionBinding *b, BindingDependence dep) {
b->dependence = dep;
}
-bool bind_isactive(OptionBinding *b) {
+static bool bind_isactive(OptionBinding *b) {
if(!b->dependence)
return true;
return b->dependence();
@@ -252,23 +253,23 @@ bool bind_isactive(OptionBinding *b) {
// --- Shared binding callbacks --- //
-int bind_common_onoff_get(OptionBinding *b) {
+static int bind_common_onoff_get(OptionBinding *b) {
return !config_get_int(b->configentry);
}
-int bind_common_onoff_set(OptionBinding *b, int v) {
+static int bind_common_onoff_set(OptionBinding *b, int v) {
return !config_set_int(b->configentry, !v);
}
-int bind_common_onoff_inverted_get(OptionBinding *b) {
+static int bind_common_onoff_inverted_get(OptionBinding *b) {
return config_get_int(b->configentry);
}
-int bind_common_onoff_inverted_set(OptionBinding *b, int v) {
+static int bind_common_onoff_inverted_set(OptionBinding *b, int v) {
return config_set_int(b->configentry, v);
}
-int bind_common_onoffplus_get(OptionBinding *b) {
+static int bind_common_onoffplus_get(OptionBinding *b) {
int v = config_get_int(b->configentry);
if(v > 1)
@@ -276,7 +277,7 @@ int bind_common_onoffplus_get(OptionBinding *b) {
return !v;
}
-int bind_common_onoffplus_set(OptionBinding *b, int v) {
+static int bind_common_onoffplus_set(OptionBinding *b, int v) {
if(v > 1)
return config_set_int(b->configentry, v);
return !config_set_int(b->configentry, !v);
@@ -285,34 +286,34 @@ int bind_common_onoffplus_set(OptionBinding *b, int v) {
#define bind_common_int_get bind_common_onoff_inverted_get
#define bind_common_int_set bind_common_onoff_inverted_set
-int bind_common_intplus1_get(OptionBinding *b) {
+static int bind_common_intplus1_get(OptionBinding *b) {
return config_get_int(b->configentry) - 1;
}
-int bind_common_intplus1_set(OptionBinding *b, int v) {
+static int bind_common_intplus1_set(OptionBinding *b, int v) {
return config_set_int(b->configentry, v + 1) - 1;
}
// --- Binding callbacks for individual options --- //
-bool bind_audio_dependence(void) {
+static bool bind_audio_dependence(void) {
return audio_backend_initialized();
}
-bool bind_resizable_dependence(void) {
+static bool bind_resizable_dependence(void) {
return !config_get_int(CONFIG_FULLSCREEN);
}
-bool bind_bgquality_dependence(void) {
+static bool bind_bgquality_dependence(void) {
return !config_get_int(CONFIG_NO_STAGEBG);
}
-bool bind_resolution_dependence(void) {
+static bool bind_resolution_dependence(void) {
return video_can_change_resolution();
}
-int bind_resolution_set(OptionBinding *b, int v) {
+static int bind_resolution_set(OptionBinding *b, int v) {
if(v >= 0) {
VideoMode *m = video.modes + v;
config_set_int(CONFIG_VID_WIDTH, m->width);
@@ -322,17 +323,17 @@ int bind_resolution_set(OptionBinding *b, int v) {
return v;
}
-int bind_power_set(OptionBinding *b, int v) {
+static int bind_power_set(OptionBinding *b, int v) {
return config_set_int(b->configentry, v * 100) / 100;
}
-int bind_power_get(OptionBinding *b) {
+static int bind_power_get(OptionBinding *b) {
return config_get_int(b->configentry) / 100;
}
// --- Creating, destroying, filling the menu --- //
-void destroy_options_menu(MenuData *m) {
+static void destroy_options_menu(MenuData *m) {
for(int i = 0; i < m->ecount; ++i) {
OptionBinding *bind = bind_get(m, i);
@@ -363,7 +364,7 @@ static void do_nothing(MenuData *menu, void *arg) { }
static void update_options_menu(MenuData *menu);
void options_menu_input(MenuData*);
-void create_options_menu_basic(MenuData *m, char *s) {
+static void create_options_menu_basic(MenuData *m, char *s) {
create_menu(m);
m->transition = TransMenuDark;
m->flags = MF_Abortable;
@@ -376,7 +377,7 @@ void create_options_menu_basic(MenuData *m, char *s) {
#define bind_onoff(b) bind_addvalue(b, "on"); bind_addvalue(b, "off")
-void options_sub_video(MenuData *parent, void *arg) {
+static void options_sub_video(MenuData *parent, void *arg) {
MenuData menu, *m;
OptionBinding *b;
m = &menu;
@@ -455,7 +456,8 @@ void options_sub_video(MenuData *parent, void *arg) {
parent->frames = 0;
}
-void bind_setvaluerange_fancy(OptionBinding *b, int ma) {
+attr_unused
+static void bind_setvaluerange_fancy(OptionBinding *b, int ma) {
int i = 0; for(i = 0; i <= ma; ++i) {
char tmp[16];
snprintf(tmp, 16, "%i", i);
@@ -467,7 +469,7 @@ static bool gamepad_enabled_depencence(void) {
return config_get_int(CONFIG_GAMEPAD_ENABLED);
}
-void options_sub_gamepad_controls(MenuData *parent, void *arg) {
+static void options_sub_gamepad_controls(MenuData *parent, void *arg) {
MenuData menu, *m;
m = &menu;
@@ -516,7 +518,7 @@ void options_sub_gamepad_controls(MenuData *parent, void *arg) {
parent->frames = 0;
}
-void options_sub_gamepad(MenuData *parent, void *arg) {
+static void options_sub_gamepad(MenuData *parent, void *arg) {
MenuData menu, *m;
OptionBinding *b;
m = &menu;
@@ -576,7 +578,7 @@ void options_sub_gamepad(MenuData *parent, void *arg) {
free(gpdev);
}
-void options_sub_controls(MenuData *parent, void *arg) {
+static void options_sub_controls(MenuData *parent, void *arg) {
MenuData menu, *m;
m = &menu;
diff --git a/src/menu/replayview.c b/src/menu/replayview.c
index 1afab768..f3154485 100644
--- a/src/menu/replayview.c
+++ b/src/menu/replayview.c
@@ -356,7 +356,7 @@ static void replayview_draw(MenuData *m) {
r_shader_standard();
}
-int replayview_cmp(const void *a, const void *b) {
+static int replayview_cmp(const void *a, const void *b) {
ReplayviewItemContext *actx = ((MenuEntry*)a)->arg;
ReplayviewItemContext *bctx = ((MenuEntry*)b)->arg;
@@ -366,7 +366,7 @@ int replayview_cmp(const void *a, const void *b) {
return brpy->stages[0].seed - arpy->stages[0].seed;
}
-int fill_replayview_menu(MenuData *m) {
+static int fill_replayview_menu(MenuData *m) {
VFSDir *dir = vfs_dir_open("storage/replays");
const char *filename;
int rpys = 0;
@@ -408,7 +408,7 @@ int fill_replayview_menu(MenuData *m) {
return rpys;
}
-void replayview_menu_input(MenuData *m) {
+static void replayview_menu_input(MenuData *m) {
ReplayviewContext *ctx = (ReplayviewContext*)m->context;
MenuData *sub = ctx->submenu;
@@ -423,7 +423,7 @@ void replayview_menu_input(MenuData *m) {
}
}
-void replayview_free(MenuData *m) {
+static void replayview_free(MenuData *m) {
if(m->context) {
ReplayviewContext *ctx = m->context;
diff --git a/src/menu/spellpractice.c b/src/menu/spellpractice.c
index 1ed4102d..912bbb66 100644
--- a/src/menu/spellpractice.c
+++ b/src/menu/spellpractice.c
@@ -13,7 +13,7 @@
#include "options.h"
#include "global.h"
-void draw_spell_menu(MenuData *m) {
+static void draw_spell_menu(MenuData *m) {
draw_options_menu_bg(m);
draw_menu_title(m, "Spell Practice");
draw_menu_list(m, 100, 100, NULL);
diff --git a/src/menu/stagepractice.c b/src/menu/stagepractice.c
index f6cce71d..5745714d 100644
--- a/src/menu/stagepractice.c
+++ b/src/menu/stagepractice.c
@@ -13,7 +13,7 @@
#include "options.h"
#include "global.h"
-void draw_stgpract_menu(MenuData *m) {
+static void draw_stgpract_menu(MenuData *m) {
draw_options_menu_bg(m);
draw_menu_title(m, "Stage Practice");
draw_menu_list(m, 100, 100, NULL);
diff --git a/src/menu/stageselect.c b/src/menu/stageselect.c
index cc78ca9c..8db1e5d1 100644
--- a/src/menu/stageselect.c
+++ b/src/menu/stageselect.c
@@ -15,7 +15,7 @@
#include "stageselect.h"
#include "common.h"
-void draw_stage_menu(MenuData *m) {
+static void draw_stage_menu(MenuData *m) {
draw_options_menu_bg(m);
draw_menu_title(m, "Select Stage");
draw_menu_list(m, 100, 100, NULL);
diff --git a/src/menu/submenus.c b/src/menu/submenus.c
index 5825cdae..7acdd573 100644
--- a/src/menu/submenus.c
+++ b/src/menu/submenus.c
@@ -13,6 +13,10 @@
#include "stageselect.h"
#include "replayview.h"
#include "spellpractice.h"
+#include "stagepractice.h"
+#include "difficultyselect.h"
+#include "global.h"
+#include "submenus.h"
void enter_options(MenuData *menu, void *arg) {
MenuData m;
@@ -37,3 +41,19 @@ void enter_spellpractice(MenuData *menu, void *arg) {
create_spell_menu(&m);
menu_loop(&m);
}
+
+void enter_stagepractice(MenuData *menu, void *arg) {
+ MenuData m;
+
+ do {
+ create_difficulty_menu(&m);
+
+ if(menu_loop(&m) < 0) {
+ return;
+ }
+
+ global.diff = progress.game_settings.difficulty;
+ create_stgpract_menu(&m, global.diff);
+ menu_loop(&m);
+ } while(m.selected < 0 || m.selected == m.ecount - 1);
+}
diff --git a/src/menu/submenus.h b/src/menu/submenus.h
index 70c7f82b..69c79e9e 100644
--- a/src/menu/submenus.h
+++ b/src/menu/submenus.h
@@ -15,5 +15,6 @@ void enter_options(MenuData *menu, void *arg);
void enter_stagemenu(MenuData *menu, void *arg);
void enter_replayview(MenuData *menu, void *arg);
void enter_spellpractice(MenuData *menu, void *arg);
+void enter_stagepractice(MenuData *menu, void *arg);
#endif // IGUARD_menu_submenus_h
diff --git a/src/meson.build b/src/meson.build
index a2aa0dfe..bcae981a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -14,7 +14,7 @@ if host_machine.system() == 'windows'
'-DICONS_DIR=@0@'.format(join_paths(meson.source_root(), 'misc', 'icons'))
]
- if get_option('buildtype').startswith('debug')
+ if is_debug_build
rcdefs += ['-DBUILDTYPE_DEFINE=#define DEBUG_BUILD']
else
rcdefs += ['-DBUILDTYPE_DEFINE=#define RELEASE_BUILD']
@@ -101,15 +101,15 @@ endif
sse42_src = []
+subdir('dialog')
subdir('menu')
subdir('plrmodes')
subdir('renderer')
subdir('resource')
subdir('rwops')
subdir('stages')
-subdir('dialog')
-subdir('vfs')
subdir('util')
+subdir('vfs')
if use_intel_intrin
sse42_lib = static_library(
@@ -130,15 +130,15 @@ endif
configure_file(configuration : config, output : 'build_config.h')
taisei_src += [
+ dialog_src,
menu_src,
plrmodes_src,
renderer_src,
resource_src,
rwops_src,
stages_src,
- vfs_src,
- dialog_src,
util_src,
+ vfs_src,
]
if taisei_deps.contains(dep_sdl2_mixer)
diff --git a/src/player.c b/src/player.c
index 057fa935..059523fd 100644
--- a/src/player.c
+++ b/src/player.c
@@ -308,7 +308,7 @@ void player_logic(Player* plr) {
}
}
-bool player_bomb(Player *plr) {
+static bool player_bomb(Player *plr) {
// stage_clear_hazards(CLEAR_HAZARDS_ALL);
// return true;
@@ -590,7 +590,7 @@ static PlrInputFlag key_to_inflag(KeyIndex key) {
}
}
-bool player_updateinputflags(Player *plr, PlrInputFlag flags) {
+static bool player_updateinputflags(Player *plr, PlrInputFlag flags) {
if(flags == plr->inputflags) {
return false;
}
@@ -603,11 +603,11 @@ bool player_updateinputflags(Player *plr, PlrInputFlag flags) {
return true;
}
-bool player_updateinputflags_moveonly(Player *plr, PlrInputFlag flags) {
+static bool player_updateinputflags_moveonly(Player *plr, PlrInputFlag flags) {
return player_updateinputflags(plr, (flags & INFLAGS_MOVE) | (plr->inputflags & ~INFLAGS_MOVE));
}
-bool player_setinputflag(Player *plr, KeyIndex key, bool mode) {
+static bool player_setinputflag(Player *plr, KeyIndex key, bool mode) {
PlrInputFlag newflags = plr->inputflags;
PlrInputFlag keyflag = key_to_inflag(key);
@@ -771,7 +771,7 @@ bool player_event_with_replay(Player *plr, uint8_t type, uint16_t value) {
}
// free-axis movement
-bool player_applymovement_gamepad(Player *plr) {
+static bool player_applymovement_gamepad(Player *plr) {
if(!plr->axis_lr && !plr->axis_ud) {
if(plr->gamepadmove) {
plr->gamepadmove = false;
diff --git a/src/plrmodes/marisa_b.c b/src/plrmodes/marisa_b.c
index 78f07f88..2f285642 100644
--- a/src/plrmodes/marisa_b.c
+++ b/src/plrmodes/marisa_b.c
@@ -253,14 +253,14 @@ static void marisa_star_bombbg(Player *plr) {
}
static void marisa_star_respawn_slaves(Player *plr, short npow) {
- Enemy *e = plr->slaves.first, *tmp;
double dmg = 56;
- while(e != 0) {
- tmp = e;
- e = e->next;
- if(tmp->hp == ENEMY_IMMUNE)
- delete_enemy(&plr->slaves, tmp);
+ for(Enemy *e = plr->slaves.first, *next; e; e = next) {
+ next = e->next;
+
+ if(e->hp == ENEMY_IMMUNE) {
+ delete_enemy(&plr->slaves, e);
+ }
}
if(npow / 100 == 1) {
diff --git a/src/plrmodes/reimu_a.c b/src/plrmodes/reimu_a.c
index 9b781477..1cb95fc8 100644
--- a/src/plrmodes/reimu_a.c
+++ b/src/plrmodes/reimu_a.c
@@ -320,20 +320,20 @@ static int reimu_spirit_bomb_orb(Projectile *p, int t) {
p->pos += p->args[2];
for(int i = 0; i < 3 /*&& circlestrength < 1*/; i++) {
- complex pos = p->pos + 10 * cexp(I*2*M_PI/3*(i+t*0.1));
- complex v = global.plr.pos - pos;
- v *= 3 * circlestrength / cabs(v);
+ complex trail_pos = p->pos + 10 * cexp(I*2*M_PI/3*(i+t*0.1));
+ complex trail_vel = global.plr.pos - trail_pos;
+ trail_vel *= 3 * circlestrength / cabs(trail_vel);
PARTICLE(
.sprite_ptr = get_sprite("part/stain"),
// .color = reimu_spirit_orb_color(&(Color){0}, i),
.color = HSLA(t/p->timeout, 0.3, 0.3, 0.0),
- .pos = pos,
+ .pos = trail_pos,
.angle = 2*M_PI*frand(),
.timeout = 30,
.draw_rule = ScaleFade,
.rule = reimu_spirit_bomb_orb_trail,
- .args = { v, 0, 0.4 },
+ .args = { trail_vel, 0, 0.4 },
);
}
@@ -635,7 +635,7 @@ static void reimu_spirit_power(Player *plr, short npow) {
}
}
-double reimu_spirit_property(Player *plr, PlrProperty prop) {
+static double reimu_spirit_property(Player *plr, PlrProperty prop) {
double base_value = reimu_common_property(plr, prop);
switch(prop) {
diff --git a/src/renderer/api.h b/src/renderer/api.h
index ec65ca4f..778c8def 100644
--- a/src/renderer/api.h
+++ b/src/renderer/api.h
@@ -446,8 +446,9 @@ UniformType r_uniform_type(Uniform *uniform);
void r_uniform_ptr_unsafe(Uniform *uniform, uint offset, uint count, void *data);
#define _R_UNIFORM_GENERIC(suffix, uniform, ...) (_Generic((uniform), \
- char* : _r_uniform_##suffix, \
- Uniform* : _r_uniform_ptr_##suffix \
+ char* : _r_uniform_##suffix, \
+ const char* : _r_uniform_##suffix, \
+ Uniform* : _r_uniform_ptr_##suffix \
))(uniform, __VA_ARGS__)
void _r_uniform_ptr_float(Uniform *uniform, float value);
@@ -576,12 +577,19 @@ void _r_uniform_ptr_sampler(Uniform *uniform, const char *tex) attr_nonnull(2);
void _r_uniform_sampler(const char *uniform, const char *tex) attr_nonnull(1, 2);
#define r_uniform_sampler(uniform, tex) (_Generic((uniform), \
char* : _Generic((tex), \
- char* : _r_uniform_sampler, \
- Texture* : _r_uniform_sampler_ptr \
+ char* : _r_uniform_sampler, \
+ const char* : _r_uniform_sampler, \
+ Texture* : _r_uniform_sampler_ptr \
+ ), \
+ const char* : _Generic((tex), \
+ char* : _r_uniform_sampler, \
+ const char* : _r_uniform_sampler, \
+ Texture* : _r_uniform_sampler_ptr \
), \
Uniform* : _Generic((tex), \
- char* : _r_uniform_ptr_sampler, \
- Texture* : _r_uniform_ptr_sampler_ptr \
+ char* : _r_uniform_ptr_sampler, \
+ const char* : _r_uniform_ptr_sampler, \
+ Texture* : _r_uniform_ptr_sampler_ptr \
) \
))(uniform, tex)
@@ -590,11 +598,15 @@ void _r_uniform_sampler_array_ptr(const char *uniform, uint offset, uint count,
void _r_uniform_ptr_sampler_array(Uniform *uniform, uint offset, uint count, const char *values[count]) attr_nonnull(4);
void _r_uniform_sampler_array(const char *uniform, uint offset, uint count, const char *values[count]) attr_nonnull(4);
#define r_uniform_sampler_array(uniform, offset, count, values) (_Generic(uniform, \
- char* : _Generic((values), \
+ char* : _Generic((values), \
char** : _r_uniform_sampler_array, \
Texture** : _r_uniform_sampler_array_ptr \
), \
- Uniform* : _Generic((values), \
+ const char* : _Generic((values), \
+ char** : _r_uniform_sampler_array, \
+ Texture** : _r_uniform_sampler_array_ptr \
+ ), \
+ Uniform* : _Generic((values), \
char** : _r_uniform_ptr_sampler_array, \
Texture** : _r_uniform_ptr_sampler_array_ptr \
) \
diff --git a/src/renderer/common/shader_glsl.c b/src/renderer/common/shader_glsl.c
index d7a7e3c1..0ff52e1f 100644
--- a/src/renderer/common/shader_glsl.c
+++ b/src/renderer/common/shader_glsl.c
@@ -116,7 +116,7 @@ static GLSLVersion glsl_parse_version_directive(GLSLFileParseState *fstate, char
return version;
}
-bool glsl_try_write_header(GLSLFileParseState *fstate) {
+static bool glsl_try_write_header(GLSLFileParseState *fstate) {
if(fstate->global->version_defined) {
return true;
}
diff --git a/src/renderer/gl33/shader_program.c b/src/renderer/gl33/shader_program.c
index 2aef2996..cf243530 100644
--- a/src/renderer/gl33/shader_program.c
+++ b/src/renderer/gl33/shader_program.c
@@ -308,8 +308,8 @@ static bool cache_uniforms(ShaderProgram *prog) {
continue;
}
- for(int i = 0; i < sizeof(magical_unfiroms)/sizeof(MagicalUniform); ++i) {
- MagicalUniform *m = magical_unfiroms + i;
+ for(int j = 0; j < sizeof(magical_unfiroms)/sizeof(MagicalUniform); ++j) {
+ MagicalUniform *m = magical_unfiroms + j;
if(!strcmp(name, m->name) && uni.type != m->type) {
log_warn("Magical uniform '%s' must be of type '%s'", name, m->typename);
diff --git a/src/renderer/glcommon/shaders.c b/src/renderer/glcommon/shaders.c
index 33e0d924..fd15a091 100644
--- a/src/renderer/glcommon/shaders.c
+++ b/src/renderer/glcommon/shaders.c
@@ -43,7 +43,7 @@ static void add_glsl_version_parsed(GLSLVersion v) {
if(v.profile == GLSL_PROFILE_NONE) {
v.profile = GLSL_PROFILE_CORE;
- ShaderLangInfo *lang = alloc_lang();
+ lang = alloc_lang();
lang->lang = SHLANG_GLSL;
lang->glsl.version = v;
}
diff --git a/src/renderer/null/null.c b/src/renderer/null/null.c
index b9d99234..264695c6 100644
--- a/src/renderer/null/null.c
+++ b/src/renderer/null/null.c
@@ -15,98 +15,98 @@
static char placeholder;
static Color dummycolor;
-SDL_Window* null_create_window(const char *title, int x, int y, int w, int h, uint32_t flags) {
+static SDL_Window* null_create_window(const char *title, int x, int y, int w, int h, uint32_t flags) {
return SDL_CreateWindow(title, x, y, w, h, flags);
}
-void null_init(void) { }
-void null_post_init(void) { }
-void null_shutdown(void) { }
+static void null_init(void) { }
+static void null_post_init(void) { }
+static void null_shutdown(void) { }
-bool null_supports(RendererFeature feature) {
+static bool null_supports(RendererFeature feature) {
return true;
}
-void null_capabilities(r_capability_bits_t capbits) { }
-r_capability_bits_t null_capabilities_current(void) { return (r_capability_bits_t)-1; }
+static void null_capabilities(r_capability_bits_t capbits) { }
+static r_capability_bits_t null_capabilities_current(void) { return (r_capability_bits_t)-1; }
-void null_color4(float r, float g, float b, float a) { }
-const Color* null_color_current(void) { return &dummycolor; }
+static void null_color4(float r, float g, float b, float a) { }
+static const Color* null_color_current(void) { return &dummycolor; }
-void null_blend(BlendMode mode) { }
-BlendMode null_blend_current(void) { return BLEND_NONE; }
+static void null_blend(BlendMode mode) { }
+static BlendMode null_blend_current(void) { return BLEND_NONE; }
-void null_cull(CullFaceMode mode) { }
-CullFaceMode null_cull_current(void) { return CULL_BACK; }
+static void null_cull(CullFaceMode mode) { }
+static CullFaceMode null_cull_current(void) { return CULL_BACK; }
-void null_depth_func(DepthTestFunc func) { }
-DepthTestFunc null_depth_func_current(void) { return DEPTH_LESS; }
+static void null_depth_func(DepthTestFunc func) { }
+static DepthTestFunc null_depth_func_current(void) { return DEPTH_LESS; }
-bool null_shader_language_supported(const ShaderLangInfo *lang, ShaderLangInfo *out_alternative) { return true; }
+static bool null_shader_language_supported(const ShaderLangInfo *lang, ShaderLangInfo *out_alternative) { return true; }
-ShaderObject* null_shader_object_compile(ShaderSource *source) { return (void*)&placeholder; }
-void null_shader_object_destroy(ShaderObject *shobj) { }
-void null_shader_object_set_debug_label(ShaderObject *shobj, const char *label) { }
-const char* null_shader_object_get_debug_label(ShaderObject *shobj) { return "Null shader object"; }
+static ShaderObject* null_shader_object_compile(ShaderSource *source) { return (void*)&placeholder; }
+static void null_shader_object_destroy(ShaderObject *shobj) { }
+static void null_shader_object_set_debug_label(ShaderObject *shobj, const char *label) { }
+static const char* null_shader_object_get_debug_label(ShaderObject *shobj) { return "Null shader object"; }
-ShaderProgram* null_shader_program_link(uint num_objects, ShaderObject *shobjs[num_objects]) { return (void*)&placeholder; }
-void null_shader_program_destroy(ShaderProgram *prog) { }
-void null_shader_program_set_debug_label(ShaderProgram *prog, const char *label) { }
-const char* null_shader_program_get_debug_label(ShaderProgram *prog) { return "Null shader program"; }
+static ShaderProgram* null_shader_program_link(uint num_objects, ShaderObject *shobjs[num_objects]) { return (void*)&placeholder; }
+static void null_shader_program_destroy(ShaderProgram *prog) { }
+static void null_shader_program_set_debug_label(ShaderProgram *prog, const char *label) { }
+static const char* null_shader_program_get_debug_label(ShaderProgram *prog) { return "Null shader program"; }
-void null_shader(ShaderProgram *prog) { }
-ShaderProgram* null_shader_current(void) { return (void*)&placeholder; }
+static void null_shader(ShaderProgram *prog) { }
+static ShaderProgram* null_shader_current(void) { return (void*)&placeholder; }
-Uniform* null_shader_uniform(ShaderProgram *prog, const char *uniform_name) {
+static Uniform* null_shader_uniform(ShaderProgram *prog, const char *uniform_name) {
return NULL;
}
-void null_uniform(Uniform *uniform, uint offset, uint count, const void *data) { }
+static void null_uniform(Uniform *uniform, uint offset, uint count, const void *data) { }
-UniformType null_uniform_type(Uniform *uniform) { return UNIFORM_FLOAT; }
+static UniformType null_uniform_type(Uniform *uniform) { return UNIFORM_FLOAT; }
-void null_draw(VertexArray *varr, Primitive prim, uint first, uint count, uint instances, uint base_instance) { }
+static void null_draw(VertexArray *varr, Primitive prim, uint first, uint count, uint instances, uint base_instance) { }
-Texture* null_texture_create(const TextureParams *params) {
+static Texture* null_texture_create(const TextureParams *params) {
return (void*)&placeholder;
}
-void null_texture_get_size(Texture *tex, uint mipmap, uint *width, uint *height) {
+static void null_texture_get_size(Texture *tex, uint mipmap, uint *width, uint *height) {
if(width) *width = 1;
if(height) *height = 1;
}
-void null_texture_get_params(Texture *tex, TextureParams *params) {
+static void null_texture_get_params(Texture *tex, TextureParams *params) {
memset(params, 0, sizeof(*params));
params->width = 1;
params->height = 1;
params->type = TEX_TYPE_RGBA;
}
-void null_texture_set_debug_label(Texture *tex, const char *label) { }
-const char* null_texture_get_debug_label(Texture *tex) { return "null texture"; }
-void null_texture_set_filter(Texture *tex, TextureFilterMode fmin, TextureFilterMode fmag) { }
-void null_texture_set_wrap(Texture *tex, TextureWrapMode fmin, TextureWrapMode fmag) { }
-void null_texture_fill(Texture *tex, uint mipmap, const Pixmap *image_data) { }
-void null_texture_fill_region(Texture *tex, uint mipmap, uint x, uint y, const Pixmap *image_data) { }
-void null_texture_invalidate(Texture *tex) { }
-void null_texture_destroy(Texture *tex) { }
-void null_texture_clear(Texture *tex, const Color *color) { }
+static void null_texture_set_debug_label(Texture *tex, const char *label) { }
+static const char* null_texture_get_debug_label(Texture *tex) { return "null texture"; }
+static void null_texture_set_filter(Texture *tex, TextureFilterMode fmin, TextureFilterMode fmag) { }
+static void null_texture_set_wrap(Texture *tex, TextureWrapMode fmin, TextureWrapMode fmag) { }
+static void null_texture_fill(Texture *tex, uint mipmap, const Pixmap *image_data) { }
+static void null_texture_fill_region(Texture *tex, uint mipmap, uint x, uint y, const Pixmap *image_data) { }
+static void null_texture_invalidate(Texture *tex) { }
+static void null_texture_destroy(Texture *tex) { }
+static void null_texture_clear(Texture *tex, const Color *color) { }
static IntRect default_fb_viewport;
-Framebuffer* null_framebuffer_create(void) { return (void*)&placeholder; }
-void null_framebuffer_set_debug_label(Framebuffer *fb, const char *label) { }
-const char* null_framebuffer_get_debug_label(Framebuffer *fb) { return "null framebuffer"; }
-void null_framebuffer_attach(Framebuffer *framebuffer, Texture *tex, uint mipmap, FramebufferAttachment attachment) { }
-Texture* null_framebuffer_attachment(Framebuffer *framebuffer, FramebufferAttachment attachment) { return (void*)&placeholder; }
-uint null_framebuffer_attachment_mipmap(Framebuffer *framebuffer, FramebufferAttachment attachment) { return 0; }
-void null_framebuffer_destroy(Framebuffer *framebuffer) { }
-void null_framebuffer_viewport(Framebuffer *framebuffer, IntRect vp) { }
-void null_framebuffer_viewport_current(Framebuffer *framebuffer, IntRect *vp) { *vp = default_fb_viewport; }
-void null_framebuffer(Framebuffer *framebuffer) { }
-Framebuffer* null_framebuffer_current(void) { return (void*)&placeholder; }
-void null_framebuffer_clear(Framebuffer *framebuffer, ClearBufferFlags flags, const Color *colorval, float depthval) { }
+static Framebuffer* null_framebuffer_create(void) { return (void*)&placeholder; }
+static void null_framebuffer_set_debug_label(Framebuffer *fb, const char *label) { }
+static const char* null_framebuffer_get_debug_label(Framebuffer *fb) { return "null framebuffer"; }
+static void null_framebuffer_attach(Framebuffer *framebuffer, Texture *tex, uint mipmap, FramebufferAttachment attachment) { }
+static Texture* null_framebuffer_attachment(Framebuffer *framebuffer, FramebufferAttachment attachment) { return (void*)&placeholder; }
+static uint null_framebuffer_attachment_mipmap(Framebuffer *framebuffer, FramebufferAttachment attachment) { return 0; }
+static void null_framebuffer_destroy(Framebuffer *framebuffer) { }
+static void null_framebuffer_viewport(Framebuffer *framebuffer, IntRect vp) { }
+static void null_framebuffer_viewport_current(Framebuffer *framebuffer, IntRect *vp) { *vp = default_fb_viewport; }
+static void null_framebuffer(Framebuffer *framebuffer) { }
+static Framebuffer* null_framebuffer_current(void) { return (void*)&placeholder; }
+static void null_framebuffer_clear(Framebuffer *framebuffer, ClearBufferFlags flags, const Color *colorval, float depthval) { }
static int64_t null_vertex_buffer_stream_seek(SDL_RWops *rw, int64_t offset, int whence) { return 0; }
static int64_t null_vertex_buffer_stream_size(SDL_RWops *rw) { return (1 << 16); }
@@ -126,45 +126,41 @@ static SDL_RWops dummy_stream = {
.close = null_vertex_buffer_stream_close,
};
-SDL_RWops* null_vertex_buffer_get_stream(VertexBuffer *vbuf) {
+static SDL_RWops* null_vertex_buffer_get_stream(VertexBuffer *vbuf) {
return &dummy_stream;
}
-VertexBuffer* null_vertex_buffer_create(size_t capacity, void *data) { return (void*)&placeholder; }
-void null_vertex_buffer_set_debug_label(VertexBuffer *vbuf, const char *label) { }
-const char* null_vertex_buffer_get_debug_label(VertexBuffer *vbuf) { return "null vertex buffer"; }
-void null_vertex_buffer_destroy(VertexBuffer *vbuf) { }
-void null_vertex_buffer_invalidate(VertexBuffer *vbuf) { }
+static VertexBuffer* null_vertex_buffer_create(size_t capacity, void *data) { return (void*)&placeholder; }
+static void null_vertex_buffer_set_debug_label(VertexBuffer *vbuf, const char *label) { }
+static const char* null_vertex_buffer_get_debug_label(VertexBuffer *vbuf) { return "null vertex buffer"; }
+static void null_vertex_buffer_destroy(VertexBuffer *vbuf) { }
+static void null_vertex_buffer_invalidate(VertexBuffer *vbuf) { }
-IndexBuffer* null_index_buffer_create(size_t max_elements) { return (void*)&placeholder; }
-size_t null_index_buffer_get_capacity(IndexBuffer *ibuf) { return UINT32_MAX; }
-const char* null_index_buffer_get_debug_label(IndexBuffer *ibuf) { return "null index buffer"; }
-void null_index_buffer_set_debug_label(IndexBuffer *ibuf, const char *label) { }
-void null_index_buffer_set_offset(IndexBuffer *ibuf, size_t offset) { }
-size_t null_index_buffer_get_offset(IndexBuffer *ibuf) { return 0; }
-void null_index_buffer_add_indices(IndexBuffer *ibuf, uint index_ofs, size_t num_elements, uint indices[num_elements]) { }
-void null_index_buffer_destroy(IndexBuffer *ibuf) { }
+static IndexBuffer* null_index_buffer_create(size_t max_elements) { return (void*)&placeholder; }
+static size_t null_index_buffer_get_capacity(IndexBuffer *ibuf) { return UINT32_MAX; }
+static const char* null_index_buffer_get_debug_label(IndexBuffer *ibuf) { return "null index buffer"; }
+static void null_index_buffer_set_debug_label(IndexBuffer *ibuf, const char *label) { }
+static void null_index_buffer_set_offset(IndexBuffer *ibuf, size_t offset) { }
+static size_t null_index_buffer_get_offset(IndexBuffer *ibuf) { return 0; }
+static void null_index_buffer_add_indices(IndexBuffer *ibuf, uint index_ofs, size_t num_elements, uint indices[num_elements]) { }
+static void null_index_buffer_destroy(IndexBuffer *ibuf) { }
-VertexArray* null_vertex_array_create(void) { return (void*)&placeholder; }
-void null_vertex_array_set_debug_label(VertexArray *varr, const char *label) { }
-const char* null_vertex_array_get_debug_label(VertexArray *varr) { return "null vertex array"; }
-void null_vertex_array_destroy(VertexArray *varr) { }
-void null_vertex_array_attach_vertex_buffer(VertexArray *varr, VertexBuffer *vbuf, uint attachment) { }
-void null_vertex_array_attach_index_buffer(VertexArray *varr, IndexBuffer *vbuf) { }
-VertexBuffer* null_vertex_array_get_vertex_attachment(VertexArray *varr, uint attachment) { return (void*)&placeholder; }
-IndexBuffer* null_vertex_array_get_index_attachment(VertexArray *varr) { return (void*)&placeholder; }
-void null_vertex_array_layout(VertexArray *varr, uint nattribs, VertexAttribFormat attribs[nattribs]) { }
+static VertexArray* null_vertex_array_create(void) { return (void*)&placeholder; }
+static void null_vertex_array_set_debug_label(VertexArray *varr, const char *label) { }
+static const char* null_vertex_array_get_debug_label(VertexArray *varr) { return "null vertex array"; }
+static void null_vertex_array_destroy(VertexArray *varr) { }
+static void null_vertex_array_attach_vertex_buffer(VertexArray *varr, VertexBuffer *vbuf, uint attachment) { }
+static void null_vertex_array_attach_index_buffer(VertexArray *varr, IndexBuffer *vbuf) { }
+static VertexBuffer* null_vertex_array_get_vertex_attachment(VertexArray *varr, uint attachment) { return (void*)&placeholder; }
+static IndexBuffer* null_vertex_array_get_index_attachment(VertexArray *varr) { return (void*)&placeholder; }
+static void null_vertex_array_layout(VertexArray *varr, uint nattribs, VertexAttribFormat attribs[nattribs]) { }
-void null_clear(ClearBufferFlags flags) { }
-void null_clear_color4(float r, float g, float b, float a) { }
-const Color* null_clear_color_current(void) { return &dummycolor; }
+static void null_vsync(VsyncMode mode) { }
+static VsyncMode null_vsync_current(void) { return VSYNC_NONE; }
-void null_vsync(VsyncMode mode) { }
-VsyncMode null_vsync_current(void) { return VSYNC_NONE; }
+static void null_swap(SDL_Window *window) { }
-void null_swap(SDL_Window *window) { }
-
-bool null_screenshot(Pixmap *dest) { return false; }
+static bool null_screenshot(Pixmap *dest) { return false; }
RendererBackend _r_backend_null = {
.name = "null",
diff --git a/src/resource/font.c b/src/resource/font.c
index 98678d44..1ad1f884 100644
--- a/src/resource/font.c
+++ b/src/resource/font.c
@@ -427,7 +427,7 @@ static bool add_glyph_to_spritesheets(Font *font, Sprite *sprite, Pixmap *pixmap
return add_glyph_to_spritesheet(font, sprite, pixmap, add_spritesheet(font, spritesheets));
}
-static const char *const pixmode_name(FT_Pixel_Mode mode) {
+static const char* pixmode_name(FT_Pixel_Mode mode) {
switch(mode) {
case FT_PIXEL_MODE_NONE : return "FT_PIXEL_MODE_NONE";
case FT_PIXEL_MODE_MONO : return "FT_PIXEL_MODE_MONO";
diff --git a/src/resource/resource.c b/src/resource/resource.c
index 0ba4b277..b2a33d90 100644
--- a/src/resource/resource.c
+++ b/src/resource/resource.c
@@ -232,7 +232,7 @@ static void load_resource_async(InternalResource *ires, char *path, char *name,
ires->async_task = taskmgr_global_submit((TaskParams) { load_resource_async_task, data });
}
-void load_resource(InternalResource *ires, const char *path, const char *name, ResourceFlags flags, bool async) {
+static void load_resource(InternalResource *ires, const char *path, const char *name, ResourceFlags flags, bool async) {
ResourceHandler *handler = get_ires_handler(ires);
const char *typename = type_name(handler->type);
char *allocated_path = NULL;
diff --git a/src/resource/texture.c b/src/resource/texture.c
index f246e8dc..e70766a4 100644
--- a/src/resource/texture.c
+++ b/src/resource/texture.c
@@ -529,30 +529,6 @@ void end_draw_texture(void) {
draw_texture_state.drawing = false;
}
-void draw_texture_p(float x, float y, Texture *tex) {
- uint tw, th;
- r_texture_get_size(tex, 0, &tw, &th);
- begin_draw_texture((FloatRect){ x, y, tw, th }, (FloatRect){ 0, 0, tw, th }, tex);
- r_draw_quad();
- end_draw_texture();
-}
-
-void draw_texture(float x, float y, const char *name) {
- draw_texture_p(x, y, get_tex(name));
-}
-
-void draw_texture_with_size_p(float x, float y, float w, float h, Texture *tex) {
- uint tw, th;
- r_texture_get_size(tex, 0, &tw, &th);
- begin_draw_texture((FloatRect){ x, y, w, h }, (FloatRect){ 0, 0, tw, th }, tex);
- r_draw_quad();
- end_draw_texture();
-}
-
-void draw_texture_with_size(float x, float y, float w, float h, const char *name) {
- draw_texture_with_size_p(x, y, w, h, get_tex(name));
-}
-
void fill_viewport(float xoff, float yoff, float ratio, const char *name) {
fill_viewport_p(xoff, yoff, ratio, 1, 0, get_tex(name));
}
diff --git a/src/resource/texture.h b/src/resource/texture.h
index 680c6d1e..1d4347a1 100644
--- a/src/resource/texture.h
+++ b/src/resource/texture.h
@@ -23,9 +23,6 @@ bool check_texture_path(const char *path);
void begin_draw_texture(FloatRect dest, FloatRect frag, Texture *tex);
void end_draw_texture(void);
-void draw_texture_with_size(float x, float y, float w, float h, const char *name);
-void draw_texture_with_size_p(float x, float y, float w, float h, Texture *tex);
-
void fill_viewport(float xoff, float yoff, float ratio, const char *name);
void fill_viewport_p(float xoff, float yoff, float ratio, float aspect, float angle, Texture *tex);
diff --git a/src/stage.c b/src/stage.c
index 20406c05..d11c7cc6 100644
--- a/src/stage.c
+++ b/src/stage.c
@@ -317,7 +317,7 @@ static bool stage_input_common(SDL_Event *event, void *arg) {
return false;
}
-bool stage_input_handler_gameplay(SDL_Event *event, void *arg) {
+static bool stage_input_handler_gameplay(SDL_Event *event, void *arg) {
TaiseiEvent type = TAISEI_EVENT(event->type);
int32_t code = event->user.code;
@@ -362,12 +362,12 @@ bool stage_input_handler_gameplay(SDL_Event *event, void *arg) {
return false;
}
-bool stage_input_handler_replay(SDL_Event *event, void *arg) {
+static bool stage_input_handler_replay(SDL_Event *event, void *arg) {
stage_input_common(event, arg);
return false;
}
-void replay_input(void) {
+static void replay_input(void) {
ReplayStage *s = global.replay_stage;
int i;
@@ -406,7 +406,7 @@ void replay_input(void) {
player_applymovement(&global.plr);
}
-void stage_input(void) {
+static void stage_input(void) {
events_poll((EventHandler[]){
{ .proc = stage_input_handler_gameplay },
{NULL}
diff --git a/src/stagedraw.c b/src/stagedraw.c
index d0563f18..0d85f5e4 100644
--- a/src/stagedraw.c
+++ b/src/stagedraw.c
@@ -485,8 +485,9 @@ static void draw_spellbg(int t) {
Boss *b = global.boss;
b->current->draw_rule(b, t);
- if(b->current->type == AT_ExtraSpell)
+ if(b->current->type == AT_ExtraSpell) {
draw_extraspell_bg(b, t);
+ }
r_mat_push();
r_mat_translate(creal(b->pos), cimag(b->pos), 0);
@@ -501,11 +502,17 @@ static void draw_spellbg(int t) {
r_mat_pop();
float delay = ATTACK_START_DELAY;
- if(b->current->type == AT_ExtraSpell)
+
+ if(b->current->type == AT_ExtraSpell) {
delay = ATTACK_START_DELAY_EXTRA;
- float f = (-t+ATTACK_START_DELAY)/(delay+ATTACK_START_DELAY);
- if(f > 0)
- draw_wall_of_text(f, b->current->name);
+ }
+
+ {
+ float f = (-t+ATTACK_START_DELAY) / (delay+ATTACK_START_DELAY);
+ if(f > 0) {
+ draw_wall_of_text(f, b->current->name);
+ }
+ }
if(t < ATTACK_START_DELAY && b->dialog) {
r_mat_push();
@@ -992,7 +999,7 @@ static void draw_label(const char *label_str, double y_ofs, struct labels_s* lab
});
}
-void stage_draw_hud_text(struct labels_s* labels) {
+static void stage_draw_hud_text(struct labels_s* labels) {
char buf[64];
Font *font;
diff --git a/src/stages/stage1_events.c b/src/stages/stage1_events.c
index 6cce982e..bed2a2e8 100644
--- a/src/stages/stage1_events.c
+++ b/src/stages/stage1_events.c
@@ -27,14 +27,14 @@ static Dialog *stage1_dialog_post_boss(void) {
return d;
}
-void cirno_intro(Boss *c, int time) {
+static void cirno_intro(Boss *c, int time) {
if(time < 0)
return;
GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.035);
}
-int cirno_snowflake_proj(Projectile *p, int time) {
+static int cirno_snowflake_proj(Projectile *p, int time) {
if(time < 0)
return ACTION_ACK;
@@ -65,7 +65,7 @@ int cirno_snowflake_proj(Projectile *p, int time) {
return 1;
}
-void cirno_icy(Boss *b, int time) {
+static void cirno_icy(Boss *b, int time) {
int interval = 70 - 8 * global.diff;
int t = time % interval;
int run = time / interval;
@@ -85,7 +85,6 @@ void cirno_icy(Boss *b, int time) {
for(int i = 0; i < c; i++) {
double ang = 2*M_PI/c*i+run*515;
complex phase = cexp(I*ang);
-
complex pos = b->pos+vel*t+dr*_i*phase;
PROJECTILE(
@@ -109,15 +108,17 @@ void cirno_icy(Boss *b, int time) {
);
int split = 3;
+
if(_i > split) {
complex pos0 = b->pos+vel*t+dr*split*phase;
+
for(int j = -1; j <= 1; j+=2) {
complex phase2 = cexp(I*M_PI/4*j)*phase;
- complex pos = pos0+(dr*(_i-split))*phase2;
+ complex pos2 = pos0+(dr*(_i-split))*phase2;
PROJECTILE(
.proto = pp_crystal,
- .pos = pos,
+ .pos = pos2,
.color = RGB(0.0,0.3*size/5,1),
.rule = cirno_snowflake_proj,
.args = { vel, _i },
@@ -130,13 +131,6 @@ void cirno_icy(Boss *b, int time) {
}
}
-void cirno_mid_outro(Boss *c, int time) {
- if(time < 0)
- return;
-
- GO_TO(c, -300.0*I, 0.035);
-}
-
static Projectile* spawn_stain(complex pos, float angle, int to) {
return PARTICLE(
.sprite = "stain",
@@ -149,7 +143,7 @@ static Projectile* spawn_stain(complex pos, float angle, int to) {
);
}
-int cirno_pfreeze_frogs(Projectile *p, int t) {
+static int cirno_pfreeze_frogs(Projectile *p, int t) {
if(t < 0)
return ACTION_ACK;
@@ -264,7 +258,7 @@ void cirno_pfreeze_bg(Boss *c, int time) {
r_color4(1.0, 1.0, 1.0, 1.0);
}
-void cirno_mid_flee(Boss *c, int time) {
+static void cirno_mid_flee(Boss *c, int time) {
if(time >= 0) {
GO_TO(c, -250 + 30 * I, 0.02)
}
@@ -277,7 +271,7 @@ Boss* stage1_spawn_cirno(complex pos) {
return cirno;
}
-Boss* create_cirno_mid(void) {
+static Boss* create_cirno_mid(void) {
Boss *cirno = stage1_spawn_cirno(VIEWPORT_W + 220 + 30.0*I);
boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro, NULL);
@@ -289,7 +283,7 @@ Boss* create_cirno_mid(void) {
return cirno;
}
-void cirno_intro_boss(Boss *c, int time) {
+static void cirno_intro_boss(Boss *c, int time) {
if(time < 0)
return;
TIMER(&time);
@@ -299,7 +293,7 @@ void cirno_intro_boss(Boss *c, int time) {
global.dialog = stage1_dialog_pre_boss();
}
-void cirno_iceplosion0(Boss *c, int time) {
+static void cirno_iceplosion0(Boss *c, int time) {
int t = time % 300;
TIMER(&t);
@@ -407,7 +401,7 @@ void cirno_crystal_rain(Boss *c, int time) {
GO_TO(c, VIEWPORT_W/2.0 + 100.0*I, 0.01);
}
-void cirno_iceplosion1(Boss *c, int time) {
+static void cirno_iceplosion1(Boss *c, int time) {
int t = time % 300;
TIMER(&t);
@@ -634,7 +628,7 @@ void cirno_snow_halation(Boss *c, int time) {
}
}
-int cirno_icicles(Projectile *p, int t) {
+static int cirno_icicles(Projectile *p, int t) {
int turn = 60;
if(t < 0) {
@@ -715,7 +709,7 @@ void cirno_icicle_fall(Boss *c, int time) {
}
-int cirno_crystal_blizzard_proj(Projectile *p, int time) {
+static int cirno_crystal_blizzard_proj(Projectile *p, int time) {
if(time < 0) {
return ACTION_ACK;
}
@@ -825,7 +819,8 @@ void cirno_benchmark(Boss* b, int t) {
}
}
-void cirno_superhardspellcard(Boss *c, int t) {
+attr_unused
+static void cirno_superhardspellcard(Boss *c, int t) {
// HOWTO: create a super hard spellcard in a few seconds
cirno_iceplosion0(c, t);
@@ -836,7 +831,7 @@ void cirno_superhardspellcard(Boss *c, int t) {
cirno_perfect_freeze(c, t);
}
-Boss *create_cirno(void) {
+static Boss *create_cirno(void) {
Boss* cirno = stage1_spawn_cirno(-230 + 100.0*I);
boss_add_attack(cirno, AT_Move, "Introduction", 2, 0, cirno_intro_boss, NULL);
@@ -855,7 +850,7 @@ Boss *create_cirno(void) {
return cirno;
}
-int stage1_burst(Enemy *e, int time) {
+static int stage1_burst(Enemy *e, int time) {
TIMER(&time);
AT(EVENT_KILLED) {
@@ -893,7 +888,7 @@ int stage1_burst(Enemy *e, int time) {
return 1;
}
-int stage1_circletoss(Enemy *e, int time) {
+static int stage1_circletoss(Enemy *e, int time) {
TIMER(&time);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, Power, 1, NULL);
@@ -928,7 +923,7 @@ int stage1_circletoss(Enemy *e, int time) {
return 1;
}
-int stage1_sinepass(Enemy *e, int time) {
+static int stage1_sinepass(Enemy *e, int time) {
TIMER(&time);
AT(EVENT_KILLED) {
tsrand_fill(2);
@@ -949,7 +944,7 @@ int stage1_sinepass(Enemy *e, int time) {
return 1;
}
-int stage1_drop(Enemy *e, int t) {
+static int stage1_drop(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, Power, frand()>0.8, NULL);
@@ -972,7 +967,7 @@ int stage1_drop(Enemy *e, int t) {
return 1;
}
-int stage1_circle(Enemy *e, int t) {
+static int stage1_circle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 3, Power, 2, NULL);
@@ -995,7 +990,7 @@ int stage1_circle(Enemy *e, int t) {
return 1;
}
-int stage1_multiburst(Enemy *e, int t) {
+static int stage1_multiburst(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 3, Power, 2, NULL);
@@ -1025,7 +1020,7 @@ int stage1_multiburst(Enemy *e, int t) {
return 1;
}
-int stage1_instantcircle(Enemy *e, int t) {
+static int stage1_instantcircle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, Power, 4, NULL);
@@ -1063,7 +1058,7 @@ int stage1_instantcircle(Enemy *e, int t) {
return 1;
}
-int stage1_tritoss(Enemy *e, int t) {
+static int stage1_tritoss(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 5, Power, 2, NULL);
diff --git a/src/stages/stage2_events.c b/src/stages/stage2_events.c
index dde0d3a4..bfc75571 100644
--- a/src/stages/stage2_events.c
+++ b/src/stages/stage2_events.c
@@ -28,7 +28,7 @@ static Dialog *stage2_dialog_post_boss(void) {
return d;
}
-int stage2_great_circle(Enemy *e, int t) {
+static int stage2_great_circle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 5, Power, 4, NULL);
@@ -73,7 +73,7 @@ int stage2_great_circle(Enemy *e, int t) {
return 1;
}
-int stage2_small_spin_circle(Enemy *e, int t) {
+static int stage2_small_spin_circle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, NULL);
@@ -106,7 +106,7 @@ int stage2_small_spin_circle(Enemy *e, int t) {
return 1;
}
-int stage2_aim(Enemy *e, int t) {
+static int stage2_aim(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Power, 2, NULL);
@@ -135,7 +135,7 @@ int stage2_aim(Enemy *e, int t) {
return 1;
}
-int stage2_sidebox_trail(Enemy *e, int t) { // creal(a[0]): velocity, cimag(a[0]): angle, a[1]: d angle/dt, a[2]: time of acceleration
+static int stage2_sidebox_trail(Enemy *e, int t) { // creal(a[0]): velocity, cimag(a[0]): angle, a[1]: d angle/dt, a[2]: time of acceleration
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, Power, 1, NULL);
@@ -161,7 +161,7 @@ int stage2_sidebox_trail(Enemy *e, int t) { // creal(a[0]): velocity, cimag(a[0]
return 1;
}
-int stage2_flea(Enemy *e, int t) {
+static int stage2_flea(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, NULL);
@@ -190,7 +190,7 @@ int stage2_flea(Enemy *e, int t) {
return 1;
}
-int stage2_accel_circle(Enemy *e, int t) {
+static int stage2_accel_circle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, Power, 3, NULL);
@@ -229,7 +229,7 @@ static void wriggle_intro_stage2(Boss *w, int t) {
w->pos = VIEWPORT_W/2 + 100.0*I + 300*(1.0-t/(4.0*FPS))*cexp(I*(3-t*0.04));
}
-int wriggle_bug(Projectile *p, int t) {
+static int wriggle_bug(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -246,7 +246,7 @@ int wriggle_bug(Projectile *p, int t) {
return ACTION_NONE;
}
-void wriggle_small_storm(Boss *w, int time) {
+static void wriggle_small_storm(Boss *w, int time) {
int t = time % 400;
TIMER(&t);
@@ -281,7 +281,7 @@ void wriggle_small_storm(Boss *w, int time) {
}
}
-void wiggle_mid_flee(Boss *w, int t) {
+static void wiggle_mid_flee(Boss *w, int t) {
if(t == 0)
aniplayer_queue(&w->ani, "fly", 0);
if(t >= 0) {
@@ -289,7 +289,7 @@ void wiggle_mid_flee(Boss *w, int t) {
}
}
-Boss *create_wriggle_mid(void) {
+static Boss *create_wriggle_mid(void) {
Boss* wriggle = create_boss("Wriggle", "wriggle", NULL, VIEWPORT_W + 150 - 30.0*I);
wriggle->glowcolor = *RGB(0.2, 0.4, 0.5);
wriggle->shadowcolor = *RGBA_MUL_ALPHA(0.4, 0.2, 0.6, 0.5);
@@ -302,7 +302,7 @@ Boss *create_wriggle_mid(void) {
return wriggle;
}
-void hina_intro(Boss *h, int time) {
+static void hina_intro(Boss *h, int time) {
TIMER(&time);
AT(100)
@@ -311,7 +311,7 @@ void hina_intro(Boss *h, int time) {
GO_TO(h, VIEWPORT_W/2 + 100.0*I, 0.05);
}
-void hina_cards1(Boss *h, int time) {
+static void hina_cards1(Boss *h, int time) {
int t = time % 500;
TIMER(&t);
@@ -361,7 +361,7 @@ void hina_amulet(Boss *h, int time) {
}
}
-void hina_cards2(Boss *h, int time) {
+static void hina_cards2(Boss *h, int time) {
int t = time % 500;
TIMER(&t);
@@ -520,7 +520,7 @@ static int timeout_deadproj_linear(Projectile *p, int time) {
return ACTION_NONE;
}
-int hina_monty_slave(Enemy *s, int time) {
+static int hina_monty_slave(Enemy *s, int time) {
if(time < 0) {
return 1;
}
@@ -552,7 +552,7 @@ int hina_monty_slave(Enemy *s, int time) {
return 1;
}
-void hina_monty_slave_visual(Enemy *s, int time, bool render) {
+static void hina_monty_slave_visual(Enemy *s, int time, bool render) {
Swirl(s, time, render);
if(!render) {
@@ -748,7 +748,7 @@ Boss* stage2_spawn_hina(complex pos) {
return hina;
}
-Boss *create_hina(void) {
+static Boss *create_hina(void) {
Boss *hina = stage2_spawn_hina(VIEWPORT_W + 150 + 100.0*I);
aniplayer_queue(&hina->ani,"main",3);
diff --git a/src/stages/stage3.h b/src/stages/stage3.h
index 4613019a..99cf0dad 100644
--- a/src/stages/stage3.h
+++ b/src/stages/stage3.h
@@ -38,4 +38,6 @@ extern struct stage3_spells_s {
extern StageProcs stage3_procs;
extern StageProcs stage3_spell_procs;
+void stage3_skip(int t);
+
#endif // IGUARD_stages_stage3_h
diff --git a/src/stages/stage3_events.c b/src/stages/stage3_events.c
index dfd4280c..7ea1be70 100644
--- a/src/stages/stage3_events.c
+++ b/src/stages/stage3_events.c
@@ -682,7 +682,7 @@ Boss* stage3_spawn_scuttle(complex pos) {
return scuttle;
}
-Boss* stage3_create_midboss(void) {
+static Boss* stage3_create_midboss(void) {
Boss *scuttle = stage3_spawn_scuttle(VIEWPORT_W/2 - 200.0*I);
boss_add_attack(scuttle, AT_Move, "Introduction", 1, 0, scuttle_intro, NULL);
@@ -1325,7 +1325,7 @@ Boss* stage3_spawn_wriggle_ex(complex pos) {
return wriggle;
}
-Boss* stage3_create_boss(void) {
+static Boss* stage3_create_boss(void) {
Boss *wriggle = stage3_spawn_wriggle_ex(VIEWPORT_W/2 - 200.0*I);
boss_add_attack(wriggle, AT_Move, "Introduction", 2, 0, stage3_boss_intro, NULL);
@@ -1341,8 +1341,6 @@ Boss* stage3_create_boss(void) {
return wriggle;
}
-void stage3_skip(int t);
-
void stage3_events(void) {
TIMER(&global.timer);
diff --git a/src/stages/stage4.h b/src/stages/stage4.h
index c412ea4e..6810408a 100644
--- a/src/stages/stage4.h
+++ b/src/stages/stage4.h
@@ -41,4 +41,6 @@ extern struct stage4_spells_s {
extern StageProcs stage4_procs;
extern StageProcs stage4_spell_procs;
+void stage4_skip(int t);
+
#endif // IGUARD_stages_stage4_h
diff --git a/src/stages/stage4_events.c b/src/stages/stage4_events.c
index 667f2bff..8ae591bd 100644
--- a/src/stages/stage4_events.c
+++ b/src/stages/stage4_events.c
@@ -39,7 +39,7 @@ static Dialog *stage4_dialog_post_boss(void) {
return d;
}
-int stage4_splasher(Enemy *e, int t) {
+static int stage4_splasher(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, Power, 3, Bomb, 1, NULL);
@@ -72,7 +72,7 @@ int stage4_splasher(Enemy *e, int t) {
return 1;
}
-int stage4_fodder(Enemy *e, int t) {
+static int stage4_fodder(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Power, 1, NULL);
@@ -95,8 +95,7 @@ int stage4_fodder(Enemy *e, int t) {
return 1;
}
-
-int stage4_partcircle(Enemy *e, int t) {
+static int stage4_partcircle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, Power, 1, NULL);
@@ -124,7 +123,7 @@ int stage4_partcircle(Enemy *e, int t) {
return 1;
}
-int stage4_cardbuster(Enemy *e, int t) {
+static int stage4_cardbuster(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, Power, 2, NULL);
@@ -155,7 +154,7 @@ int stage4_cardbuster(Enemy *e, int t) {
return 1;
}
-int stage4_backfire(Enemy *e, int t) {
+static int stage4_backfire(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 3, Power, 2, NULL);
@@ -185,7 +184,7 @@ int stage4_backfire(Enemy *e, int t) {
return 1;
}
-int stage4_bigcircle(Enemy *e, int t) {
+static int stage4_bigcircle(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, Power, 3, NULL);
@@ -233,7 +232,7 @@ int stage4_bigcircle(Enemy *e, int t) {
return 1;
}
-int stage4_explosive(Enemy *e, int t) {
+static int stage4_explosive(Enemy *e, int t) {
if(t == EVENT_KILLED || (t >= 100 && global.diff >= D_Normal)) {
int i;
@@ -267,7 +266,7 @@ int stage4_explosive(Enemy *e, int t) {
return 1;
}
-void KurumiSlave(Enemy *e, int t, bool render) {
+static void KurumiSlave(Enemy *e, int t, bool render) {
if(render) {
return;
}
@@ -288,11 +287,11 @@ void KurumiSlave(Enemy *e, int t, bool render) {
}
}
-void kurumi_intro(Boss *b, int t) {
+static void kurumi_intro(Boss *b, int t) {
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.03);
}
-int kurumi_burstslave(Enemy *e, int t) {
+static int kurumi_burstslave(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_BIRTH)
e->args[1] = e->args[0];
@@ -322,7 +321,6 @@ int kurumi_burstslave(Enemy *e, int t) {
return 1;
}
-
void kurumi_slaveburst(Boss *b, int time) {
int t = time % 400;
TIMER(&t);
@@ -342,7 +340,7 @@ void kurumi_slaveburst(Boss *b, int time) {
}
}
-int kurumi_spikeslave(Enemy *e, int t) {
+static int kurumi_spikeslave(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_BIRTH)
e->args[1] = e->args[0];
@@ -437,11 +435,11 @@ void kurumi_spell_bg(Boss *b, int time) {
r_color4(1, 1, 1, 1);
}
-void kurumi_outro(Boss *b, int time) {
+static void kurumi_outro(Boss *b, int time) {
b->pos += -5-I;
}
-void kurumi_global_rule(Boss *b, int time) {
+static void kurumi_global_rule(Boss *b, int time) {
// FIXME: avoid running this every frame!
if(b->current && ATTACK_IS_SPELL(b->current->type)) {
@@ -458,7 +456,7 @@ Boss* stage4_spawn_kurumi(complex pos) {
return b;
}
-Boss* create_kurumi_mid(void) {
+static Boss* create_kurumi_mid(void) {
Boss *b = stage4_spawn_kurumi(VIEWPORT_W/2-400.0*I);
boss_add_attack(b, AT_Move, "Introduction", 2, 0, kurumi_intro, NULL);
@@ -473,7 +471,7 @@ Boss* create_kurumi_mid(void) {
return b;
}
-int splitcard(Projectile *p, int t) {
+static int splitcard(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -491,7 +489,7 @@ int splitcard(Projectile *p, int t) {
return asymptotic(p, t);
}
-int stage4_supercard(Enemy *e, int t) {
+static int stage4_supercard(Enemy *e, int t) {
int time = t % 150;
TIMER(&t);
@@ -527,7 +525,7 @@ int stage4_supercard(Enemy *e, int t) {
return 1;
}
-void kurumi_boss_intro(Boss *b, int t) {
+static void kurumi_boss_intro(Boss *b, int t) {
TIMER(&t);
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.015);
@@ -552,7 +550,7 @@ static int splitcard_elly(Projectile *p, int t) {
return asymptotic(p, t);
}
-void kurumi_breaker(Boss *b, int time) {
+static void kurumi_breaker(Boss *b, int time) {
int t = time % 400;
int i;
@@ -594,7 +592,7 @@ void kurumi_breaker(Boss *b, int time) {
}
-int aniwall_bullet(Projectile *p, int t) {
+static int aniwall_bullet(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -613,7 +611,7 @@ int aniwall_bullet(Projectile *p, int t) {
return ACTION_NONE;
}
-int aniwall_slave(Enemy *e, int t) {
+static int aniwall_slave(Enemy *e, int t) {
float re, im;
if(t < 0)
@@ -662,7 +660,7 @@ int aniwall_slave(Enemy *e, int t) {
return 1;
}
-void KurumiAniWallSlave(Enemy *e, int t, bool render) {
+static void KurumiAniWallSlave(Enemy *e, int t, bool render) {
if(render) {
return;
}
@@ -700,7 +698,7 @@ void kurumi_aniwall(Boss *b, int time) {
}
}
-void kurumi_sbreaker(Boss *b, int time) {
+static void kurumi_sbreaker(Boss *b, int time) {
if(time < 0)
return;
@@ -738,7 +736,7 @@ void kurumi_sbreaker(Boss *b, int time) {
}
}
-int blowwall_slave(Enemy *e, int t) {
+static int blowwall_slave(Enemy *e, int t) {
float re, im;
if(t < 0)
@@ -886,7 +884,7 @@ static int kdanmaku_proj(Projectile *p, int t) {
return ACTION_NONE;
}
-int kdanmaku_slave(Enemy *e, int t) {
+static int kdanmaku_slave(Enemy *e, int t) {
float re;
if(t < 0)
@@ -958,14 +956,14 @@ void kurumi_danmaku(Boss *b, int time) {
}
}
-void kurumi_extra_shield_pos(Enemy *e, int time) {
+static void kurumi_extra_shield_pos(Enemy *e, int time) {
double dst = 75 + 100 * max((60 - time) / 60.0, 0);
double spd = cimag(e->args[0]) * min(time / 120.0, 1);
e->args[0] += spd;
e->pos = global.boss->pos + dst * cexp(I*creal(e->args[0]));
}
-bool kurumi_extra_shield_expire(Enemy *e, int time) {
+static bool kurumi_extra_shield_expire(Enemy *e, int time) {
if(time > creal(e->args[1])) {
e->hp = 0;
return true;
@@ -974,7 +972,7 @@ bool kurumi_extra_shield_expire(Enemy *e, int time) {
return false;
}
-int kurumi_extra_dead_shield_proj(Projectile *p, int time) {
+static int kurumi_extra_dead_shield_proj(Projectile *p, int time) {
if(time < 0) {
return ACTION_ACK;
}
@@ -987,7 +985,7 @@ int kurumi_extra_dead_shield_proj(Projectile *p, int time) {
return asymptotic(p, time);
}
-int kurumi_extra_dead_shield(Enemy *e, int time) {
+static int kurumi_extra_dead_shield(Enemy *e, int time) {
if(time < 0) {
return 1;
}
@@ -1020,7 +1018,7 @@ int kurumi_extra_dead_shield(Enemy *e, int time) {
return 1;
}
-int kurumi_extra_shield(Enemy *e, int time) {
+static int kurumi_extra_shield(Enemy *e, int time) {
if(time == EVENT_DEATH) {
if(global.boss && !global.game_over && !boss_is_dying(global.boss) && e->args[2] == 0) {
create_enemy2c(e->pos, ENEMY_IMMUNE, KurumiSlave, kurumi_extra_dead_shield, e->args[0], e->args[1]);
@@ -1040,7 +1038,7 @@ int kurumi_extra_shield(Enemy *e, int time) {
return 1;
}
-int kurumi_extra_bigfairy1(Enemy *e, int time) {
+static int kurumi_extra_bigfairy1(Enemy *e, int time) {
if(time < 0) {
return 1;
}
@@ -1070,7 +1068,7 @@ int kurumi_extra_bigfairy1(Enemy *e, int time) {
return 1;
}
-void kurumi_extra_drainer_draw(Projectile *p, int time) {
+static void kurumi_extra_drainer_draw(Projectile *p, int time) {
complex org = p->pos;
complex targ = p->args[1];
double a = 0.5 * creal(p->args[2]);
@@ -1088,7 +1086,7 @@ void kurumi_extra_drainer_draw(Projectile *p, int time) {
loop_tex_line_p(org, targ, 24, time * 0.003, tex);
}
-int kurumi_extra_drainer(Projectile *p, int time) {
+static int kurumi_extra_drainer(Projectile *p, int time) {
if(time == EVENT_DEATH) {
free_ref(p->args[0]);
return ACTION_ACK;
@@ -1122,7 +1120,7 @@ int kurumi_extra_drainer(Projectile *p, int time) {
return ACTION_NONE;
}
-void kurumi_extra_create_drainer(Enemy *e) {
+static void kurumi_extra_create_drainer(Enemy *e) {
PROJECTILE(
.size = 1+I,
.pos = e->pos,
@@ -1135,7 +1133,7 @@ void kurumi_extra_create_drainer(Enemy *e) {
);
}
-void kurumi_extra_swirl_visual(Enemy *e, int time, bool render) {
+static void kurumi_extra_swirl_visual(Enemy *e, int time, bool render) {
if(!render) {
// why the hell was this here?
// Swirl(e, time, render);
@@ -1148,7 +1146,7 @@ void kurumi_extra_swirl_visual(Enemy *e, int time, bool render) {
r_blend(BLEND_PREMUL_ALPHA);
}
-void kurumi_extra_fairy_visual(Enemy *e, int time, bool render) {
+static void kurumi_extra_fairy_visual(Enemy *e, int time, bool render) {
if(!render) {
Fairy(e, time, render);
return;
@@ -1161,7 +1159,7 @@ void kurumi_extra_fairy_visual(Enemy *e, int time, bool render) {
// r_blend(BLEND_ALPHA);
}
-void kurumi_extra_bigfairy_visual(Enemy *e, int time, bool render) {
+static void kurumi_extra_bigfairy_visual(Enemy *e, int time, bool render) {
if(!render) {
BigFairy(e, time, render);
return;
@@ -1174,7 +1172,7 @@ void kurumi_extra_bigfairy_visual(Enemy *e, int time, bool render) {
// r_blend(BLEND_ALPHA);
}
-int kurumi_extra_fairy(Enemy *e, int t) {
+static int kurumi_extra_fairy(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, NULL);
@@ -1336,7 +1334,7 @@ void kurumi_extra(Boss *b, int time) {
}
-Boss *create_kurumi(void) {
+static Boss *create_kurumi(void) {
Boss* b = stage4_spawn_kurumi(-400.0*I);
boss_add_attack(b, AT_Move, "Introduction", 4, 0, kurumi_boss_intro, NULL);
@@ -1423,8 +1421,6 @@ static int scythe_post_mid(Enemy *e, int t) {
return 1;
}
-void stage4_skip(int t);
-
void stage4_events(void) {
TIMER(&global.timer);
diff --git a/src/stages/stage5.h b/src/stages/stage5.h
index 63876bb4..a9537887 100644
--- a/src/stages/stage5.h
+++ b/src/stages/stage5.h
@@ -36,4 +36,6 @@ extern struct stage5_spells_s {
extern StageProcs stage5_procs;
extern StageProcs stage5_spell_procs;
+void stage5_skip(int t);
+
#endif // IGUARD_stages_stage5_h
diff --git a/src/stages/stage5_events.c b/src/stages/stage5_events.c
index cf98fc6d..043efd98 100644
--- a/src/stages/stage5_events.c
+++ b/src/stages/stage5_events.c
@@ -36,7 +36,7 @@ static Dialog *stage5_dialog_post_boss(void) {
return d;
}
-int stage5_greeter(Enemy *e, int t) {
+static int stage5_greeter(Enemy *e, int t) {
TIMER(&t)
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, Power, 2, NULL);
@@ -67,7 +67,7 @@ int stage5_greeter(Enemy *e, int t) {
return 1;
}
-int stage5_lightburst(Enemy *e, int t) {
+static int stage5_lightburst(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 2, NULL);
@@ -94,7 +94,7 @@ int stage5_lightburst(Enemy *e, int t) {
return 1;
}
-int stage5_swirl(Enemy *e, int t) {
+static int stage5_swirl(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 1, NULL);
@@ -115,7 +115,7 @@ int stage5_swirl(Enemy *e, int t) {
return 1;
}
-int stage5_limiter(Enemy *e, int t) {
+static int stage5_limiter(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 4, NULL);
@@ -133,7 +133,7 @@ int stage5_limiter(Enemy *e, int t) {
return 1;
}
-int stage5_laserfairy(Enemy *e, int t) {
+static int stage5_laserfairy(Enemy *e, int t) {
TIMER(&t)
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 5, Power, 5, NULL);
@@ -158,7 +158,7 @@ int stage5_laserfairy(Enemy *e, int t) {
return 1;
}
-int stage5_miner(Enemy *e, int t) {
+static int stage5_miner(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 2, NULL);
@@ -191,7 +191,7 @@ static void lightning_particle(complex pos, int t) {
}
}
-int stage5_magnetto(Enemy *e, int t) {
+static int stage5_magnetto(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
@@ -244,7 +244,7 @@ int stage5_magnetto(Enemy *e, int t) {
return 1;
}
-int stage5_explosion(Enemy *e, int t) {
+static int stage5_explosion(Enemy *e, int t) {
TIMER(&t)
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 5, Power, 5, Life, (int)creal(e->args[1]), NULL);
@@ -300,7 +300,7 @@ int stage5_explosion(Enemy *e, int t) {
return 1;
}
-void iku_slave_visual(Enemy *e, int t, bool render) {
+static void iku_slave_visual(Enemy *e, int t, bool render) {
if(render) {
return;
}
@@ -334,7 +334,7 @@ void iku_slave_visual(Enemy *e, int t, bool render) {
}
}
-void iku_mid_intro(Boss *b, int t) {
+static void iku_mid_intro(Boss *b, int t) {
TIMER(&t);
b->pos += -1-7.0*I+10*t*(cimag(b->pos)<-200);
@@ -349,7 +349,7 @@ void iku_mid_intro(Boss *b, int t) {
static void midboss_dummy(Boss *b, int t) { }
-Boss *create_iku_mid(void) {
+static Boss *create_iku_mid(void) {
Boss *b = create_boss("Bombs?", "iku_mid", 0, VIEWPORT_W+800.0*I);
b->glowcolor = *RGB(0.2, 0.4, 0.5);
b->shadowcolor = *RGBA_MUL_ALPHA(0.65, 0.2, 0.75, 0.5);
@@ -362,7 +362,7 @@ Boss *create_iku_mid(void) {
return b;
}
-int stage5_lightburst2(Enemy *e, int t) {
+static int stage5_lightburst2(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 4, NULL);
@@ -400,7 +400,7 @@ int stage5_lightburst2(Enemy *e, int t) {
return 1;
}
-int stage5_superbullet(Enemy *e, int t) {
+static int stage5_superbullet(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 3, NULL);
@@ -422,7 +422,7 @@ int stage5_superbullet(Enemy *e, int t) {
return 1;
}
-void iku_intro(Boss *b, int t) {
+static void iku_intro(Boss *b, int t) {
GO_TO(b, VIEWPORT_W/2+240.0*I, 0.015);
if(t == 160)
@@ -451,7 +451,7 @@ static void cloud_common(void) {
);
}
-void iku_bolts(Boss *b, int time) {
+static void iku_bolts(Boss *b, int time) {
int t = time % 400;
TIMER(&t);
@@ -532,7 +532,7 @@ void iku_atmospheric(Boss *b, int time) {
}
}
-complex bolts2_laser(Laser *l, float t) {
+static complex bolts2_laser(Laser *l, float t) {
if(t == EVENT_BIRTH) {
l->shader = r_shader_get_optional("lasers/iku_lightning");
return 0;
@@ -542,7 +542,7 @@ complex bolts2_laser(Laser *l, float t) {
return creal(l->args[0])+I*cimag(l->pos) + sign(cimag(l->args[0]-l->pos))*0.06*I*t*t + (20+4*diff)*sin(t*0.025*diff+creal(l->args[0]))*l->args[1];
}
-void iku_bolts2(Boss *b, int time) {
+static void iku_bolts2(Boss *b, int time) {
int t = time % 400;
TIMER(&t);
@@ -577,7 +577,7 @@ void iku_bolts2(Boss *b, int time) {
}
-int lightning_slave(Enemy *e, int t) {
+static int lightning_slave(Enemy *e, int t) {
if(t < 0)
return 1;
if(t > 200)
@@ -714,7 +714,7 @@ void iku_lightning(Boss *b, int time) {
}
}
-void iku_bolts3(Boss *b, int time) {
+static void iku_bolts3(Boss *b, int time) {
int t = time % 400;
TIMER(&t);
@@ -756,7 +756,7 @@ static complex induction_bullet_traj(Projectile *p, float t) {
return p->pos0 + p->args[0]*t*cexp(p->args[1]*t);
}
-int induction_bullet(Projectile *p, int time) {
+static int induction_bullet(Projectile *p, int time) {
if(time < 0) {
return ACTION_ACK;
}
@@ -781,7 +781,7 @@ int induction_bullet(Projectile *p, int time) {
return 1;
}
-complex cathode_laser(Laser *l, float t) {
+static complex cathode_laser(Laser *l, float t) {
if(t == EVENT_BIRTH) {
l->shader = r_shader_get_optional("lasers/iku_cathode");
return 0;
@@ -869,7 +869,7 @@ void iku_induction(Boss *b, int t) {
void iku_spell_bg(Boss *b, int t);
-Enemy* iku_extra_find_next_slave(complex from, double playerbias) {
+static Enemy* iku_extra_find_next_slave(complex from, double playerbias) {
Enemy *nearest = NULL, *e;
double dist, mindist = INFINITY;
@@ -891,7 +891,7 @@ Enemy* iku_extra_find_next_slave(complex from, double playerbias) {
return nearest;
}
-void iku_extra_slave_visual(Enemy *e, int t, bool render) {
+static void iku_extra_slave_visual(Enemy *e, int t, bool render) {
iku_slave_visual(e, t, render);
if(render) {
@@ -915,7 +915,7 @@ void iku_extra_slave_visual(Enemy *e, int t, bool render) {
}
}
-int iku_extra_trigger_bullet(Projectile *p, int t) {
+static int iku_extra_trigger_bullet(Projectile *p, int t) {
if(t == EVENT_DEATH) {
free_ref(p->args[1]);
return ACTION_ACK;
@@ -975,7 +975,7 @@ int iku_extra_trigger_bullet(Projectile *p, int t) {
return ACTION_NONE;
}
-void iku_extra_fire_trigger_bullet(void) {
+static void iku_extra_fire_trigger_bullet(void) {
Enemy *e = iku_extra_find_next_slave(global.boss->pos, 250);
aniplayer_queue(&global.boss->ani,"dashdown_left",1);
@@ -996,7 +996,7 @@ void iku_extra_fire_trigger_bullet(void) {
play_sound("shot2");
}
-int iku_extra_slave(Enemy *e, int t) {
+static int iku_extra_slave(Enemy *e, int t) {
GO_TO(e, e->args[0], 0.05);
if(e->args[1]) {
@@ -1114,7 +1114,7 @@ Boss* stage5_spawn_iku(complex pos) {
return b;
}
-Boss* create_iku(void) {
+static Boss* create_iku(void) {
Boss *b = stage5_spawn_iku(VIEWPORT_W/2-200.0*I);
boss_add_attack(b, AT_Move, "Introduction", 4, 0, iku_intro, NULL);
@@ -1136,8 +1136,6 @@ Boss* create_iku(void) {
return b;
}
-void stage5_skip(int t);
-
void stage5_events(void) {
TIMER(&global.timer);
diff --git a/src/stages/stage6.c b/src/stages/stage6.c
index dd26d9b4..2c795e6c 100644
--- a/src/stages/stage6.c
+++ b/src/stages/stage6.c
@@ -329,10 +329,6 @@ static void stage6_end(void) {
free_stage3d(&stage_3d_context);
}
-void elly_intro(Boss*, int);
-void elly_spawn_baryons(complex pos);
-int scythe_reset(Enemy *e, int t);
-
static void stage6_spellpractice_start(void) {
stage6_start();
skip_background_anim(stage6_update, 3800, &global.timer, &global.frames);
diff --git a/src/stages/stage6_events.c b/src/stages/stage6_events.c
index 93ed2198..fa48fe45 100644
--- a/src/stages/stage6_events.c
+++ b/src/stages/stage6_events.c
@@ -29,7 +29,7 @@ static Dialog *stage6_dialog_pre_final(void) {
return d;
}
-int stage6_hacker(Enemy *e, int t) {
+static int stage6_hacker(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 3, NULL);
@@ -54,7 +54,7 @@ int stage6_hacker(Enemy *e, int t) {
return 1;
}
-int stage6_side(Enemy *e, int t) {
+static int stage6_side(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 3, NULL);
@@ -86,7 +86,7 @@ int stage6_side(Enemy *e, int t) {
return 1;
}
-int wait_proj(Projectile *p, int t) {
+static int wait_proj(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -104,7 +104,7 @@ int wait_proj(Projectile *p, int t) {
return ACTION_NONE;
}
-int stage6_flowermine(Enemy *e, int t) {
+static int stage6_flowermine(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_KILLED) {
spawn_items(e->pos, Point, 4, Power, 3, NULL);
@@ -138,7 +138,7 @@ void scythe_common(Enemy *e, int t) {
e->args[1] += cimag(e->args[1]);
}
-int scythe_mid(Enemy *e, int t) {
+static int scythe_mid(Enemy *e, int t) {
TIMER(&t);
complex n;
@@ -183,7 +183,7 @@ int scythe_mid(Enemy *e, int t) {
return 1;
}
-void ScytheTrail(Projectile *p, int t) {
+static void ScytheTrail(Projectile *p, int t) {
r_mat_push();
r_mat_translate(creal(p->pos), cimag(p->pos), 0);
r_mat_rotate_deg(p->angle*180/M_PI+90, 0, 0, 1);
@@ -221,7 +221,7 @@ void Scythe(Enemy *e, int t, bool render) {
);
}
-int scythe_intro(Enemy *e, int t) {
+static int scythe_intro(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 0;
@@ -264,7 +264,7 @@ void elly_intro(Boss *b, int t) {
global.dialog = stage6_dialog_pre_boss();
}
-int scythe_infinity(Enemy *e, int t) {
+static int scythe_infinity(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 1;
@@ -325,7 +325,7 @@ static Enemy* find_scythe(void) {
return NULL;
}
-void elly_frequency(Boss *b, int t) {
+static void elly_frequency(Boss *b, int t) {
TIMER(&t);
Enemy *scythe;
@@ -352,7 +352,7 @@ static void elly_clap(Boss *b, int claptime) {
aniplayer_queue(&b->ani, "main", 0);
}
-int scythe_newton(Enemy *e, int t) {
+static int scythe_newton(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 1;
@@ -473,7 +473,7 @@ void elly_newton(Boss *b, int t) {
}
}
-int scythe_kepler(Enemy *e, int t) {
+static int scythe_kepler(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 1;
@@ -502,7 +502,7 @@ static ProjPrototype* kepler_pick_bullet(int tier) {
}
}
-int kepler_bullet(Projectile *p, int t) {
+static int kepler_bullet(Projectile *p, int t) {
TIMER(&t);
int tier = round(creal(p->args[1]));
@@ -597,7 +597,7 @@ void elly_kepler(Boss *b, int t) {
}
}
-void elly_frequency2(Boss *b, int t) {
+static void elly_frequency2(Boss *b, int t) {
TIMER(&t);
AT(0) {
@@ -621,7 +621,7 @@ void elly_frequency2(Boss *b, int t) {
}
}
-complex maxwell_laser(Laser *l, float t) {
+static complex maxwell_laser(Laser *l, float t) {
if(t == EVENT_BIRTH) {
l->unclearable = true;
l->shader = r_shader_get_optional("lasers/maxwell");
@@ -631,7 +631,7 @@ complex maxwell_laser(Laser *l, float t) {
return l->pos + l->args[0]*(t+I*creal(l->args[2])*t*0.02*sin(0.1*t+cimag(l->args[2])));
}
-void maxwell_laser_logic(Laser *l, int t) {
+static void maxwell_laser_logic(Laser *l, int t) {
static_laser(l, t);
TIMER(&t);
@@ -671,7 +671,7 @@ static void draw_baryon_connector(complex a, complex b) {
r_mat_pop();
}
-void Baryon(Enemy *e, int t, bool render) {
+static void Baryon(Enemy *e, int t, bool render) {
if(render) {
// the center piece draws the nodes; applying the postprocessing effect is easier this way.
return;
@@ -692,22 +692,22 @@ void Baryon(Enemy *e, int t, bool render) {
*/
}
-void draw_baryons(Enemy *e, int t) {
+static void draw_baryons(Enemy *bcenter, int t) {
// r_color4(1, 1, 1, 0.8);
r_mat_push();
- r_mat_translate(creal(e->pos), cimag(e->pos), 0);
+ r_mat_translate(creal(bcenter->pos), cimag(bcenter->pos), 0);
r_mat_rotate_deg(2*t, 0, 0, 1);
draw_sprite_batched(0, 0, "stage6/baryon_center");
r_mat_pop();
- draw_sprite_batched(creal(e->pos), cimag(e->pos), "stage6/baryon");
+ draw_sprite_batched(creal(bcenter->pos), cimag(bcenter->pos), "stage6/baryon");
r_color4(1, 1, 1, 1);
- Enemy *link0 = REF(creal(e->args[1]));
- Enemy *link1 = REF(cimag(e->args[1]));
+ Enemy *link0 = REF(creal(bcenter->args[1]));
+ Enemy *link1 = REF(cimag(bcenter->args[1]));
if(link0 && link1) {
- draw_baryon_connector(e->pos, link0->pos);
- draw_baryon_connector(e->pos, link1->pos);
+ draw_baryon_connector(bcenter->pos, link0->pos);
+ draw_baryon_connector(bcenter->pos, link1->pos);
}
for(Enemy *e = global.enemies.first; e; e = e->next) {
@@ -722,7 +722,7 @@ void draw_baryons(Enemy *e, int t) {
}
}
-void BaryonCenter(Enemy *e, int t, bool render) {
+static void BaryonCenter(Enemy *bcenter, int t, bool render) {
if(!render) {
/*
complex p = e->pos+40*frand()*cexp(2.0*I*M_PI*frand());
@@ -745,7 +745,7 @@ void BaryonCenter(Enemy *e, int t, bool render) {
}
if(config_get_int(CONFIG_POSTPROCESS) < 1) {
- draw_baryons(e, t);
+ draw_baryons(bcenter, t);
return;
}
@@ -776,7 +776,7 @@ void BaryonCenter(Enemy *e, int t, bool render) {
r_state_pop();
r_shader("sprite_default");
- draw_baryons(e, t);
+ draw_baryons(bcenter, t);
r_shader_standard();
fbpair_swap(&baryon_fbpair);
@@ -786,7 +786,7 @@ void BaryonCenter(Enemy *e, int t, bool render) {
r_color4(1, 1, 1, 1);
r_framebuffer(baryon_fbpair.front);
r_shader("sprite_default");
- draw_baryons(e, t);
+ draw_baryons(bcenter, t);
for(Enemy *e = global.enemies.first; e; e = e->next) {
if(e->visual_rule == Baryon) {
@@ -803,7 +803,7 @@ void BaryonCenter(Enemy *e, int t, bool render) {
}
}
-int baryon_unfold(Enemy *baryon, int t) {
+static int baryon_unfold(Enemy *baryon, int t) {
if(t < 0)
return 1; // not catching death for references! because there will be no death!
@@ -836,7 +836,7 @@ int baryon_unfold(Enemy *baryon, int t) {
return 1;
}
-int baryon_center(Enemy *e, int t) {
+static int baryon_center(Enemy *e, int t) {
if(t == EVENT_DEATH) {
free_ref(creal(e->args[1]));
free_ref(cimag(e->args[1]));
@@ -849,7 +849,7 @@ int baryon_center(Enemy *e, int t) {
return 1;
}
-int scythe_explode(Enemy *e, int t) {
+static int scythe_explode(Enemy *e, int t) {
if(t < 0) {
scythe_common(e, t);
return 0;
@@ -898,7 +898,7 @@ void elly_spawn_baryons(complex pos) {
e->ent.draw_layer = LAYER_BACKGROUND;
}
-void elly_paradigm_shift(Boss *b, int t) {
+static void elly_paradigm_shift(Boss *b, int t) {
if(global.stage->type == STAGE_SPELL) {
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.1)
} else if(t == 0) {
@@ -943,7 +943,7 @@ static void set_baryon_rule(EnemyLogicRule r) {
}
}
-int eigenstate_proj(Projectile *p, int t) {
+static int eigenstate_proj(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -955,7 +955,7 @@ int eigenstate_proj(Projectile *p, int t) {
return asymptotic(p, t);
}
-int baryon_eigenstate(Enemy *e, int t) {
+static int baryon_eigenstate(Enemy *e, int t) {
if(t < 0)
return 1;
@@ -990,7 +990,7 @@ int baryon_eigenstate(Enemy *e, int t) {
return 1;
}
-int baryon_reset(Enemy *baryon, int t) {
+static int baryon_reset(Enemy *baryon, int t) {
if(t < 0) {
return 1;
}
@@ -1020,7 +1020,7 @@ void elly_eigenstate(Boss *b, int t) {
set_baryon_rule(baryon_reset);
}
-int broglie_particle(Projectile *p, int t) {
+static int broglie_particle(Projectile *p, int t) {
if(t == EVENT_DEATH) {
free_ref(p->args[0]);
return ACTION_ACK;
@@ -1075,7 +1075,7 @@ int broglie_particle(Projectile *p, int t) {
#define BROGLIE_PERIOD (420 - 30 * global.diff)
-void broglie_laser_logic(Laser *l, int t) {
+static void broglie_laser_logic(Laser *l, int t) {
double hue = cimag(l->args[3]);
if(t == EVENT_BIRTH) {
@@ -1092,7 +1092,7 @@ void broglie_laser_logic(Laser *l, int t) {
l->width_exponent = 1.0 - 0.5 * charge;
}
-int broglie_charge(Projectile *p, int t) {
+static int broglie_charge(Projectile *p, int t) {
if(t == EVENT_BIRTH) {
play_sound_ex("shot3", 10, false);
}
@@ -1197,7 +1197,7 @@ int broglie_charge(Projectile *p, int t) {
return ACTION_NONE;
}
-int baryon_broglie(Enemy *e, int t) {
+static int baryon_broglie(Enemy *e, int t) {
if(t < 0) {
return 1;
}
@@ -1306,7 +1306,7 @@ void elly_broglie(Boss *b, int t) {
}
}
-int baryon_nattack(Enemy *e, int t) {
+static int baryon_nattack(Enemy *e, int t) {
if(t < 0)
return 1;
@@ -1419,7 +1419,7 @@ static int ricci_proj2(Projectile *p, int t) {
return ACTION_NONE;
}
-int baryon_ricci(Enemy *e, int t) {
+static int baryon_ricci(Enemy *e, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -1581,7 +1581,7 @@ void elly_ricci(Boss *b, int t) {
#undef SAFE_RADIUS_PHASE_NUM
/* Thank you for visiting Akari danmaku code (tm) */
-void elly_baryonattack(Boss *b, int t) {
+static void elly_baryonattack(Boss *b, int t) {
TIMER(&t);
AT(0)
set_baryon_rule(baryon_nattack);
@@ -1589,7 +1589,7 @@ void elly_baryonattack(Boss *b, int t) {
set_baryon_rule(baryon_reset);
}
-void elly_baryonattack2(Boss *b, int t) {
+static void elly_baryonattack2(Boss *b, int t) {
TIMER(&t);
AT(0) {
aniplayer_queue(&b->ani, "snipsnip", 0);
@@ -1624,7 +1624,7 @@ void elly_baryonattack2(Boss *b, int t) {
}
}
-void lhc_laser_logic(Laser *l, int t) {
+static void lhc_laser_logic(Laser *l, int t) {
Enemy *e;
static_laser(l, t);
@@ -1641,7 +1641,7 @@ void lhc_laser_logic(Laser *l, int t) {
l->pos = e->pos;
}
-int baryon_lhc(Enemy *e, int t) {
+static int baryon_lhc(Enemy *e, int t) {
int t1 = t % 400;
int g = (int)creal(e->args[2]);
if(g == 0 || g == 3)
@@ -1727,7 +1727,7 @@ void elly_lhc(Boss *b, int t) {
}
}
-int baryon_explode(Enemy *e, int t) {
+static int baryon_explode(Enemy *e, int t) {
TIMER(&t);
AT(EVENT_DEATH) {
free_ref(e->args[1]);
@@ -1821,7 +1821,7 @@ int baryon_explode(Enemy *e, int t) {
return 1;
}
-int baryon_curvature(Enemy *e, int t) {
+static int baryon_curvature(Enemy *e, int t) {
int num = creal(e->args[2])+0.5;
int odd = num&1;
complex bpos = global.boss->pos;
@@ -1842,7 +1842,7 @@ int baryon_curvature(Enemy *e, int t) {
return 1;
}
-int curvature_bullet(Projectile *p, int t) {
+static int curvature_bullet(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -1868,7 +1868,7 @@ int curvature_bullet(Projectile *p, int t) {
return ACTION_NONE;
}
-int curvature_orbiter(Projectile *p, int t) {
+static int curvature_orbiter(Projectile *p, int t) {
if(t < 0) {
return ACTION_ACK;
}
@@ -1892,7 +1892,7 @@ static double saw(double t) {
return cos(t)+cos(3*t)/9+cos(5*t)/25;
}
-int curvature_slave(Enemy *e, int t) {
+static int curvature_slave(Enemy *e, int t) {
e->args[0] = -(e->args[1] - global.plr.pos);
e->args[1] = global.plr.pos;
play_loop("shot1_loop");
@@ -1971,7 +1971,8 @@ void elly_curvature(Boss *b, int t) {
GO_TO(b, VIEWPORT_W/2+100*I+VIEWPORT_W/3*round(sin(t/200)), 0.04);
}
-void elly_baryon_explode(Boss *b, int t) {
+
+static void elly_baryon_explode(Boss *b, int t) {
TIMER(&t);
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.05);
@@ -2843,7 +2844,7 @@ static void elly_goto_center(Boss *b, int t) {
GO_TO(b, BOSS_DEFAULT_GO_POS, 0.05);
}
-Boss* create_elly(void) {
+static Boss* create_elly(void) {
Boss *b = stage6_spawn_elly(-200.0*I);
boss_add_attack(b, AT_Move, "Catch the Scythe", 6, 0, elly_intro, NULL);
diff --git a/src/stages/stage6_events.h b/src/stages/stage6_events.h
index efeca9b0..1171a1f5 100644
--- a/src/stages/stage6_events.h
+++ b/src/stages/stage6_events.h
@@ -28,12 +28,16 @@ void elly_ricci(Boss*, int);
void elly_lhc(Boss*, int);
void elly_theory(Boss*, int);
void elly_curvature(Boss*, int);
+void elly_intro(Boss*, int);
+
+void elly_spawn_baryons(complex pos);
void stage6_events(void);
Boss* stage6_spawn_elly(complex pos);
void Scythe(Enemy *e, int t, bool render);
void scythe_common(Enemy *e, int t);
+int scythe_reset(Enemy *e, int t);
// #define ELLY_TOE_TARGET_POS (VIEWPORT_W/2+298.0*I)
#define ELLY_TOE_TARGET_POS (VIEWPORT_W/2+VIEWPORT_H/2*I)
diff --git a/src/stagetext.c b/src/stagetext.c
index 98844c00..d0337e9a 100644
--- a/src/stagetext.c
+++ b/src/stagetext.c
@@ -36,7 +36,7 @@ StageText* stagetext_add(const char *text, complex pos, Alignment align, Font *f
return t;
}
-void stagetext_numeric_predraw(StageText *txt, int t, float a) {
+static void stagetext_numeric_predraw(StageText *txt, int t, float a) {
snprintf(txt->text, sizeof(NUM_PLACEHOLDER), "%i", (int)((intptr_t)txt->custom.data1 * pow(a, 5)));
}
diff --git a/src/vfs/zipfile.c b/src/vfs/zipfile.c
index f0b370da..86a53366 100644
--- a/src/vfs/zipfile.c
+++ b/src/vfs/zipfile.c
@@ -118,7 +118,7 @@ static zip_int64_t vfs_zipfile_srcfunc(void *userdata, void *data, zip_uint64_t
}
}
-void vfs_zipfile_free_tls(VFSZipFileTLS *tls) {
+static void vfs_zipfile_free_tls(VFSZipFileTLS *tls) {
if(tls->zip) {
zip_discard(tls->zip);
}
diff --git a/subprojects/crossc.wrap b/subprojects/crossc.wrap
index bc62102a..e0485aed 100644
--- a/subprojects/crossc.wrap
+++ b/subprojects/crossc.wrap
@@ -3,4 +3,4 @@ directory=crossc
url=https://github.com/taisei-project/crossc.git
push-url=git@github.com:taisei-project/crossc.git
clone-recursive=true
-revision=v1.5.0
+revision=v1.6.0