diff options
| author | johannes <johannes.herman@gmail.com> | 2024-02-06 13:00:51 +0100 |
|---|---|---|
| committer | johannes <johannes.herman@gmail.com> | 2024-02-06 13:00:51 +0100 |
| commit | c372df2fd239531ffdb5d5e2d99ba0e54f38ace9 (patch) | |
| tree | a830e2afe8db616d876843667ad2c3708a391872 /src/demo.c | |
| parent | f8e8e6622eda179bc6f88b0c064fb2629c98fac2 (diff) | |
changed chunk type to enum
Diffstat (limited to 'src/demo.c')
| -rw-r--r-- | src/demo.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -109,7 +109,11 @@ int readdemosnap(FILE *fp, demosnap *snap, int size) fread(data, sizeof(unsigned char), size, fp); - int r = decompresshuff((char *)data, size, (char *)unpacked, 1034 * 8); + if (decompresshuff((char *)data, size, (char *)unpacked, 1034 * 8) < 0) + { + printf("[ ERROR ] error while decompressing snap cunk!\n"); + return 0; + } unsigned char *cp = unpacked; @@ -156,7 +160,7 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver) demotick *tick = (demotick *)malloc(sizeof(demotick)); if (readdemotick(fp, chunkhead, tick, ver)) { - chunk->type = 0; + chunk->type = DEMOTICK; chunk->data.tick = tick; printf("TICK={keyframe: %d, innline: %d, delta: %d}\n", tick->keyframe, tick->innline, tick->delta); } @@ -181,7 +185,7 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver) demosnap *snap = (demosnap *)malloc(sizeof(demosnap)); if (readdemosnap(fp, snap, size)) { - chunk->type = 1; // TODO make a chunk-type enum + chunk->type = DEMOSNAP; chunk->data.snap = snap; printf("SNAPSHOT={datasize: %d, numitems: %d, offsets: [ ", snap->datasize, snap->numitems); @@ -214,6 +218,10 @@ int readdemochunk(FILE *fp, demochunk *chunk, unsigned char ver) printf("SNAPSHOT_DELTA={"); fseek(fp, size, SEEK_CUR); } + else + { + printf("[ ERROR ] unknown chunk type!\n"); + } printf("size: %d}\n", size); } |
