# objects
#
VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
-OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
+#OLDLIBOBJS=bitmap.$(OBJ) 16render.$(OBJ)
GFXLIBOBJS = 16_vl.$(OBJ) 16_vlpal.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16_vrs.$(OBJ) 16_spri.$(OBJ) $(OLDLIBOBJS)
16LIBOBJS = 16_mm.$(OBJ) 16_pm.$(OBJ) 16_ca.$(OBJ) 16_tail.$(OBJ) 16_in.$(OBJ) 16_head.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_wcpu.$(OBJ) 16_timer.$(OBJ) jsmn.$(OBJ) 16_map.$(OBJ) 16text.$(OBJ) 16_enti.$(OBJ)
DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
0.exe &
exmmtest.exe &
vgmtest.exe &
- scroll.exe &
zcroll.exe &
inputest.exe &
- pcxtest.exe &
vrstest.exe &
maptest.exe
TESTEXEC2 = &
+ pcxtest.exe &
+ scroll.exe &
fmemtest.exe &
fonttest.exe &
fontgfx.exe &
#include "src/16.h"\r
\r
engi_stat_t engi_stat;\r
-byte *dpal, *gpal;\r
player_t player[MaxPlayers];\r
\r
void\r
engi_stat = ENGI_RUN;\r
\r
/* save the palette */\r
- dpal = modexNewPal();\r
- modexPalSave(dpal);\r
- modexFadeOff(4, dpal);\r
- gpal = modexNewPal();\r
- modexPalSave(gpal);\r
- modexSavePalFile("data/g.pal", gpal);\r
+ modexPalSave(gvar.video.dpal);\r
+ modexFadeOff(4, gvar.video.dpal);\r
+ modexPalSave(gvar.video.palette);\r
+ modexSavePalFile("data/g.pal", gvar.video.palette);\r
VGAmodeX(1, 1, &gvar);\r
// modexPalBlack(); //so player will not see loadings~\r
IN_Default(0,&player,ctrl_Joystick);\r
printf("Project 16 16.exe. This is supposed to be the actual finished game executable!\n");\r
printf("version %s\n", VERSION);\r
WCPU_cpufpumesg();\r
- modexFadeOn(4, dpal);\r
+ modexFadeOn(4, gvar.video.dpal);\r
}\r
// modexprint(0, 0, 1, 0, colpee, ROSE);\r
//++++ getch();\r
VGAmodeX(0, 1, &gvar);\r
-// rosa=malloc(sizeof(ROSE));\r
-// (*rosa)=(byte)ROSE;\r
printf("\n%s\n", rose);\r
//printf("\nh=%d\n", '8');\r
// printf("\n%c\n", e);\r
file_s = filesize(fh);\r
CA_LoadFile(mn, &MAPBUFINLM, gvar);\r
tokcount = jsmn_parse(&p, MAPBUFINLM, file_s, NULL, 0);\r
- tok = malloc(tokcount*sizeof(jsmntok_t));//TODO: USE MM_ CA_ AND PM_\r
+ tok = malloc(tokcount*sizeof(jsmntok_t));\r
// printf("Allocated %d tokens", tokcount);\r
jsmn_init(&p);\r
if((status = jsmn_parse(&p, MAPBUFINLM, file_s, tok, tokcount)) < 0)\r
#define __16_MM__\r
\r
#include <string.h>\r
-#include <malloc.h>\r
#include "src/lib/16_head.h"\r
#include "src/lib/16_hc.h"\r
#include "src/lib/16_tail.h"\r
\r
//TODO: 16_mm and 16_ca must handle this\r
typedef struct {\r
- bitmap_t far *pcximg; // old\r
+// bitmap_t far *pcximg; // old\r
#ifdef __WATCOMC__\r
sprite_t *spri; // I will probibaly use this --sparky4\r
#endif\r
word sh; /* screen heigth */ /* resolution */\r
word width; /* virtual width of the page */\r
word height; /* virtual height of the page */\r
- word stridew; /* width/4 */ /* VGA */\r
- word pagesize; /* page size */\r
- word pi; /* increment page by this much to preserve location */\r
+ word stridew; /* width/4 */ /* VGA */\r
+ word pagesize; /* page size */\r
+ word pi; /* increment page by this much to preserve location */\r
int tlx,tly;\r
//newer vars\r
//TODO: find where they are used\r
//struct sprite *spri; //supposively the sprite sheet data\r
memptr gr;\r
#endif\r
- bitmap_t *data; //supposively the sprite sheet data//old format\r
- bitmap_t bmp;\r
+// bitmap_t *data; //supposively the sprite sheet data//old format\r
+// bitmap_t bmp;\r
\r
//input\r
byte near pdir; //previous direction~ used in IN_16 in IN_ReadControl()\r
nibble wcpu; //stored value of cpu type\r
} kurokku_t;\r
\r
+//===================================//\r
+#define PALSIZE 768\r
+#define NUMCHUNKS 416 //keen\r
//video\r
typedef struct\r
{\r
unsigned int offscreen_ofs;\r
unsigned int pattern_ofs;\r
-} ofs_t;\r
-#define NUMCHUNKS 416 //keen\r
+} ofs_t; //unfinished\r
\r
typedef struct\r
{\r
char old_mode; //old video mode before game!\r
- byte palette[768]; //palette array\r
+ byte palette[PALSIZE], dpal[PALSIZE]; //palette array\r
page_t page[MAXPAGE]; //can be used as a pointer to root page[0]\r
word vmem_remain; //remaining video memory\r
byte num_of_pages; //number of actual pages\r
}\r
\r
\r
-byte *\r
+/*byte *\r
modexNewPal() {\r
byte *ptr;\r
- ptr = malloc(PAL_SIZE);\r
+ ptr = m a l l o c(PAL_SIZE);\r
\r
- /* handle errors */\r
+ // handle errors\r
if(!ptr) {\r
printf("Could not allocate palette.\n");\r
}\r
\r
return ptr;\r
-}\r
+}*/\r
\r
\r
void\r
-modexLoadPalFile(byte *filename, byte **palette) {\r
+modexLoadPalFile(byte *filename, byte *palette) {\r
FILE *file;\r
byte *ptr;\r
\r
- /* free the palette if it exists */\r
- if(*palette) {\r
- free(*palette);\r
- }\r
+ // free the palette if it exists\r
+ //if(*palette) { free(*palette); }\r
\r
- /* allocate the new palette */\r
- *palette = modexNewPal();\r
+ // allocate the new palette\r
+ //*palette = modexNewPal();\r
\r
- /* open the file */\r
+ // open the file\r
file = fopen(filename, "rb");\r
if(!file) {\r
- printf("Could not open palette file: %s\n", filename);\r
+ printf("Could not open palette file: %s\n", filename);\r
}\r
\r
/* read the file */\r
- ptr = *palette;\r
+ ptr = palette;\r
while(!feof(file)) {\r
*ptr++ = fgetc(file);\r
}\r
#define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2))\r
#define PLANE(x) (1 << ((x) & 3))\r
#define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02)\r
-#define PALSIZE 768\r
\r
typedef union\r
{\r
\r
/* palette loading and saving */\r
void modexPalSave(byte *palette);\r
-byte *modexNewPal();\r
-void modexLoadPalFile(char *filename, byte **palette);\r
+//byte *modexNewPal();\r
+void modexLoadPalFile(char *filename, byte *palette);\r
void VL_LoadPalFile(const char *filename, byte *palette);\r
void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o);\r
void VL_UpdatePaletteWrite(byte *palette, word o);\r
\r
//color checker~\r
//i want to make another vesion that checks the palette when the palette is being appened~\r
-void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/)\r
+void modexchkcolor(imgtestpal_t *bmp, word *q, word *a, word *aa, word *z, word *i/*, word *offset*/, global_game_variables_t *gv)\r
{\r
- byte *pal;\r
+ byte *pal=&(gv->video.palette);\r
word zz=0;\r
- pal = modexNewPal();\r
- modexPalSave(pal);\r
+ //pal = modexNewPal();\r
+// modexPalSave(pal);\r
CHKCOLDBGOUT1\r
//check palette for dups\r
for(; (*z)<PAL_SIZE; (*z)+=3)\r
}\r
\r
void\r
-VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset)\r
+VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset, global_game_variables_t *gv)\r
{\r
//byte *p = bmp->palette;\r
word w=0;\r
printf("1(*i)=%02d\n", (*i)/3);//\r
printf("1z=%02d\n", z/3);//\r
#endif\r
- modexchkcolor(bmp, &q, &a, &aa, &z, i);\r
+ modexchkcolor(bmp, &q, &a, &aa, &z, i, gv);\r
#ifdef BEVERBOSEPALCHECK\r
printf("2(*i)=%02d\n", (*i)/3);\r
printf("2z=%02d\n", z/3);\r
printf(" aa=%02d\n", aa);//\r
#endif\r
//update the palette~\r
- VL_palette(bmp, p, &pp, aq, aqoffset);\r
+ VL_palette(bmp, p, &pp, aq, aqoffset, gv);\r
(*i)=pp;\r
\r
if(aq<aa){ pp=q; aq++; goto aqpee; }\r
word offset;\r
} imgtestpal_t;\r
\r
-void VL_modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqpp);\r
-void VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset);\r
-//void chkcolor(bitmap_t *bmp, word *q, word *a, word *aa, word *z);\r
+void VL_modexPalUpdate(bitmap_t *bmp, word *i, word qp, word aqpp, global_game_variables_t *gv);\r
+void VL_palette(imgtestpal_t *bmp, byte *p, word *i, word qp, word aqoffset, global_game_variables_t *gv);\r
\r
\r
#endif //__16_VLPAL_H__\r
-Subproject commit 73d44631cbd6ff2e577fd1fa9a12750ebbcd8c54
+Subproject commit b5e32a4835387e8e658b6b0167399a937db53c66
mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)\r
{\r
word rx, ry;\r
- //word textx=0, texty=0;\r
- //if(i==0) i=2;\r
// printf("%02d ", i); if(x >= page->width - t->tileWidth) printf("\n");\r
switch(i)\r
{\r
modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 1); //currently the over scan color!\r
break;\r
default:\r
- rx = (((i-1) % ((t->pcximg->width)/t->tileWidth)) * t->tileWidth);\r
- ry = (((i-1) / ((t->pcximg->height)/t->tileHeight)) * t->tileHeight);\r
+ rx = (((i-1) % ((t->spri->sprite_vrl_cont->vrl_header->width)/t->tileWidth)) * t->tileWidth);\r
+ ry = (((i-1) / ((t->spri->sprite_vrl_cont->vrl_header->height)/t->tileHeight)) * t->tileHeight);\r
#ifndef TILERENDER\r
if(!pagenorendermap) modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, i+1);\r
#else\r
main(int argc, char *argv[])\r
{\r
static global_game_variables_t gvar;\r
- byte *pal;\r
- byte *bakapee;\r
+ char *bakapee;\r
\r
bakapee = malloc(64);\r
if(argv[1]) bakapee = argv[1];\r
\r
VGAmodeX(1, 1, &gvar);\r
\r
- pal = modexNewPal();\r
- modexPalSave(pal);\r
+ modexPalSave(&(gvar.video.palette));\r
\r
- modexSavePalFile(bakapee, pal);\r
+ modexSavePalFile(bakapee, &(gvar.video.palette));\r
\r
VGAmodeX(0, 1, &gvar);\r
+ free(bakapee);\r
\r
}\r
#include "src/lib/16_vl.h"\r
#include "src/lib/bakapee.h"\r
\r
-byte *pal;\r
char *bakapee;\r
word i;\r
\r
main(int argc, char *argv[])\r
{\r
static global_game_variables_t gvar;\r
- //page.width += 32;\r
- //page.height += 32;\r
- pal = modexNewPal();\r
bakapee = malloc(64);\r
if(argv[1]) bakapee = argv[1];\r
else bakapee = "data/default.pal";\r
-// modexPalSave(pal);\r
+ modexPalSave(&(gvar.video.palette));\r
VGAmodeX(1, 1, &gvar);\r
gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);\r
modexPalBlack();\r
\r
- modexLoadPalFile(bakapee, &pal);\r
- modexPalUpdate(pal);\r
- modexFadeOn(1, pal);\r
+ modexLoadPalFile(bakapee, &(gvar.video.palette));\r
+ modexPalUpdate(&(gvar.video.palette));\r
+ modexFadeOn(1, &(gvar.video.palette));\r
modexpdump(&gvar.video.page[0]);\r
getch();\r
VGAmodeX(0, 0, &gvar);\r
- modexPalUpdate(pal);\r
+ modexPalUpdate(&(gvar.video.palette));\r
/*for(i=0;i<768;i++)\r
{\r
printf("%02X ", pal[i]);\r
}*/\r
+ free(bakapee);\r
}\r
unsigned int i;\r
//#ifdef FADE\r
static word paloffset=0;\r
- byte *dpal;\r
+ byte *gvar.video.dpal;\r
//#endif\r
- byte *gpal;\r
// byte *ptr;\r
byte *mappalptr;\r
\r
/* save the palette */\r
#ifdef MODEX\r
#ifdef FADE\r
- dpal = modexNewPal();\r
- modexPalSave(dpal);\r
- modexFadeOff(4, dpal);\r
+ gvar.video.dpal = modexNewPal();\r
+ modexPalSave(gvar.video.dpal);\r
+ modexFadeOff(4, gvar.video.dpal);\r
#endif\r
\r
VGAmodeX(bakapee, 1, &gvar);\r
// printf("====\n\n");\r
#ifdef MODEX\r
#ifdef FADE\r
- gpal = modexNewPal();\r
- modexPalSave(gpal);\r
- modexSavePalFile("data/g.pal", gpal);\r
+ &gvar.video.palette = modexNewPal();\r
+ modexPalSave(&gvar.video.palette);\r
+ modexSavePalFile("data/g.pal", &gvar.video.palette);\r
modexPalBlack(); //so player will not see loadings~\r
#endif\r
#endif\r
if (gvar.video.sprifilei == -1)\r
{\r
#ifdef FADE\r
- modexFadeOff(4, gpal);\r
+ modexFadeOff(4, &gvar.video.palette);\r
#endif\r
Quit(&gvar, "Wrong");\r
#ifdef FADE\r
- modexFadeOn(4, dpal);\r
+ modexFadeOn(4, gvar.video.dpal);\r
#endif\r
}\r
\r
\r
#ifdef MODEX\r
#ifdef FADE\r
- modexFadeOn(4, gpal);\r
+ modexFadeOn(4, &gvar.video.palette);\r
#endif\r
#endif\r
while(!IN_KeyDown(sc_Escape) && player[0].enti.hp>0)\r
//debugging binds!\r
#ifdef MODEX\r
#ifdef FADE\r
- if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } //p\r
+ if(IN_KeyDown(24)){ modexPalUpdate0(&gvar.video.palette); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } //p\r
/*if(IN_KeyDown(22)){\r
paloffset=0; modexPalBlack(); modexPalUpdate(PCXBMPVAR, &paloffset, 0, 0);\r
printf("1paloffset = %d\n", paloffset/3);\r
\r
//9\r
#ifdef FADE\r
- if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(dpal); IN_UserInput(1,1); }\r
+ if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1,1); }\r
#endif\r
if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r\r
\r
/* but 1st lets save the game palette~ */\r
#ifdef MODEX\r
#ifdef FADE\r
- modexPalSave(gpal);\r
- modexSavePalFile("data/g.pal", gpal);\r
- modexFadeOff(4, gpal);\r
+ modexPalSave(&gvar.video.palette);\r
+ modexSavePalFile("data/g.pal", &gvar.video.palette);\r
+ modexFadeOff(4, &gvar.video.palette);\r
#endif\r
VGAmodeX(0, 1, &gvar);\r
#endif\r
WCPU_cpufpumesg();\r
#ifdef MODEX\r
#ifdef FADE\r
- modexFadeOn(4, dpal);\r
+ modexFadeOn(4, gvar.video.dpal);\r
#endif\r
#endif\r
}\r
#define HGQ 55\r
\r
static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
-static byte *palette;//[PAL_SIZE];\r
\r
void main(int argc, char *argv[])\r
{\r
Startup16(&gvar);\r
\r
/* save the palette */\r
- palette = modexNewPal();\r
//====modexPalSave(pal);\r
//====modexFadeOff(1, pal);\r
//====modexPalBlack();\r
/* load our palette */\r
VL_LoadPalFile("data/16.pal", &gvar.video.palette);\r
bmp1.offset=(paloffset/3);\r
- VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0);\r
+ VL_palette(&bmp1, &gvar.video.palette, &paloffset, 0, 0, &gvar);\r
\r
//VL_LoadPalFilewithoffset("data/default.pal", &palette, paloffset);\r
- modexLoadPalFile("data/16t.pal", &palette);\r
+ modexLoadPalFile("data/16t.pal", &gvar.video.dpal);\r
bmp2.offset=(paloffset/3);\r
- VL_palette(&bmp2, palette, &paloffset, 0, 0);\r
+ VL_palette(&bmp2, &gvar.video.dpal, &paloffset, 0, 0, &gvar);\r
//====modexLoadPalFile("data/default.pal", &pal2);\r
\r
/* overscan show */\r
\r
#ifdef FADE\r
//static word paloffset=0;\r
-byte *dpal;\r
#endif\r
-byte *gpal;\r
byte *ptr;\r
memptr pal;\r
\r
\r
// save the palette\r
#ifdef FADE\r
- dpal = modexNewPal();\r
- modexPalSave(dpal);\r
- modexFadeOff(4, dpal);\r
+ modexPalSave(&gvar.video.dpal);\r
+ modexFadeOff(4, &gvar.video.dpal);\r
modexPalBlack();\r
#endif\r
\r
//VL_LoadPalFile("data/default.pal", &gvar.video.palette);\r
\r
#ifdef FADE\r
- gpal = modexNewPal();\r
- modexPalSave(gpal);\r
- modexSavePalFile("data/g.pal", gpal);\r
+ modexPalSave(&gvar.video.palette);\r
+ modexSavePalFile("data/g.pal", &gvar.video.palette);\r
modexPalBlack(); //so player will not see loadings~\r
#endif\r
\r
if (gvar.video.sprifilei == -1)\r
{\r
#ifdef FADE\r
- modexFadeOff(4, gpal);\r
+ modexFadeOff(4, &gvar.video.palette);\r
#endif\r
Quit(&gvar, "Wrong ID for sprite");\r
#ifdef FADE\r
- modexFadeOn(4, dpal);\r
+ modexFadeOn(4, &gvar.video.dpal);\r
#endif\r
}\r
\r
shinku(&gvar);\r
//modexpdump(mv[0].page);\r
#ifdef FADE\r
- modexFadeOn(4, gpal);\r
+ modexFadeOn(4, &gvar.video.palette);\r
#endif\r
while(!IN_KeyDown(sc_Escape) && player[0].enti.hp>0)\r
{\r
VL_LoadPalFile(bakapee1p, &gvar.video.palette);\r
}//JK\r
#ifdef FADE\r
- if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(dpal); IN_UserInput(1,1); }\r
+ if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate(gvar.video.dpal); IN_UserInput(1,1); }\r
#endif\r
if(IN_KeyDown(sc_R)){ modexPalOverscan(rand()%56); } //r\r
\r
/* fade back to text mode */\r
/* but 1st lets save the game palette~ */\r
#ifdef FADE\r
- modexPalSave(gpal);\r
- modexSavePalFile("data/g.pal", gpal);\r
- modexFadeOff(4, gpal);\r
+ modexPalSave(&gvar.video.palette);\r
+ modexSavePalFile("data/g.pal", &gvar.video.palette);\r
+ modexFadeOff(4, &gvar.video.palette);\r
#endif\r
Shutdown16(&gvar);\r
printf("\nProject 16 zcroll.exe. This is just a test file!\n");\r
SCROLLEXITMESG;\r
WCPU_cpufpumesg();\r
#ifdef FADE\r
- modexFadeOn(4, dpal);\r
+ modexFadeOn(4, gvar.video.dpal);\r
#endif\r
}\r