| 88 | #define BACKGROUND_AI 0 |
| 89 | |
| 90 | World::World(Engine* engine, bool editor) |
| 91 | : _engine(engine), _editor(editor), _camTypeMain(CamInternal), _camType(CamInternal), _gridOffsetX(0), |
| 92 | _gridOffsetY(0) |
| 93 | { |
| 94 | #define PRINT_SIZE(type) Log(#type " size %d", sizeof(type)) |
| 95 | PRINT_SIZE(Object); |
| 96 | PRINT_SIZE(Frame); |
| 97 | PRINT_SIZE(RemoveLinks); |
| 98 | PRINT_SIZE(OLink<Object>); |
| 99 | PRINT_SIZE(Entity); |
| 100 | PRINT_SIZE(LODShapeWithShadow); |
| 101 | PRINT_SIZE(Shape); |
| 102 | if (editor) |
| 103 | { |
| 104 | _camType = _camTypeMain = CamInternal; |
| 105 | } |
| 106 | #if _PIII |
| 107 | PoseidonAssert(((int)this & 0xf) == 0); |
| 108 | #endif |
| 109 | #if BACKGROUND_AI |
| 110 | _secThread = new SecondaryThread; |
| 111 | #endif |
| 112 | |
| 113 | _radio = new RadioChannel(CCGlobal, nullptr, RNRadio); |
| 114 | // _speaker = toIntFloor(1000 * GRandGen.RandomValue()) + 1; |
| 115 | SetSpeaker((Pars >> "CfgVoice" >> "voices")[0], 1.0); |
| 116 | |
| 117 | _scene.Init(_engine, nullptr); |
| 118 | |
| 119 | GLandscape = _scene.GetLandscape(); |
| 120 | GScene = GetScene(); |
| 121 | |
| 122 | _firstFrame = false; |
| 123 | _latitude = -40 * (H_PI / 180); // -40 - Croatia, -90 - north pole; |
| 124 | _longitude = +15 * (H_PI / 180); |
| 125 | |
| 126 | Vector3 lightDirection(+1, -0.5, +1); |
| 127 | LightSun* mainLight = new LightSun(); |
| 128 | |
| 129 | #ifdef _WIN32 |
| 130 | SYSTEMTIME time; |
| 131 | GetLocalTime(&time); |
| 132 | GRandGen.SetSeed(Poseidon::Foundation::GlobalTickCount() + time.wSecond); |
| 133 | #else |
| 134 | GRandGen.SetSeed(Poseidon::Foundation::GlobalTickCount() + (unsigned)time(nullptr)); |
| 135 | #endif |
| 136 | Glob.clock.SetTimeInYear(8 * OneHour + 130 * OneDay); |
| 137 | mainLight->Recalculate(this); |
| 138 | _timeToSkip = 0; |
| 139 | |
| 140 | _scene.SetMainLight(mainLight); |
| 141 | _scene.MainLightChanged(); |
| 142 | _noDisplay = false; |
| 143 | _enableSimulation = true; |
| 144 | _simulationFocus = true; |
| 145 | |
| 146 | // Skip UI creation for dedicated server or editor. Viewer mode |
| 147 | // also skips it: the menu Display chain (DisplayMain) would |
nothing calls this directly
no test coverage detected