| 91 | } |
| 92 | |
| 93 | CDemoRecord::CDemoRecord(const char* name, float life_time) : CEffectorCam(cefDemo, life_time) |
| 94 | { |
| 95 | Device.seqRender.Add(this, REG_PRIORITY_LOW - 1000); |
| 96 | |
| 97 | pFontSystem = std::make_unique<CGameFont>("hud_font_di", CGameFont::fsDeviceIndependent); |
| 98 | |
| 99 | m_iLMScreenshotFragment = -1; |
| 100 | |
| 101 | m_b_redirect_input_to_level = false; |
| 102 | |
| 103 | if (strlen(name) > 0) // что б можно было demo_record без файла использовать |
| 104 | { |
| 105 | _unlink(name); |
| 106 | file = FS.w_open(name); |
| 107 | } |
| 108 | //if (file) |
| 109 | { |
| 110 | //g_position.set_position = false; |
| 111 | IR_Capture(); // capture input |
| 112 | m_Camera.invert(Device.mView); |
| 113 | |
| 114 | // parse yaw |
| 115 | Fvector& dir = m_Camera.k; |
| 116 | Fvector DYaw; |
| 117 | DYaw.set(dir.x, 0.f, dir.z); |
| 118 | DYaw.normalize_safe(); |
| 119 | if (DYaw.x < 0) |
| 120 | m_HPB.x = acosf(DYaw.z); |
| 121 | else |
| 122 | m_HPB.x = 2 * PI - acosf(DYaw.z); |
| 123 | |
| 124 | // parse pitch |
| 125 | dir.normalize_safe(); |
| 126 | m_HPB.y = asinf(dir.y); |
| 127 | m_HPB.z = 0; |
| 128 | |
| 129 | m_Position.set(m_Camera.c); |
| 130 | |
| 131 | m_vVelocity.set(0, 0, 0); |
| 132 | m_vAngularVelocity.set(0, 0, 0); |
| 133 | iCount = 0; |
| 134 | |
| 135 | m_vT.set(0, 0, 0); |
| 136 | m_vR.set(0, 0, 0); |
| 137 | m_bMakeCubeMap = false; |
| 138 | m_bMakeScreenshot = false; |
| 139 | m_bMakeLevelMap = false; |
| 140 | |
| 141 | m_fSpeed0 = pSettings->r_float("demo_record", "speed0"); |
| 142 | m_fSpeed1 = pSettings->r_float("demo_record", "speed1"); |
| 143 | m_fSpeed2 = pSettings->r_float("demo_record", "speed2"); |
| 144 | m_fSpeed3 = pSettings->r_float("demo_record", "speed3"); |
| 145 | m_fAngSpeed0 = pSettings->r_float("demo_record", "ang_speed0"); |
| 146 | m_fAngSpeed1 = pSettings->r_float("demo_record", "ang_speed1"); |
| 147 | m_fAngSpeed2 = pSettings->r_float("demo_record", "ang_speed2"); |
| 148 | m_fAngSpeed3 = pSettings->r_float("demo_record", "ang_speed3"); |
| 149 | } |
| 150 | //else |