From c57679c79f3106a21d1bb2b8abd87e3e1c0286ab Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sat, 9 Mar 2019 18:14:38 +0100 Subject: [PATCH] 3d:: mimics (mirrors not generated correctly yet) --- complex.cpp | 16 +++++++++++++++- shmup.cpp | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/complex.cpp b/complex.cpp index f4ad3b85..9e1ca866 100644 --- a/complex.cpp +++ b/complex.cpp @@ -1196,6 +1196,14 @@ namespace mirror { cw.mirrored = !cw.mirrored; cell *c = cw.at; + #if MAXMDIM >= 4 + if(DIM == 3 && !binarytiling && shmup::on) { + for(int i=0; itype; i++) + createMirror(cw + i + wstep - i, cpid); + return; + } + #endif + #if CAP_GP if(GOLDBERG) { for(int i=0; itype; i++) { @@ -1219,6 +1227,13 @@ namespace mirror { return; } #endif + #if MAXMDIM >= 4 + if(DIM == 3 && !binarytiling && shmup::on) { + for(int i=0; itype; i++) + createMirror(cw + i + wstep - i, cpid); + return; + } + #endif #if CAP_GP if(GOLDBERG && !(S7 & 1)) { for(int i=0; itype; i++) { @@ -1258,7 +1273,6 @@ namespace mirror { } void createHere(cellwalker cw, int cpid) { - if(DIM == 3) return; if(!cw.at) return; if(cw.at->wall == waCloud) createMirages(cw, cpid); diff --git a/shmup.cpp b/shmup.cpp index fa6bbcdc..1b85d399 100644 --- a/shmup.cpp +++ b/shmup.cpp @@ -1224,7 +1224,7 @@ void degradeDemons() { } // we need these for the Mimics! -double playerturn[MAXPLAYER], playergo[MAXPLAYER], playerstrafe[MAXPLAYER], playerturny[MAXPLAYER]; +double playerturn[MAXPLAYER], playergo[MAXPLAYER], playerstrafe[MAXPLAYER], playerturny[MAXPLAYER], playergoturn[MAXPLAYER]; bool playerfire[MAXPLAYER]; void awakenMimics(monster *m, cell *c2) { @@ -1793,6 +1793,8 @@ void movePlayer(monster *m, int delta) { go = true; + playergoturn[cpid] = igospan[go]; + if(DIM == 3) nat = nat1 * cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid]) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]); else if(playergo[cpid]) @@ -1886,6 +1888,11 @@ void movePlayer(monster *m, int delta) { if(!go || abs(playergo[cpid]) < 1e-3 || abs(playerturn[cpid]) > 1e-3) bulltime[cpid] = curtime; + if(!go) { + playergo[cpid] = playergoturn[cpid] = playerstrafe[cpid] = 0; + if(DIM == 3) playerturn[cpid] = playerturny[cpid] = 0; + } + if(go) { if(DIM == 3) @@ -2157,7 +2164,11 @@ void moveMimic(monster *m) { m->footphase = getPlayer()->footphase; // no need to care about Mirror images, as they already have their 'at' matrix reversed :| - nat = nat * spin(playerturn[cpid]) * xpush(playergo[cpid]); + + if(DIM == 3) + nat = nat * cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid]) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]); + else + nat = nat * spin(playerturn[cpid] + playergoturn[cpid]) * xpush(playergo[cpid]) * spin(-playergoturn[cpid]); cell *c2 = m->findbase(nat); reflect(c2, m->base, nat); @@ -3566,7 +3577,9 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans if(hasHitpoints(m->type)) c->hitpoints = m->hitpoints; if(m->type == moTortoise) tortoise::emap[c] = getBits(m->torigin); - if(DIM == 3) + if(m->type == moMimic && DIM == 3) + drawMonsterType(m->type, c, view * spin(-M_PI/2), col, m->footphase); + else if(DIM == 3) drawMonsterType(m->type, c, view * cspin(0, 2, M_PI/2), col, m->footphase); else drawMonsterType(m->type, c, view, col, m->footphase);