Pages in a vclip if it needs to be
| 281 | extern int Low_vidmem; |
| 282 | // Pages in a vclip if it needs to be |
| 283 | void PageInVClip(int vcnum) { |
| 284 | ASSERT(GameVClips[vcnum].used); |
| 285 | if (!(GameVClips[vcnum].flags & VCF_NOT_RESIDENT)) |
| 286 | return; |
| 287 | |
| 288 | int mipped = 0; |
| 289 | int texture_size = GameVClips[vcnum].target_size; |
| 290 | vclip *vc = &GameVClips[vcnum]; |
| 291 | if (vc->flags & VCF_WANTS_MIPPED) |
| 292 | mipped = 1; |
| 293 | |
| 294 | CFILE *infile = (CFILE *)cfopen(vc->name, "rb"); |
| 295 | if (!infile) { |
| 296 | // due to a bug in some 3rd party tablefile editors, full paths might |
| 297 | // have been used when they shouldn't have been |
| 298 | char *end_ptr, *start_ptr; |
| 299 | start_ptr = vc->name; |
| 300 | end_ptr = start_ptr + strlen(start_ptr) - 1; |
| 301 | while ((end_ptr >= start_ptr) && (*end_ptr != '\\')) |
| 302 | end_ptr--; |
| 303 | if (end_ptr < start_ptr) { |
| 304 | mprintf(0, "Couldn't load vclip %s!\n", vc->name); |
| 305 | return; |
| 306 | } |
| 307 | |
| 308 | ASSERT(*end_ptr == '\\'); |
| 309 | end_ptr++; |
| 310 | |
| 311 | infile = (CFILE *)cfopen(end_ptr, "rb"); |
| 312 | if (!infile) { |
| 313 | mprintf(0, "Couldn't load vclip %s!\n", vc->name); |
| 314 | return; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | mprintf(0, "Paging in vclip %s!\n", vc->name); |
| 319 | |
| 320 | uint8_t start_val = cf_ReadByte(infile); |
| 321 | int version = 0; |
| 322 | if (start_val != 127) { |
| 323 | version = 0; |
| 324 | vc->num_frames = start_val; |
| 325 | cf_ReadFloat(infile); |
| 326 | vc->frame_time = cf_ReadFloat(infile); |
| 327 | cf_ReadInt(infile); |
| 328 | cf_ReadFloat(infile); |
| 329 | vc->frame_time = DEFAULT_FRAMETIME; |
| 330 | } else { |
| 331 | version = cf_ReadByte(infile); |
| 332 | vc->num_frames = cf_ReadByte(infile); |
| 333 | vc->frame_time = cf_ReadFloat(infile); |
| 334 | vc->frame_time = DEFAULT_FRAMETIME; |
| 335 | } |
| 336 | |
| 337 | for (int i = 0; i < vc->num_frames; i++) { |
| 338 | int n = bm_AllocLoadBitmap(infile, mipped); |
| 339 | |
| 340 | ASSERT(n > 0); |
no test coverage detected