// Define the day of year; this is required before calling // correction() or any of the zenith_delay or mapping_function routines. void NBTropModel::setDayOfYear(const int& d) { doy = d; if (doy > 0 && doy < 367) validDOY=true; else validDOY = false; valid = validWeather && validRxHeight && validRxLatitude && validDOY; if(!validWeather && validRxLatitude && validDOY) setWeather(); }
// Define the latitude of the receiver; this is required before calling // correction() or any of the zenith_delay or mapping_function routines. void NBTropModel::setReceiverLatitude(const double& lat) { latitude = lat; validRxLatitude = true; valid = validWeather && validRxHeight && validRxLatitude && validDOY; if(!validWeather && validRxLatitude && validDOY) setWeather(); }
// Define the receiver height; this required before calling // correction() or any of the zenith_delay or mapping_function routines. void NBTropModel::setReceiverHeight(const double& ht) { height = ht; validRxHeight = true; valid = validWeather && validRxHeight && validRxLatitude && validDOY; if(!validWeather && validRxLatitude && validDOY) setWeather(); }
// Create a trop model using the minimum information: latitude and doy. // Interpolate the weather unless setWeather (optional) is called. // @param lat Latitude of the receiver in degrees. // @param day Day of year. NBTropModel::NBTropModel(const double& lat, const int& day) throw(InvalidParameter): validWeather(false), validRxLatitude(false), validDOY(false),validRxHeight(false) { setReceiverLatitude(lat); setDayOfYear(day); setWeather(); }
void WeatherFeed::DownloadCompleted(HttpItem* itm) { m_lastTickUpdated = GetTickCount(); DebugMsg("WeatherFeed", "%s", itm->getTag().c_str()); if(strcmp(itm->getTag().c_str(), "WeatherFeed")==0) { if(itm->getResponseCode() == 200) { MemoryBuffer& buffer = itm->GetMemoryBuffer(); if(buffer.GetDataLength() > 0) { DebugMsg("WeatherFeed", "File Found"); //Parse XML WeatherXML xml; ATG::XMLParser parser; parser.RegisterSAXCallbackInterface(&xml); parser.ParseXMLBuffer((CONST CHAR*)buffer.GetData(), (UINT)buffer.GetDataLength()); if(xml.isKeyValid()) { WeatherInfo inf; inf.currentConditions = xml.getCurrentConditions(); inf.m_Forecast = xml.getForecastItem(); inf.currentGlobalConditions = xml.getCurrentGlobalConditions(); inf.currentLocaleInfo = xml.getCurrentLocaleInfo(); setWeather(inf); } else//Key Error Redownload Info { DebugMsg("WeatherFeed","Key Index %x is Invalid trying new key",itm->getTag2()); UpdateInfo((int)itm->getTag2()); } } } } }
static void initialise() { if (self->active == TRUE) { if (self->mental == 0) { if (strcmpignorecase(getWeather(), "HEAVY_RAIN") != 0) { self->flags &= ~NO_DRAW; setWeather(HEAVY_RAIN); playDefaultBossMusic(); } centerMapOnEntity(NULL); self->action = &doIntro; self->thinkTime = 60; self->endX = 0; self->touch = &entityTouch; setContinuePoint(FALSE, self->name, NULL); } else { self->action = &appear; } } checkToMap(self); }
Sky::Sky() { m_isEnable = true; m_skyBoxTechnique = Material::createFromTemplate("Sky"); auto sphere = SpherePrimitive(1.0f, 24); m_mesh = sphere.getMesh(); setCamera(g_GetCurrScene()->defaultCamera()); setScale(vec3(6360000.0f, 6360000.0f, 6360000.0f)); reCache(); tintTex = TextureMgr::shared()->getByPath("Texture/Sky/tint.tga"); tintTex2 = TextureMgr::shared()->getByPath("Texture/Sky/tint2.tga"); sunTex = TextureMgr::shared()->getByPath("Texture/Sky/sun.tga"); moonTex = TextureMgr::shared()->getByPath("Texture/Sky/moon.tga"); cloudTex = TextureMgr::shared()->getByPath("Texture/Sky/clouds1.png"); cloudTex2 = TextureMgr::shared()->getByPath("Texture/Sky/clouds2.png"); m_skyBoxTechnique->setTex("tint", tintTex, 1); m_skyBoxTechnique->setTex("tint2", tintTex2, 2); m_skyBoxTechnique->setTex("sun", sunTex, 3); m_skyBoxTechnique->setTex("moon", moonTex, 4); m_skyBoxTechnique->setTex("clouds1", cloudTex, 5); m_skyBoxTechnique->setTex("clouds2", cloudTex2, 6); setWeather(1.0f); }
Location::Location(Geoscape* geoscape, unsigned int databaseId) { // initialize location _geoscape = geoscape; _databaseId = databaseId; // make demo game data _demoGameData = new GameData( sizeof(LocationData) ); LocationData* demoLocationData = reinterpret_cast<LocationData*>( _demoGameData->getData() ); demoLocationData->player = true; // random weather unsigned int dice = unsigned int( getCore()->getRandToolkit()->getUniform( 0, 3 ) ); switch( dice ) { case 0: demoLocationData->weather = wtSunny; break; case 1: demoLocationData->weather = wtVariable; break; case 2: demoLocationData->weather = wtCloudy; break; default: demoLocationData->weather = wtSunny; } demoLocationData->wind.set( getCore()->getRandToolkit()->getUniform( -1.0f, 1.0f ), 0.0f, getCore()->getRandToolkit()->getUniform( -1.0f, 1.0f ) ); demoLocationData->wind.normalize(); demoLocationData->windAmbient = getCore()->getRandToolkit()->getUniform( 0.0f, 6.0f ); demoLocationData->windBlast = getCore()->getRandToolkit()->getUniform( 0.0f, 6.0f ); // location info database::LocationInfo* locationInfo = database::LocationInfo::getRecord( _databaseId ); // create location window _window = Gameplay::iGui->createWindow("CareerLocation"); _window->getPanel()->find( "Action" )->setRect(gui::Rect(0, 0, 20, 20)); // setup caption gui::IGuiPanel* caption = _window->getPanel()->find( "Caption" ); gui::IGuiPanel* captionShadow = _window->getPanel()->find( "CaptionShadow" ); assert( caption && caption->getStaticText() ); assert( captionShadow && captionShadow->getStaticText() ); caption->getStaticText()->setText( Gameplay::iLanguage->getUnicodeString( locationInfo->nameId ) ); captionShadow->getStaticText()->setText( Gameplay::iLanguage->getUnicodeString( locationInfo->nameId ) ); // place location if( _geoscape ) { gui::Rect oldRect = _window->getPanel()->getRect(); gui::Rect newRect; if( _databaseId == 0 ) { newRect.left = _geoscape->getCareer()->getHomeX() - oldRect.getWidth() / 2; newRect.top = _geoscape->getCareer()->getHomeY() - oldRect.getHeight() / 2; } else { newRect.left = locationInfo->worldX - oldRect.getWidth() / 2; newRect.top = locationInfo->worldY - oldRect.getHeight() / 2; } newRect.right = newRect.left + oldRect.getWidth(); newRect.bottom = newRect.top + oldRect.getHeight(); _window->getPanel()->setRect( newRect ); _geoscape->getWindow()->getPanel()->insertPanel( _window->getPanel() ); } // location serializable data GameData* gameData = NULL; if( geoscape ) { gameData = geoscape->getCareer()->getGameData( locationInfo->gameData.c_str() ); } else { gameData = _demoGameData; } if( !gameData ) { gameData = new GameData( sizeof( LocationData ) ); _gameData = reinterpret_cast<LocationData*>( gameData->getData() ); geoscape->getCareer()->addGameData( locationInfo->gameData.c_str(), gameData ); setPlayer( false ); // random weather unsigned int dice = unsigned int( getCore()->getRandToolkit()->getUniform( 0, 6 ) ); switch( dice ) { case 0: setWeather( wtSunny ); break; case 1: setWeather( wtVariable ); break; case 2: setWeather( wtCloudy ); break; case 3: setWeather( wtLightRain ); break; case 4: setWeather( wtHardRain ); break; case 5: setWeather( wtThunder ); break; default: setWeather( wtSunny ); break; } }