mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-22 23:17:04 +00:00
3d:: sword
This commit is contained in:
parent
14ea73be06
commit
10223d33b9
12
graph.cpp
12
graph.cpp
@ -332,7 +332,7 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
||||
if(onplayer && (items[itOrbSword] || items[itOrbSword2])) {
|
||||
using namespace sword;
|
||||
|
||||
if(shmup::on) {
|
||||
if(shmup::on && DIM == 2) {
|
||||
#if CAP_SHAPES
|
||||
if(items[itOrbSword])
|
||||
queuepoly(V*spin(shmup::pc[multi::cpid]->swordangle), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sintick(200)));
|
||||
@ -341,6 +341,16 @@ void drawPlayerEffects(const transmatrix& V, cell *c, bool onplayer) {
|
||||
queuepoly(V*spin(shmup::pc[multi::cpid]->swordangle+M_PI), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sintick(200)));
|
||||
#endif
|
||||
}
|
||||
|
||||
else if(shmup::on && DIM == 3) {
|
||||
#if CAP_SHAPES
|
||||
if(items[itOrbSword])
|
||||
queuepoly(V*shmup::swordmatrix[multi::cpid] * cspin(2, 0, M_PI/2) * cspin(1,2, ticks / 150.), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword].color, 0, 0xC0 + 0x30 * sintick(200)));
|
||||
|
||||
if(items[itOrbSword2])
|
||||
queuepoly(V*shmup::swordmatrix[multi::cpid] * cspin(2, 0, -M_PI/2) * cspin(1,2, ticks / 150.), (peace::on ? shMagicShovel : shMagicSword), darkena(iinf[itOrbSword2].color, 0, 0xC0 + 0x30 * sintick(200)));
|
||||
#endif
|
||||
}
|
||||
|
||||
else {
|
||||
int& ang = angle[multi::cpid];
|
||||
|
28
shmup.cpp
28
shmup.cpp
@ -1463,8 +1463,14 @@ hyperpoint keytarget(int i) {
|
||||
double getSwordSize() { return sword_size; }
|
||||
double getHornsSize() { return scalefactor * 0.33; }
|
||||
|
||||
// used in 3D
|
||||
transmatrix swordmatrix[MAXPLAYER];
|
||||
|
||||
hyperpoint swordpos(int id, bool rev, double frac) {
|
||||
return pc[id]->pat * xspinpush0(pc[id]->swordangle, (rev?-frac:frac) * getSwordSize());
|
||||
if(DIM == 3)
|
||||
return pc[id]->pat * swordmatrix[id] * cpush0(2, (rev?-frac:frac) * getSwordSize());
|
||||
else
|
||||
return pc[id]->pat * xspinpush0(pc[id]->swordangle, (rev?-frac:frac) * getSwordSize());
|
||||
}
|
||||
|
||||
hyperpoint hornpos(int id) {
|
||||
@ -1881,6 +1887,11 @@ void movePlayer(monster *m, int delta) {
|
||||
if(!go || abs(playergo[cpid]) < 1e-3 || abs(playerturn[cpid]) > 1e-3) bulltime[cpid] = curtime;
|
||||
|
||||
if(go) {
|
||||
|
||||
if(DIM == 3)
|
||||
swordmatrix[cpid] =
|
||||
cspin(1, 2, -playerturny[cpid]) * cspin(0, 2, -playerturn[cpid]) * swordmatrix[cpid];
|
||||
|
||||
if(c2 != m->base) {
|
||||
if(cellUnstable(m->base) && !markOrb(itOrbAether))
|
||||
doesFallSound(m->base);
|
||||
@ -2405,7 +2416,10 @@ void moveBullet(monster *m, int delta) {
|
||||
|
||||
if(m2->blowoff < curtime) {
|
||||
hyperpoint h = inverse(m2->pat) * nat0 * C0;
|
||||
m2->swordangle += atan2(h[1], h[0]);
|
||||
if(DIM == 3)
|
||||
swordmatrix[m2->pid] = spintox(h) * swordmatrix[m2->pid];
|
||||
else
|
||||
m2->swordangle += atan2(h[1], h[0]);
|
||||
m2->rebasePat(m2->pat * rspintox(h));
|
||||
}
|
||||
m2->blowoff = curtime + 1000;
|
||||
@ -3383,6 +3397,7 @@ void init() {
|
||||
pc[i]->inBoat = (firstland == laCaribbean || firstland == laOcean || firstland == laLivefjord ||
|
||||
firstland == laWhirlpool);
|
||||
pc[i]->store();
|
||||
swordmatrix[i] = Id;
|
||||
}
|
||||
|
||||
if(!safety) {
|
||||
@ -3466,12 +3481,19 @@ bool drawMonster(const transmatrix& V, cell *c, const transmatrix*& Vboat, trans
|
||||
|
||||
if(!hide_player() || !subscreens::is_current_player(m->pid)) {
|
||||
dynamicval<int> d(cpid, m->pid);
|
||||
if(DIM == 3) view = view * spin(-M_PI/2);
|
||||
drawPlayerEffects(view, c, true);
|
||||
if(DIM == 3) view = view * spin(-M_PI/2);
|
||||
if(m->inBoat) m->footphase = 0;
|
||||
if(mapeditor::drawplayer) drawMonsterType(moPlayer, c, view, 0xFFFFFFC0, m->footphase);
|
||||
}
|
||||
|
||||
if(subscreens::is_current_player(m->pid) && hide_player() && DIM == 3) {
|
||||
if(items[itOrbSword])
|
||||
queuechr(swordpos(m->pid, false, 1), vid.fsize * 2, '+', iinf[itOrbSword].color);
|
||||
if(items[itOrbSword2])
|
||||
queuechr(swordpos(m->pid, true, 1), vid.fsize * 2, '+', iinf[itOrbSword2].color);
|
||||
}
|
||||
|
||||
if(subscreens::is_current_player(m->pid) && keyresult[cpid]) {
|
||||
hyperpoint h = keytarget(cpid);
|
||||
if(DIM == 2)
|
||||
|
Loading…
Reference in New Issue
Block a user