Skip to content

Commit ca9eff3

Browse files
authored
Merge pull request #1405 from MageKing17/bugfix/ani-unloading
Fix unloading streaming ANI files.
2 parents 255e9aa + 0a19616 commit ca9eff3

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

code/anim/animplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ anim *anim_load(const char *real_filename, int cf_dir_type, int file_mapped)
765765
}
766766

767767
// couldn't memory-map file... must be in a packfile, so stream manually
768-
if ( file_mapped && !ptr->cfile_ptr ) {
768+
if ( file_mapped == PAGE_FROM_MEM && !ptr->cfile_ptr ) {
769769
ptr->flags &= ~ANF_MEM_MAPPED;
770770
ptr->flags |= ANF_STREAMED;
771771
ptr->cfile_ptr = cfopen(name, "rb", CFILE_NORMAL, cf_dir_type);

code/anim/animplay.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ typedef struct {
4040

4141
enum
4242
{
43-
PAGE_FROM_MEM = 0,
44-
PAGE_FROM_DISK = 1,
45-
PAGE_FROM_DISK_FORCED = 2
43+
PAGE_FROM_DISK = 0,
44+
PAGE_FROM_MEM = 1
4645
};
4746

4847
extern int Anim_paused;
@@ -59,7 +58,7 @@ int anim_stop_playing(anim_instance* anim_instance);
5958
int anim_show_next_frame(anim_instance *instance, float frametime);
6059
void anim_release_all_instances(int screen_id = 0);
6160
void anim_release_render_instance(anim_instance* instance);
62-
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_MEM);
61+
anim *anim_load(const char *name, int cf_dir_type = CF_TYPE_ANY, int file_mapped = PAGE_FROM_DISK);
6362
int anim_free(anim *ptr);
6463
int anim_playing(anim_instance *ai);
6564
int anim_write_frames_out(char *filename);

code/graphics/generic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ void generic_anim_unload(generic_anim *ga)
323323
if(ga->num_frames > 0) {
324324
if(ga->streaming) {
325325
if(ga->type == BM_TYPE_ANI) {
326-
anim_free(ga->ani.animation);
327326
free_anim_instance(ga->ani.instance);
327+
anim_free(ga->ani.animation);
328328
}
329329
if(ga->type == BM_TYPE_EFF) {
330330
if(ga->eff.next_frame >= 0)

code/mission/missionmessage.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -748,11 +748,6 @@ void message_mission_free_avi(int m_index)
748748
if ( (m_index < 0) || (m_index >= Num_message_avis) )
749749
return;
750750

751-
// Make sure this code doesn't get run if the talking head guage is off
752-
// helps prevent a crash on jump out if this code doesn't work right
753-
if ( !hud_gauge_active(HUD_TALKING_HEAD) )
754-
return;
755-
756751
generic_anim_unload(&Message_avis[m_index].anim_data);
757752
}
758753

0 commit comments

Comments
 (0)