From eab0369ce918e5e21082163396de0b20d5e22179 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Fri, 11 Jan 2019 02:23:44 +0100 Subject: [PATCH] shmup:: features of the new lands work --- game.cpp | 3 +++ shmup.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/game.cpp b/game.cpp index d71cdfc9..ada2e52e 100644 --- a/game.cpp +++ b/game.cpp @@ -2659,6 +2659,8 @@ int gravityLevel(cell *c) { int gravityLevelDiff(cell *c, cell *d) { if(c->land != laWestWall || d->land != laWestWall) return gravityLevel(c) - gravityLevel(d); + + if(shmup::on) return 0; int nid = neighborId(c, d); int id1 = parent_id(c, 1, coastvalEdge) + 1; @@ -2680,6 +2682,7 @@ bool canUnstable(eWall w, flagtype flags) { bool cellEdgeUnstable(cell *c, flagtype flags) { if(!isGravityLand(c->land) || !canUnstable(c->wall, flags)) return false; + if(shmup::on && c->land == laWestWall) return false; for(int i=0; itype; i++) if(c->move(i)) { if(isAnyIvy(c->move(i)->monst) && c->land == laMountain && !(flags & MF_IVY)) return false; diff --git a/shmup.cpp b/shmup.cpp index 47c80a02..25572d14 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1300,6 +1300,24 @@ void oceanCurrents(transmatrix& nat, monster *m, int delta) { bool airCurrents(transmatrix& nat, monster *m, int delta) { bool carried = false; cell *c = m->base; + if(c->land == laWestWall) { + cell *c2 = ts::left_of(c, westwall::coastvalEdge1); + + double spd = SCALE * delta / 900.; + + if(m->type == moVoidBeast) spd = -spd; + if(spd) { + transmatrix goal = gmatrix[c2]; + + // transmatrix t = spintox(H) * xpush(delta/300.) * rspintox(H); + + hyperpoint H = inverse(m->pat) * goal * C0; + nat = nat * rspintox(H); + nat = nat * xpush(spd); + nat = nat * spintox(H); + carried = true; + } + } if(c->land == laWhirlwind) { whirlwind::calcdirs(c); for(int i=0; i> traplist; +queue> traplist, firetraplist; void activateArrow(cell *c) { if(isCentralTrap(c)) @@ -1438,9 +1456,9 @@ monster arrowtrap_fakeparent; void doTraps() { while(true) { - if(traplist.empty()) return; + if(traplist.empty()) break; auto t = traplist.front(); - if(t.first > ticks) return; + if(t.first > ticks) break; int d = t.second->wparam; if(d == 2) { auto tl = traplimits(t.second); @@ -1467,6 +1485,19 @@ void doTraps() { } traplist.pop(); } + + while(true) { + if(firetraplist.empty()) break; + auto t = firetraplist.front(); + if(t.first > ticks) return; + int d = t.second->wparam; + if(d == 2) { + t.second->wparam = 0; + t.second->wall = waNone; + explosion(t.second, 5, 10); + } + firetraplist.pop(); + } } bool hornStuns(eMonster m) { @@ -1722,7 +1753,7 @@ void movePlayer(monster *m, int delta) { m->inBoat = false; } } - else if(c2->wall == waThumperOn && !nonAdjacent(c2, m->base)) { + else if(isPushable(c2->wall) && !nonAdjacent(c2, m->base)) { int sd = dirfromto(c2, m->base); int subdir = 1; double bestd = 9999; @@ -1817,7 +1848,12 @@ void movePlayer(monster *m, int delta) { toggleGates(c2, c2->wall); if(c2->wall == waArrowTrap && c2->wparam == 0 && !markOrb(itOrbAether)) - activateArrowTrap(c2); + activateArrowTrap(c2); + + if(c2->wall == waFireTrap && c2->wparam == 0 && !markOrb(itOrbAether)) { + c2->wparam = 2; + firetraplist.emplace(ticks + 800, c2); + } if(c2->item == itOrbYendor && !peace::on) yendor::check(c2); collectItem(c2); @@ -2231,6 +2267,8 @@ void moveBullet(monster *m, int delta) { } else if(isActivable(c2)) activateActiv(c2, true); + else if(c2->wall == waExplosiveBarrel) + explodeBarrel(c2); } if(m->type == moCrushball && c2->wall == waRuinWall) c2->wall = waNone; @@ -2292,10 +2330,10 @@ void moveBullet(monster *m, int delta) { } // multi-HP monsters if((m2->type == moPalace || m2->type == moFatGuard || m2->type == moSkeleton || - m2->type == moVizier || isMetalBeast(m2->type) || m2->type == moTortoise || + m2->type == moVizier || isMetalBeast(m2->type) || m2->type == moTortoise || m2->type == moBrownBug || m2->type == moReptile || m2->type == moSalamander || m2->type == moTerraWarrior) && m2->hitpoints > 1 && !slayer) { m2->rebasePat(m2->pat * rspintox(inverse(m2->pat) * nat0 * C0)); - if(m2->type != moSkeleton && !isMetalBeast(m2->type) && m2->type != moReptile && m2->type != moSalamander) + if(m2->type != moSkeleton && !isMetalBeast(m2->type) && m2->type != moReptile && m2->type != moSalamander && m2->type != moBrownBug) m2->hitpoints--; m->dead = true; if(m2->type == moVizier) ; @@ -2730,6 +2768,11 @@ void moveMonster(monster *m, int delta) { if(c2 != m->base && c2->wall == waArrowTrap && c2->wparam == 0 && !ignoresPlates(m->type)) activateArrowTrap(c2); + if(c2 != m->base && c2->wall == waFireTrap && c2->wparam == 0 && !ignoresPlates(m->type)) { + c2->wparam = 2; + firetraplist.emplace(ticks + 800, c2); + } + if(c2 != m->base && mayExplodeMine(c2, m->type)) killMonster(m, moNone);