| 61 | //------------------------------------------------------------------------------------------- |
| 62 | |
| 63 | BOOL IGame_Level::Load(u32 dwNum) |
| 64 | { |
| 65 | // Initialize level data |
| 66 | string_path temp; |
| 67 | if (!FS.exist(temp, fsgame::level, fsgame::level_files::level_ltx)) |
| 68 | FATAL("Can't find level configuration file '%s'.", temp); |
| 69 | pLevel = xr_new<CInifile>(temp); |
| 70 | |
| 71 | // Open |
| 72 | g_pGamePersistent->LoadTitle("st_opening_stream"); |
| 73 | IReader* LL_Stream = FS.r_open(fsgame::level, fsgame::level_files::level); |
| 74 | IReader& fs = *LL_Stream; |
| 75 | |
| 76 | // Header |
| 77 | hdrLEVEL H; |
| 78 | fs.r_chunk_safe(fsL_HEADER, &H, sizeof(H)); |
| 79 | R_ASSERT(XRCL_PRODUCTION_VERSION == H.XRLC_version, "Incompatible level version."); |
| 80 | |
| 81 | // CForms |
| 82 | g_pGamePersistent->LoadTitle("st_loading_cform"); |
| 83 | ObjectSpace.Load(); |
| 84 | |
| 85 | if (!g_hud) |
| 86 | g_hud = (CCustomHUD*)NEW_INSTANCE(CLSID_HUDMANAGER); |
| 87 | |
| 88 | Render->level_Load(LL_Stream); |
| 89 | // Msg ("* S-CREATE: %f ms, %d times",tscreate.result,tscreate.count); |
| 90 | |
| 91 | // Objects |
| 92 | g_pGamePersistent->Environment().mods_load(); |
| 93 | R_ASSERT(Load_GameSpecific_Before()); |
| 94 | Objects.Load(); |
| 95 | |
| 96 | // Done |
| 97 | FS.r_close(LL_Stream); |
| 98 | bReady = true; |
| 99 | IR_Capture(); |
| 100 | Device.seqRender.Add(this); |
| 101 | Device.seqFrame.Add(this); |
| 102 | |
| 103 | return TRUE; |
| 104 | } |
| 105 | |
| 106 | void IGame_Level::OnRender() |
| 107 | { |
nothing calls this directly
no test coverage detected