void updateLighting() { short i, j, k; enum dungeonLayers layer; enum tileType tile; creature *monst; // copy Light over oldLight and then zero out Light. for (i = 0; i < DCOLS; i++) { for (j = 0; j < DROWS; j++) { for (k=0; k<3; k++) { tmap[i][j].oldLight[k] = tmap[i][j].light[k]; tmap[i][j].light[k] = 0; } pmap[i][j].flags |= IS_IN_SHADOW; } } // go through all glowing tiles for (i = 0; i < DCOLS; i++) { for (j = 0; j < DROWS; j++) { for (layer = 0; layer < NUMBER_TERRAIN_LAYERS; layer++) { tile = pmap[i][j].layers[layer]; if (tileCatalog[tile].glowLight) { paintLight(&(lightCatalog[tileCatalog[tile].glowLight]), i, j, false); } } } } // Cycle through monsters and paint their lights: CYCLE_MONSTERS_AND_PLAYERS(monst) { if (monst->info.flags & MONST_INTRINSIC_LIGHT) { paintLight(&lightCatalog[monst->info.intrinsicLightType], monst->xLoc, monst->yLoc, false); } if (monst->status.burning && !(monst->info.flags & MONST_FIERY)) { paintLight(&lightCatalog[BURNING_CREATURE_LIGHT], monst->xLoc, monst->yLoc, false); } } // Miner's light: paintLight(&rogue.minersLight, player.xLoc, player.yLoc, true); if (playerInDarkness()) { player.info.foreColor = &playerInDarknessColor; } else if (pmap[player.xLoc][player.yLoc].flags & IS_IN_SHADOW) { player.info.foreColor = &playerInShadowColor; } else { player.info.foreColor = &playerInLightColor; } }
void SettingsQuickSettingsPopup::focusInEvent ( QFocusEvent * ) { qDebug() << Q_FUNC_INFO; paintWifi(!QBook::settings().value("wifi/disabled",true).toBool()); paintLight(FrontLight::getInstance()->isFrontLightActive()); setFocus(Qt::ActiveWindowFocusReason); }
void SettingsQuickSettingsPopup::handleOptimaLightAutoBtn() { qDebug() << Q_FUNC_INFO; bool current = FrontLight::getInstance()->isOptimaLightAutoActive(); FrontLight::getInstance()->setOptimaLightAutoMode(!current); paintLight(FrontLight::getInstance()->isFrontLightActive()); }
// Returns whether it overlaps with the field of view. boolean drawFlareFrame(flare *theFlare) { boolean inView; if (!flareIsActive(theFlare)) { return false; } lightSource tempLight = *(theFlare->light); color tempColor = *(tempLight.lightColor); tempLight.lightRadius.lowerBound = ((short) (((double) tempLight.lightRadius.lowerBound + FLOAT_FUDGE) * (theFlare->coeff / 100.0 + FLOAT_FUDGE))); tempLight.lightRadius.upperBound = ((short) (((double) tempLight.lightRadius.upperBound + FLOAT_FUDGE) * (theFlare->coeff / 100.0 + FLOAT_FUDGE))); applyColorScalar(&tempColor, (short) (theFlare->coeff + FLOAT_FUDGE)); tempLight.lightColor = &tempColor; inView = paintLight(&tempLight, theFlare->xLoc, theFlare->yLoc, false, true); return inView; }
void updateLighting() { short i, j, k; enum dungeonLayers layer; enum tileType tile; creature *monst; // Copy Light over oldLight recordOldLights(); // and then zero out Light. for (i = 0; i < DCOLS; i++) { for (j = 0; j < DROWS; j++) { for (k=0; k<3; k++) { tmap[i][j].light[k] = 0; } pmap[i][j].flags |= IS_IN_SHADOW; } } // Paint all glowing tiles. for (i = 0; i < DCOLS; i++) { for (j = 0; j < DROWS; j++) { for (layer = 0; layer < NUMBER_TERRAIN_LAYERS; layer++) { tile = pmap[i][j].layers[layer]; if (tileCatalog[tile].glowLight) { paintLight(&(lightCatalog[tileCatalog[tile].glowLight]), i, j, false, false); } } } } // Cycle through monsters and paint their lights: CYCLE_MONSTERS_AND_PLAYERS(monst) { if (monst->info.flags & MONST_INTRINSIC_LIGHT) { paintLight(&lightCatalog[monst->info.intrinsicLightType], monst->xLoc, monst->yLoc, false, false); } if (monst->status[STATUS_BURNING] && !(monst->info.flags & MONST_FIERY)) { paintLight(&lightCatalog[BURNING_CREATURE_LIGHT], monst->xLoc, monst->yLoc, false, false); } if (monsterRevealed(monst)) { paintLight(&lightCatalog[TELEPATHY_LIGHT], monst->xLoc, monst->yLoc, false, true); } } // Also paint telepathy lights for dormant monsters. for (monst = dormantMonsters->nextCreature; monst != NULL; monst = monst->nextCreature) { if (monsterRevealed(monst)) { paintLight(&lightCatalog[TELEPATHY_LIGHT], monst->xLoc, monst->yLoc, false, true); } } updateDisplayDetail(); // Miner's light: paintLight(&rogue.minersLight, player.xLoc, player.yLoc, true, true); if (player.status[STATUS_INVISIBLE]) { player.info.foreColor = &playerInvisibleColor; } else if (playerInDarkness()) { player.info.foreColor = &playerInDarknessColor; } else if (pmap[player.xLoc][player.yLoc].flags & IS_IN_SHADOW) { player.info.foreColor = &playerInShadowColor; } else { player.info.foreColor = &playerInLightColor; } }