]> 4ch.mooo.com Git - 16.git/commitdiff
proper sprite loading added wwwwwww
authorsparky4 <sparky4@cock.li>
Thu, 26 Jan 2017 15:12:34 +0000 (09:12 -0600)
committersparky4 <sparky4@cock.li>
Thu, 26 Jan 2017 15:12:34 +0000 (09:12 -0600)
DEBUG.16W [new file with mode: 0755]
HEAP.16W [new file with mode: 0755]
MEMINFO.16W [new file with mode: 0755]
MMDUMP.16W [new file with mode: 0755]
src/lib/16_tdef.h
src/lib/16_vl.c
src/lib/16_vrs.c
src/lib/16_vrs.h
src/lib/doslib
src/vrstest.c
src/zcroll.c

diff --git a/DEBUG.16W b/DEBUG.16W
new file mode 100755 (executable)
index 0000000..927f74d
--- /dev/null
+++ b/DEBUG.16W
@@ -0,0 +1,210 @@
+\e[0mSeg:0      Size:9973       Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m0000\r
+\e[0m\e[0mSeg:27ba       Size:36 Owner:0x0\r
+\e[41;31m+\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:27de       Size:256        Owner:0x1984\r
+\e[44;34m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:28de       Size:256        Owner:0x1776\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:29de       Size:256        Owner:0x1778\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2ade       Size:256        Owner:0x177a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2bde       Size:256        Owner:0x177c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2cde       Size:256        Owner:0x177e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2dde       Size:256        Owner:0x1780\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2ede       Size:256        Owner:0x1782\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:2fde       Size:256        Owner:0x1784\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:30de       Size:256        Owner:0x1786\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:31de       Size:256        Owner:0x1788\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:32de       Size:256        Owner:0x178a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:33de       Size:256        Owner:0x178c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:34de       Size:256        Owner:0x178e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:35de       Size:256        Owner:0x1790\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:36de       Size:256        Owner:0x1792\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:37de       Size:256        Owner:0x1794\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:38de       Size:256        Owner:0x1796\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:39de       Size:256        Owner:0x1798\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3ade       Size:256        Owner:0x179a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3bde       Size:256        Owner:0x179c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3cde       Size:256        Owner:0x179e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3dde       Size:256        Owner:0x17a0\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3ede       Size:256        Owner:0x17a2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:3fde       Size:256        Owner:0x17a4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:40de       Size:256        Owner:0x17a6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:41de       Size:256        Owner:0x17a8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:42de       Size:256        Owner:0x17aa\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:43de       Size:256        Owner:0x17ac\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:44de       Size:256        Owner:0x17ae\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:45de       Size:256        Owner:0x17b0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:46de       Size:256        Owner:0x17b2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:47de       Size:256        Owner:0x17b4\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:48de       Size:256        Owner:0x17b6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:49de       Size:256        Owner:0x17b8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4ade       Size:256        Owner:0x17ba\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4bde       Size:256        Owner:0x17bc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4cde       Size:256        Owner:0x17be\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4dde       Size:256        Owner:0x17c0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4ede       Size:256        Owner:0x17c2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:4fde       Size:256        Owner:0x17c4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:50de       Size:256        Owner:0x17c6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:51de       Size:256        Owner:0x17c8\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:52de       Size:256        Owner:0x17ca\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:53de       Size:256        Owner:0x17cc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:54de       Size:256        Owner:0x17ce\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:55de       Size:256        Owner:0x17d0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:56de       Size:256        Owner:0x17d2\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:57de       Size:256        Owner:0x17d4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:58de       Size:256        Owner:0x17d6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:59de       Size:256        Owner:0x17d8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5ade       Size:256        Owner:0x17da\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5bde       Size:256        Owner:0x17dc\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5cde       Size:256        Owner:0x17de\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5dde       Size:256        Owner:0x17e0\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5ede       Size:256        Owner:0x17e2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:5fde       Size:256        Owner:0x17e4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:60de       Size:256        Owner:0x17e6\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:61de       Size:256        Owner:0x17e8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:62de       Size:256        Owner:0x17ea\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:63de       Size:256        Owner:0x17ec\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:64de       Size:256        Owner:0x17ee\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:65de       Size:256        Owner:0x17f0\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:66de       Size:256        Owner:0x17f2\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:67de       Size:256        Owner:0x17f4\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:68de       Size:256        Owner:0x17f6\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:69de       Size:256        Owner:0x17f8\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6ade       Size:256        Owner:0x17fa\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6bde       Size:256        Owner:0x17fc\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6cde       Size:256        Owner:0x17fe\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6dde       Size:256        Owner:0x1800\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6ede       Size:256        Owner:0x1802\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:6fde       Size:256        Owner:0x1804\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:70de       Size:256        Owner:0x1806\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:71de       Size:256        Owner:0x1808\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:72de       Size:256        Owner:0x180a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:73de       Size:256        Owner:0x180c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:74de       Size:256        Owner:0x180e\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:75de       Size:256        Owner:0x1810\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:76de       Size:256        Owner:0x1812\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:77de       Size:256        Owner:0x1814\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:78de       Size:256        Owner:0x1816\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:79de       Size:256        Owner:0x1818\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7ade       Size:256        Owner:0x181a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7bde       Size:256        Owner:0x181c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7cde       Size:256        Owner:0x181e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7dde       Size:256        Owner:0x1820\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7ede       Size:256        Owner:0x1822\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:7fde       Size:256        Owner:0x1824\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:80de       Size:256        Owner:0x1826\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:81de       Size:256        Owner:0x1828\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:82de       Size:256        Owner:0x182a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:83de       Size:256        Owner:0x182c\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:84de       Size:256        Owner:0x182e\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:85de       Size:256        Owner:0x1830\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:86de       Size:256        Owner:0x1832\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:87de       Size:256        Owner:0x1834\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:88de       Size:256        Owner:0x1836\r
+\e[45;35m+++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:89de       Size:256        Owner:0x1838\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8ade       Size:256        Owner:0x183a\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8bde       Size:256        Owner:0x183c\r
+\e[45;35m++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:8cde       Size:401        Owner:0xef0c\r
+\e[44;34m++++++\e[0m\e[42;32m\r
+\e[0m\e[0mSeg:b7de       Size:18465      Owner:0x0\r
+\e[41;31m++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m
\ No newline at end of file
diff --git a/HEAP.16W b/HEAP.16W
new file mode 100755 (executable)
index 0000000..21a34df
--- /dev/null
+++ b/HEAP.16W
@@ -0,0 +1,69 @@
+\r
+       == default ==\r
+\r
+  FREE block at 27dc0016 of size 68\r
+  USED block at 27dc005a of size 50\r
+  USED block at 27dc008c of size 50\r
+  USED block at 27dc00be of size 50\r
+  USED block at 27dc00f0 of size 50\r
+  USED block at 27dc0122 of size 50\r
+  USED block at 27dc0154 of size 50\r
+  USED block at 27dc0186 of size 50\r
+  USED block at 27dc01b8 of size 50\r
+  USED block at 27dc01ea of size 50\r
+  USED block at 27dc021c of size 50\r
+  USED block at 27dc024e of size 50\r
+  USED block at 27dc0280 of size 50\r
+  FREE block at 27dc02b2 of size 14\r
+  USED block at 27dc02c0 of size 20\r
+  USED block at 27dc02d4 of size 136\r
+  FREE block at 27dc035c of size 7328\r
+OK - end of heap\r
+\r
+       == near ==\r
+\r
+  USED block at 17dbefa6 of size 12\r
+  USED block at 17dbefb2 of size 330\r
+  USED block at 17dbf0fc of size 52\r
+  USED block at 17dbf130 of size 20\r
+  USED block at 17dbf144 of size 20\r
+  USED block at 17dbf158 of size 20\r
+  USED block at 17dbf16c of size 20\r
+  USED block at 17dbf180 of size 20\r
+  USED block at 17dbf194 of size 3688\r
+OK - end of heap\r
+\r
+       == far ==\r
+\r
+  USED block at 27dc0016 of size 68\r
+  USED block at 27dc005a of size 50\r
+  USED block at 27dc008c of size 50\r
+  USED block at 27dc00be of size 50\r
+  USED block at 27dc00f0 of size 50\r
+  USED block at 27dc0122 of size 50\r
+  USED block at 27dc0154 of size 50\r
+  USED block at 27dc0186 of size 50\r
+  USED block at 27dc01b8 of size 50\r
+  USED block at 27dc01ea of size 50\r
+  USED block at 27dc021c of size 50\r
+  USED block at 27dc024e of size 50\r
+  USED block at 27dc0280 of size 50\r
+  USED block at 27dc02b2 of size 14\r
+  USED block at 27dc02c0 of size 20\r
+  USED block at 27dc02d4 of size 136\r
+  USED block at 27dc035c of size 7328\r
+OK - end of heap\r
+\r
+Memory Type         Total      Used       Free\r
+----------------  --------   --------   --------\r
+Default                   8166         756       7410\r
+Near              4182         494       3688\r
+Far               8166         756       7410\r
+----------------  --------   --------   --------\r
+coreleft = 3686\r
+farcoreleft = 35502\r
+GetFreeSize = 31836\r
+GetNearFreeSize = 3688\r
+GetFarFreeSize = 31836\r
+memavl = 3686\r
+stackavail = 31557\r
diff --git a/MEMINFO.16W b/MEMINFO.16W
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/MMDUMP.16W b/MMDUMP.16W
new file mode 100755 (executable)
index 0000000..9793e6e
Binary files /dev/null and b/MMDUMP.16W differ
index 730e7f964c016cf523b9766df95f5dd23553f39a..2021b8777f319afb8af1b40956885e4fd0fd5cea 100755 (executable)
@@ -471,6 +471,9 @@ typedef struct
        __SEGA  *grsegs[NUMCHUNKS];\r
        byte            far     grneeded[NUMCHUNKS];\r
        huffnode huffnode;\r
+\r
+       //TODO: extend! and learn from keen/wolf/catacomb's code wwww\r
+       memptr  spribuff;\r
 } ca_t;\r
 \r
 //==========================================================================\r
index 63942a08effb1f4530e5547af77ff1c086ec0c58..f22b7772cacd17c8bd7d9119700644bbd2ae1cf5 100755 (executable)
@@ -284,11 +284,10 @@ void modexHiganbanaPageSetup(video_t *video)
        (video->page[1]) = modexNextPage(&(video->page[0]));    video->num_of_pages++;\r
 //0000 (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), (video->page[0]).width, TILEWH*4);              video->num_of_pages++;\r
 //0000 (video->page[3]) = (video->page[2]);            video->num_of_pages++;\r
-       (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), TILEWH*4, TILEWH*4);            video->num_of_pages++;\r
-//     (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].width, 176);     video->num_of_pages++;\r
-       (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 208);        video->num_of_pages++;\r
-//     (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 172);     video->num_of_pages++;\r
-//     (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), 72, 128);               video->num_of_pages++;\r
+////   (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), TILEWH*4, TILEWH*4);            video->num_of_pages++;\r
+////   (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].sw, 208);        video->num_of_pages++;\r
+       (video->page[2]) = modexNextPageFlexibleSize(&(video->page[1]), video->page[0].width, 96);      video->num_of_pages++;\r
+       (video->page[3]) = modexNextPageFlexibleSize(&(video->page[2]), video->page[0].width, video->page[2].height);   video->num_of_pages++;\r
        modexCalcVmemRemain(video);\r
        video->p=0;\r
        video->r=1;\r
index f77119af4af5291b5067ed81d4ee0dd987f8dd02..41ef537ead389c125ea1a38d05ece7482667d8ad 100755 (executable)
  */\r
 #include "src/lib/16_vrs.h"\r
 \r
+void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){       VRS_OpenVRS(filename, enti, 1, gvar);   }\r
+void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar){       VRS_OpenVRS(filename, enti, 0, gvar);   }\r
+void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar)\r
+{\r
+       //memptr        big buffer;\r
+       static struct vrs_container vrs;\r
+       vrl1_vgax_offset_t **vrl_line_offsets;\r
+       uint16_t far *vrl_id_iter;\r
+       uint32_t far *vrl_headers_offsets;\r
+       struct vrl1_vgax_header far *curr_vrl;\r
+       uint32_t vrl_size;\r
+       int num_of_vrl,i;\r
+       int size=0;\r
+\r
+       switch(rlsw)\r
+       {\r
+               case 1:\r
+                       CA_ReadFile(filename, &gvar->ca.spribuff, gvar);\r
+               break;\r
+               case 0:\r
+                       CA_LoadFile(filename, &gvar->ca.spribuff, gvar);\r
+               break;\r
+       }\r
+\r
+       // Insert sanity cheks later\r
+       vrs.buffer = gvar->ca.spribuff;\r
+       vrs.data_size = size - sizeof(struct vrl1_vgax_header);\r
+       num_of_vrl = 0;\r
+       vrl_id_iter = (uint16_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+       while(vrl_id_iter[num_of_vrl]){\r
+               num_of_vrl++;\r
+       }\r
+\r
+       // Allocate memory for vrl line offsets table\r
+       vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);\r
+\r
+       vrl_headers_offsets = (uint32_t far *)(vrs.buffer + vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+       // Calculate line offsets for each vrl\r
+       for(i = 0; i < num_of_vrl; i++){\r
+               curr_vrl = (struct vrl1_vgax_header far *)(vrs.buffer + vrl_headers_offsets[i]);\r
+\r
+               // Calc. vrl size as (next_offset - curr_offset)\r
+               if (i != num_of_vrl - 1){\r
+                       vrl_size = vrl_headers_offsets[i+1] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+               }\r
+               // If it's the last vrl, size is (next_vrs_struct_offset - curr_offset)\r
+               else{\r
+                       vrl_size = vrs.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+               }\r
+               vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);\r
+       }\r
+       vrs.vrl_line_offsets = vrl_line_offsets;\r
+\r
+       enti->spri->spritesheet = &vrs;\r
+       enti->spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container));\r
+}\r
+\r
 // Read .vrs file into far memory\r
 int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont){\r
        int fd;\r
index 054377b1dd63c1d95cd599acf34d23363670a5ec..cb5495bbb1c17b23795df35c9c48796bf514f0ce 100755 (executable)
@@ -61,7 +61,10 @@ struct vrl_container{
 * Out:\r
 * + int - 0 on succes, 1 on failure\r
 */\r
-int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont);\r
+void VRS_ReadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
+void VRS_LoadVRS(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
+void VRS_OpenVRS(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);\r
+//int read_vrs(global_game_variables_t *gvar, char *filename, struct vrs_container *vrs_cont);\r
 \r
 /* Seek and return a specified .vrl blob from .vrs blob in memory\r
 * In:\r
index c87e11580abd698aa834d9ec65dee4ed47009f0a..82810640576d089bbc4b382b3318a41679ff2817 160000 (submodule)
@@ -1 +1 @@
-Subproject commit c87e11580abd698aa834d9ec65dee4ed47009f0a
+Subproject commit 82810640576d089bbc4b382b3318a41679ff2817
index 18353afbc468a5cb03706cb89cb1c2f5334c17bc..d879f65918cb2f92024f6bdaec48e2b4c0f9b753 100755 (executable)
@@ -44,20 +44,19 @@ void main()
        //boolean baka;\r
        entity_t enti;\r
        //vrl1_vgax_offset_t * off, *off1;\r
-       struct vrs_container vrs;\r
-       vrl1_vgax_offset_t **vrl_line_offsets;\r
+/*     struct vrs_container vrs; vrl1_vgax_offset_t **vrl_line_offsets;\r
        uint32_t far *vrl_headers_offsets;\r
        uint16_t far *vrl_id_iter;\r
        uint32_t vrl_size;\r
        int num_of_vrl;\r
        struct vrl1_vgax_header far *curr_vrl;\r
        int size=0;\r
-       dbg_nointest=0;\r
+*/\r
 \r
+       dbg_nointest=0;\r
        Startup16(&gvar);\r
 \r
-       // What should be done by read_vrs:\r
-       CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar);\r
+/*     CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar);\r
 \r
        // Insert sanity cheks later\r
        vrs.buffer = bigbuffer;\r
@@ -93,7 +92,8 @@ void main()
 \r
 \r
        enti.spri->spritesheet = &vrs;\r
-       enti.spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container));\r
+       enti.spri->sprite_vrl_cont = malloc(sizeof(struct vrl_container));*/\r
+       VRS_LoadVRS("data/spri/chikyuu.vrs", &enti, &gvar);\r
        i = set_anim_by_id((enti.spri), 31);\r
        if (i == -1)\r
        {\r
@@ -155,7 +155,7 @@ void main()
        MM_Report_(&gvar);\r
        Shutdown16(&gvar);\r
        free(enti.spri->sprite_vrl_cont);\r
-       free(vrl_line_offsets);\r
+       free(enti.spri->spritesheet->vrl_line_offsets);\r
        MM_FreePtr(&bigbuffer, &gvar);\r
        //MM_FreePtr(&((void __based(sega)*)enti.spri->spritesheet->buffer), &mm);\r
        //printf("CPU to VGA: %f\n", t1);\r
@@ -167,7 +167,7 @@ void main()
        printf("t2: %f\n", t2);\r
 //0000 printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
 //0000 printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
-       printf("Num %d", num_of_vrl);\r
+//     printf("Num %d", num_of_vrl);\r
 //     if(baka) printf("\nyay!\n");\r
 //     else printf("\npoo!\n");\r
 }\r
index 10e098dff48f8cea59de1de831d4803402ec22b8..1667459fa1501d29127589726bd653b740ada43a 100755 (executable)
@@ -90,7 +90,8 @@ void main(int argc, char *argv[])
 //     fprintf(stderr, "yay map loaded~~\n");\r
 \r
        // data\r
-       read_vrs(&gvar, bakapee1, player[0].enti.spri->spritesheet);\r
+       //read_vrs(&gvar, , .spri->spritesheet);\r
+       VRS_LoadVRS(bakapee1, &player[0].enti, &gvar);\r
 \r
        // input!\r
        IN_Default(0, &player,ctrl_Keyboard1);\r
@@ -223,7 +224,8 @@ void main(int argc, char *argv[])
                                bakapee1=FILENAME_2;\r
                                bakapee1p=FILENAME_2P;\r
                        }\r
-                       read_vrs(&gvar, bakapee1, player[0].enti.spri->spritesheet);\r
+                       //read_vrs(&gvar, bakapee1, player[0].enti.spri->spritesheet);\r
+                       VRS_ReadVRS(bakapee1, &player[0].enti, &gvar);\r
                        VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
                }//JK\r
 #ifdef FADE\r