OSDN Git Service

updated copyleft and need to test and fix newer version of open watcom
[proj16/16.git] / src / lib / 16_vl_2.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2022 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #include <conio.h>\r
24 #include <stdio.h>\r
25 #include <stdlib.h>\r
26 #include "src/lib/16_vl.h"\r
27 \r
28 #define PRINTTEXTBOXSTABLE\r
29 \r
30 void VL_modexPrintTextBox(global_game_variables_t *gvar)\r
31 {\r
32 #define PRINTTEXTBOXW   gvar->video.page[0].width\r
33 #define PRINTTEXTBOXH   gvar->video.page[0].height-96\r
34 #define PRINTTEXTBOXY   160-48//112//184//gvar->video.page[0].height-100-16\r
35 //#define PRINTTEXTBOXSIZE      20480//51200\r
36 #define PRINTTEXTBOXHLINE               0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD,   0xCD//, 0xCD,   0xCD,   0xCD,   0xCD\r
37 #define PRINTTEXTBOXHLINETOP            0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCB, 0xCD, PRINTTEXTBOXHLINE\r
38 #define PRINTTEXTBOXHLINEBOTTOM 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCA, 0xCD, PRINTTEXTBOXHLINE\r
39 #define PRINTTEXTBOXSLINE               0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20,   0x20//, 0x20,   0x20,   0x20,   0x20\r
40 #define PRINTTEXTBOXSTRA2CHAR   0x20//07\r
41 #define PRINTTEXTBOXSTRA2STR    PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR\r
42         byte    str1[41] = { 0xC9, PRINTTEXTBOXHLINETOP, 0xBB, 0x00 };\r
43 #ifdef PRINTTEXTBOXSTABLE\r
44         byte    str2[41] = { 0xBA, PRINTTEXTBOXSTRA2STR, 0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
45 #else\r
46         byte    str2[2] = { 0xBA, 0x00 },\r
47                 stra2[7] = { PRINTTEXTBOXSTRA2STR, 0x00 },\r
48                 strb2[] = {  0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
49 #endif\r
50         byte    str3[41] = { 0xC8, PRINTTEXTBOXHLINEBOTTOM, 0xBC, 0x00 };\r
51         word x = gvar->video.page[/*!*/(gvar->video.p)].dx;     //(gv->video.page[(gv->video.p)].tlx) - // follow the screen\r
52         word y = gvar->video.page[/*!*/(gvar->video.p)].dy;     //(gv->video.page[(gv->video.p)].tly) - // follow the screen\r
53         word col = 3, bgcol = 0, type = 1;//w = 64, h = 8,\r
54         word v = PRINTTEXTBOXY; //vertical offset\r
55         nibble i;\r
56         boolean                 done;\r
57         ScanCode                scan;\r
58 //      word            huge    textboxbuff[PRINTTEXTBOXSIZE];\r
59 #ifndef PRINTTEXTBOXSTABLE\r
60         word q;\r
61 #endif\r
62         //backuppart\r
63         modexCopyPageRegion(&gvar->video.page[1], &gvar->video.page[0],\r
64                         0,\r
65                         PRINTTEXTBOXY,\r
66                         0,\r
67                         PRINTTEXTBOXY,\r
68                         PRINTTEXTBOXW, PRINTTEXTBOXH);\r
69 //      memcpy(&textboxbuff, gvar->video.page[0].data, PRINTTEXTBOXSIZE);\r
70 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");\r
71 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");\r
72 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");\r
73 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");\r
74 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");\r
75 \r
76         //modexprint(*page, x, y, type, tlsw, color, bgcolor, sw, *str)\r
77         sprintf(global_temp_status_text, "%s", str1);\r
78         modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text); v-=8;\r
79 #ifdef PRINTTEXTBOXSTABLE\r
80         sprintf(global_temp_status_text, "%s", str2); for(i=0;i<8;i++)\r
81 {       modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text); v-=8;     }\r
82 #else\r
83         for(i=0;i<8;i++)\r
84         {\r
85         q=0;\r
86         sprintf(global_temp_status_text, "%s", str2);   modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1,             global_temp_status_text);       q+=8;\r
87         sprintf(global_temp_status_text, "%s", stra2);  modexprint(&(gvar->video.page[(gvar->video.p)]), x+q, y+gvar->video.page[0].height-v, type, 1, col, 3, 1,               global_temp_status_text);       q+=40;\r
88         sprintf(global_temp_status_text, "%s", strb2);  modexprint(&(gvar->video.page[(gvar->video.p)]), x+q-8, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text);\r
89                 v-=8;\r
90         }\r
91 #endif\r
92         sprintf(global_temp_status_text, "%s", str3);\r
93         modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1, global_temp_status_text);\r
94         //PRINT TEXT\r
95 //              sprintf(global_temp_status_text, "%c", 0x07);   modexprint(&(gvar->video.page[(gvar->video.p)]), x, y+gvar->video.page[0].height-v, type, 1, col, bgcol, 1,             global_temp_status_text);\r
96         for (i = 0,done = false;!done;)\r
97         {\r
98                 while (!(scan = gvar->in.inst->LastScan))\r
99                 {}\r
100 //                              SD_Poll();\r
101 \r
102                 IN_ClearKey(scan);\r
103                 switch (scan)\r
104                 {\r
105                         default:\r
106                         case sc_Escape:\r
107                                 done = true;\r
108                         break;\r
109                         case sc_Q:\r
110                         case sc_Enter:\r
111                                 //PM_GetPage(i, gvar);\r
112                         break;\r
113                 }\r
114         }\r
115 \r
116         modexCopyPageRegion(&gvar->video.page[0], &gvar->video.page[1],\r
117                         0,\r
118                         PRINTTEXTBOXY,\r
119                         0,\r
120                         PRINTTEXTBOXY,\r
121                         PRINTTEXTBOXW, PRINTTEXTBOXH);\r
122 //      memcpy(&gvar->video.page[0].data, &textboxbuff, PRINTTEXTBOXSIZE);\r
123 }\r