• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

wwww


Commit MetaInfo

Revisionb462db3cf431325bd25c81a61351a2d67a454f51 (tree)
Time2016-08-24 17:09:20
Authorsparky4 <sparky4@cock...>
Commitersparky4

Log Message

wwwwwwwwwwwwwwwwwwwwwwwwwwww vrstest.c works wwwwww yakui-lover wwwww look! wwww

Change Summary

Incremental Difference

--- a/src/lib/16_sprite.c
+++ b/src/lib/16_sprite.c
@@ -8,7 +8,7 @@ char* get_curr_anim_name(struct sprite *spri)
88 ((byte huge *)vrs +
99 vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_NAME_LIST]);
1010
11- return (char *)(vrs + anim_names_offsets[spri->curr_anim_spri]);
11+ return (char *)(vrs + anim_names_offsets[spri->curr_anim]);
1212 }
1313
1414 void init_anim(struct sprite *spri, int anim_index)
@@ -22,6 +22,7 @@ void init_anim(struct sprite *spri, int anim_index)
2222 anim_lists_offsets[anim_index]);
2323
2424 // Upon new animation, start from the first sprite in it
25+ spri->curr_anim = anim_index;
2526 spri->curr_anim_spri = 0;
2627 spri->curr_spri_id = anim_list[0].sprite_id;
2728 spri->delay = anim_list[0].delay;
@@ -44,7 +45,7 @@ int set_anim_by_id(struct sprite *spri, int anim_id)
4445 while(iter_id = anim_ids[new_anim_index])
4546 {
4647 // Return on successful match
47- if (iter_id = anim_id)
48+ if (iter_id == anim_id)
4849 {
4950 init_anim(spri, new_anim_index);
5051 return 0;
@@ -64,7 +65,6 @@ void print_anim_ids(struct sprite *spri)
6465 ((byte huge *)vrs +
6566 vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);
6667
67- printf("\nPos %lld off %lld\n", (uint32_t)vrs, vrs->offset_table[VRS_HEADER_OFFSET_ANIMATION_ID_LIST]);
6868 if(!anim_ids[new_anim_index])
6969 exit(3);
7070 // Loop through animation id untill match or end of list
@@ -79,15 +79,14 @@ void print_anim_ids(struct sprite *spri)
7979
8080 void animate_spri(struct sprite *spri)
8181 {
82- struct vrl_container *vrl_cont;
8382 // Events go here
8483
8584 // Draw sprite
86- vrl_cont = get_vrl_by_id(spri->spritesheet, spri->curr_spri_id);
85+ get_vrl_by_id(spri->spritesheet, spri->curr_spri_id, spri->sprite_vrl_cont);
8786 draw_vrl1_vgax_modex( spri->x, spri->y,
88- vrl_cont->vrl_header, vrl_cont->line_offsets,
89- vrl_cont->buffer + sizeof(struct vrl1_vgax_header),
90- vrl_cont->size - sizeof(struct vrl1_vgax_header));
87+ spri->sprite_vrl_cont->vrl_header, spri->sprite_vrl_cont->line_offsets,
88+ spri->sprite_vrl_cont->buffer + sizeof(struct vrl1_vgax_header),
89+ spri->sprite_vrl_cont->data_size);
9190
9291 // Depending on delay, update indices
9392 switch(spri->delay){
--- a/src/lib/16_sprite.h
+++ b/src/lib/16_sprite.h
@@ -29,6 +29,8 @@ struct sprite
2929 {
3030 // VRS container from which we will extract animation and image data
3131 struct vrs_container *spritesheet;
32+ // Container for a vrl sprite
33+ struct vrl_container *sprite_vrl_cont;
3234 // Current sprite id
3335 int curr_spri_id;
3436 // Index of a current sprite in an animation sequence
--- a/src/lib/16_vrs.c
+++ b/src/lib/16_vrs.c
@@ -36,7 +36,7 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
3636 byte huge *buffer;
3737 vrl1_vgax_offset_t **vrl_line_offsets;
3838 uint32_t huge *vrl_headers_offsets;
39- uint32_t huge *vrl_id_iter;
39+ uint16_t huge *vrl_id_iter;
4040 uint32_t vrl_size;
4141 int num_of_vrl, i;
4242 struct vrl1_vgax_header huge *curr_vrl;
@@ -56,18 +56,18 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
5656 fprintf(stderr, "Unablee to load file");
5757 exit(3);
5858 }
59- vrs_cont->size = size;
59+ vrs_cont->data_size = size - sizeof(struct vrs_header);
6060 vrs_cont->buffer = buffer;
6161
6262 // Calculate vrl offsets
6363
6464 // Count sprites
65- vrl_id_iter = (uint32_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);
65+ vrl_id_iter = (uint16_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);
6666 while(vrl_id_iter[num_of_vrl]){
6767 num_of_vrl++;
6868 }
6969 // Allocate memory for vrl line offsets table
70- vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t)*num_of_vrl);
70+ vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);
7171
7272 vrl_headers_offsets = (uint32_t huge *)(buffer + vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);
7373 // Calculate line offsets for each vrl
@@ -76,68 +76,64 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
7676
7777 // Calc. vrl size as (next_offset - curr_offset)
7878 if (i != num_of_vrl - 1){
79- vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i];
79+ vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);
8080 }
8181 // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset)
8282 else{
83- vrl_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i];
83+ vrl_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);
8484 }
85- vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(*curr_vrl), vrl_size - sizeof(*curr_vrl));
85+ vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);
8686 }
8787 vrs_cont->vrl_line_offsets = vrl_line_offsets;
8888 return 0;
8989 }
9090
9191 // Seek and return a specified .vrl blob from .vrs blob in far memory
92-struct vrl_container * get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id){
92+int get_vrl_by_id(struct vrs_container /*huge*/ *vrs_cont, uint16_t id, struct vrl_container *vrl_cont){
9393 uint16_t huge *ids;
9494 uint32_t huge *vrl_offs_list;
95- struct vrl_container huge *vrl_cont;
9695 int counter = 0;
9796
98- // If id is invalid, return null
97+ // If id is invalid, return -1
9998 if(id == 0){
10099 // Probably add an error message?
101- return 0;
100+ return -1;
102101 }
103102
104103 // Get id list from .vrs blob (base + offset)
105- ids = (uint16_t huge*)vrs_cont->buffer +
106- (dword)vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST];
104+ ids = (uint16_t huge*)(vrs_cont->buffer +
105+ vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);
107106
108107 // Loop through the id list until we found the right one or hit the end of the list
109108 // Counter is keeping track of the offset(in ids/vrl blobs)
110109 while(ids[counter] != id && ids[counter]){
111110 counter++;
112111 }
113- // Return null if we couldn't find the requested id
112+ // Return -2 if we couldn't find the requested id
114113 if(!ids[counter]){
115114 // Error message?
116- return 0;
115+ return -2;
117116 }
118117
119118 // Get vrl offsets list from .vrs blob (base + offset)
120119 vrl_offs_list = (uint32_t huge *)(vrs_cont->buffer +
121120 vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);
122121
123- // Allocate memory for vrl_cont
124- vrl_cont = (struct vrl_container *)malloc(sizeof(struct vrl_container));
125-
126122 // Get vrl_header from .vrs (base + offset from vrl_list)
127123 // Counter is number of vrls to skip (ids and vrls are aligned according to the .vrs specification)
128124 vrl_cont->vrl_header = (struct vrl1_vgax_header huge *)(vrs_cont->buffer + vrl_offs_list[counter]);
129125
130126 // Get .vrl size by integer arithmetics (next vrl offset - current vrl offset)
131127 if(ids[counter+1]){
132- vrl_cont->size = vrl_offs_list[counter+1] - vrl_offs_list[counter];
128+ vrl_cont->data_size = vrl_offs_list[counter+1] - vrl_offs_list[counter] - sizeof(struct vrl1_vgax_header);
133129 }
134130 // If we are retriving the last vrl, size is ids_list offset - current vrl offset, as next vrl offs is 0
135131 else{
136- vrl_cont->size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_offs_list[counter];
132+ vrl_cont->data_size = vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_offs_list[counter] - sizeof(struct vrl1_vgax_header);
137133 }
138134
139135 // Retrive line offsets form .vrs
140136 vrl_cont->line_offsets = vrs_cont->vrl_line_offsets[counter];
141137
142- return vrl_cont;
138+ return 0;
143139 }
--- a/src/lib/16_vrs.h
+++ b/src/lib/16_vrs.h
@@ -31,7 +31,8 @@
3131
3232 struct vrs_container{
3333 // Size of a .vrs lob in memory
34- dword size;
34+ // minus header
35+ dword data_size;
3536 union{
3637 byte huge *buffer;
3738 struct vrs_header huge *vrs_hdr;
@@ -42,7 +43,8 @@ struct vrs_container{
4243
4344 struct vrl_container{
4445 // Size of a .vrl blob in memory
45- dword size;
46+ // minus header
47+ dword data_size;
4648 union{
4749 byte huge *buffer;
4850 struct vrl1_vgax_header huge *vrl_header;
@@ -66,10 +68,11 @@ int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container
6668 * + struct vrs_container *vrs_cont - pointer to the vrs_container
6769 * with a loaded .vrs file
6870 * + uint16_t id - id of the vrl to retrive
71+* + struct vrl_container * vrl_cont - pointer to vrl_container to load to
6972 * Out:
70-* struct vrl_container* - a pointer to a vrl_container with a pointer
73+* int - operation status
7174 * to the requested .vrl blob
7275 */
73-struct vrl_container * get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id);
76+int get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id, struct vrl_container * vrl_cont);
7477
7578 #endif
--- a/src/vrstest.c
+++ b/src/vrstest.c
@@ -1,143 +1,229 @@
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-
23-#include <stdio.h>
24-#include <dos.h>
25-#include <string.h>
26-#include "src/lib/modex16.h"
27-#include "src/lib/16_sprite.h"
28-#include "src/lib/16_ca.h"
29-#include "src/lib/16_mm.h"
30-
31-global_game_variables_t gvar;
32-
33-void main() {
34- mminfo_t mm; mminfotype mmi;
35- __segment sega;
36- void __based(sega)* bigbuffer;
37- int i;
38- word start;
39- int plane;
40- float t1, t2;
41- boolean baka;
42- byte *pal;
43-
44- // DOSLIB: check our environment
45- probe_dos();
46-
47- // DOSLIB: what CPU are we using?
48- // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
49- // So this code by itself shouldn't care too much what CPU it's running on. Except that other
50- // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
51- // the CPU to carry out tasks. --J.C.
52- cpu_probe();
53-
54- // DOSLIB: check for VGA
55- if (!probe_vga()) {
56- printf("VGA probe failed\n");
57- return;
58- }
59- // hardware must be VGA or higher!
60- if (!(vga_state.vga_flags & VGA_IS_VGA)) {
61- printf("This program requires VGA or higher graphics hardware\n");
62- return;
63- }
64-
65- //bmp = bitmapLoadPcx("data/chikyuu.pcx");
66- VGAmodeX(1, 1, &gvar);
67- gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
68-
69- mm.mmstarted=0;
70- MM_Startup(&mm, &mmi);
71- CA_Startup(&gvar);
72- if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &mm, &mmi)) baka=1; else baka=0;
73-
74- /* fix up the palette and everything */
75- //modexPalUpdate1(bmp.palette);
76- //modexLoadPalFile("data/spri/chikyuu.pal", &pal);
77- //modexPalUpdate1(pal);
78-
79- /* clear and draw one sprite and one bitmap */
80- modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);
81-
82- /* non sprite comparison */
83- start = *clockw;
84- //for(i=0; i<100 ;i++) {
85- // oldDrawBmp(VGA, 20, 20, &bmp, 0);
86- //}
87-
88- start = *clockw;
89- //for(i=0; i<100 ;i++) {
90-//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp);
91- // modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp);
92- //}
93- t1 = (*clockw-start) /18.2;
94-
95- start = *clockw;
96- //for(i=0; i<100; i++) {
97-//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64);
98- modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);
99- //}
100- t2 = (*clockw-start)/18.2;
101-
102-
103- start = *clockw;
104- //for(i=0; i<100 ;i++) {
105- // oldDrawBmp(VGA, 20, 20, &bmp, 1);
106- //}
107-
108-
109- start = *clockw;
110- //for(i=0; i<100 ;i++) {
111-//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp);
112- // modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp);
113- //}
114- //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2));
115- //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp);
116- while(!kbhit())
117- {
118- //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);
119- }
120- VGAmodeX(0, 1, &gvar);
121- MM_FreePtr(&bigbuffer, &mm);
122- MM_Shutdown(&mm);
123- CA_Shutdown(&gvar);
124- /*printf("\nmain=%Fp\n\n", &i);
125- printf("bmp.data=%Fp\n", bmp.data);
126- printf("*bmp.data=%Fp\n", *(bmp.data));
127- printf("&bmp.data=%Fp\n", &(bmp.data));
128-
129- printf("\n%d\n", sizeof(p->plane));
130- printf("%d\n", sizeof(bmp));*/
131-
132- /*for(i=0; i<(320*240); i++)
133- {
134- fprintf(stdout, "%d", bmp.data[i]);
135- if(i%bmp.width==0) fprintf(stdout, "\n");
136- }*/
137- printf("CPU to VGA: %f\n", t1);
138- printf("VGA to VGA: %f\n", t2);
139- printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);
140- printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);
141- if(baka) printf("\nyay!\n");
142- else printf("\npoo!\n");
143-}
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+
23+#include <stdio.h>
24+#include <dos.h>
25+#include <string.h>
26+#include "src/lib/modex16.h"
27+#include "src/lib/16_sprite.h"
28+#include "src/lib/16_ca.h"
29+#include "src/lib/16_mm.h"
30+
31+global_game_variables_t gvar;
32+
33+void main() {
34+ mminfo_t mm; mminfotype mmi;
35+ __segment sega;
36+ void __based(sega)* bigbuffer;
37+ int i;
38+ word start;
39+ int plane;
40+ float t1, t2;
41+ boolean baka;
42+ byte *pal;
43+ int fd, size, size1;
44+ struct sprite spri;
45+ vrl1_vgax_offset_t * off, *off1;
46+ struct vrs_container vrs;
47+ vrl1_vgax_offset_t **vrl_line_offsets;
48+ uint32_t huge *vrl_headers_offsets;
49+ uint16_t huge *vrl_id_iter;
50+ uint32_t vrl_size;
51+ int num_of_vrl;
52+ struct vrl1_vgax_header huge *curr_vrl;
53+ struct vrl_container *vrl;
54+ int success;
55+
56+
57+
58+ // DOSLIB: check our environment
59+ probe_dos();
60+
61+ // DOSLIB: what CPU are we using?
62+ // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
63+ // So this code by itself shouldn't care too much what CPU it's running on. Except that other
64+ // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
65+ // the CPU to carry out tasks. --J.C.
66+ cpu_probe();
67+
68+ // DOSLIB: check for VGA
69+ if (!probe_vga()) {
70+ printf("VGA probe failed\n");
71+ return;
72+ }
73+ // hardware must be VGA or higher!
74+ if (!(vga_state.vga_flags & VGA_IS_VGA)) {
75+ printf("This program requires VGA or higher graphics hardware\n");
76+ return;
77+ }
78+
79+ //bmp = bitmapLoadPcx("data/chikyuu.pcx");
80+ gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
81+
82+ mm.mmstarted=0;
83+ MM_Startup(&mm, &mmi);
84+ CA_Startup(&gvar);
85+ if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &mm, &mmi)) baka=1; else baka=0;
86+ fd = open("data/spri/chikyuu.vrs", O_RDONLY|O_BINARY);
87+ size = lseek(fd, 0, SEEK_END);
88+ lseek(fd, 0, SEEK_SET);
89+ close(fd);
90+ // Insert sanity cheks later
91+ vrs.buffer = bigbuffer;
92+ vrs.data_size = size - sizeof(struct vrl1_vgax_header);
93+ num_of_vrl = 0;
94+ vrl_id_iter = (uint16_t huge *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);
95+ while(vrl_id_iter[num_of_vrl]){
96+ num_of_vrl++;
97+ }
98+
99+ // Allocate memory for vrl line offsets table
100+ vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);
101+
102+ vrl_headers_offsets = (uint32_t huge *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);
103+ // Calculate line offsets for each vrl
104+ for(i = 0; i < num_of_vrl; i++){
105+ curr_vrl = (struct vrl1_vgax_header huge *)(vrs.buffer + vrl_headers_offsets[i]);
106+
107+ // Calc. vrl size as (next_offset - curr_offset)
108+ if (i != num_of_vrl - 1){
109+ vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);
110+ }
111+ // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset)
112+ else{
113+ vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);
114+ }
115+ vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);
116+ }
117+ vrs.vrl_line_offsets = vrl_line_offsets;
118+
119+ //read_vrs(&gvar, "data/spri/chikyuu.vrs", &vrs);
120+ spri.spritesheet = &vrs;
121+ spri.sprite_vrl_cont = malloc(sizeof(struct vrl_container));
122+
123+ vrl = malloc(sizeof(struct vrl_container));
124+ i = get_vrl_by_id(&vrs, 10, vrl);
125+ if(i == -2)
126+ {
127+ puts("Die");
128+ return;
129+ }
130+ off = vrl1_vgax_genlineoffsets(curr_vrl/*vrl->buffer*/, vrl->buffer + sizeof(struct vrl1_vgax_header), vrl->data_size);
131+ fd = open("data/spri/chikyuu.vrl", O_RDONLY|O_BINARY);
132+ size = lseek(fd, 0, SEEK_END);
133+ lseek(fd, 0, SEEK_SET);
134+ close(fd);
135+
136+ if(CA_LoadFile("data/spri/chikyuu.vrl", &bigbuffer, &mm, &mmi)) baka=1; else baka=0;
137+ off1 = vrl1_vgax_genlineoffsets(bigbuffer, (byte *)bigbuffer + sizeof(struct vrl1_vgax_header), size - sizeof(struct vrl1_vgax_header));
138+
139+
140+ //read_vrs(&gvar, "data/spri/chikyuu.vrs", spri.spritesheet);
141+ i = set_anim_by_id(&spri, 10);
142+ if (i == -1)
143+ {
144+ return;
145+ }
146+ spri.x = spri.y = 70;
147+
148+
149+ /* fix up the palette and everything */
150+ //modexPalUpdate1(bmp.palette);
151+ //modexLoadPalFile("data/spri/chikyuu.pal", &pal);
152+ //modexPalUpdate1(pal);
153+
154+ /* clear and draw one sprite and one bitmap */
155+ VGAmodeX(1, 1, &gvar);
156+ modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);
157+
158+ /* non sprite comparison */
159+ start = *clockw;
160+ //for(i=0; i<100 ;i++) {
161+ // oldDrawBmp(VGA, 20, 20, &bmp, 0);
162+ //}
163+
164+ start = *clockw;
165+ //for(i=0; i<100 ;i++) {
166+//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp);
167+ // modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp);
168+ //}
169+ t1 = (*clockw-start) /18.2;
170+
171+ start = *clockw;
172+ //for(i=0; i<100; i++) {
173+//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64);
174+ modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);
175+ animate_spri(&spri);
176+ draw_vrl1_vgax_modex(5,5,curr_vrl/*vrl->buffer*/,vrl->line_offsets,vrl->buffer + sizeof(struct vrl1_vgax_header),vrl->data_size);
177+ draw_vrl1_vgax_modex(40,40,curr_vrl/*vrs.buffer*/ + vrl_headers_offsets[0],vrs.vrl_line_offsets[0],vrs.buffer + vrl_headers_offsets[0] + sizeof(struct vrl1_vgax_header),vrl_headers_offsets[1] - vrl_headers_offsets[0] - sizeof(struct vrl1_vgax_header));
178+ draw_vrl1_vgax_modex(100, 5, bigbuffer, off1, (byte *)bigbuffer + sizeof(struct vrl1_vgax_header), size - sizeof(struct vrl1_vgax_header));
179+
180+ //}
181+ t2 = (*clockw-start)/18.2;
182+
183+ //for (i = 0; i < 5; i++){
184+ //animate_spri(&spri);
185+
186+ start = *clockw;
187+ //for(i=0; i<100 ;i++) {
188+ // oldDrawBmp(VGA, 20, 20, &bmp, 1);
189+ //}
190+
191+
192+ start = *clockw;
193+ //for(i=0; i<100 ;i++) {
194+//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp);
195+ // modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp);
196+ //}
197+ //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2));
198+ //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp);
199+ while(!kbhit())
200+ {
201+ //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);
202+ }
203+ VGAmodeX(0, 1, &gvar);
204+ free(spri.sprite_vrl_cont);
205+ MM_FreePtr(&bigbuffer, &mm);
206+ //MM_FreePtr(&((void __based(sega)*)spri.spritesheet->buffer), &mm);
207+ MM_Shutdown(&mm);
208+ CA_Shutdown(&gvar);
209+ /*printf("\nmain=%Fp\n\n", &i);
210+ printf("bmp.data=%Fp\n", bmp.data);
211+ printf("*bmp.data=%Fp\n", *(bmp.data));
212+ printf("&bmp.data=%Fp\n", &(bmp.data));
213+
214+ printf("\n%d\n", sizeof(p->plane));
215+ printf("%d\n", sizeof(bmp));*/
216+
217+ /*for(i=0; i<(320*240); i++)
218+ {
219+ fprintf(stdout, "%d", bmp.data[i]);
220+ if(i%bmp.width==0) fprintf(stdout, "\n");
221+ }*/
222+ printf("CPU to VGA: %f\n", t1);
223+ printf("VGA to VGA: %f\n", t2);
224+ printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);
225+ printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);
226+ printf("Num %d", num_of_vrl);
227+ if(baka) printf("\nyay!\n");
228+ else printf("\npoo!\n");
229+}
--- a/wbuild.sh
+++ b/wbuild.sh
@@ -2,3 +2,8 @@
22 wmake -h clean
33 wmake -h
44 wmake -h comp
5+if [ -f *.err ]
6+then
7+ echo dumping *.err
8+ cat *.err
9+fi