diff --git a/celldrawer.cpp b/celldrawer.cpp index 76e3dce2..e641f038 100644 --- a/celldrawer.cpp +++ b/celldrawer.cpp @@ -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 diff --git a/graph.cpp b/graph.cpp index 33fba103..b719e60c 100644 --- a/graph.cpp +++ b/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, 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! diff --git a/monstermove.cpp b/monstermove.cpp index 085d93c4..bc777e9b 100644 --- a/monstermove.cpp +++ b/monstermove.cpp @@ -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;