//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //Procedure GetWind //Author Andrew McRae //Date Thu 2 Apr 1998 // //Description // //Inputs // //Returns // //------------------------------------------------------------------------------ Bool Atmosphere::GetWind (AirStrucPtr const ControlledAC, FCRD& wind, FP height) { PMODEL pModel = ControlledAC->fly.pModel; if (Save_Data.flightdifficulty [FD_WINDEFFECTS]) { SLong wx, wy ,wz; GetWind(pModel->Pos.y, wx, wy, wz); //CSB 10/06/99 wind.x = wx * 0.0001; wind.y = wy * 0.0001; wind.z = wz * 0.0001; } else { NullVec(wind); NullVec(pModel->Gust.Vec); pModel->Gust.ACTIVE = FALSE; } if (Save_Data.flightdifficulty [FD_WINDGUSTS]) { if (pModel->Gust.ACTIVE) { wind.x += pModel->Gust.Vec.x; wind.y += pModel->Gust.Vec.y; wind.z += pModel->Gust.Vec.z; // terminate ?? pModel->Gust.Time -= (SWord)Timer_Code.FRAMETIME; if (pModel->Gust.Time <= 0) { pModel->Gust.ACTIVE = FALSE; pModel->Gust.Time = 0; NullVec(pModel->Gust.Vec); // Restore default gust... //RJS 08Apr98 //?? MMC.Sky.SetGusts (25, 125, 3, 7, 56000); //RJS 08Apr98 } } else { // start a new gust ?? if ((UWord)Math_Lib.rnd () >= Frequency) { // make new gust // magnitude and direction FP magscale = ((FP)(UWord)Math_Lib.rnd() / 65536); FP mag = MinMagnitude + ((MaxMagnitude - MinMagnitude) * magscale); pModel->Gust.Vec.x = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 pModel->Gust.Vec.y = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 pModel->Gust.Vec.z = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 // duration pModel->Gust.Time = MinDuration + (SWord)(((ULong)(MaxDuration - MinDuration) * (ULong)Math_Lib.rnd()) >> 16); // set active pModel->Gust.ACTIVE = TRUE; } } }
global func FxFireScorchingTimer(object target, proplist effect, int time) { if (time >= effect.duration) { RemoveObject(); return FX_Execute_Kill; } // particles var wind = BoundBy(GetWind(), -5, 5); CreateParticle("SmokeDirty", PV_Random(-5, 5), PV_Random(-5, 5), wind, -effect.strength/8, PV_Random(20, 40), Particles_SmokeTrail(), 2); return FX_OK; }
private func Wind2Turn() { // Zielobjekt verloren if (!GetActionTarget()) return(RemoveObject()); // Drehgeschwindigkeit var turn = BoundBy(GetWind()/20 +5, 1, 9); if(!(GetAction() eq Format("Turn%d", turn))) SetAction(Format("Turn%d", turn)); // Energieerzeugung DoEnergy(GetActMapVal("Delay", Format("Turn%d", turn))*30, GetActionTarget()); }
func Hit() { if(!GBackLiquid()) { for(var i=15; i>0; i--) { var iX=Sin(GetR(), RandomX(4,8)), iY=-Cos(GetR(), RandomX(4,8)), iXDir=GetWind()*30/100, iYDir=-Cos(GetR()+RandomX(-2,2), Random(7)); InsertMaterial(Material("Water"), iX, iY, iXDir, iYDir); } SetEmpty(); } }
global func FxSmokeTrailTimer(object pTarget, int iEffectNumber, int iEffectTime) { var iStrength = EffectVar(0, pTarget, iEffectNumber); var iAStr = EffectVar(1, pTarget, iEffectNumber); var iX = EffectVar(2, pTarget, iEffectNumber); var iY = EffectVar(3, pTarget, iEffectNumber); var iXDir = EffectVar(4, pTarget, iEffectNumber); var iYDir = EffectVar(5, pTarget, iEffectNumber); iAStr = Max(1,iAStr-iAStr/10+Random(2)); iAStr--; iYDir += GetGravity()*2/3; iYDir += GetWind(iX,iY)/20; var xdir = iXDir*iAStr/iStrength; var ydir = iYDir*iAStr/iStrength; // Neu: Random iX += RandomX(-3,3); iY += RandomX(-3,3); // zuerst zeichnen CreateParticle("Smoke3",iX,iY,RandomX(-2,2),RandomX(-2,2)-3,20+iAStr*8,RGBa(128,128,128,55+35*iAStr/iStrength)); CreateParticle("Blast",iX,iY,0,0,10+iAStr*8,RGBa(250,100+Random(100),100,160)); // dann nächste position berechnen iX += xdir/100; iY += ydir/100; if(GBackSemiSolid(iX,iY)) return -1; if(iAStr <= 1) return -1; EffectVar(1, pTarget, iEffectNumber) = iAStr; EffectVar(2, pTarget, iEffectNumber) = iX; EffectVar(3, pTarget, iEffectNumber) = iY; EffectVar(5, pTarget, iEffectNumber) = iYDir; }
void GRIBTable::InitGribTable( int zone, ArrayOfGribRecordSets *rsa ) { //init fonts and colours wxFont dayfont = wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ); wxFont labelfont = wxFont( 10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ); wxFont timefont = wxFont( 9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD ); wxFont datafont = wxFont( 9, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ); wxColour colour; GetGlobalColor(_T("DILG1"), &colour); //populate "cursor position" display wxString l; l.Append(toSDMM_PlugIn(1, m_pGDialog->m_cursor_lat)).Append(_T(" ")) .Append(toSDMM_PlugIn(2, m_pGDialog->m_cursor_lon)); m_pCursorPosition->SetLabel(l); m_pCursorPosition->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); m_pPositionText->SetFont(wxFont(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL)); //init row attr wxGridCellAttr *daysrow = new wxGridCellAttr(); daysrow->SetFont(dayfont); daysrow->SetBackgroundColour(colour); daysrow->SetAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); wxGridCellAttr *timerow = new wxGridCellAttr(); timerow->SetFont(timefont); timerow->SetBackgroundColour(colour); timerow->SetAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); wxGridCellAttr *singledatarow = new wxGridCellAttr(); singledatarow->SetFont(datafont); singledatarow->SetAlignment(wxALIGN_CENTRE, wxALIGN_CENTRE); wxGridCellAttr *doubledatarow = new wxGridCellAttr(); doubledatarow->SetFont(datafont); doubledatarow->SetAlignment(wxALIGN_CENTRE, -1); //init labels m_pGribTable->SetLabelFont(labelfont); m_pGribTable->SetLabelBackgroundColour(colour); //create as columns as necessary m_pGribTable->AppendCols(rsa->GetCount()); m_pGribTable->SetSelectionBackground(colour); m_pGribTable->SetSelectionForeground(m_pGribTable->GetDefaultCellTextColour()); //init days row m_pGribTable->SetRowLabelValue(0, wxEmptyString); m_pGribTable->SetRowAttr(0, daysrow); //init time row m_pGribTable->SetRowLabelValue(1, wxEmptyString); m_pGribTable->SetRowAttr(1, timerow); //populate grib wxDateTime day(rsa->Item(0).m_Reference_Time); wxDateTime time; int ncols = -1,nrows,dcol = 0; for(unsigned i = 0; i < rsa->GetCount(); i++ ) { time = rsa->Item(i).m_Reference_Time; //populate 'time' row m_pGribTable->SetCellValue(GetTimeRowsStrings( rsa->Item(i).m_Reference_Time, zone , 0), 1, i ); nrows = 2; m_pTimeset = m_pGDialog->GetTimeLineRecordSet(time); GribRecord **RecordArray = m_pTimeset->m_GribRecordPtrArray; //create and polulate wind data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_WIND_VX) != wxNOT_FOUND && m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_WIND_VY) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Wind"), doubledatarow ); wxString wc(GetWind(RecordArray)); //wind is a special case: if current unit is not bf ==> double speed display (current unit + bf) if(m_pGDialog->m_OverlaySettings.Settings[GribOverlaySettings::WIND].m_Units != GribOverlaySettings::BFS) if(!wc.IsEmpty()) wc.Append(_T("\n")).Append(GetWindBf(RecordArray)); // m_pGribTable->SetCellValue(nrows, i, wc); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate Pressure data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_PRESSURE) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Pressure"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetPressure(RecordArray)); nrows++; } //create and polulate Wind gusts data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_WIND_GUST) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Wind Gust"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetWindGust(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate Waves data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_HTSIGW) != wxNOT_FOUND || m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_WVDIR) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Waves"), doubledatarow ); m_pGribTable->SetCellValue(nrows, i, GetWaves(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate total rainfall data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_PRECIP_TOT) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Rainfall"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetRainfall(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate total cloud control if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_CLOUD_TOT) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Cloud"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetCloudCover(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate the Air Temperature data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_AIR_TEMP) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Air\nTemperature"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetAirTemp(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate the Sea Surface Temperature data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_SEA_TEMP) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Sea\nTemperature"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetSeaTemp(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate the Convective Available Potential Energy (CAPE) data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_CAPE) != wxNOT_FOUND) { AddDataRow( nrows, i, _("CAPE"), singledatarow ); m_pGribTable->SetCellValue(nrows, i, GetCAPE(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } //create and polulate the current data row if(m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_SEACURRENT_VX) != wxNOT_FOUND && m_pGDialog->m_bGRIBActiveFile->m_GribIdxArray.Index(Idx_SEACURRENT_VY) != wxNOT_FOUND) { AddDataRow( nrows, i, _("Current"), doubledatarow ); m_pGribTable->SetCellValue(nrows, i, GetCurrent(RecordArray)); m_pGribTable->SetCellBackgroundColour(nrows, i, m_pDataCellsColour); nrows++; } m_pGribTable->AutoSizeColumn(i, false); ncols++; //write 'days' row if(time.GetDateOnly() != day.GetDateOnly() || i == rsa->GetCount()- 1){ if( i == 0 ) continue; //not the first item if(i == rsa->GetCount() - 1 && ncols != 1) ncols++; ////if end of time range don't forgett the last col m_pGribTable->SetCellSize(0, dcol, 1, ncols); m_pGribTable->SetCellValue(0, dcol, GetTimeRowsStrings(day.GetDateOnly() , zone, 1)); day = rsa->Item(i).m_Reference_Time; dcol = i; if( ncols == 1){ //if only one item per day m_pGribTable->AutoSizeColumn(i-1, false); if(i == rsa->GetCount() - 1 ) { //if end of time range m_pGribTable->SetCellValue(0, i, GetTimeRowsStrings(day.GetDateOnly() , zone, 1)); m_pGribTable->AutoSizeColumn(i, false); } } ncols = 0; } } AutoSizeDataRows(); m_pGribTable->SetGridCursor( m_pGribTable->GetNumberRows(), 0); //put cursor outside the grid this->Fit(); this->Refresh(); }
global func Explode(int iLevel, object pObj, id idEffect, string szEffect) { if(!pObj) if(!(pObj=this)) return; var x = AbsX(pObj->GetX()), y = AbsY(pObj->GetY()); var boom = FindObject(BOOM); if(!boom) boom = CreateObject(BOOM,0,0,-1); var xdir = GetXDir(pObj) + GetWind(GetX(pObj),GetY(pObj))/20; var ydir = GetYDir(pObj); var opt_angle = Angle(xdir,ydir); var speed = BoundBy(Distance(xdir,ydir),0,60); ///Feuer-, Funken- und Dirt-Effekte... var i=0, count = 3+iLevel/8, angle = Random(360); while((count > 0) && (++i < count*10)) { angle += RandomX(40,80); angle = Interpolate4K(angle,opt_angle,0,60,speed); angle -= 180; //Rauch var smokex = +Sin(angle,RandomX(iLevel/4,iLevel/2)); var smokey = -Cos(angle,RandomX(iLevel/4,iLevel/2)); if(GBackSolid(x+smokex,y+smokey)) continue; var level = iLevel + Random(iLevel/5); var a = angle+RandomX(-15,+15); for(var i = 7; i > 0; i--) CreateParticle("BlastSpark1", smokex, smokey, +Sin(a,level+RandomX(-5,+5)), -Cos(a,level+RandomX(-5,+5)), 25+Random(50)); CreateParticle("BlastFlame", smokex, smokey, +Sin(angle,level/2), -Cos(angle,level/2), level*5); for(var i = Random(3)+1; i > 0; i--) { a = angle+RandomX(-30,+30); CreateParticle("BlastDirt", smokex, smokey, +Sin(a,level+RandomX(-20,+20)), -Cos(a,level+RandomX(-20,+20)), level*RandomX(7,12)); } //CreateSmokeTrail(level,angle,smokex,smokey,pObj); count--; } ///Brandspuren... // Wir haben keine Effekteinstellungen oä., daher immer an //if(EffectLevel() > EM4K_Low) CreateBurnMark(x,y,iLevel,20+iLevel/2); ///Lichteffekte bei Dunkelheit... if(IsDark()) { var iSize = iLevel*100; if(iLevel < 20) iSize /= 2; AddLightFlash(iSize/3, x, y, RGBa(255,220,64,15)); } ///Feuer-Effekt.. /*angle = Interpolate4K(0,opt_angle,0,120,speed); angle -= 180; CreateParticle("BlastBg",0,0,+Sin(angle,100),-Cos(angle,100),iLevel*20); //CreateParticle("BlastBg",0,0,0,-1,iLevel*20); */ ///Der eigentliche Blast-Partikel... CreateParticle("Blast",x,y,0,0,iLevel*11); ///Standart-Verhalten... return inherited(iLevel, pObj, idEffect, szEffect); }
//컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴컴 //Procedure GetWind //Author Andrew McRae //Date Thu 2 Apr 1998 // //Description // //Inputs // //Returns // //------------------------------------------------------------------------------ Bool Atmosphere::GetWind (AirStrucPtr const ControlledAC, FCRD& wind, FP height) { PMODEL pModel = ControlledAC->fly.pModel; if (Save_Data.flightdifficulty [FD_WINDEFFECTS]) { //DeadCode CSB 10/06/99 // wind.x = Wind.x; //DeadCode CSB 10/06/99 // wind.y = Wind.y; //DeadCode CSB 10/06/99 // wind.z = Wind.z; //DeadCode CSB 10/06/99 //DeadCode CSB 10/06/99 if (height <= (WindAltHeight - FT_10000)) //DeadCode CSB 10/06/99 { //DeadCode CSB 10/06/99 wind.x = Wind0.x; //DeadCode CSB 10/06/99 wind.y = Wind0.y; //DeadCode CSB 10/06/99 wind.z = Wind0.z; //DeadCode CSB 10/06/99 } //DeadCode CSB 10/06/99 else if (height > WindAltHeight) //DeadCode CSB 10/06/99 { //DeadCode CSB 10/06/99 wind.x = (SLong)WindAlt.x; //DeadCode CSB 10/06/99 wind.y = (SLong)WindAlt.y; //DeadCode CSB 10/06/99 wind.z = (SLong)WindAlt.z; //DeadCode CSB 10/06/99 //DeadCode CSB 10/06/99 }else //DeadCode CSB 10/06/99 //DeadCode CSB 10/06/99 { //DeadCode CSB 10/06/99 FP h = height; //DeadCode CSB 10/06/99 if (h < 0) h = 0; //DeadCode CSB 10/06/99 //DeadCode CSB 10/06/99 FP frac = (h - (WindAltHeight - FT_10000)) / FT_10000; //DeadCode CSB 10/06/99 //DeadCode CSB 10/06/99 wind.x = ((frac * (WindAlt.x - Wind0.x)) + Wind0.x); //DeadCode CSB 10/06/99 wind.y = ((frac * (WindAlt.y - Wind0.y)) + Wind0.y); //DeadCode CSB 10/06/99 wind.z = ((frac * (WindAlt.z - Wind0.z)) + Wind0.z); //DeadCode CSB 10/06/99 } SLong wx, wy ,wz; GetWind(pModel->Pos.y, wx, wy, wz); //CSB 10/06/99 wind.x = wx * 0.1; wind.y = wy * 0.1; wind.z = wz * 0.1; } else NullVec (wind); if (Save_Data.flightdifficulty [FD_WINDGUSTS]) { if (pModel->Gust.ACTIVE) { wind.x += pModel->Gust.Vec.x; wind.y += pModel->Gust.Vec.y; wind.z += pModel->Gust.Vec.z; // terminate ?? pModel->Gust.Time -= (SWord)Timer_Code.FIXEDFRAMETIME; if (pModel->Gust.Time <= 0) { pModel->Gust.ACTIVE = FALSE; pModel->Gust.Time = 0; NullVec(pModel->Gust.Vec); // Restore default gust... //RJS 08Apr98 //?? MMC.Sky.SetGusts (25, 125, 3, 7, 56000); //RJS 08Apr98 } } else { // start a new gust ?? if ((UWord)Math_Lib.rnd () >= Frequency) { // make new gust // magnitude and direction FP magscale = ((FP)(UWord)Math_Lib.rnd() / 65536); FP mag = MinMagnitude + ((MaxMagnitude - MinMagnitude) * magscale); //DeadCode CSB 23/12/98 pModel->Gust.Vec.x = 0; //DeadCode CSB 23/12/98 pModel->Gust.Vec.y = 1; //DeadCode CSB 23/12/98 pModel->Gust.Vec.z = 0; //DeadCode CSB 23/12/98 FP angle = Rowan2Rads ((UWord) Math_Lib.rnd()); //DeadCode CSB 23/12/98 RotVecXSC (pModel->Gust.Vec, pModel->Gust.Vec, FSin(angle), FCos(angle)); //DeadCode CSB 23/12/98 angle = Rowan2Rads ((UWord) Math_Lib.rnd()); //DeadCode CSB 23/12/98 RotVecYSC (pModel->Gust.Vec, pModel->Gust.Vec, FSin(angle), FCos(angle)); //DeadCode CSB 23/12/98 pModel->Gust.Vec.x *= mag; //DeadCode CSB 23/12/98 pModel->Gust.Vec.y *= mag; //DeadCode CSB 23/12/98 pModel->Gust.Vec.z *= mag; pModel->Gust.Vec.x = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 pModel->Gust.Vec.y = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 pModel->Gust.Vec.z = mag * ((FP)Math_Lib.rnd() - 32768) / 32768; //CSB 23/12/98 // duration pModel->Gust.Time = MinDuration + (SWord)(((ULong)(MaxDuration - MinDuration) * (ULong)Math_Lib.rnd()) >> 16); // set active pModel->Gust.ACTIVE = TRUE; } } }
func Rain(){ var vx = GetWind(0, 3) / 10, vy = 150 - Min(GetMaterialVal("WindDrift", "Material", mat), 100)*3/2; InsertMaterial(mat, Random(LandscapeWidth()), 0, vx, vy); ScheduleCall(this, "Rain", RandomX(5, 10), 0); }