diff options
| author | johannes <johannes.herman@gmail.com> | 2024-02-09 16:01:33 +0100 |
|---|---|---|
| committer | johannes <johannes.herman@gmail.com> | 2024-02-09 16:01:33 +0100 |
| commit | c39ca31ffb42414b26ded21aa5b904253c7c7edc (patch) | |
| tree | 292d372c8a5ce631424c38f01bec66a99fe9803a /inc | |
| parent | efa0424f21827ebc67d63375dcfeb0b77bd4d28f (diff) | |
added read demo and write demo functions
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/demo.h | 32 |
1 files changed, 17 insertions, 15 deletions
@@ -97,10 +97,10 @@ typedef struct typedef struct { - demoheader *header; - demotimeline *timeline; - demomap *map; - demodata *data; + demoheader header; + demotimeline timeline; + demomap map; + demodata data; } demo; /* Read demo header from demofile into given demoheader */ @@ -122,19 +122,21 @@ int readdemomap(FILE *demofile, demomap *map, int mapsize, unsigned char version /* Will allocate memory if chunk is snap, delta or message */ int readdemochunk(FILE *demofile, demochunk *chunk, unsigned char version); -int readdemochunks(FILE *fp, demodata *dd, unsigned char ver); +/* Reads all chunks from demofile */ +/* Returns a positive number on success, negative on error */ +/* Will allocate the needed memory for data */ +int readdemochunks(FILE *demofile, demodata *data, unsigned char version); -int writedemoheader(FILE *outfile, demoheader *header); -int writedemotimeline(FILE *outfile, demotimeline *timeline); -int writedemomap(FILE *outfile, demomap *map, int mapsize, unsigned char version); +/* Reads a demo file from demofile */ +/* Returns a positive number on success, negative on error */ +/* Allocates memory needed in demo map and data */ +int readdemo(FILE *demofile, demo *demo); -int writedemotick(FILE *outfile, demotick *tick, unsigned char version); -int writedemosnap(FILE *outfile, demosnap *snap, unsigned char version); -int writedemomessage(FILE *outfile, demomessage *message, unsigned char ver); -int writedemodelta(FILE *outfile, demodelta *delta, unsigned char ver); +/* Writes given demo file to outfile */ +/* Returns a positive number on success, negative on error */ +int writedemo(FILE *outfile, demo *demo); -void printdemoheader(demoheader *header); -void printdemotick(demotick *tick); -void printdemosnap(demosnap *snap); +/* Prints given demo file */ +void printdemo(demo *demo); #endif // DEMO_H |
