OSDN Git Service

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