mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 01:00:25 +00:00
curses thrown are now animated
This commit is contained in:
parent
4a4a0fc217
commit
f94163bb78
@ -2698,7 +2698,15 @@ void celldrawer::draw() {
|
||||
|
||||
draw_item_full();
|
||||
draw_monster_full();
|
||||
|
||||
|
||||
if(animations[LAYER_THROW].count(c)) {
|
||||
shiftmatrix Vthrow = V;
|
||||
ld footphase;
|
||||
applyAnimation(c, Vthrow, footphase, LAYER_THROW);
|
||||
eItem it = animations[LAYER_THROW][c].thrown_item;
|
||||
drawItemType(it, c, Vthrow, iinf[it].color, 0, false);
|
||||
}
|
||||
|
||||
#if CAP_TEXTURE
|
||||
if(!texture::using_aura())
|
||||
#endif
|
||||
|
23
graph.cpp
23
graph.cpp
@ -5477,14 +5477,16 @@ struct animation {
|
||||
int attacking; /** 0 = no attack animation, 1 = first phase, 2 = second phase, 3 = hugging */
|
||||
transmatrix attackat;
|
||||
bool mirrored;
|
||||
eItem thrown_item; /** for thrown items */
|
||||
};
|
||||
|
||||
// we need separate animation layers for Orb of Domination and Tentacle+Ghost,
|
||||
// and also to mark Boats
|
||||
#define ANIMLAYERS 3
|
||||
#define ANIMLAYERS 4
|
||||
#define LAYER_BIG 0 // for worms and krakens
|
||||
#define LAYER_SMALL 1 // for others
|
||||
#define LAYER_BOAT 2 // mark that a boat has moved
|
||||
#define LAYER_THROW 3 // for thrown items
|
||||
#endif
|
||||
|
||||
EX array<map<cell*, animation>, ANIMLAYERS> animations;
|
||||
@ -5527,6 +5529,25 @@ EX void animateMovement(const movei& m, int layer) {
|
||||
a.mirrored = !a.mirrored;
|
||||
}
|
||||
|
||||
EX void animate_item_throw(cell *from, cell *to, eItem it) {
|
||||
|
||||
bool steps = false;
|
||||
again:
|
||||
if(from != to) {
|
||||
forCellIdEx(c1, i, from) if(celldistance(c1, to) < celldistance(from, to)) {
|
||||
animateMovement(movei(from, i), LAYER_THROW);
|
||||
from = c1;
|
||||
steps = true;
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
|
||||
if(steps) {
|
||||
animation& a = animations[LAYER_THROW][to];
|
||||
a.thrown_item = it;
|
||||
}
|
||||
}
|
||||
|
||||
EX void animateAttackOrHug(const movei& m, int layer, int phase, ld ratio, ld delta) {
|
||||
LATE( animateAttack(m, layer); )
|
||||
if(vid.mspeed >= 5) return; // no animations!
|
||||
|
@ -1912,6 +1912,7 @@ EX void specialMoves() {
|
||||
int d = celldistance(c,t);
|
||||
if(d <= firerange) {
|
||||
addMessage(XLAT("%The1 curses you with %the2!", m, c->item));
|
||||
animate_item_throw(c, t, c->item);
|
||||
items[c->item] += orbcharges(c->item);
|
||||
c->item = itNone;
|
||||
c->stuntime = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user