//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::BtnSaveClick(TObject *Sender) { FILE *fp; AnsiString file=Plot->SkyImageFile; if (file=="") return; UpdateSky(); file=file+".tag"; if ((fp=fopen(file.c_str(),"r"))) { fclose(fp); ConfDialog->Label1->Caption="File exists. Overwrite it?"; ConfDialog->Label2->Caption=file; if (ConfDialog->ShowModal()!=mrOk) return; } if (!(fp=fopen(file.c_str(),"w"))) return; fprintf(fp,"%% sky image tag file: rtkplot %s\n\n",VER_RTKLIB); fprintf(fp,"centx = %.6g\n",Plot->SkyCent[0]); fprintf(fp,"centy = %.6g\n",Plot->SkyCent[1]); fprintf(fp,"scale = %.6g\n",Plot->SkyScale ); fprintf(fp,"roll = %.6g\n",Plot->SkyFov[0] ); fprintf(fp,"pitch = %.6g\n",Plot->SkyFov[1] ); fprintf(fp,"yaw = %.6g\n",Plot->SkyFov[2] ); fprintf(fp,"destcorr= %d\n" ,Plot->SkyDestCorr); fprintf(fp,"resample= %d\n" ,Plot->SkyRes ); fprintf(fp,"flip = %d\n" ,Plot->SkyFlip ); fprintf(fp,"dest = %.6g %.6g %.6g %.6g %.6g %.6g %.6g %.6g %.6g\n", Plot->SkyDest[1],Plot->SkyDest[2],Plot->SkyDest[3],Plot->SkyDest[4], Plot->SkyDest[5],Plot->SkyDest[6],Plot->SkyDest[7],Plot->SkyDest[8], Plot->SkyDest[9]); fprintf(fp,"elmask = %d\n" ,Plot->SkyElMask ); fclose(fp); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyCent2UpDownChangingEx(TObject *Sender, bool &AllowChange, short NewValue, TUpDownDirection Direction) { AnsiString s; double cent=str2dbl(SkyCent2->Text); cent=floor(cent+0.5); if (Direction==updUp) cent+=1.0; else cent-=1.0; SkyCent2->Text=s.sprintf("%.2f",cent); UpdateSky(); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyScaleUpDownChangingEx(TObject *Sender, bool &AllowChange, short NewValue, TUpDownDirection Direction) { AnsiString s; double scale=str2dbl(SkyScale->Text); scale=floor(scale+0.5); if (Direction==updUp) scale+=1.0; else scale-=1.0; if (scale<1.0) scale=1.0; SkyScale->Text=s.sprintf("%.2f",scale); UpdateSky(); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyFov3UpDownChangingEx(TObject *Sender, bool &AllowChange, short NewValue, TUpDownDirection Direction) { AnsiString s; double fov=str2dbl(SkyFov3->Text); fov=floor(fov+0.5); if (Direction==updUp) fov+=1.0; else fov-=1.0; if (fov<=-180.0) fov+=360.0; else if (fov>180.0) fov-=360.0; SkyFov3->Text=s.sprintf("%.2f",fov); UpdateSky(); }
void World::SetSkyPortal( Event *ev ) { sky_portal = ev->GetBoolean( 1 ); UpdateSky(); }
void World::SetSkyAlpha( Event *ev ) { sky_alpha = ev->GetFloat( 1 ); UpdateSky(); }
World::World() { const char *text; str mapname; int i; assert( this->entnum == ENTITYNUM_WORLD ); world = this; world_dying = false; setMoveType( MOVETYPE_NONE ); setSolidType( SOLID_BSP ); // world model is always index 1 edict->s.modelindex = 1; model = "*1"; turnThinkOn(); UpdateConfigStrings(); groupcoordinator = NULL; // Anything that modifies configstrings, or spawns things is ignored when loading savegames if ( LoadingSavegame ) { return; } // clear out the soundtrack from the last level ChangeSoundtrack( "" ); // set the default farplane parameters farplane_distance = 0; farplane_color = Vector(0, 0, 0); farplane_cull = true; farplane_fog = true; UpdateFog(); terrain_global = false; terrain_global_min = MIN_WORLD_COORD; UpdateTerrain(); entity_fade_dist = DEFAULT_ENTITY_FADE_DIST; UpdateEntityFadeDist(); UpdateDynamicLights(); UpdateWeather(); time_scale = 1.0f; sky_alpha = 1.0f; sky_portal = true; UpdateSky(); // // see if this is a cinematic level // level.cinematic = ( spawnflags & CINEMATIC ) ? true : false; if ( level.cinematic ) gi.cvar_set( "sv_cinematic", "1" ); else gi.cvar_set( "sv_cinematic", "0" ); level.nextmap = ""; level.level_name = level.mapname; // Set up the mapname as the default script mapname = "maps/"; mapname += level.mapname; for( i = mapname.length() - 1; i >= 0; i-- ) { if ( mapname[ i ] == '.' ) { mapname[ i ] = 0; break; } } mapname += ".scr"; text = &mapname[ 5 ]; // If there isn't a script with the same name as the map, then don't try to load script if ( gi.FS_ReadFile( mapname.c_str(), NULL, true ) != -1 ) { gi.DPrintf( "Adding script: '%s'\n", text ); // just set the script, we will start it in G_Spawn level.SetGameScript( mapname.c_str() ); } else { level.SetGameScript( "" ); } level.consoleThread = Director.CreateThread(); SoundMan.Init(); SoundMan.Load(); // Set the color for the blends. level.water_color = Vector( 0.0f, 0.0f, 0.5f ); level.water_alpha = 0.4f; level.slime_color = Vector( 0.2f, 0.4f, 0.2f ); level.slime_alpha = 0.6f; level.lava_color = Vector( 0.5f, 0.15f, 0.0f ); level.lava_alpha = 0.6f; // // set the targetname of the world // SetTargetName( "world" ); groupcoordinator = new GroupCoordinator; // Initialize movement info for ( i = 0 ; i < WORLD_PHYSICS_TOTAL_NUMBER ; i++ ) { _physicsInfo[ i ] = -1.0f; } _canShakeCamera = false; }
void World::Archive( Archiver &arc ) { int i; int num; TargetList *tempTargetList; Entity::Archive( arc ); if ( arc.Loading() ) { FreeTargetList(); } if ( arc.Saving() ) num = targetList.NumObjects(); arc.ArchiveInteger( &num ); for ( i = 1; i <= num; i++ ) { if ( arc.Saving() ) { tempTargetList = targetList.ObjectAt( i ); } else { tempTargetList = new TargetList; targetList.AddObject( tempTargetList ); } arc.ArchiveObject( ( Class * )tempTargetList ); } _brokenThings.Archive( arc ); _availableViewModes.Archive( arc ); arc.ArchiveBoolean( &world_dying ); arc.ArchiveString( &skipthread ); arc.ArchiveFloat( &farplane_distance ); arc.ArchiveVector( &farplane_color ); arc.ArchiveBoolean( &farplane_cull ); arc.ArchiveBoolean( &farplane_fog ); arc.ArchiveBoolean( &terrain_global ); arc.ArchiveFloat( &terrain_global_min ); arc.ArchiveFloat( &entity_fade_dist ); for( i = 0 ; i < MAX_LIGHTING_GROUPS ; i++ ) dynamic_lights[ i ].Archive( arc ); wind.Archive( arc ); weather.Archive( arc ); arc.ArchiveFloat( &time_scale ); arc.ArchiveFloat( &sky_alpha ); arc.ArchiveBoolean( &sky_portal ); for ( i = 0 ; i < WORLD_PHYSICS_TOTAL_NUMBER ; i++ ) { arc.ArchiveFloat( &_physicsInfo[ i ] ); } arc.ArchiveBool( &_canShakeCamera ); if ( arc.Loading() ) { UpdateConfigStrings(); UpdateFog(); UpdateTerrain(); UpdateSky(); UpdateDynamicLights(); UpdateWindDirection(); UpdateWindIntensity(); UpdateWeather(); UpdateTimeScale(); } // Archive groupcoordinator (not part of world but this is a good place) if ( arc.Loading() ) { if ( groupcoordinator ) delete groupcoordinator; groupcoordinator = new GroupCoordinator; } groupcoordinator->Archive( arc ); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::BtnUpdateClick(TObject *Sender) { UpdateSky(); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyResChange(TObject *Sender) { UpdateSky(); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyFlipMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { UpdateSky(); }
//--------------------------------------------------------------------------- void __fastcall TSkyImgDialog::SkyDestCorrMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift, int X, int Y) { UpdateSky(); UpdateEnable(); }