]> 4ch.mooo.com Git - 16.git/blob - src/lib/16_vrs.h
dacc606bf88c04260904679cb80729e9c54fc418
[16.git] / src / lib / 16_vrs.h
1 /* Project 16 Source Code~
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
3  *
4  * This file is part of Project 16.
5  *
6  * Project 16 is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Project 16 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,
19  * Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22 #ifndef __16_VRS__
23 #define __16_VRS__
24
25 #include "src/lib/16_head.h"
26 #include "src/lib/modex16.h"
27 #include "src/lib/16_ca.h"
28 #include "src/lib/16_mm.h"
29 //#include <hw/cpu/cpu.h>
30 //#include <hw/dos/dos.h>
31 //#include <hw/vga/vga.h>
32
33 // Container for .vrs files loaded in memory with useful info
34 // Includes:
35 // + size of the .vrs blob in memory
36 // + pointer to the blob/vrs header
37 // + id of the curent (shown) animation
38 // + id of the first sprite of the curret animation (supplementary)
39 // + id of the current (shown) sprite
40
41 struct vrs_container{
42         dword size;
43         union{
44                 byte *buffer;
45                 struct vrs_header *vrs_hdr;
46         };
47         uint16_t anchor_sprite_id;
48         uint16_t current_sprite_id;
49 };
50
51 // Container for .vrl files loaded in memory with useful info
52 // Includes:
53 // + size of the .vrl blob in memory
54 // + pointer to the blob/vrl header
55 struct vrl_container{
56         dword size;
57         union{
58                 byte *buffer;
59                 struct vrl1_vgax_header *vrl_header;
60         };
61 };
62
63 // Read .vrs file into memory
64 // In:
65 // + char *filename - name of the file to load
66 // + struct vrs_container *vrs_cont - pointer to the vrs_container
67 // to load the file into
68 // Out:
69 // + int - 0 on succes, 1 on failure
70 int read_vrs(char *filename, struct vrs_container *vrs_cont);
71
72 // Seek and return a specified .vrl blob from .vrs blob in memory
73 // In:
74 // + struct vrs_container *vrs_cont - pointer to the vrs_container
75 // with a loaded .vrs file
76 // + uint16_t id - id of the vrl to retrive
77 // Out:
78 // struct vrl_container* - a pointer to a vrl_container with a pointer
79 // to the requested .vrl blob
80 struct vrl_container* get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id);
81
82 #endif