1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

more elegant airdir

This commit is contained in:
? 2019-02-26 14:08:51 +01:00 committed by Zeno Rogue
parent a6094f7b0c
commit f37c8d2f1c
2 changed files with 7 additions and 10 deletions

View File

@ -700,7 +700,6 @@ bool passable(cell *w, cell *from, flagtype flags) {
return true;
}
int airdir;
vector<pair<cell*, int> > airmap;
int airdist(cell *c) {
@ -711,14 +710,13 @@ int airdist(cell *c) {
return 3;
}
void calcAirdir(cell *c) {
ld calcAirdir(cell *c) {
if(!c || c->monst == moAirElemental || !passable(c, NULL, P_BLOW))
return;
return 0;
for(int i=0; i<c->type; i++) {
cell *c2 = c->move(i);
if(c2 && c2->monst == moAirElemental) {
airdir = c->c.spin(i) * S42 / c2->type;
return;
return c->c.spin(i) * 2 * M_PI / c2->type;
}
}
for(int i=0; i<c->type; i++) {
@ -729,12 +727,11 @@ void calcAirdir(cell *c) {
for(int i=0; i<c2->type; i++) {
cell *c3 = c2->move(i);
if(c3 && c3->monst == moAirElemental) {
airdir = c2->c.spin(i) * S42 / c3->type;
return;
return c2->c.spin(i) * 2 * M_PI / c3->type;
}
}
}
return;
return 0;
}
bool againstWind(cell *cto, cell *cfrom) {

View File

@ -5047,10 +5047,10 @@ void drawcell(cell *c, transmatrix V, int spinv, bool mirrored) {
for(int i=0; i<c->type; i++) {
cell *c2 = c->move(i);
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);
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));