mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-25 10:57:59 +00:00
nilrider:: synchronized music
This commit is contained in:
@@ -472,6 +472,9 @@ ld level::safe_alt(hyperpoint h, ld mul, ld mulx) {
|
|||||||
|
|
||||||
bool stepped_display;
|
bool stepped_display;
|
||||||
|
|
||||||
|
int nilrider_tempo = 562;
|
||||||
|
int nilrider_shift = 2633;
|
||||||
|
|
||||||
void level::draw_level(const shiftmatrix& V) {
|
void level::draw_level(const shiftmatrix& V) {
|
||||||
int id = 0;
|
int id = 0;
|
||||||
init_statues();
|
init_statues();
|
||||||
@@ -483,7 +486,11 @@ void level::draw_level(const shiftmatrix& V) {
|
|||||||
id++;
|
id++;
|
||||||
if(!gotit) {
|
if(!gotit) {
|
||||||
for(int i=0; i<6; i++) {
|
for(int i=0; i<6; i++) {
|
||||||
auto &poly = queuepoly(V * rgpushxto0(t.where) * cpush(2, abs(0.2 * sin(current.timer * 5))), shMini[i], t.colors[i]);
|
ld tim = current.timer * 1000;
|
||||||
|
tim -= nilrider_shift;
|
||||||
|
tim /= nilrider_tempo;
|
||||||
|
tim = abs(0.2 * sin(tim * M_PI));
|
||||||
|
auto &poly = queuepoly(V * rgpushxto0(t.where) * cpush(2, tim), shMini[i], t.colors[i]);
|
||||||
poly.tinf = &floor_texture_vertices[cgi.shFloor.id];
|
poly.tinf = &floor_texture_vertices[cgi.shFloor.id];
|
||||||
ensure_vertex_number(*poly.tinf, poly.cnt);
|
ensure_vertex_number(*poly.tinf, poly.cnt);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,8 +67,17 @@ bool crash_sound = true;
|
|||||||
bool running;
|
bool running;
|
||||||
bool backing;
|
bool backing;
|
||||||
|
|
||||||
|
/* land for music */
|
||||||
|
|
||||||
|
eLand music_nilrider = eLand(400);
|
||||||
|
eLand music_nilrider_back = eLand(401);
|
||||||
|
eLand music_nilrider_paused = eLand(402);
|
||||||
|
eLand music_nilrider_planning = eLand(403);
|
||||||
|
eLand music_nilrider_nonrunning = eLand(404);
|
||||||
|
|
||||||
void sync_music(eLand l) {
|
void sync_music(eLand l) {
|
||||||
musicpos[laCanvas] = curlev->current.timer * 1000;
|
musicpos[music_nilrider] = zgmod(curlev->current.timer * 1000, musiclength[music_nilrider]);
|
||||||
|
musicpos[music_nilrider_back] = zgmod(-curlev->current.timer * 1000, musiclength[music_nilrider_back]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool turn(int delta) {
|
bool turn(int delta) {
|
||||||
@@ -534,14 +543,14 @@ void nilrider_keys() {
|
|||||||
|
|
||||||
bool nilrider_music(eLand& l) {
|
bool nilrider_music(eLand& l) {
|
||||||
if(planning_mode && !view_replay)
|
if(planning_mode && !view_replay)
|
||||||
l = eLand(1);
|
l = music_nilrider_planning;
|
||||||
else if(paused)
|
else if(paused)
|
||||||
l = eLand(2);
|
l = music_nilrider_paused;
|
||||||
else if(!running)
|
else if(!running)
|
||||||
l = eLand(3);
|
l = music_nilrider_nonrunning;
|
||||||
else if(backing)
|
else if(backing)
|
||||||
l = eLand(4);
|
l = music_nilrider_back;
|
||||||
else l = laCanvas;
|
else l = music_nilrider;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,6 +571,9 @@ void initialize() {
|
|||||||
param_enum(stepped_display, "stepped_display", "stepped_display", false)
|
param_enum(stepped_display, "stepped_display", "stepped_display", false)
|
||||||
-> editable({{"smooth", "ride on a smooth surface"}, {"blocky", "makes slopes more visible -- actual physics are not affected"}}, "game mode", 's');
|
-> editable({{"smooth", "ride on a smooth surface"}, {"blocky", "makes slopes more visible -- actual physics are not affected"}}, "game mode", 's');
|
||||||
|
|
||||||
|
param_i(nilrider_tempo, "nilrider_tempo");
|
||||||
|
param_i(nilrider_shift, "nilrider_shift");
|
||||||
|
|
||||||
rv_hook(hooks_frame, 100, frame);
|
rv_hook(hooks_frame, 100, frame);
|
||||||
rv_hook(shmup::hooks_turn, 100, turn);
|
rv_hook(shmup::hooks_turn, 100, turn);
|
||||||
rv_hook(hooks_resetGL, 100, cleanup_textures);
|
rv_hook(hooks_resetGL, 100, cleanup_textures);
|
||||||
|
|||||||
Reference in New Issue
Block a user