Skip to content

Commit

Permalink
Play animations from bundled VVF files
Browse files Browse the repository at this point in the history
Playback from the old ANIMS.DAT is no longer needed.
  • Loading branch information
nextghost committed Jun 15, 2020
1 parent f673435 commit f80df5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 22 deletions.
17 changes: 5 additions & 12 deletions signus/src/anims.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <cstdio>
#include <cstring>
#include <climits>
#include <cmath>
#include <SDL_timer.h>
#include "global.h"
Expand Down Expand Up @@ -897,23 +898,15 @@ void VVFStream::reset(void) {
}

int open_anim_file(File &file, const char *name) {
int num;
char fullname[PATH_MAX];

if (!AnimsDF) {
return 0;
}

num = AnimsDF->lookfor(name, 0, AnimsDF->getcount() - 1);

if (num < 0) {
return 0;
}
snprintf(fullname, PATH_MAX, "anims/%s.vvf", name);
multipath_fopen(file, fullname, File::READ);

if (!file.open(AnimsDF->filename(), File::READ)) {
if (!file.isOpen()) {
return 0;
}

file.seek(AnimsDF->getinfo(num)->offset, SEEK_SET);
return 1;
}

Expand Down
8 changes: 1 addition & 7 deletions signus/src/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void ApplyINI()



TDataFile *GraphicsDF, *GraphicsI18nDF, *TextsDF, *AnimsDF;
TDataFile *GraphicsDF, *GraphicsI18nDF, *TextsDF;

TFont *NormalFont;
TFont *HugeFont;
Expand Down Expand Up @@ -395,12 +395,6 @@ int InitGlobal() {
GraphicsDF = new TDataFile("graphics-common.dat", dfOpenRead, NULL);
GraphicsI18nDF = new TDataFile("graphics.dat", dfOpenRead, NULL);

if (test_file_exists("anims.dat")) {
AnimsDF = new TDataFile("anims.dat", dfOpenRead);
} else if (test_file_exists("ANIMS.DAT")) {
AnimsDF = new TDataFile("ANIMS.DAT", dfOpenRead);
}

char fontfile[PATH_MAX];
char fontfileTiny[PATH_MAX];
snprintf(fontfile, PATH_MAX, "%s/nolang/FreeSans.ttf",
Expand Down
3 changes: 0 additions & 3 deletions signus/src/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ extern TDataFile *GraphicsDF, *GraphicsI18nDF;
// Datovy soubor s texty:
extern TDataFile *TextsDF;

// Cutscene data file
extern TDataFile *AnimsDF;

// Oba textove fonty:
extern TFont *NormalFont;
extern TFont *HugeFont;
Expand Down

0 comments on commit f80df5b

Please sign in to comment.