mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 09:30:35 +00:00
dual:: 3D:: dual works in 3D
This commit is contained in:
parent
ff584bb74c
commit
e6efc8fabc
2
hyper.h
2
hyper.h
@ -5539,6 +5539,8 @@ namespace dual {
|
|||||||
void disable();
|
void disable();
|
||||||
void enable();
|
void enable();
|
||||||
|
|
||||||
|
transmatrix get_orientation();
|
||||||
|
|
||||||
inline reaction_t mayboth(reaction_t what) { return [=] { may_split_or_do(what); }; }
|
inline reaction_t mayboth(reaction_t what) { return [=] { may_split_or_do(what); }; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1076,7 +1076,7 @@ transmatrix eumovedir(int d) {
|
|||||||
void spinEdge(ld aspd) {
|
void spinEdge(ld aspd) {
|
||||||
ld downspin = 0;
|
ld downspin = 0;
|
||||||
if(dual::state == 2 && dual::currently_loaded != dual::main_side) {
|
if(dual::state == 2 && dual::currently_loaded != dual::main_side) {
|
||||||
transmatrix our = gpushxto0(tC0(cwtV)) * cwtV;
|
transmatrix our = dual::get_orientation();
|
||||||
transmatrix their = dual::player_orientation[dual::main_side];
|
transmatrix their = dual::player_orientation[dual::main_side];
|
||||||
fixmatrix(our);
|
fixmatrix(our);
|
||||||
fixmatrix(their);
|
fixmatrix(their);
|
||||||
|
@ -82,11 +82,39 @@ namespace dual {
|
|||||||
gamedata dgd[2];
|
gamedata dgd[2];
|
||||||
transmatrix player_orientation[2];
|
transmatrix player_orientation[2];
|
||||||
|
|
||||||
|
hyperpoint which_dir;
|
||||||
|
|
||||||
|
int remap_direction(int d, int cg) {
|
||||||
|
if(WDIM == 2 || cg == currently_loaded) return d;
|
||||||
|
|
||||||
|
hyperpoint h = sword::dir[0].T * which_dir;
|
||||||
|
|
||||||
|
h = hpxy3(h[0]/10, h[1]/10, h[2]/10);
|
||||||
|
ld b = HUGE_VAL;
|
||||||
|
for(int i=0; i<S7; i++) {
|
||||||
|
hyperpoint checked = tC0(currentmap->relative_matrix(cwt.at->cmove(i)->master, cwt.at->master));
|
||||||
|
ld dist = hdist(checked, h);
|
||||||
|
if(dist < b) { b = dist; d = i; }
|
||||||
|
}
|
||||||
|
d = gmod(d - cwt.spin, S7);
|
||||||
|
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
transmatrix get_orientation() {
|
||||||
|
if(WDIM == 2)
|
||||||
|
return gpushxto0(tC0(cwtV)) * cwtV;
|
||||||
|
else if(cwt.at)
|
||||||
|
return gpushxto0(tC0(ggmatrix(cwt.at))) * ggmatrix(cwt.at) * sword::dir[0].T;
|
||||||
|
else
|
||||||
|
return Id;
|
||||||
|
}
|
||||||
|
|
||||||
void switch_to(int k) {
|
void switch_to(int k) {
|
||||||
if(k != currently_loaded) {
|
if(k != currently_loaded) {
|
||||||
// gamedata has shmup::on because tutorial needs changing it, but dual should keep it fixed
|
// gamedata has shmup::on because tutorial needs changing it, but dual should keep it fixed
|
||||||
dynamicval<bool> smon(shmup::on);
|
dynamicval<bool> smon(shmup::on);
|
||||||
player_orientation[currently_loaded] = gpushxto0(tC0(cwtV)) * cwtV;
|
player_orientation[currently_loaded] = get_orientation();
|
||||||
dgd[currently_loaded].storegame();
|
dgd[currently_loaded].storegame();
|
||||||
currently_loaded = k;
|
currently_loaded = k;
|
||||||
dgd[currently_loaded].restoregame();
|
dgd[currently_loaded].restoregame();
|
||||||
@ -129,13 +157,15 @@ namespace dual {
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
which_dir = inverse(sword::dir[0].T) * tC0(currentmap->relative_matrix((cwt+d).cpeek()->master, cwt.at->master));
|
||||||
|
|
||||||
bool lms[2][5];
|
bool lms[2][5];
|
||||||
eLastmovetype lmt[2][5];
|
eLastmovetype lmt[2][5];
|
||||||
for(int k=0; k<2; k++) {
|
for(int k=0; k<2; k++) {
|
||||||
switch_to(k);
|
switch_to(k);
|
||||||
for(eForcemovetype fm: { fmMove, fmAttack, fmInstant, fmActivate }) {
|
for(eForcemovetype fm: { fmMove, fmAttack, fmInstant, fmActivate }) {
|
||||||
forcedmovetype = fm;
|
forcedmovetype = fm;
|
||||||
lms[k][fm] = movepcto(fm == fmMove ? d : 0, subdir, true);
|
lms[k][fm] = movepcto(fm == fmMove ? remap_direction(d, cg) : 0, subdir, true);
|
||||||
lmt[k][fm] = nextmovetype;
|
lmt[k][fm] = nextmovetype;
|
||||||
forcedmovetype = fmSkip;
|
forcedmovetype = fmSkip;
|
||||||
for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i];
|
for(int i=0; i<ittypes; i++) orbused[i] = orbusedbak[i];
|
||||||
|
Loading…
Reference in New Issue
Block a user