OSDN Git Service

updated copyleft and need to test and fix newer version of open watcom
[proj16/16.git] / src / lib / 16_vl.h
index 3cfa434..2390cf8 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
+ * Copyright (C) 2012-2022 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -26,6 +26,7 @@
 #define MODEX16_H\r
 \r
 #include "src/lib/16_head.h"\r
+#include "src/lib/16_tail.h"\r
 //#include "src/lib/planar.h"\r
 //#include "src/lib/modex16/16planar.h"\r
 #include "src/lib/16text.h"\r
@@ -67,6 +68,8 @@ typedef union
 \r
 /* -======================= Constants & Vars ==========================- */\r
 extern byte far*  VGA;  /* The VGA Memory */\r
+extern byte far gamepal;\r
+extern byte far corepal;       //core palette used universally\r
 #define SCREEN_SEG             0xa000\r
 #define VIDEO_INT              0x10\r
 #define SET_MODE               0x00\r
@@ -125,8 +128,11 @@ extern byte far*  VGA;  /* The VGA Memory */
 #define HIGH_ADDRESS           0x0C\r
 #define LOW_ADDRESS            0x0D\r
 #define VRETRACE               0x08\r
-//#define INPUT_STATUS_1               0x03da  defined in 16_head\r
-#define STATUS_REGISTER_1      INPUT_STATUS_1\r
+//#define INPUT _STATUS_1                      defined in 16_head\r
+//#define STATUS_REGISTER_1    0x03da\r
+\r
+#define        STATUS_REGISTER_1    0x3da\r
+\r
 #define ATR_INDEX                      AC_INDEX\r
 #define ATR_OVERSCAN           17\r
 #define DISPLAY_ENABLE         0x01\r
@@ -151,29 +157,36 @@ extern byte far*  VGA;  /* The VGA Memory */
 //\r
 // VGA hardware routines\r
 //\r
-\r
-void VGAMAPMASK(byte x);\r
-void VGAWRITEMODE(byte x);\r
-void VGAREADMAP(byte x);\r
+void   VGAWRITEMODE(byte x),\r
+       VGAMAPMASK(byte x),\r
+       VGAREADMAP(byte x),\r
+       VGABITMASK(byte x);\r
 \r
 #define VW_Hlin(x,z,y,c,q)     VL_Hlin(x,y,(z)-(x)+1,c,q)\r
 #define VW_Vlin(y,z,x,c,q)     VL_Vlin(x,y,(z)-(y)+1,c,q)\r
+#define PALPROGRAMSNEWPAGE gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0], &gvar);// modexFadeOn(4, &gvar.video.palette);\r
 \r
 /* -============================ Functions =============================- */\r
 /* mode switching, page, and plane functions */\r
-void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv);\r
-void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv);\r
-byte vgaGetMode();\r
+void   VL_Startup (global_game_variables_t *gvar),\r
+       VL_Shutdown (global_game_variables_t *gvar),\r
+       VL_SetVGAPlaneMode (global_game_variables_t *gvar),\r
+       VL_ClearVideo (byte color),\r
+       VL_DePlaneVGA (),\r
+       VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv),\r
+       modexEnter(sword vq, boolean cmem, global_game_variables_t *gv);\r
+//void VL_vgaSetMode(byte mode);\r
+byte VL_vgaGetMode(void);\r
 extern void TL_VidInit(global_game_variables_t *gvar);\r
-void modexLeave();\r
+void modexLeave(void);\r
 void modexsetBaseXMode();\r
-page_t modexDefaultPage(page_t *p);\r
+page_t modexDefaultPage(page_t *p, global_game_variables_t *gvar);\r
 page_t modexNextPage(page_t *p);\r
 page_t modexNextPageFlexibleSize(page_t *p, word x, word y);\r
 void modexCalcVmemRemain(video_t *video);\r
 void VL_Initofs(video_t *video);\r
-void modexHiganbanaPageSetup(video_t *video);\r
-//void modexShowPage(page_t *page);\r
+void modexHiganbanaPageSetup(global_game_variables_t *gvar);\r
+void modexShowPage(page_t *page);//for 0croll.exe\r
 void VL_ShowPage(page_t *page, boolean vsync, boolean sr);\r
 void modexPanPage(page_t *page, int dx, int dy);\r
 void modexSelectPlane(byte plane);\r
@@ -189,13 +202,16 @@ void modexFlashOn(word fade, byte *palette);
 void modexFlashOff(word fade, byte *palette);\r
 \r
 /* palette loading and saving */\r
+void VL_SetPalette (byte far *palette, video_t *v);\r
 void modexPalSave(byte *palette);\r
 //byte *modexNewPal();\r
 void modexLoadPalFile(char *filename, byte *palette);\r
-void VL_LoadPalFile(const char *filename, byte *palette);\r
-void VL_LoadPalFileCore(byte *palette);\r
-void VL_LoadPalFilewithoffset(const char *filename, byte *palette, word o);\r
-void VL_UpdatePaletteWrite(byte *palette, word o);\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 VL_SetCorePal(global_game_variables_t *gvar);\r
+void VLL_LoadPalFilewithoffset(const char *filename, byte *palette, word o, word palsize, 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
@@ -206,11 +222,13 @@ void modexPalWhite();
 /* utility functions */\r
 void modexPalUpdate(byte *p);\r
 void VL_modexPalScramble(byte *p);\r
-word modexPalOverscan(word col);\r
-void VL_Plot (int x, int y, int color, ofs_t *ofs);\r
-void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, ofs_t *ofs);\r
-void VL_Vlin (int x, int y, int height, int color, ofs_t *ofs);\r
-void VL_Bar (int x, int y, int width, int height, int color, ofs_t *ofs);\r
+word VL_modexPalOverscan(byte *p, word col);\r
+void VL_ColorBorder (int color, video_t *v);\r
+void VL_Plot (int x, int y, int color, global_game_variables_t *gvar);\r
+void VL_Hlin (unsigned x, unsigned y, unsigned width, unsigned color, global_game_variables_t *gvar);\r
+void VL_Vlin (int x, int y, int height, int color, global_game_variables_t *gvar);\r
+void VL_Bar (int x, int y, int width, int height, int color, global_game_variables_t *gvar);\r
+void VL_MemToScreen (byte far *source, int width, int height, int x, int y, global_game_variables_t *gvar);\r
 void modexputPixel(page_t *page, int x, int y, byte color);\r
 byte modexgetPixel(page_t *page, int x, int y);\r
 \r
@@ -241,17 +259,17 @@ static inline byte modexreadPixel(page_t *page, int x, int y, word addr)
 #endif\r
 \r
 void modexDrawChar(page_t *page, int x/*for planar selection only*/, word t, word col, word bgcol, word addr);\r
-void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word col, word bgcol, boolean sw, const byte *str);\r
+void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word color, word bgcolor, boolean vidsw, const byte *str);\r
 void modexprintbig(page_t *page, word x, word y, word t, word col, word bgcol, const byte *str);\r
 void VL_modexPrintTextBox(global_game_variables_t *gvar);\r
-void modexpdump(page_t *pee);\r
-void modexcls(page_t *page, byte color, byte *Where);\r
+void VL_print(const byte *str, nibble pagenum, global_game_variables_t *gvar);\r
+void modexpdump(nibble pagenum, global_game_variables_t *gvar);\r
 void VL_PatternDraw(video_t *video, word pn, boolean sw, boolean allsw);\r
 void modexWaitBorder();\r
 void modexWaitBorder_start();\r
 void modexWaitBorder_end();\r
 void VL_WaitVBL(word num);\r
-void VL_SetLineWidth (unsigned width, ofs_t *ofs);\r
+void VL_SetLineWidth (unsigned width, global_game_variables_t *gvar);\r
 void VL_PrintmodexmemInfo(video_t *v);\r
 \r
 #endif\r