From: sparky4 Date: Fri, 2 Sep 2016 16:00:29 +0000 (-0500) Subject: wwww merged X-Git-Url: http://4ch.mooo.com/gitweb/?p=16.git;a=commitdiff_plain;h=61480f54c57a34d3634d41f7c8d78d8f029f1393 wwww merged --- diff --git a/16.BAK b/16.BAK new file mode 100755 index 00000000..aee7ace5 Binary files /dev/null and b/16.BAK differ diff --git a/src/lib/16_sprit.c b/src/lib/16_sprit.c index ab6e3378..c5158dc5 100755 --- a/src/lib/16_sprit.c +++ b/src/lib/16_sprit.c @@ -1,24 +1,3 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ #include "src/lib/16_sprit.h" char* get_curr_anim_name(struct sprite *spri) @@ -38,9 +17,9 @@ void init_anim(struct sprite *spri, int anim_index) uint32_t huge *anim_lists_offsets = (uint32_t huge *) ((byte huge *)vrs + vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_LIST]); - struct vrs_animation_list_entry_t *anim_list = (struct vrs_animation_list_entry_t huge *) - ((byte huge *)vrs + - anim_lists_offsets[anim_index]); + struct vrs_animation_list_entry_t huge *anim_list = (struct vrs_animation_list_entry_t huge *) + ((byte huge *)vrs + + anim_lists_offsets[anim_index]); // Upon new animation, start from the first sprite in it spri->curr_anim = anim_index; @@ -93,17 +72,22 @@ void print_anim_ids(struct sprite *spri) { // Return on successful match new_anim_index++; - printf("%d, ", iter_id); } } void animate_spri(struct sprite *spri) { + int i; // Events go here // Draw sprite - get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); + i = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont); + if(i < 0) + { + printf("Error retriving required sprite"); + exit(-1); + } draw_vrl1_vgax_modex( spri->x, spri->y, spri->sprite_vrl_cont->vrl_header, spri->sprite_vrl_cont->line_offsets, spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header), diff --git a/src/vrstest.c b/src/vrstest.c index e90d10e8..a65eee09 100755 --- a/src/vrstest.c +++ b/src/vrstest.c @@ -55,14 +55,41 @@ void main() { word w=0; + + // DOSLIB: check our environment + probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + + //bmp = bitmapLoadPcx("data/chikyuu.pcx"); + gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); + mm.mmstarted=0; MM_Startup(&mm, &mmi); CA_Startup(&gvar); + // What should be done by read_vrs: + sega = (mm.bufferseg); if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &mm, &mmi)) baka=1; else baka=0; -// fd = open("data/spri/chikyuu.vrs", O_RDONLY|O_BINARY); -// size = lseek(fd, 0, SEEK_END); -// lseek(fd, 0, SEEK_SET); -// close(fd); + fd = open("data/spri/chikyuu.vrs", O_RDONLY|O_BINARY); + size = lseek(fd, 0, SEEK_END); + lseek(fd, 0, SEEK_SET); + close(fd); // Insert sanity cheks later vrs.buffer = bigbuffer; vrs.data_size = size - sizeof(struct vrl1_vgax_header); @@ -92,6 +119,7 @@ void main() { } vrs.vrl_line_offsets = vrl_line_offsets; + //read_vrs(&gvar, "data/spri/chikyuu.vrs", &vrs); spri.spritesheet = &vrs; spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container)); @@ -104,33 +132,8 @@ void main() { spri.y = 100; // Uncomment to see broken sprites - //if(CA_ReadFile("data/spri/CHUBACW1.vrl", &bigbuffer, &mm)) baka=1; else baka=0; - //if(CA_LoadFile("data/spri/CHUBACW1.vrl", &bbuffer, &mm, &mmi)) baka=1; else baka=0; - - // DOSLIB: check our environment - probe_dos(); - - // DOSLIB: what CPU are we using? - // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. - // So this code by itself shouldn't care too much what CPU it's running on. Except that other - // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for - // the CPU to carry out tasks. --J.C. - cpu_probe(); - - // DOSLIB: check for VGA - if (!probe_vga()) { - printf("VGA probe failed\n"); - return; - } - // hardware must be VGA or higher! - if (!(vga_state.vga_flags & VGA_IS_VGA)) { - printf("This program requires VGA or higher graphics hardware\n"); - return; - } - - //bmp = bitmapLoadPcx("data/chikyuu.pcx"); - gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); - +/* sega = mm.bufferseg; + if(CA_LoadFile("data/spri/CHUBACW1.vrl", &bigbuffer, &mm, &mmi)) baka=1; else baka=0;*/ /* clear and draw one sprite and one bitmap */ VGAmodeX(1, 1, &gvar);