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].sw\r
37 #define PRINTTEXTBOXH   160\r
38 //#define PRINTTEXTBOXSIZE      51200\r
39 #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
40 #define PRINTTEXTBOXHLINETOP            0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCB, 0xCD, PRINTTEXTBOXHLINE\r
41 #define PRINTTEXTBOXHLINEBOTTOM 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCD, 0xCA, 0xCD, PRINTTEXTBOXHLINE\r
42 #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
43 #define PRINTTEXTBOXSTRA2CHAR   0x20//07\r
44 #define PRINTTEXTBOXSTRA2STR    PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR, PRINTTEXTBOXSTRA2CHAR\r
45         byte    str1[41] = { 0xC9, PRINTTEXTBOXHLINETOP, 0xBB, 0x00 };\r
46 #ifdef PRINTTEXTBOXSTABLE\r
47         byte    str2[41] = { 0xBA, PRINTTEXTBOXSTRA2STR, 0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
48 #else\r
49         byte    str2[2] = { 0xBA, 0x00 },\r
50                 stra2[7] = { PRINTTEXTBOXSTRA2STR, 0x00 },\r
51                 strb2[] = {  0xBA, PRINTTEXTBOXSLINE, 0xBA, 0x00 };\r
52 #endif\r
53         byte    str3[41] = { 0xC8, PRINTTEXTBOXHLINEBOTTOM, 0xBC, 0x00 };\r
54         word x = gvar->video.page[/*!*/(gvar->video.p)].dx;     //(gv->video.page[(gv->video.p)].tlx) - // follow the screen\r
55         word y = gvar->video.page[/*!*/(gvar->video.p)].dy;     //(gv->video.page[(gv->video.p)].tly) - // follow the screen\r
56         word col = 3, bgcol = 0, type = 1;//w = 64, h = 8,\r
57         word v = gvar->video.page[0].height-PRINTTEXTBOXH;      //vertical offset\r
58         nibble i;\r
59         boolean                 done;\r
60         ScanCode                scan;\r
61 //      word            huge    textboxbuff[PRINTTEXTBOXSIZE];\r
62 #ifndef PRINTTEXTBOXSTABLE\r
63         word q;\r
64 #endif\r
65         //backuppart\r
66         modexCopyPageRegion(&gvar->video.page[1], &gvar->video.page[0],\r
67                         x,\r
68                         gvar->video.page[0].height-PRINTTEXTBOXH,\r
69                         x,\r
70                         gvar->video.page[0].height-PRINTTEXTBOXH,\r
71                         PRINTTEXTBOXW, PRINTTEXTBOXH);\r
72 //      memcpy(&textboxbuff, gvar->video.page[0].data, PRINTTEXTBOXSIZE);\r
73 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");\r
74 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");\r
75 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");\r
76 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");\r
77 //              mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");\r
78 \r
79         //modexprint(*page, x, y, type, tlsw, color, bgcolor, sw, *str)\r
80         sprintf(global_temp_status_text, "%s", str1);\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 #ifdef PRINTTEXTBOXSTABLE\r
83         sprintf(global_temp_status_text, "%s", str2); for(i=0;i<8;i++)\r
84 {       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
85 #else\r
86         for(i=0;i<8;i++)\r
87         {\r
88         q=0;\r
89         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
90         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
91         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
92                 v-=8;\r
93         }\r
94 #endif\r
95         sprintf(global_temp_status_text, "%s", str3);\r
96         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
97         //PRINT TEXT\r
98         for (i = 0,done = false;!done;)\r
99         {\r
100                 while (!(scan = gvar->in.inst->LastScan))\r
101                 {}\r
102 //                              SD_Poll();\r
103 \r
104                 IN_ClearKey(scan);\r
105                 switch (scan)\r
106                 {\r
107                         default:\r
108                         case sc_Escape:\r
109                                 done = true;\r
110                         break;\r
111                         case sc_Q:\r
112                         case sc_Enter:\r
113                                 //PM_GetPage(i, gvar);\r
114                         break;\r
115                 }\r
116         }\r
117 \r
118         modexCopyPageRegion(&gvar->video.page[0], &gvar->video.page[1],\r
119                         x,\r
120                         gvar->video.page[0].height-PRINTTEXTBOXH,\r
121                         x,\r
122                         gvar->video.page[0].height-PRINTTEXTBOXH,\r
123                         PRINTTEXTBOXW, PRINTTEXTBOXH);\r
124 //      memcpy(&gvar->video.page[0].data, &textboxbuff, PRINTTEXTBOXSIZE);\r
125 }\r