void CEnvironment::Update() { Vector vecOrigin = Hud().GetOrigin(); if( g_iUser1 > 0 && g_iUser1 != OBS_ROAMING ) { if( cl_entity_t* pFollowing = gEngfuncs.GetEntityByIndex( g_iUser2 ) ) { vecOrigin = pFollowing->origin; } } vecOrigin.z += 36.0f; if( cl_weather->value > 3.0 ) { gEngfuncs.Cvar_SetValue( "cl_weather", 3.0 ); } m_flWeatherValue = cl_weather->value; if( !IEngineStudio.IsHardware() ) m_flWeatherValue = 0; m_vecWeatherOrigin = vecOrigin; UpdateWind(); if( m_bGrassActive ) { UpdateGrass(); } if( m_flWeatherTime <= gEngfuncs.GetClientTime() ) { switch( m_WeatherType ) { case WeatherType::NONE: break; case WeatherType::RAIN: { UpdateRain(); break; } case WeatherType::SNOW: { UpdateSnow(); break; } } } m_flOldTime = gEngfuncs.GetClientTime(); }
void racing_loop (double time_step){ CControl *ctrl = Players.GetCtrl (g_game.player_id); double ycoord = Course.FindYCoord (ctrl->cpos.x, ctrl->cpos.z); bool airborne = (bool) (ctrl->cpos.y > (ycoord + JUMP_MAX_START_HEIGHT)); check_gl_error(); ClearRenderContext (); Env.SetupFog (); Music.Update (); CalcTrickControls (ctrl, time_step, airborne); if (!g_game.finish) CalcSteeringControls (ctrl, time_step); else CalcFinishControls (ctrl, time_step, airborne); PlayTerrainSound (ctrl, airborne); // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ctrl->UpdatePlayerPos (time_step); // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> if (g_game.finish) IncCameraDistance (time_step); update_view (ctrl, time_step); UpdateTrackmarks (ctrl); SetupViewFrustum (ctrl); if (sky) Env.DrawSkybox (ctrl->viewpos); if (fog) Env.DrawFog (); void SetupLight (); if (terr) RenderCourse (); DrawTrackmarks (); if (trees) DrawTrees (); if (param.perf_level > 2) { update_particles (time_step); draw_particles (ctrl); } Char.Draw (g_game.char_id); UpdateWind (time_step, ctrl); UpdateSnow (time_step, ctrl); DrawSnow (ctrl); DrawHud (ctrl); Reshape (param.x_resolution, param.y_resolution); Winsys.SwapBuffers (); if (g_game.finish == false) g_game.time += time_step; }
void GameOverLoop (double time_step) { CControl *ctrl = Players.GetCtrl (g_game.player_id); int width, height; width = param.x_resolution; height = param.y_resolution; check_gl_error(); Music.Update (); ClearRenderContext (); Env.SetupFog (); update_view (ctrl, 0); if (final_frame != NULL) final_frame->Update (time_step, ctrl); SetupViewFrustum (ctrl); Env.DrawSkybox (ctrl->viewpos); Env.DrawFog (); Env.SetupLight (); RenderCourse (); DrawTrackmarks (); DrawTrees (); UpdateWind (time_step, ctrl); UpdateSnow (time_step, ctrl); DrawSnow (ctrl); Char.Draw (g_game.char_id); set_gl_options (GUI); SetupGuiDisplay (); if (final_frame != NULL) { if (!final_frame->active) GameOverMessage (ctrl); } else GameOverMessage (ctrl); DrawHud (ctrl); Reshape (width, height); Winsys.SwapBuffers (); }