OSDN Git Service

p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
[proj16/16.git] / src / lib / 16_vl_2.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 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 // big global status text buffer\r
29 char global_temp_status_text[512];\r
30 char global_temp_status_text2[512];\r
31 \r
32 #define PRINTTEXTBOXSTABLE\r
33 \r
34 void VL_modexPrintTextBox(global_game_variables_t *gvar)\r
35 {\r
36 #define PRINTTEXTBOXW   gvar->video.page[0].width\r
37 #define PRINTTEXTBOXH   160\r
38 #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
39 #define PRINTTEXTBOXHLINETOP            0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCB, 0xCD, PRINTTEXTBOXHLINE\r
40 #define PRINTTEXTBOXHLINEBOTTOM 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCA, 0xCD, PRINTTEXTBOXHLINE\r
41 #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
42 #define PRINTTEXTBOXSTRA2CHAR   0x20//07\r
43 #define PRINTTEXTBOXSTRA2STR    PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR\r
44         byte    str1[41] = { 0xC9, PRINTTEXTBOXHLINETOP, 0xBB, 0x00 };\r
45 #ifdef PRINTTEXTBOXSTABLE\r
46         byte    str2[41] = { 0xBA, PRINTTEXTBOXSTRA2STR, 0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
47 #else\r
48         byte    str2[2] = { 0xBA, 0x00 },\r
49                 stra2[7] = { PRINTTEXTBOXSTRA2STR, 0x00 },\r
50                 strb2[] = {  0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
51 #endif\r
52         byte    str3[41] = { 0xC8, PRINTTEXTBOXHLINEBOTTOM, 0xBC, 0x00 };\r
53         word x = gvar->video.page[/*!*/(gvar->video.p)].dx;     //(gv->video.page[(gv->video.p)].tlx) - // follow the screen\r
54         word y = gvar->video.page[/*!*/(gvar->video.p)].dy;     //(gv->video.page[(gv->video.p)].tly) - // follow the screen\r
55         word col = 3, bgcol = 0, type = 1;//w = 64, h = 8,\r
56         word v = gvar->video.page[0].height-PRINTTEXTBOXH;      //vertical offset\r
57         nibble i;\r
58         boolean                 done;\r
59         ScanCode                scan;\r
60 #ifndef PRINTTEXTBOXSTABLE\r
61         word q;\r
62 #endif\r
63         //backuppart\r
64         modexCopyPageRegion(&gvar->video.page[0], &gvar->video.page[2],\r
65                         0,\r
66                         0,\r
67                         x,\r
68                         PRINTTEXTBOXH,\r
69                         PRINTTEXTBOXW, PRINTTEXTBOXH);\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         for (i = 0,done = false;!done;)\r
95         {\r
96                 while (!(scan = gvar->in.inst->LastScan))\r
97                 {}\r
98 //                              SD_Poll();\r
99 \r
100                 IN_ClearKey(scan);\r
101                 switch (scan)\r
102                 {\r
103                         default:\r
104                         case sc_Escape:\r
105                                 done = true;\r
106                         break;\r
107                         case sc_Enter:\r
108                                 //PM_GetPage(i, gvar);\r
109                         break;\r
110                 }\r
111         }\r
112         modexCopyPageRegion(&gvar->video.page[2], &gvar->video.page[0],\r
113                         x,\r
114                         PRINTTEXTBOXH,\r
115                         0,\r
116                         0,\r
117                         PRINTTEXTBOXW, PRINTTEXTBOXH);\r
118 }\r