OSDN Git Service

updated copyright. i am not dead just busy. i am working more on wolfenstien 3d and...
[proj16/16.git] / src / lib / 16_spri.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2020 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 #ifndef __16_SPRI__\r
23 #define __16_SPRI__\r
24 \r
25 //#include "src/lib/16_vrs.h"\r
26 #include "src/lib/16_vl.h"\r
27 //#include <hw/cpu/cpu.h>\r
28 //#include <hw/dos/dos.h>\r
29 #include <hw/vga/vrl.h>\r
30 #include "src/lib/16_ca.h"\r
31 #include "src/lib/scroll16.h"\r
32 \r
33 \r
34 /*\r
35 struct vrs_container{\r
36         // Size of a .vrs lob in memory\r
37         // minus header\r
38         dword data_size;\r
39         union{\r
40                 byte far *buffer;\r
41                 struct vrs_header far *vrs_hdr;\r
42         };\r
43         // Array of corresponding vrl line offsets\r
44         vrl1_vgax_offset_t **vrl_line_offsets;\r
45 };\r
46 *//*\r
47 struct vrl_container{\r
48         // Size of a .vrl blob in memory\r
49         // minus header\r
50         dword data_size;\r
51         union{\r
52                 byte far *buffer;\r
53                 struct vrl1_vgax_header far *vrl_header;\r
54         };\r
55         // Pointer to a corresponding vrl line offsets struct\r
56         vrl1_vgax_offset_t *line_offsets;\r
57 };\r
58 */\r
59 /* Read .vrs file into memory\r
60 * In:\r
61 * + char *filename - name of the file to load\r
62 * + struct vrs_container *vrs_cont - pointer to the vrs_container\r
63 * to load the file into\r
64 * Out:\r
65 * + int - 0 on succes, 1 on failure\r
66 */\r
67 void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
68 void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
69 void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);\r
70 void VRS_ReadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
71 void VRS_LoadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
72 void VRS_OpenVRL(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);\r
73 \r
74 /* Seek and return a specified .vrl blob from .vrs blob in memory\r
75 * In:\r
76 * + struct vrs_container *vrs_cont - pointer to the vrs_container\r
77 * with a loaded .vrs file\r
78 * + uint16_t id - id of the vrl to retrive\r
79 * + struct vrl_container * vrl_cont - pointer to vrl_container to load to\r
80 * Out:\r
81 * int - operation status\r
82 * to the requested .vrl blob\r
83 */\r
84 int get_vrl_by_id(struct vrs_container far *vrs_cont, uint16_t id, struct vrl_container *vrl_cont);\r
85 \r
86 void DrawVRL (unsigned int x,unsigned int y,struct vrl1_vgax_header *hdr,vrl1_vgax_offset_t *lineoffs/*array hdr->width long*/,unsigned char *data,unsigned int datasz);\r
87 \r
88 //moved to 16_tdef.h\r
89 // struct sprite\r
90 // {\r
91 //      // VRS container from which we will extract animation and image data\r
92 //      struct vrs_container *spritesheet;\r
93 //      // Container for a vrl sprite\r
94 //      struct vrl_container *sprite_vrl_cont;\r
95 //      // Current sprite id\r
96 //      int curr_spri_id;\r
97 //      // Index of a current sprite in an animation sequence\r
98 //      int curr_anim_spri;\r
99 //      // Current animation sequence\r
100 //      struct vrs_animation_list_entry_t *curr_anim_list;\r
101 //      // Index of current animation in relevant VRS offsets table\r
102 //      int curr_anim;\r
103 //      // Delay in time units untill we should change sprite\r
104 //      int delay;\r
105 //      // Position of sprite on screen\r
106 //      int x, y;\r
107 // };\r
108 \r
109 /* Retrive current animation name of sprite\r
110 * In:\r
111 * + struct sprite *spri - sprite to retrive current animation sequence name from\r
112 * Out:\r
113 * + char* - animation sequence name\r
114 */\r
115 char* get_curr_anim_name(struct sprite *spri);\r
116 \r
117 /* Change sprite's current animation to the one given by id\r
118  * In:\r
119  * struct sprite *spri - sprite to manipulate on\r
120  * int id - id of a new animation sequence of th sprite\r
121  * Out:\r
122  * int - 0 on success, -1 on error\r
123  */\r
124 int set_anim_by_id(struct sprite *spri, int anim_id);\r
125 \r
126 /* Animate sprite, triggering any events and changing indices if necessary\r
127  * NB: if you want to change animation sequence after a specific sprite is shown, you should call animate_spri first\r
128  * In:\r
129  * + struct sprite *spri - sprite to animate\r
130  */\r
131 void animate_spri(entity_t *enti, video_t *video);\r
132 \r
133 void print_anim_ids(struct sprite *spri);\r
134 \r
135 #endif\r