]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_sprit.c
makefile polished!! it seems everything works reletively ok
[16.git] / src / lib / 16_sprit.c
index 89d38906d40a0c1d26168dc97d267e7350e6f2e2..c11ff63895d18dc3d741f1a59a7076aa0c4f17c0 100755 (executable)
@@ -1,11 +1,33 @@
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
 #include "src/lib/16_sprit.h"\r
 \r
 char* get_curr_anim_name(struct sprite *spri)\r
 {\r
        // Retrive animation name list\r
-       struct vrs_header huge *vrs = spri->spritesheet->vrs_hdr;\r
-       uint32_t huge *anim_names_offsets =     (uint32_t huge *)\r
-                                               ((byte huge *)vrs +\r
+       struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+       uint32_t far *anim_names_offsets =      (uint32_t far *)\r
+                                               ((byte far *)vrs +\r
                                                 vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]);\r
 \r
        return (char *)(vrs + anim_names_offsets[spri->curr_anim]);\r
@@ -13,12 +35,12 @@ char* get_curr_anim_name(struct sprite *spri)
 \r
 void init_anim(struct sprite *spri, int anim_index)\r
 {\r
-       struct vrs_header huge *vrs = spri->spritesheet->vrs_hdr;\r
-       uint32_t huge *anim_lists_offsets =     (uint32_t huge *)\r
-                                               ((byte huge *)vrs +\r
+       struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
+       uint32_t far *anim_lists_offsets =      (uint32_t far *)\r
+                                               ((byte far *)vrs +\r
                                                 vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_LIST]);\r
-       struct vrs_animation_list_entry_t huge *anim_list =     (struct vrs_animation_list_entry_t huge *)\r
-                                                               ((byte huge *)vrs +\r
+       struct vrs_animation_list_entry_t far *anim_list =      (struct vrs_animation_list_entry_t far *)\r
+                                                               ((byte far *)vrs +\r
                                                                 anim_lists_offsets[anim_index]);\r
 \r
        // Upon new animation, start from the first sprite in it\r
@@ -35,10 +57,10 @@ int set_anim_by_id(struct sprite *spri, int anim_id)
 {\r
        int new_anim_index = 0;\r
        int iter_id;\r
-       struct vrs_header huge *vrs = spri->spritesheet->vrs_hdr;\r
+       struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
        // Retruve animation ids list\r
-        uint16_t huge *anim_ids =      (uint16_t huge *)\r
-                                       ((byte huge *)vrs +\r
+        uint16_t far *anim_ids =       (uint16_t far *)\r
+                                       ((byte far *)vrs +\r
                                         vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);\r
 \r
        // Loop through animation id untill match or end of list\r
@@ -59,10 +81,10 @@ void print_anim_ids(struct sprite *spri)
 {\r
        int new_anim_index = 0;\r
        int iter_id;\r
-       struct vrs_header huge *vrs = spri->spritesheet->vrs_hdr;\r
+       struct vrs_header far *vrs = spri->spritesheet->vrs_hdr;\r
        // Retruve animation ids list\r
-        uint16_t huge *anim_ids =      (uint16_t huge *)\r
-                                       ((byte huge *)vrs +\r
+        uint16_t far *anim_ids =       (uint16_t far *)\r
+                                       ((byte far *)vrs +\r
                                         vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);\r
 \r
        if(!anim_ids[new_anim_index])\r
@@ -76,7 +98,7 @@ void print_anim_ids(struct sprite *spri)
 }\r
 \r
 \r
-void animate_spri(struct sprite *spri)\r
+void animate_spri(struct sprite *spri, global_game_variables_t *gv)\r
 {\r
        int i;\r
        // Events go here\r
@@ -85,10 +107,10 @@ void animate_spri(struct sprite *spri)
        i = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);\r
        if(i < 0)\r
        {\r
-               printf("Error retriving required sprite");\r
-               exit(-1);\r
+               Quit (gv, "Error retriving required sprite");\r
        }\r
-       draw_vrl1_vgax_modex(   spri->x, spri->y,\r
+       draw_vrl1_vgax_modex(   spri->x,// - spri->sprite_vrl_cont->vrl_header->width-28,\r
+                                       spri->y,// - spri->sprite_vrl_cont->vrl_header->height*2 -(gv->video.page[0].sh/2),\r
                                spri->sprite_vrl_cont->vrl_header, spri->sprite_vrl_cont->line_offsets,\r
                                spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),\r
                                spri->sprite_vrl_cont->data_size);\r