mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
startgame animations
This commit is contained in:
parent
3f0bda332e
commit
e2b262979b
@ -2412,6 +2412,7 @@ void drawaura() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
glflush();
|
glflush();
|
||||||
|
current_display->set_projection(0, false);
|
||||||
glhr::switch_mode(glhr::gmVarColored, glhr::shader_projection::standard);
|
glhr::switch_mode(glhr::gmVarColored, glhr::shader_projection::standard);
|
||||||
glhr::id_modelview();
|
glhr::id_modelview();
|
||||||
glhr::prepare(auravertices);
|
glhr::prepare(auravertices);
|
||||||
|
@ -65,8 +65,10 @@ int main(int argc, char **argv) {
|
|||||||
start_game();
|
start_game();
|
||||||
#endif
|
#endif
|
||||||
#if !ISWEB
|
#if !ISWEB
|
||||||
if(showstartmenu && !vid.skipstart)
|
if(showstartmenu && !vid.skipstart) {
|
||||||
|
startanims::pick();
|
||||||
pushScreen(showStartMenu);
|
pushScreen(showStartMenu);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
mainloop();
|
mainloop();
|
||||||
finishAll();
|
finishAll();
|
||||||
|
7
hyper.h
7
hyper.h
@ -2590,6 +2590,8 @@ extern bool useRangedOrb;
|
|||||||
|
|
||||||
void addaura(hyperpoint h, color_t col, int fd);
|
void addaura(hyperpoint h, color_t col, int fd);
|
||||||
void addauraspecial(hyperpoint h, color_t col, int dir);
|
void addauraspecial(hyperpoint h, color_t col, int dir);
|
||||||
|
void drawaura();
|
||||||
|
void clearaura();
|
||||||
|
|
||||||
void drawBug(const cellwalker& cw, color_t col);
|
void drawBug(const cellwalker& cw, color_t col);
|
||||||
|
|
||||||
@ -4429,6 +4431,11 @@ namespace anims {
|
|||||||
extern ld period, cycle_length, parabolic_length, rug_angle, circle_radius, circle_spins;
|
extern ld period, cycle_length, parabolic_length, rug_angle, circle_radius, circle_spins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace startanims {
|
||||||
|
extern reaction_t current;
|
||||||
|
void pick();
|
||||||
|
}
|
||||||
|
|
||||||
extern int animation_lcm;
|
extern int animation_lcm;
|
||||||
extern ld animation_factor;
|
extern ld animation_factor;
|
||||||
ld parseld(const string& s);
|
ld parseld(const string& s);
|
||||||
|
@ -255,7 +255,7 @@ void showMainMenu() {
|
|||||||
else if(uni == 'd') pushScreen(showDisplayMode);
|
else if(uni == 'd') pushScreen(showDisplayMode);
|
||||||
else if(uni == 'm') pushScreen(showChangeMode);
|
else if(uni == 'm') pushScreen(showChangeMode);
|
||||||
else if(uni == 'R') dialog::do_if_confirmed([] {
|
else if(uni == 'R') dialog::do_if_confirmed([] {
|
||||||
popScreenAll(), pushScreen(showStartMenu);
|
popScreenAll(), startanims::pick(), pushScreen(showStartMenu);
|
||||||
});
|
});
|
||||||
#if CAP_SAVE
|
#if CAP_SAVE
|
||||||
else if(uni == 't') scores::load();
|
else if(uni == 't') scores::load();
|
||||||
@ -602,7 +602,7 @@ void showStartMenu() {
|
|||||||
daily_mode = 20;
|
daily_mode = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
gamescreen(2);
|
startanims::current();
|
||||||
|
|
||||||
getcstat = ' ';
|
getcstat = ' ';
|
||||||
|
|
||||||
@ -813,6 +813,7 @@ void showStartMenu() {
|
|||||||
clearMessages();
|
clearMessages();
|
||||||
welcomeMessage();
|
welcomeMessage();
|
||||||
}
|
}
|
||||||
|
else if(sym == SDLK_F5) startanims::pick();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1526,6 +1526,7 @@ hpcshape
|
|||||||
shWestHat1, shWestHat2, shGunInHand,
|
shWestHat1, shWestHat2, shGunInHand,
|
||||||
shKnightArmor, shKnightCloak, shWightCloak,
|
shKnightArmor, shKnightCloak, shWightCloak,
|
||||||
shGhost, shEyes, shSlime, shJelly, shJoint, shWormHead, shTentHead, shShark, shWormSegment, shSmallWormSegment, shWormTail, shSmallWormTail,
|
shGhost, shEyes, shSlime, shJelly, shJoint, shWormHead, shTentHead, shShark, shWormSegment, shSmallWormSegment, shWormTail, shSmallWormTail,
|
||||||
|
shMiniGhost, shMiniEyes,
|
||||||
shHedgehogBlade, shHedgehogBladePlayer,
|
shHedgehogBlade, shHedgehogBladePlayer,
|
||||||
shWolfBody, shWolfHead, shWolfLegs, shWolfEyes,
|
shWolfBody, shWolfHead, shWolfLegs, shWolfEyes,
|
||||||
shWolfFrontLeg, shWolfRearLeg, shWolfFrontPaw, shWolfRearPaw,
|
shWolfFrontLeg, shWolfRearLeg, shWolfFrontPaw, shWolfRearPaw,
|
||||||
@ -2356,6 +2357,7 @@ void buildpolys() {
|
|||||||
|
|
||||||
// monsters
|
// monsters
|
||||||
bshape(shGhost, PPR::MONSTER_BODY, scalefactor, 69);
|
bshape(shGhost, PPR::MONSTER_BODY, scalefactor, 69);
|
||||||
|
bshape(shMiniGhost, PPR::MONSTER_BODY, scalefactor/3, 69);
|
||||||
bshape(shGargoyleWings, PPR::MONSTER_CLOAK, scalefactor, 70);
|
bshape(shGargoyleWings, PPR::MONSTER_CLOAK, scalefactor, 70);
|
||||||
bshape(shGargoyleBody, PPR::MONSTER_BODY, scalefactor, 71);
|
bshape(shGargoyleBody, PPR::MONSTER_BODY, scalefactor, 71);
|
||||||
bshape(shDogStripes, PPR::MONSTER_ARMOR1, scalefactor, 72);
|
bshape(shDogStripes, PPR::MONSTER_ARMOR1, scalefactor, 72);
|
||||||
@ -2490,6 +2492,7 @@ void buildpolys() {
|
|||||||
bshape(shFlowerHand, PPR::MONSTER_WPN, scalefactor, 133);
|
bshape(shFlowerHand, PPR::MONSTER_WPN, scalefactor, 133);
|
||||||
bshape(shPFace, PPR::MONSTER_FACE, scalefactor, 134);
|
bshape(shPFace, PPR::MONSTER_FACE, scalefactor, 134);
|
||||||
bshape(shEyes, PPR::MONSTER_EYE0, scalefactor, 135);
|
bshape(shEyes, PPR::MONSTER_EYE0, scalefactor, 135);
|
||||||
|
bshape(shMiniEyes, PPR::MONSTER_EYE0, scalefactor/3, 135);
|
||||||
bshape(shShark, PPR::MONSTER_BODY, scalefactor, 136);
|
bshape(shShark, PPR::MONSTER_BODY, scalefactor, 136);
|
||||||
bshape(shTinyShark, PPR::MONSTER_BODY, scalefactor / 2, 136);
|
bshape(shTinyShark, PPR::MONSTER_BODY, scalefactor / 2, 136);
|
||||||
bshape(shBugBody, PPR::MONSTER_BODY, scalefactor, 137);
|
bshape(shBugBody, PPR::MONSTER_BODY, scalefactor, 137);
|
||||||
|
120
screenshot.cpp
120
screenshot.cpp
@ -1006,4 +1006,124 @@ bool center_music() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace startanims {
|
||||||
|
|
||||||
|
int ticks_start = 0;
|
||||||
|
|
||||||
|
void null_animation() {
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void joukowsky() {
|
||||||
|
dynamicval<eModel> dm(pmodel, mdJoukowskyInverted);
|
||||||
|
dynamicval<ld> dt(conformal::model_orientation, ticks / 25.);
|
||||||
|
dynamicval<int> dv(vid.use_smart_range, 2);
|
||||||
|
dynamicval<ld> ds(vid.scale, 1/4.);
|
||||||
|
conformal::configure();
|
||||||
|
dynamicval<color_t> dc(ringcolor, 0);
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void bandspin() {
|
||||||
|
dynamicval<eModel> dm(pmodel, mdBand);
|
||||||
|
dynamicval<ld> dt(conformal::model_orientation, ticks / 25.);
|
||||||
|
dynamicval<int> dv(vid.use_smart_range, 2);
|
||||||
|
conformal::configure();
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void perspective() {
|
||||||
|
ld x = sin(ticks / 1500.);
|
||||||
|
x += 1;
|
||||||
|
x /= 2;
|
||||||
|
x *= 1.5;
|
||||||
|
x = tan(x);
|
||||||
|
dynamicval<ld> da(vid.alpha, x);
|
||||||
|
dynamicval<ld> ds(vid.scale, (1+x)/2);
|
||||||
|
calcparam();
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rug() {
|
||||||
|
dynamicval<bool> b(rug::rugged, true);
|
||||||
|
rug::physics();
|
||||||
|
rug::apply_rotation(rotmatrix(ticks / 3000., 1, 2));
|
||||||
|
gamescreen(2);
|
||||||
|
rug::apply_rotation(rotmatrix(-ticks / 3000., 1, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
void spin_around() {
|
||||||
|
dynamicval<ld> da(vid.alpha, 999);
|
||||||
|
dynamicval<ld> ds(vid.scale, 500);
|
||||||
|
ld alpha = 2 * M_PI * ticks / 10000.;
|
||||||
|
ld circle_radius = acosh(2.);
|
||||||
|
dynamicval<transmatrix> dv(View, spin(-cos_auto(circle_radius)*alpha) * xpush(circle_radius) * spin(alpha) * View);
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
reaction_t add_to_frame;
|
||||||
|
|
||||||
|
void draw_ghost(const transmatrix V) {
|
||||||
|
queuepoly(V, shMiniGhost, 0xFFFFFFC0);
|
||||||
|
queuepoly(V, shMiniEyes, 0xFF);
|
||||||
|
}
|
||||||
|
|
||||||
|
void row_of_ghosts() {
|
||||||
|
dynamicval<reaction_t> r(add_to_frame, [] {
|
||||||
|
for(ld x=-5; x<=5; x+=0.2)
|
||||||
|
for(ld y=-5; y<=5; y+=0.2) {
|
||||||
|
ld ay = y + (ticks % 1000) / 1000.;
|
||||||
|
draw_ghost(xpush(x) * spin(M_PI/2) * xpush(ay));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dynamicval<bool> rd(mapeditor::drawplayer, false);
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void army_of_ghosts() {
|
||||||
|
dynamicval<bool> rd(mapeditor::drawplayer, false);
|
||||||
|
dynamicval<reaction_t> r(add_to_frame, [] {
|
||||||
|
for(ld x=-3; x<=3; x+=0.5) {
|
||||||
|
int minv = int(cosh(x) * 3);
|
||||||
|
for(ld y=-minv; y<=minv; y+=0.5) {
|
||||||
|
ld ay = y + (ticks % 2000) / 2000.;
|
||||||
|
draw_ghost(spin(M_PI/2) * xpush(ay / cosh(x)) * spin(-M_PI/2) * xpush(x) * spin(M_PI/2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ghost_spiral() {
|
||||||
|
dynamicval<reaction_t> r(add_to_frame, [] {
|
||||||
|
ld t = (ticks - ticks_start - 2000) / 150000.;
|
||||||
|
for(ld i=3; i<=40; i++) {
|
||||||
|
draw_ghost(spin(t * i * 2 * M_PI) * xpush(asinh(15. / i)) * spin(M_PI/2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
gamescreen(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// more start animations:
|
||||||
|
// - fly a ghost around center, in Gans model
|
||||||
|
// - triangle edges?
|
||||||
|
|
||||||
|
reaction_t current = null_animation;
|
||||||
|
|
||||||
|
void pick() {
|
||||||
|
if(((gold() > 0 || tkills() > 0) && canmove) || geometry != gNormal || ISWEB || ISMOBILE) {
|
||||||
|
current = null_animation;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
vector<reaction_t> known = { null_animation, perspective, joukowsky, bandspin, rug, spin_around, row_of_ghosts, ghost_spiral, army_of_ghosts };
|
||||||
|
int id = rand() % 9;
|
||||||
|
current = known[id];
|
||||||
|
ticks_start = ticks;
|
||||||
|
if(id == 4) rug::init(), rug::rugged = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto sanimhook = addHook(hooks_frame, 100, []() { if(add_to_frame) add_to_frame(); });
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user