mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
rug:: CAP_CRYSTAL guards
This commit is contained in:
parent
f27bf01474
commit
ccc77b05fb
15
rug.cpp
15
rug.cpp
@ -1048,10 +1048,12 @@ void addNewPoints() {
|
|||||||
|
|
||||||
void physics() {
|
void physics() {
|
||||||
|
|
||||||
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal()) {
|
if(in_crystal()) {
|
||||||
crystal::build_rugdata();
|
crystal::build_rugdata();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if(good_shape) return;
|
if(good_shape) return;
|
||||||
|
|
||||||
@ -1424,12 +1426,14 @@ void init_model() {
|
|||||||
qvalid = 0; dt = 0; queueiter = 0;
|
qvalid = 0; dt = 0; queueiter = 0;
|
||||||
err_zero_current = err_zero;
|
err_zero_current = err_zero;
|
||||||
|
|
||||||
|
#if CAP_CRYSTAL
|
||||||
if(geometry == gCrystal && surface::sh == surface::dsNone) {
|
if(geometry == gCrystal && surface::sh == surface::dsNone) {
|
||||||
surface::sh = surface::dsCrystal;
|
surface::sh = surface::dsCrystal;
|
||||||
crystal::init_rotation();
|
crystal::init_rotation();
|
||||||
good_shape = true;
|
good_shape = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
try {
|
try {
|
||||||
buildRug();
|
buildRug();
|
||||||
@ -1484,8 +1488,11 @@ ld protractor = 0;
|
|||||||
|
|
||||||
void apply_rotation(const transmatrix& t) {
|
void apply_rotation(const transmatrix& t) {
|
||||||
if(!rug_perspective) currentrot = t * currentrot;
|
if(!rug_perspective) currentrot = t * currentrot;
|
||||||
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal()) crystal::apply_rotation(t);
|
if(in_crystal()) crystal::apply_rotation(t);
|
||||||
else for(auto p: points) p->flat = t * p->flat;
|
else
|
||||||
|
#endif
|
||||||
|
for(auto p: points) p->flat = t * p->flat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void move_forward(ld distance) {
|
void move_forward(ld distance) {
|
||||||
@ -1511,23 +1518,29 @@ bool handlekeys(int sym, int uni) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(NUMBERKEY == '2') {
|
else if(NUMBERKEY == '2') {
|
||||||
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal())
|
if(in_crystal())
|
||||||
crystal::switch_z_coordinate();
|
crystal::switch_z_coordinate();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
apply_rotation(rotmatrix(M_PI, 0, 2));
|
apply_rotation(rotmatrix(M_PI, 0, 2));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if(NUMBERKEY == '3') {
|
else if(NUMBERKEY == '3') {
|
||||||
|
#if CAP_CRYSTAL
|
||||||
if(in_crystal())
|
if(in_crystal())
|
||||||
crystal::flip_z();
|
crystal::flip_z();
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
apply_rotation(rotmatrix(M_PI/2, 0, 2));
|
apply_rotation(rotmatrix(M_PI/2, 0, 2));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#if CAP_CRYSTAL
|
||||||
else if(sym == SDLK_HOME && in_crystal()) {
|
else if(sym == SDLK_HOME && in_crystal()) {
|
||||||
crystal::next_home_orientation();
|
crystal::next_home_orientation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#if !CAP_HOLDKEYS
|
#if !CAP_HOLDKEYS
|
||||||
else if(sym == SDLK_PAGEUP || uni == '[') {
|
else if(sym == SDLK_PAGEUP || uni == '[') {
|
||||||
move_forward(.1);
|
move_forward(.1);
|
||||||
|
Loading…
Reference in New Issue
Block a user