mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-16 22:57:38 +00:00
more elegant airdir
This commit is contained in:
13
game.cpp
13
game.cpp
@@ -700,7 +700,6 @@ bool passable(cell *w, cell *from, flagtype flags) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int airdir;
|
|
||||||
vector<pair<cell*, int> > airmap;
|
vector<pair<cell*, int> > airmap;
|
||||||
|
|
||||||
int airdist(cell *c) {
|
int airdist(cell *c) {
|
||||||
@@ -711,14 +710,13 @@ int airdist(cell *c) {
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcAirdir(cell *c) {
|
ld calcAirdir(cell *c) {
|
||||||
if(!c || c->monst == moAirElemental || !passable(c, NULL, P_BLOW))
|
if(!c || c->monst == moAirElemental || !passable(c, NULL, P_BLOW))
|
||||||
return;
|
return 0;
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
cell *c2 = c->move(i);
|
cell *c2 = c->move(i);
|
||||||
if(c2 && c2->monst == moAirElemental) {
|
if(c2 && c2->monst == moAirElemental) {
|
||||||
airdir = c->c.spin(i) * S42 / c2->type;
|
return c->c.spin(i) * 2 * M_PI / c2->type;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
@@ -729,12 +727,11 @@ void calcAirdir(cell *c) {
|
|||||||
for(int i=0; i<c2->type; i++) {
|
for(int i=0; i<c2->type; i++) {
|
||||||
cell *c3 = c2->move(i);
|
cell *c3 = c2->move(i);
|
||||||
if(c3 && c3->monst == moAirElemental) {
|
if(c3 && c3->monst == moAirElemental) {
|
||||||
airdir = c2->c.spin(i) * S42 / c3->type;
|
return c2->c.spin(i) * 2 * M_PI / c3->type;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool againstWind(cell *cto, cell *cfrom) {
|
bool againstWind(cell *cto, cell *cfrom) {
|
||||||
|
@@ -5047,10 +5047,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
|
|||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
cell *c2 = c->move(i);
|
cell *c2 = c->move(i);
|
||||||
if(airdist(c2) < airdist(c)) {
|
if(airdist(c2) < airdist(c)) {
|
||||||
calcAirdir(c2); // printf("airdir = %d\n", airdir);
|
ld airdir = calcAirdir(c2); // printf("airdir = %d\n", airdir);
|
||||||
transmatrix V0 = ddspin(c, i, M_PI);
|
transmatrix V0 = ddspin(c, i, M_PI);
|
||||||
|
|
||||||
double ph = ptick(PURE?150:75) + airdir * M_PI / (S21+.0);
|
double ph = ptick(PURE?150:75) + airdir;
|
||||||
|
|
||||||
int aircol = 0x8080FF00 | int(32 + 32 * -cos(ph));
|
int aircol = 0x8080FF00 | int(32 + 32 * -cos(ph));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user