mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-18 11:14:49 +00:00
sol:: basic shmup works
This commit is contained in:
parent
06a5309468
commit
774c871c74
2
hyper.h
2
hyper.h
@ -5636,6 +5636,8 @@ namespace solv {
|
||||
hyperpoint inverse_exp(hyperpoint h, bool lazy);
|
||||
|
||||
transmatrix get_solmul(const transmatrix T, const transmatrix V);
|
||||
transmatrix get_solmul_pt(const transmatrix Position, const transmatrix T);
|
||||
transmatrix spin_towards(const transmatrix Position, const hyperpoint goal);
|
||||
extern string solshader;
|
||||
}
|
||||
|
||||
|
@ -796,4 +796,14 @@ transmatrix solmul(const transmatrix T, const transmatrix V) {
|
||||
else return T * V;
|
||||
}
|
||||
|
||||
transmatrix solmul_pt(const transmatrix Position, const transmatrix T) {
|
||||
if(sol) return solv::get_solmul_pt(Position, T);
|
||||
else return Position * T;
|
||||
}
|
||||
|
||||
transmatrix spin_towards(const transmatrix Position, const hyperpoint goal) {
|
||||
if(sol) return solv::spin_towards(Position, goal);
|
||||
return Position * rspintox(inverse(Position) * goal);
|
||||
}
|
||||
|
||||
}
|
||||
|
18
shmup.cpp
18
shmup.cpp
@ -1877,18 +1877,18 @@ void movePlayer(monster *m, int delta) {
|
||||
if(inertia_based) {
|
||||
if(igo) { go = false; break; }
|
||||
ld r = hypot_d(WDIM, avg_inertia);
|
||||
nat = nat * rspintox(avg_inertia) * xpush(r * delta) * spintox(avg_inertia);
|
||||
nat = solmul_pt(nat, rspintox(avg_inertia) * xpush(r * delta)) * spintox(avg_inertia);
|
||||
if(WDIM == 3) nat = nat * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
||||
m->vel = r * (600/SCALE);
|
||||
}
|
||||
else if(WDIM == 3) {
|
||||
nat = nat1 * cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid]) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
||||
nat = solmul_pt(nat1, cpush(0, playerstrafe[cpid]) * cpush(2, playergo[cpid])) * cspin(0, 2, playerturn[cpid]) * cspin(1, 2, playerturny[cpid]);
|
||||
m->inertia[0] = playerstrafe[cpid] / delta;
|
||||
m->inertia[1] = 0;
|
||||
m->inertia[2] = playergo[cpid] / delta;
|
||||
}
|
||||
else if(playergo[cpid]) {
|
||||
nat = nat1 * spin(playergoturn[cpid]) * xpush(playergo[cpid]) * spin(-playergoturn[cpid]);
|
||||
nat = solmul_pt(nat1, spin(playergoturn[cpid]) * xpush(playergo[cpid])) * spin(-playergoturn[cpid]);
|
||||
m->inertia = spin(playergoturn[cpid]) * xpush0(playergo[cpid] / delta);
|
||||
}
|
||||
|
||||
@ -2473,10 +2473,10 @@ void moveBullet(monster *m, int delta) {
|
||||
|
||||
if(inertia_based) {
|
||||
ld r = hypot_d(WDIM, m->inertia);
|
||||
nat = nat * rspintox(m->inertia) * xpush(r * delta) * spintox(m->inertia);
|
||||
nat = solmul_pt(nat, rspintox(m->inertia) * xpush(r * delta) * spintox(m->inertia));
|
||||
}
|
||||
else
|
||||
nat = nat * frontpush(delta * SCALE * m->vel / speedfactor());
|
||||
nat = solmul_pt(nat, frontpush(delta * SCALE * m->vel / speedfactor()));
|
||||
cell *c2 = m->findbase(nat);
|
||||
|
||||
if(m->parent && isPlayer(m->parent) && markOrb(itOrbLava) && c2 != m->base && !isPlayerOn(m->base))
|
||||
@ -2902,7 +2902,7 @@ void moveMonster(monster *m, int delta) {
|
||||
if(h[0] < fabsl(h[1])) return;
|
||||
}
|
||||
else if(!peace::on) {
|
||||
nat = nat * rspintox(inverse(m->pat) * goal * C0);
|
||||
nat = spin_towards(m->pat, tC0(goal));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2951,14 +2951,14 @@ void moveMonster(monster *m, int delta) {
|
||||
if(inertia_based) {
|
||||
if(igo) return;
|
||||
ld r = hypot_d(WDIM, m->inertia);
|
||||
nat = nat * rspintox(m->inertia) * xpush(r * delta) * spintox(m->inertia);
|
||||
nat = solmul_pt(nat, rspintox(m->inertia) * xpush(r * delta) * spintox(m->inertia));
|
||||
}
|
||||
else if(WDIM == 3 && igo) {
|
||||
ld fspin = rand() % 1000;
|
||||
nat = nat0 * cspin(1,2,fspin) * spin(igospan[igo]) * xpush(step) * spin(-igospan[igo]) * cspin(2,1,fspin);
|
||||
nat = solmul_pt(nat0, cspin(1,2,fspin) * spin(igospan[igo]) * xpush(step) * spin(-igospan[igo]) * cspin(2,1,fspin));
|
||||
}
|
||||
else {
|
||||
nat = nat0 * spin(igospan[igo]) * xpush(step) * spin(-igospan[igo]); // * spintox(wherePC);
|
||||
nat = solmul_pt(nat0, spin(igospan[igo]) * xpush(step) * spin(-igospan[igo])); // * spintox(wherePC);
|
||||
}
|
||||
|
||||
if(m->type != moRagingBull && !peace::on)
|
||||
|
18
sol.cpp
18
sol.cpp
@ -380,6 +380,24 @@ namespace solv {
|
||||
return space_to_view * npush * push_to;
|
||||
}
|
||||
|
||||
transmatrix get_solmul_pt(const transmatrix Position, const transmatrix T) {
|
||||
return inverse(get_solmul(inverse(T), inverse(Position)));
|
||||
}
|
||||
|
||||
transmatrix spin_towards(const transmatrix Position, const hyperpoint goal) {
|
||||
// Position * rspintox(inverse(Position) * goal);
|
||||
// Position * rspintox(inverse(back_Position) * back_goal);
|
||||
|
||||
hyperpoint at = tC0(Position);
|
||||
transmatrix push_back = inverse(eupush(at));
|
||||
hyperpoint back_goal = push_back * goal;
|
||||
back_goal = inverse_exp(back_goal, false);
|
||||
|
||||
transmatrix back_Position = push_back * Position;
|
||||
|
||||
return Position * rspintox(inverse(back_Position) * back_goal);
|
||||
}
|
||||
|
||||
string solshader =
|
||||
"uniform mediump sampler3D tInvExpTable;"
|
||||
"uniform mediump float PRECX, PRECY, PRECZ;"
|
||||
|
@ -1157,8 +1157,6 @@ void set_geometry(eGeometry target) {
|
||||
if(sol && old_DIM == 2) pmodel = mdSolPerspective;
|
||||
if(DIM == 2 && among(pmodel, mdPerspective, mdSolPerspective)) pmodel = mdDisk;
|
||||
if(sol && old_DIM == 2 && vid.texture_step < 4) vid.texture_step = 4;
|
||||
|
||||
if(sol && shmup::on) shmup::on = false, racing::on = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,7 +1276,6 @@ void switch_game_mode(char switchWhat) {
|
||||
shmup::on = !shmup::on;
|
||||
princess::challenge = false;
|
||||
if(!shmup::on) racing::on = false;
|
||||
if(sol) set_geometry(gNormal);
|
||||
break;
|
||||
|
||||
case rg::randpattern:
|
||||
|
Loading…
Reference in New Issue
Block a user