#ifndef BITMAP_H\r
#define BITMAP_H\r
#include "types.h"\r
+typedef struct {\r
+ byte *data;\r
+ word width;\r
+ word height;\r
+ byte *palette;\r
+ word offset;\r
+} bitmap_t;\r
+/*\r
typedef struct {\r
byte *data;\r
word width;\r
word height;\r
byte *palette;\r
} bitmap_t;\r
+*/\r
\r
+typedef struct {\r
+ byte far **data;\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
+} tileset_t;\r
+/*\r
typedef struct {\r
byte **data;\r
- word ntiles; /* the number of tiles */\r
- word twidth; /* width of the tiles */\r
- word theight; /* height of the tiles */\r
- byte *palette; /* palette for the tile set */\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
} tileset_t;\r
+*/\r
\r
bitmap_t bitmapLoadPcx(char *filename);\r
tileset_t bitmapLoadPcxTiles(char *filename, word twidth, word theight);\r
void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);\r
void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp);\r
void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);\r
+void modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height);\r
\r
/* Palette fade and flash effects */\r
void modexFadeOn(word fade, byte *palette);\r
--- /dev/null
+\e[0mSeg:0 Size:10306 Owner:0x0\r
+\e[41;31m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\e[42;32m00\r
+\e[0m\e[0mSeg:2896 Size:76 Owner:0x0\r
+\e[41;31m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:28e2 Size:256 Owner:0x6120\r
+\e[44;34m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:29e2 Size:256 Owner:0x1f62\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2ae2 Size:256 Owner:0x1f64\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2be2 Size:256 Owner:0x1f66\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2ce2 Size:256 Owner:0x1f68\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2de2 Size:256 Owner:0x1f6a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2ee2 Size:256 Owner:0x1f6c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:2fe2 Size:256 Owner:0x1f6e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:30e2 Size:256 Owner:0x1f70\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:31e2 Size:256 Owner:0x1f72\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:32e2 Size:256 Owner:0x1f74\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:33e2 Size:256 Owner:0x1f76\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:34e2 Size:256 Owner:0x1f78\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:35e2 Size:256 Owner:0x1f7a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:36e2 Size:256 Owner:0x1f7c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:37e2 Size:256 Owner:0x1f7e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:38e2 Size:256 Owner:0x1f80\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:39e2 Size:256 Owner:0x1f82\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3ae2 Size:256 Owner:0x1f84\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3be2 Size:256 Owner:0x1f86\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3ce2 Size:256 Owner:0x1f88\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3de2 Size:256 Owner:0x1f8a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3ee2 Size:256 Owner:0x1f8c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:3fe2 Size:256 Owner:0x1f8e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:40e2 Size:256 Owner:0x1f90\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:41e2 Size:256 Owner:0x1f92\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:42e2 Size:256 Owner:0x1f94\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:43e2 Size:256 Owner:0x1f96\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:44e2 Size:256 Owner:0x1f98\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:45e2 Size:256 Owner:0x1f9a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:46e2 Size:256 Owner:0x1f9c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:47e2 Size:256 Owner:0x1f9e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:48e2 Size:256 Owner:0x1fa0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:49e2 Size:256 Owner:0x1fa2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4ae2 Size:256 Owner:0x1fa4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4be2 Size:256 Owner:0x1fa6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4ce2 Size:256 Owner:0x1fa8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4de2 Size:256 Owner:0x1faa\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4ee2 Size:256 Owner:0x1fac\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:4fe2 Size:256 Owner:0x1fae\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:50e2 Size:256 Owner:0x1fb0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:51e2 Size:256 Owner:0x1fb2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:52e2 Size:256 Owner:0x1fb4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:53e2 Size:256 Owner:0x1fb6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:54e2 Size:256 Owner:0x1fb8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:55e2 Size:256 Owner:0x1fba\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:56e2 Size:256 Owner:0x1fbc\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:57e2 Size:256 Owner:0x1fbe\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:58e2 Size:256 Owner:0x1fc0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:59e2 Size:256 Owner:0x1fc2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5ae2 Size:256 Owner:0x1fc4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5be2 Size:256 Owner:0x1fc6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5ce2 Size:256 Owner:0x1fc8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5de2 Size:256 Owner:0x1fca\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5ee2 Size:256 Owner:0x1fcc\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:5fe2 Size:256 Owner:0x1fce\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:60e2 Size:256 Owner:0x1fd0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:61e2 Size:256 Owner:0x1fd2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:62e2 Size:256 Owner:0x1fd4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:63e2 Size:256 Owner:0x1fd6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:64e2 Size:256 Owner:0x1fd8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:65e2 Size:256 Owner:0x1fda\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:66e2 Size:256 Owner:0x1fdc\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:67e2 Size:256 Owner:0x1fde\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:68e2 Size:256 Owner:0x1fe0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:69e2 Size:256 Owner:0x1fe2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6ae2 Size:256 Owner:0x1fe4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6be2 Size:256 Owner:0x1fe6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6ce2 Size:256 Owner:0x1fe8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6de2 Size:256 Owner:0x1fea\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6ee2 Size:256 Owner:0x1fec\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:6fe2 Size:256 Owner:0x1fee\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:70e2 Size:256 Owner:0x1ff0\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:71e2 Size:256 Owner:0x1ff2\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:72e2 Size:256 Owner:0x1ff4\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:73e2 Size:256 Owner:0x1ff6\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:74e2 Size:256 Owner:0x1ff8\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:75e2 Size:256 Owner:0x1ffa\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:76e2 Size:256 Owner:0x1ffc\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:77e2 Size:256 Owner:0x1ffe\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:78e2 Size:256 Owner:0x2000\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:79e2 Size:256 Owner:0x2002\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7ae2 Size:256 Owner:0x2004\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7be2 Size:256 Owner:0x2006\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7ce2 Size:256 Owner:0x2008\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7de2 Size:256 Owner:0x200a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7ee2 Size:256 Owner:0x200c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:7fe2 Size:256 Owner:0x200e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:80e2 Size:256 Owner:0x2010\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:81e2 Size:256 Owner:0x2012\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:82e2 Size:256 Owner:0x2014\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:83e2 Size:256 Owner:0x2016\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:84e2 Size:256 Owner:0x2018\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:85e2 Size:256 Owner:0x201a\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:86e2 Size:256 Owner:0x201c\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:87e2 Size:256 Owner:0x201e\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:88e2 Size:256 Owner:0x2020\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:89e2 Size:256 Owner:0x2022\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:8ae2 Size:256 Owner:0x2024\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:8be2 Size:256 Owner:0x2026\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:8ce2 Size:256 Owner:0x2028\r
+\e[45;35m\e[0m\e[42;32m0\r
+\e[0m\e[0mSeg:8de2 Size:273 Owner:0x6120\r
+\e[44;34m\e[0m\e[42;32m000000000000000000000000000000000000000000000000\r
+\e[0m\e[0mSeg:9dc1 Size:25150 Owner:0x0\r
+\e[41;31m\e[0m
\ No newline at end of file
\r
== default ==\r
\r
- USED block at 2e770016 of size 6146\r
- USED block at 2e771818 of size 20\r
- USED block at 2e77182c of size 66\r
- USED block at 2e77186e of size 50\r
- USED block at 2e7718a0 of size 50\r
- USED block at 2e7718d2 of size 50\r
- USED block at 2e771904 of size 50\r
- USED block at 2e771936 of size 50\r
- USED block at 2e771968 of size 50\r
- USED block at 2e77199a of size 50\r
- USED block at 2e7719cc of size 50\r
- USED block at 2e7719fe of size 50\r
- USED block at 2e771a30 of size 50\r
- USED block at 2e771a62 of size 50\r
- USED block at 2e771a94 of size 50\r
- FREE block at 2e771ac6 of size 29618\r
- USED block at 2e778e78 of size 1202\r
- USED block at 2e77932a of size 1202\r
- USED block at 2e7797dc of size 1202\r
- USED block at 2e779c8e of size 136\r
- USED block at 2e779d16 of size 22\r
- FREE block at 2e779d2c of size 8202\r
+ USED block at 2ed20016 of size 4098\r
+ USED block at 2ed21018 of size 20\r
+ USED block at 2ed2102c of size 66\r
+ USED block at 2ed2106e of size 50\r
+ USED block at 2ed210a0 of size 50\r
+ USED block at 2ed210d2 of size 50\r
+ USED block at 2ed21104 of size 50\r
+ USED block at 2ed21136 of size 50\r
+ USED block at 2ed21168 of size 50\r
+ USED block at 2ed2119a of size 50\r
+ USED block at 2ed211cc of size 50\r
+ USED block at 2ed211fe of size 50\r
+ USED block at 2ed21230 of size 50\r
+ USED block at 2ed21262 of size 50\r
+ USED block at 2ed21294 of size 50\r
+ FREE block at 2ed212c6 of size 29552\r
+ USED block at 2ed28636 of size 1202\r
+ USED block at 2ed28ae8 of size 1202\r
+ USED block at 2ed28f9a of size 1202\r
+ USED block at 2ed2944c of size 136\r
+ USED block at 2ed294d4 of size 22\r
+ FREE block at 2ed294ea of size 8202\r
+ FREE block at 2ed2b4f4 of size 0\r
ERROR - bad node in heap\r
\r
== near ==\r
\r
- FREE block at 1e76f9a6 of size 12\r
- FREE block at 1e76f9b2 of size 320\r
- FREE block at 1e76faf2 of size 52\r
- FREE block at 1e76fb26 of size 20\r
- FREE block at 1e76fb3a of size 20\r
- FREE block at 1e76fb4e of size 20\r
- FREE block at 1e76fb62 of size 20\r
- FREE block at 1e76fb76 of size 20\r
- FREE block at 1e76fb8a of size 1138\r
+ FREE block at 1ed1f9f6 of size 12\r
+ FREE block at 1ed1fa02 of size 320\r
+ FREE block at 1ed1fb42 of size 52\r
+ FREE block at 1ed1fb76 of size 20\r
+ FREE block at 1ed1fb8a of size 20\r
+ FREE block at 1ed1fb9e of size 20\r
+ FREE block at 1ed1fbb2 of size 20\r
+ FREE block at 1ed1fbc6 of size 20\r
+ FREE block at 1ed1fbda of size 1058\r
OK - end of heap\r
\r
== far ==\r
\r
- FREE block at 2e770016 of size 6146\r
- FREE block at 2e771818 of size 20\r
- FREE block at 2e77182c of size 66\r
- FREE block at 2e77186e of size 50\r
- FREE block at 2e7718a0 of size 50\r
- FREE block at 2e7718d2 of size 50\r
- FREE block at 2e771904 of size 50\r
- FREE block at 2e771936 of size 50\r
- FREE block at 2e771968 of size 50\r
- FREE block at 2e77199a of size 50\r
- FREE block at 2e7719cc of size 50\r
- FREE block at 2e7719fe of size 50\r
- FREE block at 2e771a30 of size 50\r
- FREE block at 2e771a62 of size 50\r
- FREE block at 2e771a94 of size 50\r
- FREE block at 2e771ac6 of size 29618\r
- FREE block at 2e778e78 of size 1202\r
- FREE block at 2e77932a of size 1202\r
- FREE block at 2e7797dc of size 1202\r
- FREE block at 2e779c8e of size 136\r
- FREE block at 2e779d16 of size 22\r
- FREE block at 2e779d2c of size 8202\r
+ FREE block at 2ed20016 of size 4098\r
+ FREE block at 2ed21018 of size 20\r
+ FREE block at 2ed2102c of size 66\r
+ FREE block at 2ed2106e of size 50\r
+ FREE block at 2ed210a0 of size 50\r
+ FREE block at 2ed210d2 of size 50\r
+ FREE block at 2ed21104 of size 50\r
+ FREE block at 2ed21136 of size 50\r
+ FREE block at 2ed21168 of size 50\r
+ FREE block at 2ed2119a of size 50\r
+ FREE block at 2ed211cc of size 50\r
+ FREE block at 2ed211fe of size 50\r
+ FREE block at 2ed21230 of size 50\r
+ FREE block at 2ed21262 of size 50\r
+ FREE block at 2ed21294 of size 50\r
+ FREE block at 2ed212c6 of size 29552\r
+ FREE block at 2ed28636 of size 1202\r
+ FREE block at 2ed28ae8 of size 1202\r
+ FREE block at 2ed28f9a of size 1202\r
+ FREE block at 2ed2944c of size 136\r
+ FREE block at 2ed294d4 of size 22\r
+ FREE block at 2ed294ea of size 8202\r
+ FREE block at 2ed2b4f4 of size 0\r
ERROR - bad node in heap\r
\r
Memory Type Total Used Free\r
---------------- -------- -------- --------\r
-Default 48416 10596 37820\r
-Near 1622 484 1138\r
-Far 48416 10596 37820\r
+Default 46302 8548 37754\r
+Near 1542 484 1058\r
+Far 46302 8548 37754\r
---------------- -------- -------- --------\r
-HC_coreleft = 1136\r
-HC_farcoreleft = 417792\r
-HC_GetFreeSize = 37820\r
-HC_GetNearFreeSize = 1138\r
-HC_GetFarFreeSize = 37820\r
-memavl = 1136\r
+HC_coreleft = 1056\r
+HC_farcoreleft = 415744\r
+HC_GetFreeSize = 37754\r
+HC_GetNearFreeSize = 1058\r
+HC_GetFarFreeSize = 37754\r
+memavl = 1056\r
stackavail = 31484\r
#
VGMSNDOBJ = vgmSnd.$(OBJ)
OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
-GFXLIBOBJS = 16_vl.$(OBJ) 16_vl_1.$(OBJ) 16_vl_2.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ)
+GFXLIBOBJS = 16_vl.$(OBJ) 16_vl_1.$(OBJ) 16_vl_2.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) scroll16.$(OBJ) 16_spri.$(OBJ)
16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_head.$(OBJ) 16_enti.$(OBJ) 16_dbg.$(OBJ) 16_in.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16_sd.$(OBJ) 16_tail_.$(OBJ) 16_dbg_1.$(OBJ)
DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
!ifeq DEBUGSERIAL 1
sountest.exe &
xcroll.exe &
0croll.exe &
+ 1croll.exe &
inputest.exe &
vrstest.exe &
tesuto.exe &
#
scroll.exe: scroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
scroll.$(OBJ): $(SRC)/scroll.c
-xcroll.exe: xcroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
+xcroll.exe: xcroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB) #bitmapl.$(OBJ)
xcroll.$(OBJ): $(SRC)/xcroll.c
zcroll.exe: zcroll.$(OBJ) $(16LIB) gfx.lib $(DOSLIB)
zcroll.$(OBJ): $(SRC)/zcroll.c
16_vlpal.$(OBJ): $(SRCLIB)/16_vlpa_.c $(SRCLIB)/16_vlpal.c $(SRCLIB)/16_vlpal.h
bakapee.$(OBJ): $(SRCLIB)/bakapee.c $(SRCLIB)/bakapee.h
16planar.$(OBJ): $(MODEXLIB16)/16planar.c $(MODEXLIB16)/16planar.h
-16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIB)
+#16_vrs.$(OBJ): $(SRCLIB)/16_vrs.c $(SRCLIB)/16_vrs.h $(DOSLIB)
16_spri.$(OBJ): $(SRCLIB)/16_spri.c $(SRCLIB)/16_spri.h
planar.$(OBJ): $(SRCLIB)/planar.c $(SRCLIB)/planar.h
scroll16.$(OBJ): $(SRCLIB)/scroll16.c $(SRCLIB)/scroll16.h
vgmSnd.$(OBJ): $(VGMSNDLIB)/vgmSnd.c $(VGMSNDLIB)/vgmSnd.h
16_wcpu.$(OBJ): $(WCPULIB)/16_wcpu.c $(WCPULIB)/16_wcpu.h
#memory.$(OBJ): $(EXMMLIB)/memory.c $(EXMMLIB)/memory.h
-midi.$(OBJ): $(SRCLIB)/midi.c
+#midi.$(OBJ): $(SRCLIB)/midi.c
c_utils.$(OBJ): $(MODEXLIB)/c_utils.asm
modex.$(OBJ): $(MODEXLIB)/modex.asm
ll.$(OBJ): $(SRCLIB)/ll.c $(SRCLIB)/ll.h
+bitmapl.$(OBJ): $(SRCLIB)/bitmapl.c $(SRCLIB)/bitmapl.h
#
# old 16 lib
wcl -0 $(WCLQ) 0croll.$(OBJ) modex16.obj dos_kb.obj bitmap.obj# omodex16.$(OBJ) bitmap.$(OBJ)# 16_ino.$(OBJ)
0croll.$(OBJ): $(SRC)/0croll.c
wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c src/0croll.c
+1croll.exe: 1croll.$(OBJ) modex16.obj dos_kb.obj bitmap.obj# $(OLDLIBOBJS) omodex16.$(OBJ)# 16_ino.$(OBJ)
+ wcl -0 $(WCLQ) 1croll.$(OBJ) modex16.obj dos_kb.obj bitmap.obj# omodex16.$(OBJ) bitmap.$(OBJ)# 16_ino.$(OBJ)
+1croll.$(OBJ): $(SRC)/1croll.c
+ wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c src/1croll.c
#16render.$(OBJ): $(OLDMODEX16LIBDIR)/16render.c $(OLDMODEX16LIBDIR)/16render.h
# wcl -0 $(WCLQ) -i"src/lib/doslib" -fo=.$(OBJ) -c $(OLDMODEX16LIBDIR)/16render.c
bitmap.$(OBJ): $(OLDMODEX16LIBDIR)/bitmap.c $(OLDMODEX16LIBDIR)/bitmap.h
-#include "src\lib\modex16.h"\r
+#include "16/modex16/modex16.h"\r
#include <stdio.h>\r
#include <stdlib.h>\r
-#include "src\lib\dos_kb.h"\r
-#include "src\lib\wtest\wtest.c"\r
+#include "16/modex16/dos_kb.h"\r
+//#include "src/lib/wtest/wtest.h"\r
\r
//word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
\r
void main() {\r
bitmap_t ptmp; // player sprite\r
word q=1;\r
- const char *cpus;\r
+//++++ const char *cpus;\r
static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
page_t screen, screen2, screen3;\r
map_t map;\r
/* draw the tiles */\r
ptr = map.data;\r
/*data\\*/\r
- ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite\r
+ ptmp = bitmapLoadPcx("data/chikyuu.pcx"); // load sprite\r
setkb(1);\r
modexEnter();\r
modexPalUpdate(ptmp.palette);\r
printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");\r
printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");\r
printf("\n");\r
+#if 0\r
+ //++++\r
switch(detectcpu())\r
{\r
case 0: cpus = "8086/8088 or 186/88"; break;\r
default: cpus = "internal error"; break;\r
}\r
printf("detected CPU type: %s\n", cpus);\r
+#endif\r
}\r
\r
\r
//modexClearRegion(top->page, 66, 66, 2, 40, 0);\r
//modexCopyPageRegion(dest->page, top->page, 66, 66, 66, 66, 2, 40);\r
//turn this off if XT\r
- if(detectcpu() > 0) modexWaitBorder();\r
+//++++ if(detectcpu() > 0) modexWaitBorder();\r
}\r
\r
gvar.player[0].enti.q=1;\r
gvar.player[0].enti.d=2;\r
- gvar.player[0].enti.speed=4;\r
+ gvar.player[0].enti.spt=4;\r
\r
//0000 nibbletest();\r
//0000 booleantest();\r
{\r
//right movement\r
case 3:\r
- if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.speed)))\r
+ if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
{\r
gvar.player[0].enti.q++;\r
} else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
\r
//left movement\r
case 1:\r
- if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.speed)))\r
+ if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
{\r
gvar.player[0].enti.q++;\r
} else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
\r
//down movement\r
case 4:\r
- if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.speed)))\r
+ if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
{\r
gvar.player[0].enti.q++;\r
} else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
\r
//up movement\r
case 0:\r
- if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.speed)))\r
+ if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
{\r
gvar.player[0].enti.q++;\r
} else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
enti->d = 2;//dir var\r
enti->pred = 4;//previous dir\r
enti->hp = 4;//hit points\r
- enti->speed = 4;//walkspeed\r
+ enti->spt = 4;//walkspeed\r
enti->persist_aniframe = enti->q;\r
- enti->spt=(TILEWH/(enti->speed)); //speed per tile wwww\r
+ enti->spt=(TILEWH/(enti->spt)); //speed per tile wwww\r
enti->overdraww = 0;\r
enti->overdrawh = 4;\r
\r
} while (lowest != 0xffff);\r
\r
fclose (dumpfile);\r
+\r
+ //reset filename\r
+#ifdef __BORLANDC__\r
+ strcpy(gvar->handle.datadumpfilename, "mmdump.16b");\r
+#endif\r
+#ifdef __WATCOMC__\r
+ strcpy(gvar->handle.datadumpfilename, "mmdump.16w");\r
+#endif\r
//00 printf ("MMDUMP.16 created.\n");\r
}\r
\r
\r
#include "src/lib/16_spri.h"\r
#include <hw/vga/vrl1xdrc.h>\r
+\r
+#define VRS_USECAMMPM\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
+#ifndef VRS_USECAMMPM\r
+ vrl1_vgax_offset_t **vrl_line_offsets;\r
+#endif\r
+ uint16_t far *vrl_id_iter;\r
+ uint32_t far *vrl_headers_offsets;\r
+ struct vrl1_vgax_header far *curr_vrl;\r
+ uint16_t vrl_size;\r
+ int num_of_vrl,i;\r
+\r
+ switch(rlsw)\r
+ {\r
+ case 1:\r
+//TODO ++++ CA_ReadFile(filename, &gvar->ca.spribuff, gvar);\r
+ CA_ReadFile(filename, MEMPTRCONV enti->spri.spritesheet.spribuff, gvar);\r
+ break;\r
+ case 0:\r
+//TODO ++++ CA_LoadFile(filename, &gvar->ca.spribuff, gvar);\r
+ CA_LoadFile(filename, MEMPTRCONV enti->spri.spritesheet.spribuff, gvar);\r
+ break;\r
+ }\r
+\r
+ // Insert sanity cheks later\r
+//TODO ++++ enti->spri.spritesheet.buffer = gvar->ca.spribuff;\r
+ enti->spri.spritesheet.buffer = enti->spri.spritesheet.spribuff; //TODO: merge these 2 vars into 1\r
+ enti->spri.spritesheet.data_size = sizeof(enti->spri.spritesheet.buffer) - sizeof(struct vrl1_vgax_header);\r
+ num_of_vrl = 0;\r
+ vrl_id_iter = (uint16_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.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
+#ifndef VRS_USECAMMPM\r
+ vrl_line_offsets = malloc(sizeof(vrl1_vgax_offset_t *)*num_of_vrl);//TODO: USE MM_ CA_ AND PM_\r
+#else\r
+ switch(rlsw)\r
+ {\r
+ case 0:\r
+#ifdef __DEBUG_MM__\r
+ dbg_debugmm=0;\r
+#endif\r
+// MM_GetPtr(MEMPTRCONV gvar->ca.grsegs, sizeof(vrl1_vgax_offset_t *)*num_of_vrl, gvar);\r
+// enti->spri.spritesheet.vrl_line_offsets = (vrl1_vgax_offset_t **)gvar->ca.grsegs;\r
+ MM_GetPtr(gvar->ca.spribuff, sizeof(vrl1_vgax_offset_t *)*num_of_vrl, gvar);\r
+ enti->spri.spritesheet.vrl_line_offsets = (vrl1_vgax_offset_t **)(gvar->ca.spribuff);\r
+// MM_GetPtr(spribuff, sizeof(vrl1_vgax_offset_t *)*num_of_vrl, gvar);\r
+// enti->spri.spritesheet.vrl_line_offsets = (vrl1_vgax_offset_t **)spribuff;\r
+ break;\r
+ }\r
+#endif\r
+\r
+ vrl_headers_offsets = (uint32_t far *)(enti->spri.spritesheet.buffer + enti->spri.spritesheet.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 *)(enti->spri.spritesheet.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 = enti->spri.spritesheet.vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST] - vrl_headers_offsets[i] - sizeof(struct vrl1_vgax_header);\r
+ }\r
+#ifndef VRS_USECAMMPM\r
+ vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);\r
+#else\r
+ enti->spri.spritesheet.vrl_line_offsets[i] = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), vrl_size);\r
+#endif\r
+ }\r
+#ifndef VRS_USECAMMPM\r
+ enti->spri.spritesheet.vrl_line_offsets = vrl_line_offsets;\r
+#endif\r
+// printf("VRS_OpenVRS\n");\r
+// printf(" vrl_size=%lu\n\n",vrl_size);\r
+}\r
+\r
+#if 0\r
+//\r
+void VRS_ReadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRL(filename, enti, 1, gvar); }\r
+void VRS_LoadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar){ VRS_OpenVRL(filename, enti, 0, gvar); }\r
+void VRS_OpenVRL(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar)\r
+{\r
+#ifndef VRL_USECAMMPM\r
+ vrl1_vgax_offset_t *line_offsets;\r
+#endif\r
+// uint32_t far *vrl_headers_offsets;\r
+ struct vrl1_vgax_header far *curr_vrl;\r
+\r
+ switch(rlsw)\r
+ {\r
+ case 1:\r
+ CA_ReadFile(filename, &enti->spri.spritesheet.spribuff, gvar);\r
+ break;\r
+ case 0:\r
+ CA_LoadFile(filename, &enti->spri.spritesheet.spribuff, gvar);\r
+ break;\r
+ }\r
+\r
+ // Insert sanity cheks later\r
+ enti->spri.sprite_vrl_cont.buffer = enti->spri.spritesheet.spribuff;\r
+ enti->spri.sprite_vrl_cont.data_size = sizeof(enti->spri.spritesheet.buffer) - sizeof(struct vrl1_vgax_header);\r
+\r
+ // Allocate memory for vrl line offsets table\r
+#ifndef VRL_USECAMMPM\r
+ line_offsets = malloc(sizeof(vrl1_vgax_offset_t *));//TODO: USE MM_ CA_ AND PM_\r
+#else\r
+ MM_GetPtr(MEMPTRCONV gvar->ca.grsegs[0], sizeof(vrl1_vgax_offset_t *), gvar);\r
+ enti->spri.sprite_vrl_cont.line_offsets = (vrl1_vgax_offset_t *)gvar->ca.grsegs[0];\r
+#endif\r
+\r
+ //vrl_headers_offsets = (uint32_t far *)(enti->spri.sprite_vrl_cont.buffer + enti->spri.sprite_vrl_cont.vrs_hdr->offset_table[VRL_HEADER_OFFSET_VRL_LIST]);\r
+ // Calculate line offsets for each vrl\r
+ curr_vrl = (struct vrl1_vgax_header far *)(enti->spri.sprite_vrl_cont.buffer);// + vrl_headers_offsets);\r
+\r
+#ifndef VRL_USECAMMPM\r
+ line_offsets = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), sizeof(enti->spri.spritesheet.buffer));\r
+#else\r
+ enti->spri.sprite_vrl_cont.line_offsets = vrl1_vgax_genlineoffsets(curr_vrl, (byte *)curr_vrl + sizeof(struct vrl1_vgax_header), sizeof(enti->spri.spritesheet.buffer));\r
+#endif\r
+\r
+#ifndef VRL_USECAMMPM\r
+ enti->spri.sprite_vrl_cont.line_offsets = line_offsets;\r
+#endif\r
+ printf("VRS_OpenVRL\n");\r
+ printf(" vrl_size=%lu\n\n",sizeof(enti->spri.spritesheet.buffer));\r
+}\r
+//\r
+#endif\r
+\r
+// Seek and return a specified .vrl blob from .vrs blob in far memory\r
+int get_vrl_by_id(struct vrs_container far *vrs_cont, uint16_t id, struct vrl_container *vrl_cont){\r
+ uint16_t far *ids;\r
+ uint32_t far *vrl_offs_list;\r
+ int counter = 0;\r
+\r
+ // If id is invalid, return -1\r
+ if(id == 0){\r
+ // Probably add an error message?\r
+ return -1;\r
+ }\r
+\r
+ // Get id list from .vrs blob (base + offset)\r
+ ids = (uint16_t far*)(vrs_cont->buffer +\r
+ vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_SPRITE_ID_LIST]);\r
+\r
+ // Loop through the id list until we found the right one or hit the end of the list\r
+ // Counter is keeping track of the offset(in ids/vrl blobs)\r
+ while(ids[counter] != id && ids[counter]){\r
+ counter++;\r
+ }\r
+ // Return -2 if we couldn't find the requested id\r
+ if(!ids[counter]){\r
+ // Error message?\r
+ return -2;\r
+ }\r
+\r
+ // Get vrl offsets list from .vrs blob (base + offset)\r
+ vrl_offs_list = (uint32_t far *)(vrs_cont->buffer +\r
+ vrs_cont->vrs_hdr->offset_table[VRS_HEADER_OFFSET_VRS_LIST]);\r
+\r
+ // Get vrl_header from .vrs (base + offset from vrl_list)\r
+ // Counter is number of vrls to skip (ids and vrls are aligned according to the .vrs specification)\r
+ vrl_cont->vrl_header = (struct vrl1_vgax_header far *)(vrs_cont->buffer + vrl_offs_list[counter]);\r
+\r
+ // Get .vrl size by integer arithmetics (next vrl offset - current vrl offset)\r
+ if(ids[counter+1]){\r
+ vrl_cont->data_size = vrl_offs_list[counter+1] - vrl_offs_list[counter] - sizeof(struct vrl1_vgax_header);\r
+ }\r
+ // If we are retriving the last vrl, size is ids_list offset - current vrl offset, as next vrl offs is 0\r
+ else{\r
+ 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);\r
+ }\r
+\r
+ // Retrive line offsets form .vrs\r
+ vrl_cont->line_offsets = vrs_cont->vrl_line_offsets[counter];\r
+\r
+ return 0;\r
+}\r
+\r
//void draw_vrl1_vgax_modex_strip(unsigned char far *draw,unsigned char far *s);\r
\r
//===========================================================================\r
#define INC_PER_FRAME if(enti->q&1) enti->persist_aniframe++; if(enti->persist_aniframe>4) enti->persist_aniframe = 1;\r
unsigned int i,o,o2; int j;\r
int x,y,rx,ry,w,h;\r
- static struct glob_game_vars *ggvv;\r
VGA_RAM_PTR omemptr = (VGA_RAM_PTR)video->page[0].data;// save original mem ptr\r
\r
x=enti->spri.x;\r
// if(ggvv->player[0].enti.q<5)\r
if(dbg_delayanimation)\r
{\r
- IN_Ack(ggvv);// delay(250);//{ while(!IN_KeyDown(sc_Space)/* && !IN_KeyDown(sc_Escape)*/){} delay(250); }\r
+ {\r
+ delay(250);\r
+ // static struct glob_game_vars *ggvv; IN_Ack(ggvv);\r
+ // { while(!IN_KeyDown(sc_Space)/* && !IN_KeyDown(sc_Escape)*/){} delay(250); }\r
+ }\r
}\r
#endif\r
if(!video->vga_state.rss)\r
#ifndef __16_SPRI__\r
#define __16_SPRI__\r
\r
-#include "src/lib/16_vrs.h"\r
+//#include "src/lib/16_vrs.h"\r
+#include "src/lib/16_vl.h"\r
+//#include <hw/cpu/cpu.h>\r
+//#include <hw/dos/dos.h>\r
+#include <hw/vga/vrl.h>\r
+#include "src/lib/16_ca.h"\r
#include "src/lib/scroll16.h"\r
\r
+\r
+/*\r
+struct vrs_container{\r
+ // Size of a .vrs lob in memory\r
+ // minus header\r
+ dword data_size;\r
+ union{\r
+ byte far *buffer;\r
+ struct vrs_header far *vrs_hdr;\r
+ };\r
+ // Array of corresponding vrl line offsets\r
+ vrl1_vgax_offset_t **vrl_line_offsets;\r
+};\r
+*//*\r
+struct vrl_container{\r
+ // Size of a .vrl blob in memory\r
+ // minus header\r
+ dword data_size;\r
+ union{\r
+ byte far *buffer;\r
+ struct vrl1_vgax_header far *vrl_header;\r
+ };\r
+ // Pointer to a corresponding vrl line offsets struct\r
+ vrl1_vgax_offset_t *line_offsets;\r
+};\r
+*/\r
+/* Read .vrs file into memory\r
+* In:\r
+* + char *filename - name of the file to load\r
+* + struct vrs_container *vrs_cont - pointer to the vrs_container\r
+* to load the file into\r
+* Out:\r
+* + int - 0 on succes, 1 on failure\r
+*/\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
+void VRS_ReadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
+void VRS_LoadVRL(char *filename, entity_t *enti, global_game_variables_t *gvar);\r
+void VRS_OpenVRL(char *filename, entity_t *enti, boolean rlsw, global_game_variables_t *gvar);\r
+\r
+/* Seek and return a specified .vrl blob from .vrs blob in memory\r
+* In:\r
+* + struct vrs_container *vrs_cont - pointer to the vrs_container\r
+* with a loaded .vrs file\r
+* + uint16_t id - id of the vrl to retrive\r
+* + struct vrl_container * vrl_cont - pointer to vrl_container to load to\r
+* Out:\r
+* int - operation status\r
+* to the requested .vrl blob\r
+*/\r
+int get_vrl_by_id(struct vrs_container *vrs_cont, uint16_t id, struct vrl_container * vrl_cont);\r
+\r
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
\r
//moved to 16_tdef.h\r
if(gvar.in.inst->Keyboard[sc_I]){ dbg_maptext=!dbg_maptext; IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_PgDn]){ \\r
rotateR(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
- VL_UpdatePaletteWrite(&gvar.video.palette, 0, &gvar); IN_UserInput(1, &gvar); } \\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0, 255, &gvar); IN_UserInput(1, &gvar); } \\r
if(gvar.in.inst->Keyboard[sc_PgUp]){ \\r
rotateL(gvar.video.palette, sizeof(gvar.video.palette)/sizeof(gvar.video.palette[0])); \\r
- VL_UpdatePaletteWrite(&gvar.video.palette, 0, &gvar); IN_UserInput(1, &gvar); }\r
+ VL_UpdatePaletteWrite(&gvar.video.palette, 0, 255, &gvar); IN_UserInput(1, &gvar); }\r
#ifdef __BORLANDC__\r
#define PAL_WRITE_REG 0x03C8 /* Color register, write address */\r
#define PAL_DATA_REG 0x03C9 /* Color register, data port */\r
/*\r
* typedefs of the game variables!\r
*/\r
-typedef struct {\r
- byte *data;\r
- word width;\r
- word height;\r
- byte *palette;\r
- word offset;\r
-} bitmap_t;\r
-\r
-typedef struct {\r
- byte far **data;\r
- word ntiles; // the number of tiles\r
- word twidth; // width of the tiles\r
- word theight; // height of the tiles\r
- byte *palette; // palette for the tile set\r
-} tileset_t;\r
-\r
typedef struct {\r
byte far *plane[4]; // 4 planes of image data\r
word width; // width of the image (spread across 4 planes)\r
nibble pred; //prev. direction for animation changing\r
word dire; //sprite in use\r
nibble q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
- word speed; //entity speed!\r
+// word speed; //entity speed!\r
word spt; //speed per tile\r
#ifdef __WATCOMC__\r
sprite_t spri; // sprite used by entity\r
in_info_t in; // 16_in info\r
player_t player[MaxPlayers]; // player vars\r
map_view_t mv[4];\r
+ map_t map;\r
// sw_t sw;\r
boolean DLStarted;\r
} global_game_variables_t;\r
fclose(file);\r
}\r
\r
+#define COREPALSIZE 9//27 //3*9\r
+\r
void VLL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, word palsize, global_game_variables_t *gvar)\r
{\r
int fd;\r
\r
fd = open(filename,O_RDONLY|O_BINARY);\r
if (fd >= 0) {\r
- read(fd,palette, palsize);\r
+ read(fd,palette, palsize*3);\r
close(fd);\r
\r
- if(palsize==27) newpalette = palette; else{ //if core then load it\r
+ if(palsize==COREPALSIZE) newpalette = palette; else{ //if core then load it\r
newpalette = &palette[3]; //skip overscan color\r
if(!o) o++;\r
}\r
- VL_UpdatePaletteWrite(newpalette, o, gvar);\r
+ VL_UpdatePaletteWrite(newpalette, o, palsize, gvar);\r
}\r
}\r
\r
void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar)\r
{\r
VLL_LoadPalFilewithoffset(filename, palette,\r
- 0, //overwrite core/system palette\r
-// 9, //preserved core/system palette\r
- PAL_SIZE, gvar);\r
+ 0, //overwrite core/system palette\r
+// COREPALSIZE, //preserved core/system palette\r
+ PAL_SIZE/3, gvar);\r
}\r
\r
void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar)\r
{\r
- VLL_LoadPalFilewithoffset("data/16.pal", palette, 0, 27, gvar);\r
+ VLL_LoadPalFilewithoffset("data/16.pal", palette, 0, COREPALSIZE, gvar);\r
}\r
\r
-void VL_UpdatePaletteWrite(byte *palette, word o, global_game_variables_t *gvar)\r
+void VL_UpdatePaletteWrite(byte *palette, word o, word p, global_game_variables_t *gvar)\r
{\r
word i;\r
\r
vga_palette_lseek(o);\r
- for (i=0;i < 255-o;i++)\r
+ for (i=0;i < p-o;i++)\r
vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
\r
VL_PaletteSync(gvar);\r
void VL_LoadPalFile(const char *filename, byte *palette, global_game_variables_t *gvar);\r
void VL_LoadPalFileCore(byte *palette, global_game_variables_t *gvar);\r
//void VLL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, global_game_variables_t *gvar);\r
-void VL_UpdatePaletteWrite(byte *palette, word o, global_game_variables_t *gvar);\r
+void VL_UpdatePaletteWrite(byte *palette, word o, word palsize, global_game_variables_t *gvar);\r
void VL_PaletteSync(global_game_variables_t *gvar);\r
void modexSavePalFile(char *filename, byte *palette);\r
#define MenuFadeIn() VL_FadeIn(0,255,&gamepal,10)\r
\r
#include "src/lib/16_vl.h"\r
#include "src/lib/16_vlpld.h"\r
+#include "16/modex16/bitmap.h"\r
\r
\r
typedef struct\r
--- /dev/null
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include "src/lib/bitmapl.h"\r
+#include <malloc.h>\r
+//#include "modex16.h"\r
+\r
+static struct pcxHeader {\r
+ byte id;\r
+ byte version;\r
+ byte encoding;\r
+ byte bpp;\r
+ word xmin;\r
+ word ymin;\r
+ word xmax;\r
+ word ymax;\r
+ word hres;\r
+ word vres;\r
+ byte pal16[48];\r
+ byte res1;\r
+ word bpplane;\r
+ word palType;\r
+ word hScreenSize;\r
+ word vScreenSize;\r
+ byte padding[54];\r
+} head;\r
+\r
+byte *\r
+modexNewPal() {\r
+ byte *ptr;\r
+ ptr = _fmalloc(768);\r
+\r
+ /* handle errors */\r
+ if(!ptr) {\r
+ printf("Could not allocate palette.\n");\r
+ exit(-1);\r
+ }\r
+\r
+ return ptr;\r
+}\r
+\r
+static void loadPcxStage1(FILE *file, bitmap_t *result) {\r
+// long bufSize;\r
+// int index;\r
+// byte count, val;\r
+// long int pos;\r
+\r
+ /* read the header */\r
+ fread(&head, sizeof(char), sizeof(struct pcxHeader), file);\r
+\r
+ /* get the width and height */\r
+ result->width = head.xmax - head.xmin + 1;\r
+ result->height = head.ymax - head.ymin + 1;\r
+\r
+ /* make sure this is 8bpp */\r
+ if(head.bpp != 8) {\r
+ printf("I only know how to handle 8bpp pcx files!\n");\r
+ fclose(file);\r
+ exit(-2);\r
+ }\r
+}\r
+\r
+\r
+static void loadPcxPalette(FILE *file, bitmap_t *result) {\r
+ byte val;\r
+ int index;\r
+\r
+ /* handle the palette */\r
+ fseek(file, -769, SEEK_END);\r
+ val = fgetc(file);\r
+ result->palette = modexNewPal();\r
+ if(head.version == 5 && val == 12) {\r
+ /* use the vga palette */\r
+ for(index=0; !feof(file) && index < 768; index++) {\r
+ val = fgetc(file);\r
+ result->palette[index] = val >> 2;\r
+ }\r
+ } else {\r
+ /* use the 16 color palette */\r
+ for(index=0; index<48; index++) {\r
+ result->palette[index] = head.pal16[index];\r
+ }\r
+ }\r
+}\r
+\r
+\r
+bitmap_t\r
+bitmapLoadPcx(char *filename) {\r
+ FILE *file;\r
+ bitmap_t result;\r
+ long bufSize;\r
+ int index;\r
+ byte count, val;\r
+\r
+ /* open the PCX file for reading */\r
+ file = fopen(filename, "rb");\r
+ if(!file) {\r
+ printf("Could not open %s for reading.\n", filename);\r
+ //return result;//exit(-2);\r
+ }\r
+\r
+ /* load the first part of the pcx file */\r
+ loadPcxStage1(file, &result);\r
+\r
+ /* allocate the buffer */\r
+ bufSize = result.width * result.height;\r
+ result.data = malloc(bufSize);\r
+ if(!result.data) {\r
+ printf("Could not allocate memory for bitmap data.");\r
+ fclose(file);\r
+ return result;//exit(-1);\r
+ }\r
+\r
+ /* read the buffer in */\r
+ index = 0;\r
+ do {\r
+ /* get the run length and the value */\r
+ count = fgetc(file);\r
+ if(0xC0 == (count & 0xC0)) { /* this is the run count */\r
+ count &= 0x3f;\r
+ val = fgetc(file);\r
+ } else {\r
+ val = count;\r
+ count = 1;\r
+ }\r
+\r
+ /* write the pixel the specified number of times */\r
+ for(; count && index < bufSize; count--,index++) {\r
+ result.data[index] = val;\r
+ }\r
+ } while(index < bufSize);\r
+\r
+ loadPcxPalette(file, &result);\r
+\r
+ fclose(file);\r
+\r
+ return result;\r
+}\r
+\r
+\r
+tileset_t\r
+bitmapLoadPcxTiles(char *filename, word twidth, word theight) {\r
+ tileset_t ts;\r
+ FILE *file;\r
+ bitmap_t result;\r
+ int i;\r
+\r
+ /* open the PCX file for reading */\r
+ file = fopen(filename, "rb");\r
+ if(!file) {\r
+ printf("Could not open %s for reading.\n", filename);\r
+ exit(-2);\r
+ }\r
+\r
+ /* load the first part of the pcx file */\r
+ loadPcxStage1(file, &result);\r
+\r
+ /* get the number of tiles and set up the result structure */\r
+ ts.twidth = twidth;\r
+ ts.theight = theight;\r
+ ts.ntiles = (result.width/twidth) * (result.height/theight);\r
+ ts.palette = result.palette;\r
+\r
+ /* allocate the pixel storage for the tiles */\r
+ ts.data = _fmalloc(sizeof(byte*) * ts.ntiles);\r
+ ts.data[0] = _fmalloc(sizeof(byte) * ts.ntiles * twidth * theight);\r
+ for(i=1; i < ts.ntiles; i++) {\r
+ ts.data[i] = ts.data[i-1] + twidth * theight;\r
+ }\r
+\r
+ /* finish off the file */\r
+ loadPcxPalette(file, &result);\r
+\r
+ fclose(file);\r
+\r
+ return ts;\r
+}\r
--- /dev/null
+/*\r
+ * Functions and types for loading and manipulating bitmaps.\r
+ */\r
+#ifndef BITMAPL_H\r
+#define BITMAPL_H\r
+#include "src/lib/16_t.h"\r
+typedef struct {\r
+ byte *data;\r
+ word width;\r
+ word height;\r
+ byte *palette;\r
+ word offset;\r
+} bitmap_t;\r
+/*\r
+typedef struct {\r
+ byte *data;\r
+ word width;\r
+ word height;\r
+ byte *palette;\r
+} bitmap_t;\r
+*/\r
+\r
+typedef struct {\r
+ byte far **data;\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
+} tileset_t;\r
+/*\r
+typedef struct {\r
+ byte **data;\r
+ word ntiles; // the number of tiles\r
+ word twidth; // width of the tiles\r
+ word theight; // height of the tiles\r
+ byte *palette; // palette for the tile set\r
+} tileset_t;\r
+*/\r
+\r
+bitmap_t bitmapLoadPcx(char *filename);\r
+tileset_t bitmapLoadPcxTiles(char *filename, word twidth, word theight);\r
+#endif\r
gvar->player[pn].walktype=1;\r
if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
{\r
- gvar->player[pn].enti.x+=(gvar->player[pn].enti.speed);\r
+ gvar->player[pn].enti.x+=(gvar->player[pn].enti.spt);\r
ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
gvar->player[pn].enti.q++;\r
#ifdef OLDWALKSHOWPAGESTUFF\r
gvar->player[pn].walktype=1;\r
if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
{\r
- gvar->player[pn].enti.x-=(gvar->player[pn].enti.speed);\r
+ gvar->player[pn].enti.x-=(gvar->player[pn].enti.spt);\r
ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
gvar->player[pn].enti.q++;\r
#ifdef OLDWALKSHOWPAGESTUFF\r
gvar->player[pn].walktype=1;\r
if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
{\r
- gvar->player[pn].enti.y+=(gvar->player[pn].enti.speed);\r
+ gvar->player[pn].enti.y+=(gvar->player[pn].enti.spt);\r
ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
gvar->player[pn].enti.q++;\r
#ifdef OLDWALKSHOWPAGESTUFF\r
gvar->player[pn].walktype=1;\r
if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
{\r
- gvar->player[pn].enti.y-=(gvar->player[pn].enti.speed);\r
+ gvar->player[pn].enti.y-=(gvar->player[pn].enti.spt);\r
ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
gvar->player[pn].enti.q++;\r
#ifdef OLDWALKSHOWPAGESTUFF\r
#ifdef __DEBUG_RF__\r
if(dbg_pagedelayrendermap) if(!y) y+=TILEWH; else y-=TILEWH;\r
#endif\r
- poopoffset%=player[0].enti.speed;\r
+ poopoffset%=player[0].enti.spt;\r
//printf("y: %d\n", poopoffset);\r
#ifdef __DEBUG_RF__\r
if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dx); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, 1, global_temp_status_text); }\r
#ifdef __DEBUG_RF__\r
if(dbg_pagedelayrendermap) if(!x) x+=TILEWH; else x-=TILEWH;\r
#endif\r
- poopoffset%=player[0].enti.speed;\r
+ poopoffset%=player[0].enti.spt;\r
//printf("x: %d\n", poopoffset);\r
#ifdef __DEBUG_RF__\r
if(dbg_pagedelayrendermap){ sprintf(global_temp_status_text, "%-3u", mv->dy); modexprint(mv[0].page, player[0].enti.x, player[0].enti.y-28-(poopoffset*8) , 1, 0, PALMAPDRAWW, 1, global_temp_status_text); }\r
break;\r
case 2:\r
dd = 1;\r
- qq = player[pn].enti.q*player[pn].enti.speed;\r
+ qq = player[pn].enti.q*player[pn].enti.spt;\r
break;\r
}\r
x-=4;\r
printf("size of mmblocktype: %u ", sizeof(mmblocktype));\\r
printf("\n\n");\\r
printf("player vars:\n");\\r
- printf(" xy: %dx%d", gvar.player[0].enti.x, gvar.player[0].enti.y); printf(" txy: %dx%d", gvar.player[0].enti.tx, gvar.player[0].enti.ty); printf(" triggxy: %dx%d", gvar.player[0].enti.triggerx, gvar.player[0].enti.triggery); printf(" value: %d\n", gvar.mv[1].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(map.width*(gvar.player[0].enti.triggery-1))]);\\r
+ printf(" xy: %dx%d", gvar.player[0].enti.x, gvar.player[0].enti.y); printf(" txy: %dx%d", gvar.player[0].enti.tx, gvar.player[0].enti.ty); printf(" triggxy: %dx%d", gvar.player[0].enti.triggerx, gvar.player[0].enti.triggery); printf(" value: %d\n", gvar.mv[1].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(gvar.map.width*(gvar.player[0].enti.triggery-1))]);\\r
printf(" hp: %d", (gvar.player[0].enti.hp)); printf(" q: %u", gvar.player[0].enti.q); printf(" info.dir: %u", gvar.player[0].info.dir); printf(" d: %u", gvar.player[0].enti.d); printf(" dire: %u", gvar.player[0].enti.dire);\\r
printf(" pdir: %u\n", gvar.player[0].pdir); printf(" delay=%u", gvar.player[0].enti.spri.delay);\\r
printf("\n\n");\\r
inline void near ScrollRight(map_view_t *mv, player_t *pl, word id, word plid)\r
{\r
/* increment the pixel position and update the page */\r
- mv[id].page->dx += pl[plid].enti.speed;\r
+ mv[id].page->dx += pl[plid].enti.spt;\r
\r
/* check to see if this changes the tile */\r
if(mv[id].page->dx >= mv[id].dxThresh )\r
inline void near ScrollLeft(map_view_t *mv, player_t *pl, word id, word plid)\r
{\r
/* decrement the pixel position and update the page */\r
- mv[id].page->dx -= pl[plid].enti.speed;\r
+ mv[id].page->dx -= pl[plid].enti.spt;\r
\r
/* check to see if this changes the tile */\r
if(mv[id].page->dx == 0)\r
inline void near ScrollUp(map_view_t *mv, player_t *pl, word id, word plid)\r
{\r
/* decrement the pixel position and update the page */\r
- mv[id].page->dy -= pl[plid].enti.speed;\r
+ mv[id].page->dy -= pl[plid].enti.spt;\r
\r
/* check to see if this changes the tile */\r
if(mv[id].page->dy == 0 )\r
inline void near ScrollDown(map_view_t *mv, player_t *pl, word id, word plid)\r
{\r
/* increment the pixel position and update the page */\r
- mv[id].page->dy += pl[plid].enti.speed;\r
+ mv[id].page->dy += pl[plid].enti.spt;\r
\r
/* check to see if this changes the tile */\r
if(mv[id].page->dy >= mv[id].dyThresh )\r
#include "src/lib/scroll16.h"\r
#include "src/lib/16_timer.h"\r
//#include "src/lib/16_dbg.h"\r
-//HC_heapdump\r
\r
+#define FADE\r
+//#define NOMAPLOAD\r
+//#define OLDPLAYERSPRITESTUFF\r
#ifdef __DEBUG__\r
-#define SCROLLEXEDEBUG\r
+//#define SCROLLEXEDEBUG\r
boolean\r
dbg_nointest=1;\r
#endif\r
\r
-#define FADE\r
-//#define NOMAPLOAD\r
-\r
-static map_t map;\r
+//static map_t map;\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+#include "src/lib/bitmapl.h"\r
+static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */\r
+#define INC_PER_FRAME if(gvar->player[pn].enti.q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;\r
+\r
+void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp);\r
+void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);\r
+boolean ZCL_ScreenMidPosChk(map_view_t *map_v, nibble dir, int tx, int ty);\r
+boolean ZCL_CollCheck(map_view_t *map_v, nibble dir, int tx, int ty);\r
+boolean ZCL_mapEdgeChk(map_view_t *map_v, nibble dir, int tx, int ty, boolean pansw, boolean noscrollsw);\r
+void oldwalk(global_game_variables_t *gvar, word pn, bitmap_t *pbmp);\r
+void animatePlayer(global_game_variables_t *gvar, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp);\r
+#endif\r
float t;\r
\r
//debugswitches\r
\r
void main(int argc, char *argv[])\r
{\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+ bitmap_t ptmp; // player sprite\r
+#endif\r
static global_game_variables_t gvar;\r
struct glob_game_vars *ggvv;\r
\r
// create the map\r
#ifdef SCROLLEXEDEBUG\r
strcpy(gvar.handle.datadumpfilename, "xcroll1.16w"); MM_DumpData (&gvar);\r
- fprintf(stderr, "testing map load~ ");\r
+ //fprintf(stderr, "testing map load~ ");\r
#endif\r
- CA_loadmap("data/test.map", &map, &gvar);\r
+ CA_loadmap("data/test.map", &gvar.map, &gvar);\r
#ifndef NOMAPLOAD\r
- chkmap(&map, 0);\r
+ chkmap(&gvar.map, 0);\r
#else\r
- chkmap(&map, 1);\r
+ chkmap(&gvar.map, 1);\r
#endif\r
- //initMap(&map);\r
+ //initMap(&gvar.map);\r
#ifdef SCROLLEXEDEBUG\r
printf("chkmap ok\n");\r
// fprintf(stderr, "yay map loaded~~\n");\r
#endif\r
\r
// data\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+ ptmp = bitmapLoadPcx("data/chikyuu.pcx"); // load sprite\r
+ modexPalUpdate(ptmp.palette);\r
+#else\r
#ifdef SCROLLEXEDEBUG\r
fprintf(stderr, "VRS_LoadVRS~ ");\r
strcpy(gvar.handle.datadumpfilename, "xcroll3.16w"); MM_DumpData (&gvar);\r
strcpy(gvar.handle.datadumpfilename, "xcroll4.16w"); MM_DumpData (&gvar);\r
#endif\r
strcpy(gvar.handle.datadumpfilename, "xcroll.16w");\r
+#endif\r
\r
// input!\r
IN_Default(0, &gvar.player[0],ctrl_Keyboard1, &gvar);\r
\r
// setup camera and screen~\r
modexHiganbanaPageSetup(&gvar);\r
- ZC_MVSetup(&gvar.mv, &map, &gvar);\r
+ ZC_MVSetup(&gvar.mv, &gvar.map, &gvar);\r
\r
#ifdef FADE\r
modexFadeOn(4, &gvar.video.palette);\r
\r
ZC_PlayerXYpos(0, 0, &gvar.player[0], &gvar.mv, 1);\r
EN_initPlayer(&gvar.player[0], &gvar.video);\r
+#ifdef SPRITE\r
+#ifndef OLDPLAYERSPRITESTUFF\r
//print_anim_ids(gvar.player[0].enti.spri);\r
if (gvar.video.sprifilei == -1)\r
{\r
modexFadeOn(4, &gvar.video.dpal);\r
#endif\r
}\r
+#endif\r
+#endif\r
\r
// while(!gvar.in.inst->Keyboard[sc_Escape) && !gvar.in.inst->Keyboard[sc_Space) && !gvar.in.inst->Keyboard[sc_Enter]){ FUNCTIONKEYSHOWMV }\r
gvar.video.page[0].tlx=gvar.mv[0].tx*TILEWH;\r
if(!panswitch){\r
//ZC_walk2(gvar.player[0].ent, mv);\r
//ZC_walk(&gvar.mv, &gvar.player, 0);\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+ oldwalk(&gvar, 0, &ptmp);\r
+#else\r
ZC_walk(&gvar, 0);\r
+#endif\r
}else{\r
TAIL_PANKEYFUNZC;\r
//printf(" gvar.player[0].enti.q: %d", gvar.player[0].enti.q); printf(" gvar.player[0].d: %d\n", gvar.player[0].d);\r
\r
//the scripting stuff....\r
//if(((gvar.player[0].enti.triggerx == TRIGGX && gvar.player[0].enti.triggery == TRIGGY) && gvar.in.inst->Keyboard[0x1C))||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5))\r
- if(((gvar.mv[0].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(map.width*(gvar.player[0].enti.triggery-1))] == 0) && gvar.in.inst->Keyboard[0x1C])||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5))\r
+ if(((gvar.mv[0].map->layerdata[0].data[(gvar.player[0].enti.triggerx-1)+(gvar.map.width*(gvar.player[0].enti.triggery-1))] == 0) && gvar.in.inst->Keyboard[0x1C])||(gvar.player[0].enti.tx == 5 && gvar.player[0].enti.ty == 5))\r
{\r
short i;\r
for(i=800; i>=400; i--)\r
}\r
nosound();\r
}\r
- if(gvar.player[0].enti.q == (TILEWH/(gvar.player[0].enti.speed))+1 && gvar.player[0].info.dir != 2 && (gvar.player[0].enti.triggerx == 5 && gvar.player[0].enti.triggery == 5)){ gvar.player[0].enti.hp--; }\r
+ if(gvar.player[0].enti.q == (TILEWH/(gvar.player[0].enti.spt))+1 && gvar.player[0].info.dir != 2 && (gvar.player[0].enti.triggerx == 5 && gvar.player[0].enti.triggery == 5)){ gvar.player[0].enti.hp--; }\r
//debugging binds!\r
// if(gvar.in.inst->Keyboard[24]){ VL_modexPalScramble(&gvar.video.palette); /*paloffset=0;*/ VL_LoadPalFileCore(&gvar.video.palette, &gvar); modexpdump(gvar.mv[0].page); IN_UserInput(1, &gvar); } //o\r
+ if(gvar.in.inst->Keyboard[sc_O]){ VL_LoadPalFileCore(&gvar.video.palette, &gvar); modexpdump(gvar.video.sp, &gvar); IN_UserInput(1, &gvar); } //o\r
if(gvar.in.inst->Keyboard[22]){ VL_modexPalScramble(&gvar.video.palette); VL_LoadPalFileCore(&gvar.video.palette, &gvar); } //u\r
\r
TAIL_FUNCTIONKEYFUNCTIONS\r
#endif\r
//===============================================================================\r
\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+ if(gvar.in.inst->Keyboard[sc_J])// || gvar.in.inst->Keyboard[sc_K])\r
+ {\r
+// sprintf(global_temp_status_text2, "%Fp", &ptmp.data);\r
+// modexprint(&(gvar.video.page[0]), gvar.video.page[0].sw/2, gvar.video.page[0].sh/2, 1, 1, 3/*ccolor*/, 8, gvar.video.VL_Started, global_temp_status_text2);\r
+ modexDrawSprite(&gvar.video.page[0], 16, 16, &ptmp);\r
+ }\r
+ if(gvar.in.inst->Keyboard[sc_K])\r
+ {\r
+ _fmemset(ptmp.data, 4, (ptmp.width)*ptmp.height);\r
+ }\r
+#else\r
if(gvar.in.inst->Keyboard[sc_J])// || gvar.in.inst->Keyboard[sc_K])\r
{\r
if(spriteswitch)//gvar.in.inst->Keyboard[sc_J])\r
ZC_animatePlayer(&gvar.mv, &gvar.player, 0);\r
IN_UserInput(1, &gvar);\r
}//JK\r
+#endif\r
//#ifdef FADE\r
// if(gvar.in.inst->Keyboard[10]){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1, &gvar); }\r
//#endif\r
modexFadeOff(4, &gvar.video.palette);\r
#endif\r
#ifdef SCROLLEXEDEBUG\r
- MM_Reset(&gvar); MM_DumpData (&gvar);\r
+ MM_DumpData (&gvar);\r
HC_heapdump (&gvar);\r
#endif\r
Shutdown16(&gvar);\r
modexFadeOn(4, gvar.video.dpal);\r
#endif\r
}\r
+\r
+#ifdef OLDPLAYERSPRITESTUFF\r
+void\r
+modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp) {\r
+ /* draw the whole sprite */\r
+ modexDrawSpriteRegion(page, x, y, 0, 0, bmp->width, bmp->height, bmp);\r
+// sprintf(global_temp_status_text2, "%Fp", &bmp->data);\r
+// modexprint(page, page->sw/2, (page->sh/2)+8, 1, 1, 3/*ccolor*/, 8, gvar->video.VL_Started, global_temp_status_text2);\r
+}\r
+\r
+void\r
+modexDrawSpriteRegion(page_t *page, int x, int y,\r
+ int rx, int ry, int rw, int rh, bitmap_t *bmp) {\r
+ word poffset = (word)page->data + y*(page->width/4) + x/4;\r
+ byte *data = bmp->data;\r
+ word bmpOffset = (word) data + ry * bmp->width + rx;\r
+ word width = rw;\r
+ word height = rh;\r
+ byte plane = 1 << ((byte) x & 0x03);\r
+ word scanCount = width/4 + (width%4 ? 1 :0);\r
+ word nextPageRow = page->width/4 - scanCount;\r
+ word nextBmpRow = (word) bmp->width - width;\r
+ word rowCounter=0;\r
+ byte planeCounter = 4;\r
+\r
+// sprintf(global_temp_status_text2, "%Fp", bmp->data);\r
+// modexprint(page, page->sw/2, (page->sh/2)+8, 1, 1, 3/*ccolor*/, 8, ggvv->video.VL_Started, global_temp_status_text2);\r
+// sprintf(global_temp_status_text2, "%Fp", data);\r
+// modexprint(page, page->sw/2, (page->sh/2)+16, 1, 1, 3/*ccolor*/, 8, ggvv->video.VL_Started, global_temp_status_text2);\r
+\r
+ __asm {\r
+ MOV AX, SCREEN_SEG ; go to the VGA memory\r
+ MOV ES, AX\r
+\r
+ MOV DX, SC_INDEX ; point at the map mask register\r
+ MOV AL, SC_MAPMASK ;\r
+ OUT DX, AL ;\r
+\r
+ PLANE_LOOP:\r
+ MOV DX, SC_DATA ; select the current plane\r
+ MOV AL, plane ;\r
+ OUT DX, AL ;\r
+\r
+ ;-- begin plane painting\r
+ MOV AX, height ; start the row counter\r
+ MOV rowCounter, AX ;\r
+ MOV DI, poffset ; go to the first pixel\r
+ MOV SI, bmpOffset ; go to the bmp pixel\r
+ ROW_LOOP:\r
+ MOV CX, width ; count the columns\r
+ SCAN_LOOP:\r
+ LODSB\r
+ DEC SI\r
+ CMP AL, 0\r
+ JNE DRAW_PIXEL ; draw non-zero pixels\r
+\r
+ INC DI ; skip the transparent pixel\r
+ ADD SI, 1\r
+ JMP NEXT_PIXEL\r
+ DRAW_PIXEL:\r
+ MOVSB ; copy the pixel\r
+ NEXT_PIXEL:\r
+ SUB CX, 3 ; we skip the next 3\r
+ ADD SI, 3 ; skip the bmp pixels\r
+ LOOP SCAN_LOOP ; finish the scan\r
+\r
+ MOV AX, nextPageRow\r
+ ADD DI, AX ; go to the next row on screen\r
+ MOV AX, nextBmpRow\r
+ ADD SI, AX ; go to the next row on bmp\r
+\r
+ DEC rowCounter\r
+ JNZ ROW_LOOP ; do all the rows\r
+ ;-- end plane painting\r
+\r
+ MOV AL, plane ; advance to the next plane\r
+ SHL AL, 1 ;\r
+ AND AL, 0x0f ; mask the plane properly\r
+ MOV plane, AL ; store the plane\r
+\r
+ INC bmpOffset ; start bmp at the right spot\r
+\r
+ DEC planeCounter\r
+ JNZ PLANE_LOOP ; do all 4 planes\r
+ }\r
+}\r
+\r
+void oldwalk(global_game_variables_t *gvar, word pn, bitmap_t *pbmp)\r
+{\r
+ switch(gvar->player[pn].enti.d)\r
+ {\r
+ //no direction\r
+ case 2:\r
+ //0000gvar->mv[0].video->startclk = (*clockw);\r
+ break;\r
+ //right movement\r
+ case 3:\r
+ if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx+1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ {\r
+ gvar->player[pn].walktype=2;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ animatePlayer(gvar, 1, 1, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+ gvar->player[pn].enti.q++;\r
+ //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx++; }\r
+ }\r
+ else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx+1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))\r
+ {\r
+ gvar->player[pn].walktype=1;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ gvar->player[pn].enti.x+=(gvar->player[pn].enti.spt);\r
+ animatePlayer(gvar, 1, 0, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ gvar->player[pn].enti.q++;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx++; }\r
+ }\r
+ else\r
+ {\r
+ gvar->player[pn].walktype=0;\r
+ //ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+ modexShowPage(&gvar->video.page[0]);\r
+ gvar->player[pn].enti.d = 2;\r
+ }\r
+ gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx+1;\r
+ gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty;\r
+ break;\r
+ //left movement\r
+ case 1:\r
+ if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx-1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY)) //collision detection!\r
+ {\r
+ gvar->player[pn].walktype=2;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ animatePlayer(gvar, 1, 1, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+ gvar->player[pn].enti.q++;\r
+ //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx--; }\r
+ }\r
+ else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx-1 == TRIGGX && gvar->player[pn].enti.ty == TRIGGY))\r
+ {\r
+ gvar->player[pn].walktype=1;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ gvar->player[pn].enti.x-=(gvar->player[pn].enti.spt);\r
+ animatePlayer(gvar, 1, 0, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ gvar->player[pn].enti.q++;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.tx--; }\r
+ }\r
+ else\r
+ {\r
+ gvar->player[pn].walktype=0;\r
+ //ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+ modexShowPage(&gvar->video.page[0]);\r
+ gvar->player[pn].enti.d = 2;\r
+ }\r
+ gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx-1;\r
+ gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty;\r
+ break;\r
+ //down movement\r
+ case 4:\r
+ if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->player[pn].enti.ty+1 == TRIGGY)) //collision detection!\r
+ {\r
+ gvar->player[pn].walktype=2;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ animatePlayer(gvar, 1, 1, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+ gvar->player[pn].enti.q++;\r
+ //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty++; }\r
+ }\r
+ else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->player[pn].enti.ty+1 == TRIGGY))\r
+ {\r
+ gvar->player[pn].walktype=1;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ gvar->player[pn].enti.y+=(gvar->player[pn].enti.spt);\r
+ animatePlayer(gvar, 1, 0, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ gvar->player[pn].enti.q++;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty++; }\r
+ }\r
+ else\r
+ {\r
+ gvar->player[pn].walktype=0;\r
+ //ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+ modexShowPage(&gvar->video.page[0]);\r
+ gvar->player[pn].enti.d = 2;\r
+ }\r
+ gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx;\r
+ gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty+1;\r
+ break;\r
+ //up movement\r
+ case 0:\r
+ if(ZCL_ScreenMidPosChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->player[pn].enti.ty-1 == TRIGGY)) //collision detection!\r
+ {\r
+ gvar->player[pn].walktype=2;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ animatePlayer(gvar, 1, 1, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ ZC_mapScroll(gvar->mv, gvar->player, pn);\r
+ gvar->player[pn].enti.q++;\r
+ //0000gvar->mv[0].video->clk = ((*clockw)-gvar->mv[0].video->startclk)/18.2;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty--; }\r
+ }\r
+ else if(ZCL_mapEdgeChk(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty, 0, 1) &&\r
+ ZCL_CollCheck(gvar->mv, gvar->player[pn].enti.d, gvar->player[pn].enti.tx, gvar->player[pn].enti.ty))//!(gvar->player[pn].enti.tx == TRIGGX && gvar->player[pn].enti.ty-1 == TRIGGY))\r
+ {\r
+ gvar->player[pn].walktype=1;\r
+ if(gvar->player[pn].enti.q<=gvar->player[pn].enti.spt)\r
+ {\r
+ INC_PER_FRAME;\r
+ gvar->player[pn].enti.y-=(gvar->player[pn].enti.spt);\r
+ animatePlayer(gvar, 1, 0, gvar->player[pn].enti.x, gvar->player[pn].enti.y, persist_aniframe, gvar->player[pn].enti.q, pbmp);\r
+ gvar->player[pn].enti.q++;\r
+ modexShowPage(&gvar->video.page[0]);\r
+ } else { gvar->player[pn].enti.q = 1; gvar->player[pn].enti.d = 2; gvar->player[pn].enti.ty--; }\r
+ }\r
+ else\r
+ {\r
+ gvar->player[pn].walktype=0;\r
+ //ZC_animatePlayer(gvar->mv, gvar->player, pn);\r
+ modexShowPage(&gvar->video.page[0]);\r
+ gvar->player[pn].enti.d = 2;\r
+ }\r
+ gvar->player[pn].enti.triggerx = gvar->player[pn].enti.tx;\r
+ gvar->player[pn].enti.triggery = gvar->player[pn].enti.ty-1;\r
+ break;\r
+ }\r
+}\r
+\r
+void animatePlayer(global_game_variables_t *gvar, /*map_view_t *top, */short d1, short d2, int x, int y, int ls, int lp, bitmap_t *bmp)\r
+{\r
+ short dire=32*d1; //direction\r
+ short qq; //scroll offset\r
+\r
+ if(d2==0) qq = 0;\r
+ else qq = ((lp)*gvar->player[0].enti.spt);\r
+ switch (d1)\r
+ {\r
+ case 0:\r
+ //up\r
+ x=x-4;\r
+ y=y-qq-TILEWH;\r
+ break;\r
+ case 1:\r
+ // right\r
+ x=x+qq-4;\r
+ y=y-TILEWH;\r
+ break;\r
+ case 2:\r
+ //down\r
+ x=x-4;\r
+ y=y+qq-TILEWH;\r
+ break;\r
+ case 3:\r
+ //left\r
+ x=x-qq-4;\r
+ y=y-TILEWH;\r
+ break;\r
+ }\r
+ modexCopyPageRegion(gvar->mv[0].page, gvar->mv[1].page, x-4, y-4, x-4, y-4, 28, 40);\r
+ if(2>ls && ls>=1) { modexDrawSpriteRegion(gvar->mv[0].page, x, y, 48, dire, 24, 32, bmp); }else\r
+ if(3>ls && ls>=2) { modexDrawSpriteRegion(gvar->mv[0].page, x, y, 24, dire, 24, 32, bmp); }else\r
+ if(4>ls && ls>=3) { modexDrawSpriteRegion(gvar->mv[0].page, x, y, 0, dire, 24, 32, bmp); }else\r
+ if(5>ls && ls>=4) { modexDrawSpriteRegion(gvar->mv[0].page, x, y, 24, dire, 24, 32, bmp); }\r
+ //TODO: mask copy //modexCopyPageRegion(gvar->mv[0].page, gvar->mv[0].page, x-4, y-4, x-4, y-4, 28, 40);\r
+ //modexClearRegion(top->page, 66, 66, 2, 40, 0);\r
+ //modexCopyPageRegion(gvar->mv[0].page, top->page, 66, 66, 66, 66, 2, 40);\r
+ //turn this off if XT\r
+ //if(detectcpu() > 0) modexWaitBorder();\r
+ switch(gvar->kurokku.fpscap)\r
+ {\r
+ case 0: //turn this off if XT\r
+ //modexprint(&(gv->video.page[0]), x, y+8, type, 1, col, bgcol, "sanic!");\r
+ gvar->kurokku.frames_per_second=1;\r
+ break;\r
+ case 1:\r
+ modexWaitBorder();\r
+ gvar->kurokku.frames_per_second=FPSVALUE;\r
+ break;\r
+ }\r
+ PM_NextFrame(gvar);\r
+}\r
+#endif\r