| 94 | } |
| 95 | |
| 96 | dxRender_Visual* CModelPool::Instance_Load(LPCSTR N, BOOL allow_register) |
| 97 | { |
| 98 | string_path fn; |
| 99 | string_path name; |
| 100 | |
| 101 | // Add default ext if no ext at all |
| 102 | if (nullptr == strext(N)) |
| 103 | strconcat(sizeof(name), name, N, ".ogf"); |
| 104 | else |
| 105 | xr_strcpy(name, sizeof(name), N); |
| 106 | |
| 107 | // Load data from MESHES or LEVEL |
| 108 | if (!FS.exist(fn, fsgame::level, name)) |
| 109 | { |
| 110 | if (!FS.exist(fn, fsgame::game_meshes, name)) |
| 111 | { |
| 112 | FATAL("Can't find model file [%s]", name); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | // Actual loading |
| 117 | #ifdef DEBUG |
| 118 | if (bLogging) |
| 119 | Msg("- Uncached model loading: %s", fn); |
| 120 | #endif // DEBUG |
| 121 | |
| 122 | IReader* data = FS.r_open(fn); |
| 123 | |
| 124 | dxRender_Visual* V; |
| 125 | |
| 126 | ogf_header H; |
| 127 | data->r_chunk_safe(OGF_HEADER, &H, sizeof(H)); |
| 128 | V = Instance_Create(H.type); |
| 129 | V->Load(N, data, 0); |
| 130 | FS.r_close(data); |
| 131 | |
| 132 | g_pGamePersistent->RegisterModel(V); |
| 133 | |
| 134 | // Registration |
| 135 | if (allow_register) |
| 136 | Instance_Register(N, V); |
| 137 | |
| 138 | return V; |
| 139 | } |
| 140 | |
| 141 | dxRender_Visual* CModelPool::Instance_Load(LPCSTR N, IReader* data, BOOL allow_register) |
| 142 | { |
nothing calls this directly
no test coverage detected