2 Copyright (C) 1998 BJ Eirich (aka vecna)
\r
3 This program is free software; you can redistribute it and/or
\r
4 modify it under the terms of the GNU General Public License
\r
5 as published by the Free Software Foundation; either version 2
\r
6 of the License, or (at your option) any later version.
\r
7 This program is distributed in the hope that it will be useful,
\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\r
10 See the GNU General Public Lic
\r
11 See the GNU General Public License for more details.
\r
12 You should have received a copy of the GNU General Public License
\r
13 along with this program; if not, write to the Free Software
\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
\r
24 #include "guicomp.h"
\r
29 #include "vdriver.h"
\r
30 #include "keyboard.h"
\r
32 #include "smalfont.h"
\r
33 #include "columns.h"
\r
34 #include "tilesel.h"
\r
36 // ================================= Data ====================================
\r
40 char text[44]; // message text
\r
41 int exptime; // message expire time
\r
44 struct message messages[6]; // 5-message buffer
\r
45 char num_msgs=0; // number of active messages
\r
46 char playingmod[80]; // currently playing mod.
\r
47 extern char scrollmode;
\r
49 // ================================= Code ====================================
\r
51 void CheckMessageExpirations()
\r
54 for (i=0; i<num_msgs; i++)
\r
55 if (systemtime>messages[i].exptime)
\r
57 memcpy(messages[i].text, messages[i+1].text, (48*(num_msgs-i+1)));
\r
62 void Message(char *text, int duration)
\r
66 memcpy(messages[num_msgs].text, text, strlen(text));
\r
67 messages[num_msgs].exptime=systemtime+duration;
\r
72 memcpy(&messages[0].text, &messages[1].text, 192);
\r
73 memcpy(messages[4].text, text, strlen(text)+1);
\r
74 messages[num_msgs].exptime=systemtime+duration;
\r
77 void DrawScreenControls()
\r
85 GotoXY(298-5,tsy-19+13);
\r
90 // Put current-tile boxes if applicable.
\r
93 FilledBox(298,tsy-19,18,18,white);
\r
94 FilledBox(317,tsy-19,18,18,white);
\r
95 CopySprite(299,tsy-18,16,16,vsp+(256*lt));
\r
96 CopySprite(318,tsy-18,16,16,vsp+(256*rt));
\r
101 sprintf(strbuf,"Zone %d",curzone);
\r
102 GotoXY(280,tsy-16);
\r
103 printstring(strbuf);
\r
104 GotoXY(280,tsy-10);
\r
105 printstring(zones[curzone].name);
\r
107 c=zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) *
\r
108 layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)/16)];
\r
112 sprintf(strbuf,"zone %d",c);
\r
114 printstring(strbuf);
\r
116 printstring(zones[c].name);
\r
122 sprintf(strbuf,"%d entities",entities);
\r
123 GotoXY(285,17); printstring(strbuf);
\r
125 if (c=EntityThere((mx+xwin-16)/16,(my+ywin-16)/16))
\r
128 GotoXY(285,tsy-10);
\r
129 printstring(entity[c].desc);
\r
133 // Put the current-tile mouse thingy.
\r
135 dec_to_asciiz((xwin+mx-16)/16,strbuf);
\r
136 printstring(strbuf); printstring(", ");
\r
137 dec_to_asciiz((ywin+my-16)/16,strbuf);
\r
138 printstring(strbuf);
\r
140 // Put the layer editor/selector.
\r
142 for (i=0; i<6; i++)
\r
144 if (el==i) c=white; else c=darkw;
\r
145 FilledBox(17+(i*10),tsy-7,9,7,c);
\r
146 if (layertoggle[i]) c=darkred; else c=0;
\r
147 FilledBox(18+(i*10),tsy-6,7,6,c);
\r
148 GotoXY(20+(i*10),tsy-5); dec_to_asciiz(i+1,strbuf);
\r
149 if (i<numlayers) printstring(strbuf);
\r
152 for (i=6; i<10; i++)
\r
154 if (el==i) c=white; else c=darkw;
\r
155 FilledBox(17+(i*10),tsy-7,9,7,c);
\r
156 if (layertoggle[i]) c=darkred; else c=0;
\r
157 FilledBox(18+(i*10),tsy-6,7,6,c);
\r
158 GotoXY(20+(i*10),tsy-5);
\r
161 case 6: printstring("O"); break;
\r
162 case 7: printstring("N"); break;
\r
163 case 8: printstring("E"); break;
\r
164 case 9: printstring("T"); break;
\r
169 void RenderMessages()
\r
172 CheckMessageExpirations();
\r
173 for (i=0; i<num_msgs; i++)
\r
175 GotoXY(17,23+(i*6));
\r
176 printstring(messages[i].text);
\r
183 DrawScreenControls();
\r
187 // ============================= Dialog Code =================================
\r
189 int mmxofs=60, mmyofs=50;
\r
194 MainMenu(mmxofs, mmyofs);
\r
197 void MainMenu(int dx, int dy)
\r
199 //int mxo, myo, cursorblink;
\r
207 if (dx+80>335) dx=336-80;
\r
208 if (dy+89>sy+16) dy=(sy+16)-89;
\r
212 stdwindow(dx, dy, dx+80, dy+89);
\r
214 if (mx>dx && mx<dx+80)
\r
216 if (my>dy+2 && my<dy+9) FilledBox(dx+2, dy+2, 76, 7, darkw);
\r
217 if (my>dy+8 && my<dy+15) FilledBox(dx+2, dy+8, 76, 7, darkw);
\r
218 if (my>dy+14 && my<dy+21) FilledBox(dx+2, dy+14, 76, 7, darkw);
\r
219 if (my>dy+20 && my<dy+26) FilledBox(dx+2, dy+20, 76, 7, darkw);
\r
220 if (my>dy+29 && my<dy+36) FilledBox(dx+2, dy+29, 76, 7, darkw);
\r
221 if (my>dy+35 && my<dy+42) FilledBox(dx+2, dy+35, 76, 7, darkw);
\r
222 if (my>dy+41 && my<dy+48) FilledBox(dx+2, dy+41, 76, 7, darkw);
\r
223 if (my>dy+47 && my<dy+54) FilledBox(dx+2, dy+47, 76, 7, darkw);
\r
224 if (my>dy+53 && my<dy+60) FilledBox(dx+2, dy+53, 76, 7, darkw);
\r
225 if (my>dy+59 && my<dy+66) FilledBox(dx+2, dy+59, 76, 7, darkw);
\r
226 if (my>dy+65 && my<dy+72) FilledBox(dx+2, dy+65, 76, 7, darkw);
\r
227 if (my>dy+71 && my<dy+78) FilledBox(dx+2, dy+71, 76, 7, darkw);
\r
228 if (my>dy+80 && my<dy+87) FilledBox(dx+2, dy+80, 76, 7, darkw);
\r
231 GotoXY(dx+3, dy+3); printstring("New MAP");
\r
232 GotoXY(dx+3, dy+9); printstring("Load MAP");
\r
233 GotoXY(dx+3, dy+15); printstring("Save MAP");
\r
234 GotoXY(dx+3, dy+21); printstring("Load VSP");
\r
235 HLine(dx+2, dy+28, 76, white);
\r
236 GotoXY(dx+3, dy+30); printstring("MAP Properties");
\r
237 GotoXY(dx+3, dy+36); printstring("Layers"); GotoXY(dx+73, dy+36); printstring(">");
\r
238 GotoXY(dx+3, dy+42); printstring("Options");
\r
239 GotoXY(dx+3, dy+48); printstring("MOD Player");
\r
240 GotoXY(dx+3, dy+54); printstring("CD Player");
\r
241 GotoXY(dx+3, dy+60); printstring("Columns");
\r
242 GotoXY(dx+3, dy+66); printstring("Execute"); GotoXY(dx+73, dy+66); printstring(">");
\r
243 GotoXY(dx+3, dy+72); printstring("Exit to DOS");
\r
244 HLine(dx+2, dy+79, 76, white);
\r
245 GotoXY(dx+3, dy+81); printstring("About MapEd");
\r
251 if (mb==1 && mx>dx && mx<dx+80)
\r
253 if (my>dy+2 && my<dy+9) { NewMAP(); done=1; WaitRelease(); break; }
\r
254 if (my>dy+8 && my<dy+15) { done=1; WaitRelease(); LoadMAPDialog(); break; }
\r
255 if (my>dy+14 && my<dy+21) { done=1; WaitRelease(); key[SCAN_F10]=1; break; }
\r
256 if (my>dy+20 && my<dy+26) { done=1; WaitRelease(); LoadVSPDialog(); break; }
\r
257 if (my>dy+29 && my<dy+36) { done=1; WaitRelease(); MapPropertiesDialog(); break; }
\r
258 if (my>dy+35 && my<dy+42) { done=1; WaitRelease(); LayersSubMenu(dx,dy); break; }
\r
259 if (my>dy+41 && my<dy+48) { done=1; WaitRelease(); OptionsDialog(); break; }
\r
260 if (my>dy+47 && my<dy+54) { done=1; WaitRelease(); MPDialog(); break; }
\r
261 if (my>dy+53 && my<dy+60) { done=1; WaitRelease(); CDDialog(); break; }
\r
262 if (my>dy+59 && my<dy+66) { done=1; WaitRelease(); Columns(); break; }
\r
263 if (my>dy+65 && my<dy+72) { done=1; WaitRelease(); ExecuteSubMenu(); break; }
\r
264 if (my>dy+71 && my<dy+78) { done=1; WaitRelease(); key[SCAN_X]=1; key[SCAN_ALT]=1; break; }
\r
265 if (my>dy+80 && my<dy+87) { done=1; About(); break; }
\r
273 if (key[SCAN_ESC]==1) done=1;
\r
280 extern int width, depth;
\r
281 extern int vidoffset;
\r
284 extern word ontiles;
\r
286 static int TileMatch(int a, int b)
\r
287 { return !memcmp(ovsp+(a*256), ovsp+(b*256), 256); }
\r
289 int ilxsize=145, ilysize=122+10;
\r
290 int ilxofs=16, ilyofs=16;
\r
292 // make this configurable at some point
\r
293 #define MIN_TILE_X 50
\r
294 #define MIN_TILE_Y 50
\r
296 static int BitToNum(int num)
\r
303 for (i=0; i<32; i++)
\r
313 byte TileCmp(byte *one, byte *two)
\r
314 { return !memcmp(one,two, 256); }
\r
316 void ImageToLayer()
\r
317 { char done=0, moving=0;
\r
318 int mxo, myo, cursorblink;
\r
319 char ctf=0, cb=0, c, tt, *str;
\r
320 char nstr1[80], nstr2[80];
\r
324 int num_padx=0,num_pady=0; // in tiles
\r
325 int minpadx=0,minpady=0; // in tiles
\r
326 int tilesx=0,tilesy=0; // in tiles
\r
327 int totalx=0,totaly=0; // in tiles
\r
328 int excessx=0,excessy=0; // in pixels
\r
329 //int chk_1=1,chk_2=0,chk_3=0,chk_4=0,chk_5=0,chk_6=0; // radio control
\r
331 int chk_grabexcess=0,chk_centerinpad=0,chk_nodup=1; //,chk_padisblank=1;
\r
332 char txt_imagename[80];
\r
337 int matched=0,plot=0; //,mapat=0;
\r
339 int startx=0,starty=0;
\r
340 memset(txt_imagename,0,80);
\r
341 bmode=0; // for browser; update map/gui
\r
342 width=0; depth=0; // for pcx loading code
\r
344 sprintf(nstr1, "%d", num_padx);
\r
345 sprintf(nstr2, "%d", num_pady);
\r
352 if (ctf && systemtime >= cursorblink)
\r
355 cursorblink = systemtime+40;
\r
362 if (ilxofs<16) ilxofs = 16;
\r
363 if (ilyofs<16) ilyofs = 16;
\r
364 if (ilxofs+ilxsize>335) ilxofs = 336-ilxsize;
\r
365 if (ilyofs+ilysize>sy+16) ilyofs = (sy+16)-ilysize;
\r
368 Window(ilxofs, ilyofs, ilxofs+ilxsize, ilyofs+ilysize, "Import Image As Layer");
\r
369 Button(ilxofs+109, ilyofs+12, "Browse");
\r
370 Button(ilxofs+109, ilyofs+30, "OK");
\r
371 GotoXY(ilxofs+5, ilyofs+25); printstring("Layer:");
\r
372 // layer select radio buttons
\r
373 for (i=0; i<6; i++)
\r
375 CheckBox(ilxofs+29+(i*10), ilyofs+33, chk_layer & (1<<i));
\r
376 GotoXY(ilxofs+31+(i*10), ilyofs+25);
\r
377 sprintf(strbuf, "%i", i+1); printstring(strbuf);
\r
379 GotoXY(ilxofs+5, ilyofs+14); printstring("Image:");
\r
380 //TextField(ilxofs+29, ilyofs+12, 75, txt_imagename, ctf == 1 ? cb : 0);
\r
381 GotoXY(ilxofs+29, ilyofs+14); printstring(txt_imagename);
\r
382 HLine(ilxofs+1, ilyofs+44, 143, white);
\r
383 GotoXY(ilxofs+5, ilyofs+49); printstring("Image Dimensions:");
\r
386 GotoXY(ilxofs+5+pixels("Image Dimensions:")+3, ilyofs+49);
\r
387 sprintf(strbuf, "%dx%d", width, depth);
\r
388 printstring(strbuf);
\r
390 GotoXY(ilxofs+5, ilyofs+60); printstring("Tiles X:");
\r
393 GotoXY(ilxofs+5+pixels("Tiles X:")+3, ilyofs+60);
\r
394 sprintf(strbuf, "%d", tilesx);
\r
395 printstring(strbuf);
\r
397 GotoXY(ilxofs+5, ilyofs+71); printstring("Tiles Y:");
\r
400 GotoXY(ilxofs+5+pixels("Tiles Y:")+3, ilyofs+71);
\r
401 sprintf(strbuf, "%d", tilesy);
\r
402 printstring(strbuf);
\r
404 GotoXY(ilxofs+51, ilyofs+60); printstring("Pad X:");
\r
405 GotoXY(ilxofs+51, ilyofs+71); printstring("Pad Y:");
\r
406 TextField(ilxofs+74, ilyofs+58, 12, nstr1, ctf == 1 ? cb : 0);
\r
407 TextField(ilxofs+74, ilyofs+69, 12, nstr2, ctf == 2 ? cb : 0);
\r
408 GotoXY(ilxofs+95, ilyofs+60); printstring("Total X:");
\r
411 GotoXY(ilxofs+95+pixels("Total X:")+3, ilyofs+60);
\r
412 sprintf(strbuf, "%d", totalx);
\r
413 printstring(strbuf);
\r
415 GotoXY(ilxofs+95, ilyofs+71); printstring("Total Y:");
\r
418 GotoXY(ilxofs+95+pixels("Total Y:")+3, ilyofs+71);
\r
419 sprintf(strbuf, "%d", totaly);
\r
420 printstring(strbuf);
\r
422 GotoXY(ilxofs+5, ilyofs+81); printstring("Excess Pixels X:");
\r
425 GotoXY(ilxofs+5+pixels("Excess Pixels X:")+3, ilyofs+81);
\r
426 sprintf(strbuf, "%d", excessx);
\r
427 printstring(strbuf);
\r
429 GotoXY(ilxofs+5, ilyofs+91); printstring("Excess Pixels Y:");
\r
432 GotoXY(ilxofs+5+pixels("Excess Pixels Y:")+3, ilyofs+91);
\r
433 sprintf(strbuf, "%d", excessy);
\r
434 printstring(strbuf);
\r
436 CheckBox(ilxofs+5, ilyofs+101, chk_grabexcess);
\r
437 GotoXY(ilxofs+17, ilyofs+102); printstring("Grab Excess");
\r
438 CheckBox(ilxofs+5, ilyofs+110, chk_centerinpad);
\r
439 GotoXY(ilxofs+17, ilyofs+111); printstring("Center Within Padding");
\r
440 CheckBox(ilxofs+5, ilyofs+119, chk_nodup);
\r
441 GotoXY(ilxofs+17, ilyofs+120); printstring("Eliminate Duplicates");
\r
448 if ((mb==1 && mx>ilxofs+109 && mx<ilxofs+30+109 && my>ilyofs+12 && my<ilyofs+10+12 && !moving) || (key[SCAN_ALT] && key[SCAN_B]))
\r
450 // insert code for button "Browse" here
\r
451 ButtonPressed(ilxofs+109, ilyofs+12, "Browse");
\r
459 Browse(1, "*.pcx", "", "", "", txt_imagename);
\r
460 key[SCAN_ESC]=0; // just in case ESC exited
\r
461 f=fopen(txt_imagename, "rb");
\r
464 LoadPCXHeaderNP(txt_imagename);
\r
467 if (chk_grabexcess) i=15; else i=0;
\r
468 tilesx=((width+i)&~15)/16;
\r
469 tilesy=((depth+i)&~15)/16;
\r
470 excessx=width & 15;
\r
471 excessy=depth & 15;
\r
472 if (tilesx<MIN_TILE_X) { minpadx=MIN_TILE_X-tilesx; num_padx=minpadx; }
\r
473 if (tilesy<MIN_TILE_Y) { minpady=MIN_TILE_Y-tilesy; num_pady=minpady; }
\r
474 sprintf(nstr1, "%d", minpadx);
\r
475 sprintf(nstr2, "%d", minpady);
\r
476 totalx=tilesx+minpadx;
\r
477 totaly=tilesy+minpady;
\r
479 WaitRelease(); continue;
\r
482 if ((mb==1 && mx>ilxofs+109 && mx<ilxofs+30+109 && my>ilyofs+30 && my<ilyofs+10+30 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
484 // insert code for button "OK" here
\r
485 ButtonPressed(ilxofs+109, ilyofs+30, "OK");
\r
494 if (strlen(txt_imagename))
\r
498 ly=BitToNum(chk_layer) -1;
\r
502 if (chk_centerinpad)
\r
504 startx=(totalx-tilesx)/2;
\r
505 starty=(totaly-tilesy)/2;
\r
508 LoadPCXHeaderNP(txt_imagename);
\r
512 if (chk_grabexcess)
\r
514 // round up to the nearest multiple of 16 if grabbing excess
\r
515 wide=(width+15)&~15;
\r
516 deep=(depth+15)&~15;
\r
518 // allocate transit image bay, which may have padding ^
\r
519 t=(char *) valloc(wide * deep,"img2layer",0);
\r
521 for (i=0; i<depth; i++)
\r
530 ontiles=(wide*deep)+1; // +1 for our empty tile
\r
532 ovsp=(char *) valloc(ontiles*256,"img2layer2",0);
\r
534 layer[ly].pmultx=1; layer[ly].pmulty=1;
\r
535 layer[ly].pdivx=1; layer[ly].pdivy=1;
\r
536 // totalx & totaly are the sum of tilesx/tilesy & num_padx/num_pady
\r
537 layer[ly].sizex=totalx; layer[ly].sizey=totaly;
\r
538 layer[ly].trans=0; layer[ly].hline=0;
\r
540 lsz = totalx * totaly;
\r
542 if (layers[ly]) vfree(layers[ly]);
\r
543 layers[ly]=(unsigned short *) valloc((lsz*2)+4,"layer data",ly);
\r
546 memset(ovsp,0,256);
\r
549 for (i=0; i<deep; i++)
\r
551 for (j=0; j<wide; j++)
\r
553 GrabTileAt((j*16), (i*16), tilesripped, 0);
\r
556 // eliminate duplicates?
\r
560 for (k=0; k<tilesripped; k++)
\r
562 if (TileMatch(tilesripped, k))
\r
570 for(m=0; m<numtiles; m++)
\r
572 if(TileCmp(vsp+m*256,ovsp+tilesripped*256))
\r
581 if (!matched) tilesripped++;
\r
583 // grabbing all; keep it regardless
\r
584 else tilesripped++;
\r
586 layers[ly][((i+starty)*totalx)+j+startx]=plot;
\r
590 // adjust indices past current tile amount
\r
591 for (i=0; i<(totalx*totaly); i++)
\r
592 layers[ly][i]+=numtiles;
\r
596 if (obstruct) vfree(obstruct);
\r
597 obstruct=(char *) valloc(lsz+4,"obstruct",0);
\r
598 if (zone) vfree(zone);
\r
599 zone=(char *) valloc(lsz+4,"zone", 0);
\r
602 // reallocate tilebay and patch in ovsp
\r
603 str=(char *)valloc((numtiles+tilesripped)*256,"vsp data",0);
\r
604 memcpy(str, vsp, (numtiles*256));
\r
605 vfree(vsp); vsp=str; str=0;
\r
606 memcpy(vsp+(numtiles*256), ovsp, (tilesripped*256));
\r
607 numtiles+=tilesripped;
\r
609 // did we make a new layer?
\r
610 if (ly+1>numlayers)
\r
613 sprintf(rstring, "%s%i", rstring, ly+1); // update render-order
\r
620 WaitRelease(); continue;
\r
623 if (mb==1 && mx>ilxofs+29 && mx<ilxofs+8+29 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
628 //chk_2=0,chk_3=0,chk_4=0,chk_5=0,chk_6=0;
\r
629 WaitRelease(); continue;
\r
632 if (mb==1 && mx>ilxofs+39 && mx<ilxofs+8+39 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
634 if (numlayers+1 >= 2)
\r
639 //chk_1=0,chk_3=0,chk_4=0,chk_5=0,chk_6=0;
\r
640 WaitRelease(); continue;
\r
644 if (mb==1 && mx>ilxofs+49 && mx<ilxofs+8+49 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
646 if (numlayers+1 >= 3)
\r
651 //chk_1=0,chk_2=0,chk_4=0,chk_5=0,chk_6=0;
\r
652 WaitRelease(); continue;
\r
656 if (mb==1 && mx>ilxofs+59 && mx<ilxofs+8+59 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
658 if (numlayers+1 >= 4)
\r
663 //chk_1=0,chk_2=0,chk_3=0,chk_5=0,chk_6=0;
\r
664 WaitRelease(); continue;
\r
668 if (mb==1 && mx>ilxofs+69 && mx<ilxofs+8+69 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
670 if (numlayers+1 >= 5)
\r
675 //chk_1=0,chk_2=0,chk_3=0,chk_4=0,chk_6=0;
\r
676 WaitRelease(); continue;
\r
680 if (mb==1 && mx>ilxofs+79 && mx<ilxofs+8+79 && my>ilyofs+33 && my<ilyofs+7+33 && !moving)
\r
682 if (numlayers+1 >= 6)
\r
687 //chk_1=0,chk_2=0,chk_3=0,chk_4=0,chk_5=0;
\r
688 WaitRelease(); continue;
\r
692 // if no checkboxes are marked, mark the first.
\r
693 //if (!(chk_1+chk_2+chk_3+chk_4+chk_5+chk_6)) chk_1=1;
\r
694 if (!chk_layer) chk_layer=1;
\r
696 // if (mb==1 && mx>ilxofs+29 && mx<ilxofs+75+29 && my>ilyofs+12 && my<ilyofs+9+12 && !moving)
\r
698 // ctf=1; str=txt_imagename; cb=1;
\r
699 // cursorblink=systemtime+40; continue;
\r
704 if (mx>ilxofs+74 && mx<ilxofs+12+74 && my>ilyofs+58 && my<ilyofs+9+58 && !moving)
\r
708 if (atoi(str)<minpady)
\r
709 sprintf(str, "%d", minpady);
\r
711 ctf=1; str=nstr1; cb=1;
\r
712 cursorblink=systemtime+40; continue;
\r
715 if (mx>ilxofs+74 && mx<ilxofs+12+74 && my>ilyofs+69 && my<ilyofs+9+69 && !moving)
\r
719 if (atoi(str)<minpadx)
\r
720 sprintf(str, "%d", minpadx);
\r
722 ctf=2; str=nstr2; cb=1;
\r
723 cursorblink=systemtime+40; continue;
\r
728 case 1: if (atoi(str) < minpadx) sprintf(str, "%d", minpadx); break;
\r
729 case 2: if (atoi(str) < minpady) sprintf(str, "%d", minpady); break;
\r
733 if (mb==1 && mx>ilxofs+5 && mx<ilxofs+8+5 && my>ilyofs+101 && my<ilyofs+7+101 && !moving)
\r
735 chk_grabexcess ^= 1;
\r
737 if (excessx+excessy)
\r
739 if (chk_grabexcess)
\r
741 if (excessx) tilesx++;
\r
742 if (excessy) tilesy++;
\r
746 if (excessx) tilesx--;
\r
747 if (excessy) tilesy--;
\r
749 if (tilesx<MIN_TILE_X) { minpadx=MIN_TILE_X-tilesx; num_padx=minpadx; }
\r
750 if (tilesy<MIN_TILE_Y) { minpady=MIN_TILE_Y-tilesy; num_pady=minpady; }
\r
751 sprintf(nstr1, "%d", minpadx);
\r
752 sprintf(nstr2, "%d", minpady);
\r
753 totalx=tilesx+minpadx;
\r
754 totaly=tilesy+minpady;
\r
756 WaitRelease(); continue;
\r
759 if (mb==1 && mx>ilxofs+5 && mx<ilxofs+8+5 && my>ilyofs+110 && my<ilyofs+7+110 && !moving)
\r
761 chk_centerinpad ^= 1; WaitRelease(); continue;
\r
764 if (mb==1 && mx>ilxofs+5 && mx<ilxofs+8+5 && my>ilyofs+119 && my<ilyofs+7+119 && !moving)
\r
766 chk_nodup ^= 1; WaitRelease(); continue;
\r
769 if (mb==1 && mx>(ilxofs+ilxsize-9) && (mx<ilxofs+ilxsize-2)
\r
770 && my>(ilyofs+1) && (my<ilyofs+8) && !moving)
\r
777 if (mb==1 && mx>ilxofs && mx<ilxofs+ilxsize && my>ilyofs && my<(ilyofs+9) && !moving)
\r
785 if (mb==1 && !moving)
\r
795 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
796 else c=key_ascii_tbl[last_pressed];
\r
798 if (last_pressed==SCAN_ESC)
\r
805 if (last_pressed==SCAN_ENTER)
\r
809 // keep minimally required padding
\r
812 if (atoi(str)<minpadx)
\r
813 sprintf(str, "%d", minpadx);
\r
817 if (atoi(str)<minpady)
\r
818 sprintf(str, "%d", minpady);
\r
827 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
831 case 0: ctf=1; str=nstr1; break;
\r
832 case 1: ctf=2; str=nstr2; break;
\r
833 case 2: ctf=0; str=0; break;
\r
834 //case 3: ctf=0; str=0; break;
\r
838 cb=1; cursorblink=systemtime+40;
\r
842 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
846 case 0: ctf=2; str=nstr2; break;
\r
847 case 1: ctf=0; str=0; break;
\r
848 case 2: ctf=1; str=nstr1; break;
\r
849 //case 3: ctf=2; str=nstr1; break;
\r
853 cb=1; cursorblink=systemtime+40;
\r
860 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
862 str[strlen(str)-1]=0;
\r
863 key[SCAN_BACKSP]=0;
\r
867 else if (last_pressed==SCAN_BACKSP)
\r
881 //num_padx=atoi(nstr1);
\r
882 //num_pady=atoi(nstr2);
\r
885 int dtxsize=102, dtysize=52;
\r
886 int dtxofs=100, dtyofs=70;
\r
889 { char done=0, moving=0;
\r
890 int mxo, myo, cursorblink;
\r
891 char ctf=0, cb=0, c, t, *str;
\r
892 int zn_check=0,zd_check=0,ob_check=0,ent_check=0;
\r
900 if (ctf && systemtime >= cursorblink)
\r
903 cursorblink = systemtime+40;
\r
910 if (dtxofs<16) dtxofs = 16;
\r
911 if (dtyofs<16) dtyofs = 16;
\r
912 if (dtxofs+dtxsize>335) dtxofs = 336-dtxsize;
\r
913 if (dtyofs+dtysize>sy+16) dtyofs = (sy+16)-dtysize;
\r
916 Window(dtxofs, dtyofs, dtxofs+dtxsize, dtyofs+dtysize, "Destroyer");
\r
917 CheckBox(dtxofs+4, dtyofs+11, zn_check);
\r
918 CheckBox(dtxofs+4, dtyofs+31, ob_check);
\r
919 CheckBox(dtxofs+4, dtyofs+21, zd_check);
\r
920 GotoXY(dtxofs+15, dtyofs+12); printstring("Zones");
\r
921 GotoXY(dtxofs+15, dtyofs+32); printstring("Obstructions");
\r
922 GotoXY(dtxofs+15, dtyofs+22); printstring("Zone Data");
\r
923 Button(dtxofs+68, dtyofs+11, "ok");
\r
924 Button(dtxofs+68, dtyofs+24, "cancel");
\r
925 CheckBox(dtxofs+4, dtyofs+41, ent_check);
\r
926 GotoXY(dtxofs+15, dtyofs+42); printstring("Entities");
\r
933 if (mb==1 && mx>dtxofs+4 && mx<dtxofs+8+4 && my>dtyofs+11 && my<dtyofs+7+11 && !moving)
\r
935 zn_check ^= 1; WaitRelease(); continue;
\r
938 if (mb==1 && mx>dtxofs+4 && mx<dtxofs+8+4 && my>dtyofs+21 && my<dtyofs+7+21 && !moving)
\r
940 zd_check ^= 1; WaitRelease(); continue;
\r
943 if (mb==1 && mx>dtxofs+4 && mx<dtxofs+8+4 && my>dtyofs+31 && my<dtyofs+7+31 && !moving)
\r
945 ob_check ^= 1; WaitRelease(); continue;
\r
948 if (mb==1 && mx>dtxofs+4 && mx<dtxofs+8+4 && my>dtyofs+41 && my<dtyofs+7+41 && !moving)
\r
950 ent_check ^= 1; WaitRelease(); continue;
\r
953 if (mb==1 && mx>dtxofs+68 && mx<dtxofs+30+68 && my>dtyofs+11 && my<dtyofs+10+11 && !moving)
\r
955 // insert code for button "ok" here
\r
956 ButtonPressed(dtxofs+68, dtyofs+11, "ok");
\r
965 if (Confirm("Are you sure?"))
\r
968 if (ob_check) memset(obstruct, 0, (layer[0].sizex*layer[0].sizey)+4);
\r
969 if (zn_check) memset(zone, 0, (layer[0].sizex*layer[0].sizey)+4);
\r
973 memset(&zones, 0, sizeof zones);
\r
980 memset(&ms, 0, sizeof ms);
\r
981 memset(&entity, 0, sizeof entities);
\r
982 memset(&chrlist, 0, sizeof chrlist);
\r
985 WaitRelease(); continue;
\r
988 if (mb==1 && mx>dtxofs+68 && mx<dtxofs+30+68 && my>dtyofs+24 && my<dtyofs+10+24 && !moving)
\r
991 // insert code for button "cancel" here
\r
992 ButtonPressed(dtxofs+68, dtyofs+24, "cancel");
\r
1000 WaitRelease(); continue;
\r
1003 if (mb==1 && mx>(dtxofs+dtxsize-9) && (mx<dtxofs+dtxsize-2)
\r
1004 && my>(dtyofs+1) && (my<dtyofs+8) && !moving)
\r
1011 if (mb==1 && mx>dtxofs && mx<dtxofs+dtxsize && my>dtyofs && my<(dtyofs+9) && !moving)
\r
1019 if (mb==1 && !moving)
\r
1029 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
1030 else c=key_ascii_tbl[last_pressed];
\r
1032 if (last_pressed==SCAN_ESC)
\r
1039 if (last_pressed==SCAN_ENTER)
\r
1041 key[SCAN_ENTER]=0;
\r
1048 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
1052 case 0: ctf=0; str=0; break;
\r
1056 cb=1; cursorblink=systemtime+40;
\r
1060 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
1064 case 0: ctf=0; str=0; break;
\r
1068 cb=1; cursorblink=systemtime+40;
\r
1075 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
1077 str[strlen(str)-1]=0;
\r
1078 key[SCAN_BACKSP]=0;
\r
1082 else if (last_pressed==SCAN_BACKSP)
\r
1096 void LayersSubMenu(int dx, int dy)
\r
1098 //int mxo, myo, cursorblink;
\r
1104 if (dx+80>335) dx=336-80;
\r
1105 if (dy+89>sy+16) dy=(sy+16)-89;
\r
1109 stdwindow(dx, dy, dx+80, dy+29);
\r
1111 if (mx>dx && mx<dx+80)
\r
1113 if (my>dy+2 && my<dy+9) FilledBox(dx+2, dy+2, 76, 7, darkw);
\r
1114 if (my>dy+8 && my<dy+15) FilledBox(dx+2, dy+8, 76, 7, darkw);
\r
1115 if (my>dy+14 && my<dy+21) FilledBox(dx+2, dy+14, 76, 7, darkw);
\r
1116 if (my>dy+20 && my<dy+26) FilledBox(dx+2, dy+20, 76, 7, darkw);
\r
1119 GotoXY(dx+3, dy+3); printstring("Add Layer");
\r
1120 GotoXY(dx+3, dy+9); printstring("Edit Layer");
\r
1121 GotoXY(dx+3, dy+15); printstring("Import Image");
\r
1122 GotoXY(dx+3, dy+21); printstring("Destroyer");
\r
1126 CheckTimerStuff();
\r
1128 if (mb==1 && mx>dx && mx<dx+80)
\r
1130 if (my>dy+2 && my<dy+9) { AddLayer(); NoticeDialog(); done=1; WaitRelease(); break; }
\r
1131 if (my>dy+8 && my<dy+15) { EditLayerProperties(); done=1; WaitRelease(); break; }
\r
1132 if (my>dy+14 && my<dy+21) { ImageToLayer(); done=1; WaitRelease(); break; }
\r
1133 if (my>dy+20 && my<dy+26) { Destroyer(); done=1; WaitRelease(); break; }
\r
1141 if (key[SCAN_ESC]==1) done=1;
\r
1146 void ExecuteSubMenu(int dx, int dy)
\r
1148 //int mxo, myo, cursorblink;
\r
1154 if (dx+80>335) dx=336-80;
\r
1155 if (dy+89>sy+16) dy=(sy+16)-89;
\r
1159 stdwindow(dx, dy, dx+80, dy+23);
\r
1161 if (mx>dx && mx<dx+80)
\r
1163 if (my>dy+2 && my<dy+9) FilledBox(dx+2, dy+2, 76, 7, darkw);
\r
1164 if (my>dy+8 && my<dy+15) FilledBox(dx+2, dy+8, 76, 7, darkw);
\r
1165 if (my>dy+14 && my<dy+21) FilledBox(dx+2, dy+14, 76, 7, darkw);
\r
1168 GotoXY(dx+3, dy+3); printstring("MAP");
\r
1169 GotoXY(dx+3, dy+9); printstring("VERGE");
\r
1170 GotoXY(dx+3, dy+15); printstring("DOS");
\r
1174 CheckTimerStuff();
\r
1176 if (mb==1 && mx>dx && mx<dx+80)
\r
1178 if (my>dy+2 && my<dy+9) { ShellMAP(); done=1; WaitRelease(); break; }
\r
1179 if (my>dy+8 && my<dy+15) { ShellVERGE(); done=1; WaitRelease(); break; }
\r
1180 if (my>dy+14 && my<dy+21) { ShellToDOS(); done=1; WaitRelease(); break; }
\r
1188 if (key[SCAN_ESC]==1) done=1;
\r
1195 layers[numlayers]=(word *) valloc(layer[0].sizex * layer[0].sizey * 2,"layer data",numlayers);
\r
1196 //memset(layers[numlayers], 0, layer[0].sizex * layer[0].sizey * 2);
\r
1197 layer[numlayers].pmultx=1; layer[numlayers].pmulty=1;
\r
1198 layer[numlayers].pdivx=1; layer[numlayers].pdivy=1;
\r
1199 layer[numlayers].sizex=layer[0].sizex;
\r
1200 layer[numlayers].sizey=layer[0].sizey;
\r
1201 layer[numlayers].trans=0;
\r
1202 layer[numlayers].hline=0;
\r
1206 int lpxsize=190, lpysize=68;
\r
1207 int lpxofs=40, lpyofs=60;
\r
1209 void EditLayerProperties()
\r
1210 { char done=0, moving=0;
\r
1211 int mxo, myo, cursorblink, i;
\r
1212 char ctf=0, cb=0, c, t, *str;
\r
1213 char nstr1[80], nstr2[80], nstr3[80], nstr4[80], nstr5[80],nstr6[80];
\r
1217 if (i>=numlayers) i=0;
\r
1219 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1220 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1221 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1222 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1223 sprintf(nstr5, "%d", layer[i].trans);
\r
1224 sprintf(nstr6, "%d", layer[i].hline);
\r
1231 if (ctf && systemtime >= cursorblink)
\r
1234 cursorblink = systemtime+40;
\r
1238 lpxofs = (mx-mxo);
\r
1239 lpyofs = (my-myo);
\r
1240 if (!mb) moving=0;
\r
1241 if (lpxofs<16) lpxofs = 16;
\r
1242 if (lpyofs<16) lpyofs = 16;
\r
1243 if (lpxofs+lpxsize>335) lpxofs = 336-lpxsize;
\r
1244 if (lpyofs+lpysize>sy+16) lpyofs = (sy+16)-lpysize;
\r
1247 Window(lpxofs, lpyofs, lpxofs+lpxsize, lpyofs+lpysize, "Edit Layer Properties");
\r
1248 GotoXY(lpxofs+3, lpyofs+10); printstring("Parallax controls:");
\r
1249 GotoXY(lpxofs+4, lpyofs+21); printstring("MultX:");
\r
1250 GotoXY(lpxofs+12, lpyofs+31); printstring("DivX:");
\r
1251 GotoXY(lpxofs+93, lpyofs+21); printstring("MultY:");
\r
1252 GotoXY(lpxofs+101, lpyofs+31); printstring("DivY:");
\r
1253 TextField(lpxofs+29, lpyofs+19, 60, nstr1, ctf == 1 ? cb : 0);
\r
1254 TextField(lpxofs+29, lpyofs+29, 60, nstr2, ctf == 2 ? cb : 0);
\r
1255 TextField(lpxofs+118, lpyofs+19, 60, nstr3, ctf == 3 ? cb : 0);
\r
1256 TextField(lpxofs+118, lpyofs+29, 60, nstr4, ctf == 4 ? cb : 0);
\r
1257 HLine(lpxofs+1, lpyofs+43, 188, white);
\r
1258 GotoXY(lpxofs+9, lpyofs+48); printstring("Transparent");
\r
1259 GotoXY(lpxofs+36, lpyofs+58); printstring("HLine");
\r
1260 TextField(lpxofs+56, lpyofs+46, 60, nstr5, ctf == 5 ? cb : 0);
\r
1261 TextField(lpxofs+56, lpyofs+56, 60, nstr6, ctf == 6 ? cb : 0);
\r
1262 Button(lpxofs+156, lpyofs+55, "OK");
\r
1263 GotoXY(lpxofs+144, lpyofs+47); printstring("Layer");
\r
1264 sprintf(strbuf,"%d",i); GotoXY(lpxofs+168, lpyofs+47); printstring(strbuf);
\r
1268 CheckTimerStuff();
\r
1271 if (mb==1 && mx>lpxofs+29 && mx<lpxofs+60+29 && my>lpyofs+19 && my<lpyofs+9+19 && !moving)
\r
1273 ctf=1; str=nstr1; cb=1;
\r
1274 cursorblink=systemtime+40; continue;
\r
1277 if (mb==1 && mx>lpxofs+29 && mx<lpxofs+60+29 && my>lpyofs+29 && my<lpyofs+9+29 && !moving)
\r
1279 ctf=2; str=nstr2; cb=1;
\r
1280 cursorblink=systemtime+40; continue;
\r
1283 if (mb==1 && mx>lpxofs+118 && mx<lpxofs+60+118 && my>lpyofs+19 && my<lpyofs+9+19 && !moving)
\r
1285 ctf=3; str=nstr3; cb=1;
\r
1286 cursorblink=systemtime+40; continue;
\r
1289 if (mb==1 && mx>lpxofs+118 && mx<lpxofs+60+118 && my>lpyofs+29 && my<lpyofs+9+29 && !moving)
\r
1291 ctf=4; str=nstr4; cb=1;
\r
1292 cursorblink=systemtime+40; continue;
\r
1295 if (mb==1 && mx>lpxofs+56 && mx<lpxofs+60+56 && my>lpyofs+46 && my<lpyofs+9+46 && !moving)
\r
1297 ctf=5; str=nstr5; cb=1;
\r
1298 cursorblink=systemtime+40; continue;
\r
1301 if (mb==1 && mx>lpxofs+56 && mx<lpxofs+60+56 && my>lpyofs+56 && my<lpyofs+9+56 && !moving)
\r
1303 ctf=6; str=nstr6; cb=1;
\r
1304 cursorblink=systemtime+40; continue;
\r
1307 if ((mb==1 && mx>lpxofs+156 && mx<lpxofs+30+156 && my>lpyofs+55 && my<lpyofs+10+55 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
1309 // insert code for button "OK" here
\r
1310 ButtonPressed(lpxofs+156, lpyofs+55, "OK");
\r
1311 DrawMouse(); done=1;
\r
1318 WaitRelease(); continue;
\r
1321 if (mb==1 && mx>(lpxofs+lpxsize-9) && (mx<lpxofs+lpxsize-2)
\r
1322 && my>(lpyofs+1) && (my<lpyofs+8) && !moving)
\r
1329 if (mb==1 && mx>lpxofs && mx<lpxofs+lpxsize && my>lpyofs && my<(lpyofs+9) && !moving)
\r
1337 if (mb==1 && !moving)
\r
1347 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
1348 else c=key_ascii_tbl[last_pressed];
\r
1350 if (last_pressed==SCAN_ESC)
\r
1357 if (last_pressed==SCAN_UP)
\r
1359 layer[i].pmultx=atoi(nstr1);
\r
1360 layer[i].pdivx=atoi(nstr2);
\r
1361 layer[i].pmulty=atoi(nstr3);
\r
1362 layer[i].pdivy=atoi(nstr4);
\r
1363 layer[i].trans=atoi(nstr5);
\r
1364 layer[i].hline=atoi(nstr6);
\r
1365 last_pressed=0; key[SCAN_UP]=0;
\r
1366 if (i) i--; else i=numlayers-1;
\r
1367 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1368 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1369 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1370 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1371 sprintf(nstr5, "%d", layer[i].trans);
\r
1372 sprintf(nstr6, "%d", layer[i].hline);
\r
1374 if (last_pressed==SCAN_DOWN)
\r
1376 layer[i].pmultx=atoi(nstr1);
\r
1377 layer[i].pdivx=atoi(nstr2);
\r
1378 layer[i].pmulty=atoi(nstr3);
\r
1379 layer[i].pdivy=atoi(nstr4);
\r
1380 layer[i].trans=atoi(nstr5);
\r
1381 layer[i].hline=atoi(nstr6);
\r
1382 last_pressed=0; key[SCAN_DOWN]=0;
\r
1383 if (i<numlayers-1) i++; else i=0;
\r
1384 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1385 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1386 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1387 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1388 sprintf(nstr5, "%d", layer[i].trans);
\r
1389 sprintf(nstr6, "%d", layer[i].hline);
\r
1392 if (last_pressed==SCAN_ENTER)
\r
1394 key[SCAN_ENTER]=0;
\r
1401 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
1405 case 0: ctf=1; str=nstr1; break;
\r
1406 case 1: ctf=2; str=nstr2; break;
\r
1407 case 2: ctf=3; str=nstr3; break;
\r
1408 case 3: ctf=4; str=nstr4; break;
\r
1409 case 4: ctf=5; str=nstr5; break;
\r
1410 case 5: ctf=6; str=nstr6; break;
\r
1411 case 6: ctf=0; str=0; break;
\r
1415 cb=1; cursorblink=systemtime+40;
\r
1419 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
1423 case 0: ctf=6; str=nstr6; break;
\r
1424 case 1: ctf=0; str=0; break;
\r
1425 case 2: ctf=1; str=nstr1; break;
\r
1426 case 3: ctf=2; str=nstr2; break;
\r
1427 case 4: ctf=3; str=nstr3; break;
\r
1428 case 5: ctf=4; str=nstr4; break;
\r
1429 case 6: ctf=5; str=nstr5; break;
\r
1433 cb=1; cursorblink=systemtime+40;
\r
1440 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
1442 str[strlen(str)-1]=0;
\r
1443 key[SCAN_BACKSP]=0;
\r
1447 else if (last_pressed==SCAN_BACKSP)
\r
1459 layer[i].pmultx=atoi(nstr1);
\r
1460 layer[i].pdivx=atoi(nstr2);
\r
1461 layer[i].pmulty=atoi(nstr3);
\r
1462 layer[i].pdivy=atoi(nstr4);
\r
1463 layer[i].trans=atoi(nstr5);
\r
1464 layer[i].hline=atoi(nstr6);
\r
1467 int lpxsize=190, lpysize=68;
\r
1468 int lpxofs=40, lpyofs=60;
\r
1470 void EditLayerProperties()
\r
1471 { char done=0, moving=0;
\r
1472 int mxo, myo, cursorblink, i;
\r
1473 char ctf=0, cb=0, c, t, *str;
\r
1474 char nstr1[80], nstr2[80], nstr3[80], nstr4[80];
\r
1478 if (i>=numlayers) i=0;
\r
1480 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1481 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1482 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1483 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1490 if (ctf && systemtime >= cursorblink)
\r
1493 cursorblink = systemtime+40;
\r
1497 lpxofs = (mx-mxo);
\r
1498 lpyofs = (my-myo);
\r
1499 if (!mb) moving=0;
\r
1500 if (lpxofs<16) lpxofs = 16;
\r
1501 if (lpyofs<16) lpyofs = 16;
\r
1502 if (lpxofs+lpxsize>335) lpxofs = 336-lpxsize;
\r
1503 if (lpyofs+lpysize>sy+16) lpyofs = (sy+16)-lpysize;
\r
1506 Window(lpxofs, lpyofs, lpxofs+lpxsize, lpyofs+lpysize, "Edit Layer Properties");
\r
1507 GotoXY(lpxofs+3, lpyofs+10); printstring("Parallax controls:");
\r
1508 GotoXY(lpxofs+4, lpyofs+21); printstring("MultX:");
\r
1509 GotoXY(lpxofs+12, lpyofs+31); printstring("DivX:");
\r
1510 GotoXY(lpxofs+93, lpyofs+21); printstring("MultY:");
\r
1511 GotoXY(lpxofs+101, lpyofs+31); printstring("DivY:");
\r
1512 TextField(lpxofs+29, lpyofs+19, 60, nstr1, ctf == 1 ? cb : 0);
\r
1513 TextField(lpxofs+29, lpyofs+29, 60, nstr2, ctf == 2 ? cb : 0);
\r
1514 TextField(lpxofs+118, lpyofs+19, 60, nstr3, ctf == 3 ? cb : 0);
\r
1515 TextField(lpxofs+118, lpyofs+29, 60, nstr4, ctf == 4 ? cb : 0);
\r
1516 HLine(lpxofs+1, lpyofs+43, 188, white);
\r
1517 GotoXY(lpxofs+6, lpyofs+49); printstring("Transparent");
\r
1518 GotoXY(lpxofs+32, lpyofs+56); printstring("HLine");
\r
1519 CheckBox(lpxofs+56, lpyofs+48, layer[i].trans);
\r
1520 CheckBox(lpxofs+56, lpyofs+56, layer[i].hline);
\r
1521 Button(lpxofs+156, lpyofs+55, "OK");
\r
1522 GotoXY(lpxofs+144, lpyofs+47); printstring("Layer");
\r
1523 sprintf(strbuf,"%d",i); GotoXY(lpxofs+168, lpyofs+47); printstring(strbuf);
\r
1527 CheckTimerStuff();
\r
1530 if (mb==1 && mx>lpxofs+29 && mx<lpxofs+60+29 && my>lpyofs+19 && my<lpyofs+9+19 && !moving)
\r
1532 ctf=1; str=nstr1; cb=1;
\r
1533 cursorblink=systemtime+40; continue;
\r
1536 if (mb==1 && mx>lpxofs+29 && mx<lpxofs+60+29 && my>lpyofs+29 && my<lpyofs+9+29 && !moving)
\r
1538 ctf=2; str=nstr2; cb=1;
\r
1539 cursorblink=systemtime+40; continue;
\r
1542 if (mb==1 && mx>lpxofs+118 && mx<lpxofs+60+118 && my>lpyofs+19 && my<lpyofs+9+19 && !moving)
\r
1544 ctf=3; str=nstr3; cb=1;
\r
1545 cursorblink=systemtime+40; continue;
\r
1548 if (mb==1 && mx>lpxofs+118 && mx<lpxofs+60+118 && my>lpyofs+29 && my<lpyofs+9+29 && !moving)
\r
1550 ctf=4; str=nstr4; cb=1;
\r
1551 cursorblink=systemtime+40; continue;
\r
1554 if (mb==1 && mx>lpxofs+56 && mx<lpxofs+8+56 && my>lpyofs+48 && my<lpyofs+7+48 && !moving)
\r
1556 layer[i].trans ^= 1; WaitRelease(); continue;
\r
1559 if (mb==1 && mx>lpxofs+56 && mx<lpxofs+8+56 && my>lpyofs+56 && my<lpyofs+7+56 && !moving)
\r
1561 layer[i].hline ^= 1; WaitRelease(); continue;
\r
1564 if ((mb==1 && mx>lpxofs+156 && mx<lpxofs+30+156 && my>lpyofs+55 && my<lpyofs+10+55 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
1566 // insert code for button "OK" here
\r
1568 ButtonPressed(lpxofs+156, lpyofs+55, "OK");
\r
1576 WaitRelease(); continue;
\r
1579 if (mb==1 && mx>(lpxofs+lpxsize-9) && (mx<lpxofs+lpxsize-2)
\r
1580 && my>(lpyofs+1) && (my<lpyofs+8) && !moving)
\r
1587 if (mb==1 && mx>lpxofs && mx<lpxofs+lpxsize && my>lpyofs && my<(lpyofs+9) && !moving)
\r
1595 if (mb==1 && !moving)
\r
1605 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
1606 else c=key_ascii_tbl[last_pressed];
\r
1608 if (last_pressed==SCAN_ESC)
\r
1615 if (last_pressed==SCAN_UP)
\r
1617 layer[i].pmultx=atoi(nstr1);
\r
1618 layer[i].pdivx=atoi(nstr2);
\r
1619 layer[i].pmulty=atoi(nstr3);
\r
1620 layer[i].pdivy=atoi(nstr4);
\r
1621 last_pressed=0; key[SCAN_UP]=0;
\r
1622 if (i) i--; else i=numlayers-1;
\r
1623 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1624 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1625 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1626 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1628 if (last_pressed==SCAN_DOWN)
\r
1630 layer[i].pmultx=atoi(nstr1);
\r
1631 layer[i].pdivx=atoi(nstr2);
\r
1632 layer[i].pmulty=atoi(nstr3);
\r
1633 layer[i].pdivy=atoi(nstr4);
\r
1634 last_pressed=0; key[SCAN_DOWN]=0;
\r
1635 if (i<numlayers-1) i++; else i=0;
\r
1636 sprintf(nstr1, "%d", layer[i].pmultx);
\r
1637 sprintf(nstr2, "%d", layer[i].pdivx);
\r
1638 sprintf(nstr3, "%d", layer[i].pmulty);
\r
1639 sprintf(nstr4, "%d", layer[i].pdivy);
\r
1642 if (last_pressed==SCAN_ENTER)
\r
1644 key[SCAN_ENTER]=0;
\r
1651 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
1655 case 0: ctf=1; str=nstr1; break;
\r
1656 case 1: ctf=2; str=nstr2; break;
\r
1657 case 2: ctf=3; str=nstr3; break;
\r
1658 case 3: ctf=4; str=nstr4; break;
\r
1659 case 4: ctf=0; str=0; break;
\r
1663 cb=1; cursorblink=systemtime+40;
\r
1667 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
1671 case 0: ctf=4; str=nstr4; break;
\r
1672 case 1: ctf=0; str=0; break;
\r
1673 case 2: ctf=1; str=nstr1; break;
\r
1674 case 3: ctf=2; str=nstr2; break;
\r
1675 case 4: ctf=3; str=nstr3; break;
\r
1679 cb=1; cursorblink=systemtime+40;
\r
1686 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
1688 str[strlen(str)-1]=0;
\r
1689 key[SCAN_BACKSP]=0;
\r
1693 else if (last_pressed==SCAN_BACKSP)
\r
1706 layer[i].pmultx=atoi(nstr1);
\r
1707 layer[i].pdivx=atoi(nstr2);
\r
1708 layer[i].pmulty=atoi(nstr3);
\r
1709 layer[i].pdivy=atoi(nstr4);
\r
1713 { int cursorblink;
\r
1715 if (Confirm("Lose existing MAP?"))
\r
1717 for (cursorblink=0; cursorblink<numlayers; cursorblink++)
\r
1718 vfree(layers[cursorblink]);
\r
1719 memcpy(mapname,"UNTITLED.MAP",13);
\r
1720 memcpy(vspname,"UNTITLED.VSP",13);
\r
1721 memcpy(musname,"\0",1);
\r
1722 memcpy(rstring,"1E",2);
\r
1723 xstart=1; ystart=1;
\r
1727 // aen: default newmap dimensions set to 100x100
\r
1728 layer[0].pmultx=1; layer[0].pmulty=1;
\r
1729 layer[0].pdivx=1; layer[0].pdivy=1;
\r
1730 layer[0].sizex=100; layer[0].sizey=100;
\r
1731 layer[0].trans=0; layer[0].hline=0;
\r
1733 layers[0] = (unsigned short *)valloc((layer[0].sizex*layer[0].sizey*2)+4,"layer data",0);
\r
1735 obstruct=(char *) valloc((layer[0].sizex*layer[0].sizey)+4,"obstruct",0);
\r
1737 zone=(char *) valloc((layer[0].sizex*layer[0].sizey)+4,"zone",0);
\r
1738 entities=0; // Mordred
\r
1740 // aen: default number of tiles set to 100
\r
1743 vsp=(char *) valloc(256 * numtiles,"vsp data",0);
\r
1745 // zero: was re-allocating same memory so gfx still visible in some places
\r
1746 memset(vsp,0,256*numtiles);
\r
1747 // zero: gotta clear that anim stuff man!
\r
1748 memset(vspanim,0,800);
\r
1753 layertoggle[0]=1; layertoggle[1]=0; layertoggle[2]=0; layertoggle[3]=0;
\r
1754 layertoggle[4]=0; layertoggle[5]=0; layertoggle[6]=0; layertoggle[7]=0;
\r
1759 int amxsize=150, amysize=88;
\r
1760 int amxofs=60, amyofs=60;
\r
1764 char done=0, moving=0;
\r
1765 int mxo, myo, cursorblink;
\r
1766 char ctf=0, cb=0, c, t, *str;
\r
1775 if (ctf && systemtime >= cursorblink)
\r
1778 cursorblink = systemtime+40;
\r
1782 amxofs = (mx-mxo);
\r
1783 amyofs = (my-myo);
\r
1784 if (!mb) moving=0;
\r
1785 if (amxofs<16) amxofs = 16;
\r
1786 if (amyofs<16) amyofs = 16;
\r
1787 if (amxofs+amxsize>335) amxofs = 336-amxsize;
\r
1788 if (amyofs+amysize>sy+16) amyofs = (sy+16)-amysize;
\r
1791 sprintf(strbuf, "About MapEd %s", ME2_VERSION);
\r
1792 Window(amxofs, amyofs, amxofs+amxsize, amyofs+amysize, strbuf);
\r
1793 sprintf(strbuf, "MapEd v.%s", ME2_VERSION);
\r
1794 GotoXY(amxofs+52, amyofs+16); printstring(strbuf);
\r
1795 GotoXY(amxofs+31, amyofs+22); printstring("Copyright (C) 1998 vecna");
\r
1796 GotoXY(amxofs+40, amyofs+28); printstring("All Rights Reserved");
\r
1797 GotoXY(amxofs+(75-pixels("Additional code by Ric")/2), amyofs+41);
\r
1798 printstring("Additional code by Ric");
\r
1799 GotoXY(amxofs+(75-pixels("Additional code by aen")/2), amyofs+47);
\r
1800 printstring("Additional code by aen");
\r
1801 GotoXY(amxofs+(75-pixels("Additional code by zeromus")/2), amyofs+53);
\r
1802 printstring("Additional code by zeromus");
\r
1803 Button(amxofs+60, amyofs+68, "OK");
\r
1807 CheckTimerStuff();
\r
1810 if ((mb==1 && mx>amxofs+66 && mx<amxofs+30+66 && my>amyofs+68 && my<amyofs+10+68 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
1812 // insert code for button "OK" here
\r
1814 ButtonPressed(amxofs+60, amyofs+68, "OK");
\r
1822 WaitRelease(); continue;
\r
1825 if (mb==1 && mx>(amxofs+amxsize-9) && (mx<amxofs+amxsize-2) &&
\r
1826 my>(amyofs+1) && (my<amyofs+8) && !moving)
\r
1833 if (mb==1 && mx>amxofs && mx<amxofs+amxsize && my>amyofs && my<(amyofs+9) && !moving)
\r
1841 if (mb==1 && !moving)
\r
1851 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
1852 else c=key_ascii_tbl[last_pressed];
\r
1854 if (last_pressed==SCAN_ESC)
\r
1861 if (last_pressed==SCAN_ENTER)
\r
1863 key[SCAN_ENTER]=0;
\r
1870 if (last_pressed==SCAN_TAB)
\r
1874 case 0: ctf=0; str=0; break;
\r
1878 cb=1; cursorblink=systemtime+40;
\r
1885 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
1887 str[strlen(str)-1]=0;
\r
1888 key[SCAN_BACKSP]=0;
\r
1892 else if (last_pressed==SCAN_BACKSP)
\r
1907 int cnxsize=125, cnysize=50;
\r
1908 int cnxofs=114, cnyofs=70;
\r
1910 int Confirm(char *message)
\r
1911 { char done=0, moving=0;
\r
1912 int mxo, myo, cursorblink;
\r
1913 char ctf=0, cb=0, c, t, *str;
\r
1922 if (ctf && systemtime >= cursorblink)
\r
1925 cursorblink = systemtime+40;
\r
1929 cnxofs = (mx-mxo);
\r
1930 cnyofs = (my-myo);
\r
1931 if (!mb) moving=0;
\r
1932 if (cnxofs<16) cnxofs = 16;
\r
1933 if (cnyofs<16) cnyofs = 16;
\r
1934 if (cnxofs+cnxsize>335) cnxofs = 336-cnxsize;
\r
1935 if (cnyofs+cnysize>sy+16) cnyofs = (sy+16)-cnysize;
\r
1938 Window(cnxofs, cnyofs, cnxofs+cnxsize, cnyofs+cnysize, "Confirm? (Y/N)");
\r
1939 GotoXY(cnxofs+125/2-(pixels(message)/2), cnyofs+15); printstring(message);
\r
1941 Button(cnxofs+24, cnyofs+30, "Yes");
\r
1942 Button(cnxofs+69, cnyofs+30, "No");
\r
1946 CheckTimerStuff();
\r
1949 if (mb==1 && mx>cnxofs+24 && mx<cnxofs+30+24 && my>cnyofs+30 && my<cnyofs+10+30 && !moving)
\r
1951 // insert code for button "Yes" here
\r
1952 ButtonPressed(cnxofs+24, cnyofs+30, "Yes");
\r
1964 if (mb==1 && mx>cnxofs+69 && mx<cnxofs+30+69 && my>cnyofs+30 && my<cnyofs+10+30 && !moving)
\r
1966 ButtonPressed(cnxofs+69, cnyofs+30, "No");
\r
1978 if (mb==1 && mx>(cnxofs+cnxsize-9) && (mx<cnxofs+cnxsize-2)
\r
1979 && my>(cnyofs+1) && (my<cnyofs+8) && !moving)
\r
1986 if (mb==1 && mx>cnxofs && mx<cnxofs+cnxsize && my>cnyofs && my<(cnyofs+9) && !moving)
\r
1994 if (mb==1 && !moving)
\r
2004 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
2005 else c=key_ascii_tbl[last_pressed];
\r
2007 if (last_pressed==SCAN_ESC)
\r
2013 if (last_pressed==SCAN_N)
\r
2019 if (last_pressed==SCAN_Y)
\r
2025 if (last_pressed==SCAN_ENTER)
\r
2027 key[SCAN_ENTER]=0;
\r
2034 if (last_pressed==SCAN_TAB)
\r
2038 case 0: ctf=0; str=0; break;
\r
2042 cb=1; cursorblink=systemtime+40;
\r
2049 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
2051 str[strlen(str)-1]=0;
\r
2052 key[SCAN_BACKSP]=0;
\r
2056 else if (last_pressed==SCAN_BACKSP)
\r
2072 int lmxsize=145, lmysize=36;
\r
2073 int lmxofs=80, lmyofs=50;
\r
2075 void LoadMAPDialog()
\r
2076 { char lmapname[80];
\r
2077 char done=0, moving=0;
\r
2078 int mxo, myo, cursorblink;
\r
2079 char ctf=0, cb=0, c, t, *str;
\r
2081 memset(lmapname, 0, 80);
\r
2088 if (ctf && systemtime >= cursorblink)
\r
2091 cursorblink = systemtime+40;
\r
2095 lmxofs = (mx-mxo);
\r
2096 lmyofs = (my-myo);
\r
2097 if (!mb) moving=0;
\r
2098 if (lmxofs<16) lmxofs = 16;
\r
2099 if (lmyofs<16) lmyofs = 16;
\r
2100 if (lmxofs+lmxsize>335) lmxofs = 336-lmxsize;
\r
2101 if (lmyofs+lmysize>sy+16) lmyofs = (sy+16)-lmysize;
\r
2104 Window(lmxofs, lmyofs, lmxofs+lmxsize, lmyofs+lmysize, "Load MAP");
\r
2105 GotoXY(lmxofs+2, lmyofs+13); printstring("Load MAP:");
\r
2106 TextField(lmxofs+38, lmyofs+11, 70, lmapname, ctf == 1 ? cb : 0);
\r
2107 Button(lmxofs+79, lmyofs+22, "OK");
\r
2108 Button(lmxofs+111, lmyofs+22, "Cancel");
\r
2109 Button(lmxofs+111, lmyofs+11, "Browse");
\r
2113 CheckTimerStuff();
\r
2116 if (mb==1 && mx>lmxofs+38 && mx<lmxofs+70+38 && my>lmyofs+11 && my<lmyofs+9+11 && !moving)
\r
2118 ctf=1; str=lmapname; cb=1;
\r
2119 cursorblink=systemtime+40; continue;
\r
2122 if ((mb==1 && mx>lmxofs+79 && mx<lmxofs+30+79 && my>lmyofs+22 && my<lmyofs+10+22 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
2124 // insert code for button "OK" here
\r
2126 if (!Confirm("Lose unsaved changes?")) { done=1; continue; }
\r
2127 for (cursorblink=0; cursorblink<numlayers; cursorblink++)
\r
2128 vfree(layers[cursorblink]);
\r
2133 memcpy(mapname, lmapname, strlen(lmapname)+1);
\r
2136 xwin=0; ywin=0; done=1;
\r
2138 ButtonPressed(lmxofs+79, lmyofs+22, "OK");
\r
2146 WaitRelease(); continue;
\r
2149 if (mb==1 && mx>lmxofs+111 && mx<lmxofs+30+111 && my>lmyofs+22 && my<lmyofs+10+22 && !moving)
\r
2151 // insert code for button "Cancel" here
\r
2152 ButtonPressed(lmxofs+111, lmyofs+22, "Cancel");
\r
2153 DrawMouse(); done=1;
\r
2160 WaitRelease(); continue;
\r
2163 if ((mb==1 && mx>lmxofs+111 && mx<lmxofs+30+111 && my>lmyofs+11 && my<lmyofs+10+11 && !moving) || (key[SCAN_ALT] && key[SCAN_B]))
\r
2165 // insert code for button "Browse" here
\r
2166 ButtonPressed(lmxofs+111, lmyofs+11, "Browse");
\r
2175 Browse(1,"*.map","","","",lmapname);
\r
2179 if (mb==1 && mx>(lmxofs+lmxsize-9) && (mx<lmxofs+lmxsize-2)
\r
2180 && my>(lmyofs+1) && (my<lmyofs+8) && !moving)
\r
2187 if (mb==1 && mx>lmxofs && mx<lmxofs+lmxsize && my>lmyofs && my<(lmyofs+9) && !moving)
\r
2195 if (mb==1 && !moving)
\r
2205 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
2206 else c=key_ascii_tbl[last_pressed];
\r
2208 if (last_pressed==SCAN_ESC)
\r
2215 if (last_pressed==SCAN_ENTER)
\r
2217 key[SCAN_ENTER]=0;
\r
2224 if (last_pressed==SCAN_TAB)
\r
2228 case 0: ctf=1; str=lmapname; break;
\r
2229 case 1: ctf=0; str=0; break;
\r
2233 cb=1; cursorblink=systemtime+40;
\r
2240 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
2242 str[strlen(str)-1]=0;
\r
2243 key[SCAN_BACKSP]=0;
\r
2247 else if (last_pressed==SCAN_BACKSP)
\r
2262 int lvxsize=145, lvysize=35;
\r
2263 int lvxofs=80, lvyofs=50;
\r
2265 void LoadVSPDialog()
\r
2266 { char done=0, moving=0;
\r
2267 int mxo, myo, cursorblink;
\r
2268 char ctf=0, cb=0, c, t, *str;
\r
2269 char lvspname[80];
\r
2272 memset(lvspname,0,80);
\r
2278 if (ctf && systemtime >= cursorblink)
\r
2281 cursorblink = systemtime+40;
\r
2285 lvxofs = (mx-mxo);
\r
2286 lvyofs = (my-myo);
\r
2287 if (!mb) moving=0;
\r
2288 if (lvxofs<16) lvxofs = 16;
\r
2289 if (lvyofs<16) lvyofs = 16;
\r
2290 if (lvxofs+lvxsize>335) lvxofs = 336-lvxsize;
\r
2291 if (lvyofs+lvysize>sy+16) lvyofs = (sy+16)-lvysize;
\r
2294 Window(lvxofs, lvyofs, lvxofs+lvxsize, lvyofs+lvysize, "Load VSP");
\r
2295 GotoXY(lvxofs+2, lvyofs+13); printstring("Load VSP:");
\r
2296 TextField(lvxofs+38, lvyofs+11, 70, lvspname, ctf == 1 ? cb : 0);
\r
2297 Button(lvxofs+79, lvyofs+21, "OK");
\r
2298 Button(lvxofs+111, lvyofs+21, "Cancel");
\r
2299 Button(lvxofs+111, lvyofs+10, "Browse");
\r
2303 CheckTimerStuff();
\r
2306 if (mb==1 && mx>lvxofs+38 && mx<lvxofs+70+38 && my>lvyofs+11 && my<lvyofs+9+11 && !moving)
\r
2308 ctf=1; str=lvspname; cb=1;
\r
2309 cursorblink=systemtime+40; continue;
\r
2312 if ((mb==1 && mx>lvxofs+79 && mx<lvxofs+30+79 && my>lvyofs+21 && my<lvyofs+10+21 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
2314 // insert code for button "OK" here
\r
2316 memcpy(vspname, lvspname, strlen(lvspname)+1);
\r
2319 ButtonPressed(lvxofs+79, lvyofs+21, "OK");
\r
2328 WaitRelease(); continue;
\r
2331 if (mb==1 && mx>lvxofs+111 && mx<lvxofs+30+111 && my>lvyofs+21 && my<lvyofs+10+21 && !moving)
\r
2333 // insert code for button "Cancel" here
\r
2334 ButtonPressed(lvxofs+111, lvyofs+21, "Cancel");
\r
2335 DrawMouse(); done=1;
\r
2342 WaitRelease(); continue;
\r
2345 if ((mb==1 && mx>lvxofs+111 && mx<lvxofs+30+111 && my>lvyofs+10 && my<lvyofs+10+10 && !moving) || (key[SCAN_ALT] && key[SCAN_B]))
\r
2347 // insert code for button "Browse" here
\r
2348 ButtonPressed(lvxofs+111, lvyofs+10, "Browse");
\r
2356 Browse(1,"*.vsp","","","",lvspname);
\r
2357 WaitRelease(); continue;
\r
2360 if (mb==1 && mx>(lvxofs+lvxsize-9) && (mx<lvxofs+lvxsize-2)
\r
2361 && my>(lvyofs+1) && (my<lvyofs+8) && !moving)
\r
2368 if (mb==1 && mx>lvxofs && mx<lvxofs+lvxsize && my>lvyofs && my<(lvyofs+9) && !moving)
\r
2376 if (mb==1 && !moving)
\r
2386 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
2387 else c=key_ascii_tbl[last_pressed];
\r
2389 if (last_pressed==SCAN_ESC)
\r
2396 if (last_pressed==SCAN_ENTER)
\r
2398 key[SCAN_ENTER]=0;
\r
2405 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
2409 case 0: ctf=1; str=lvspname; break;
\r
2410 case 1: ctf=0; str=0; break;
\r
2414 cb=1; cursorblink=systemtime+40;
\r
2418 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
2422 case 0: ctf=1; str=lvspname; break;
\r
2423 case 1: ctf=0; str=lvspname; break;
\r
2427 cb=1; cursorblink=systemtime+40;
\r
2434 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
2436 str[strlen(str)-1]=0;
\r
2437 key[SCAN_BACKSP]=0;
\r
2441 else if (last_pressed==SCAN_BACKSP)
\r
2454 int mpxsize=175, mpysize=37;
\r
2455 int mpxofs=60, mpyofs=60;
\r
2458 { char done=0, moving=0, playmod[80];
\r
2459 int mxo, myo, cursorblink;
\r
2460 char ctf=0, cb=0, c, t, *str;
\r
2463 memset(playmod, 0, 80);
\r
2469 if (ctf && systemtime >= cursorblink)
\r
2472 cursorblink = systemtime+40;
\r
2476 mpxofs = (mx-mxo);
\r
2477 mpyofs = (my-myo);
\r
2478 if (!mb) moving=0;
\r
2479 if (mpxofs<16) mpxofs = 16;
\r
2480 if (mpyofs<16) mpyofs = 16;
\r
2481 if (mpxofs+mpxsize>335) mpxofs = 336-mpxsize;
\r
2482 if (mpyofs+mpysize>sy+16) mpyofs = (sy+16)-mpysize;
\r
2485 Window(mpxofs, mpyofs, mpxofs+mpxsize, mpyofs+mpysize, "MOD Player Controls");
\r
2486 GotoXY(mpxofs+2, mpyofs+15); printstring("MOD Playing:");
\r
2487 TextField(mpxofs+49, mpyofs+13, 90, playmod, ctf == 1 ? cb : 0);
\r
2488 Button(mpxofs+110, mpyofs+24, "Play");
\r
2489 Button(mpxofs+142, mpyofs+24, "Stop");
\r
2490 Button(mpxofs+78, mpyofs+24, "OK");
\r
2491 Button(mpxofs+142, mpyofs+12, "Browse");
\r
2495 CheckTimerStuff();
\r
2498 if (mb==1 && mx>mpxofs+49 && mx<mpxofs+90+49 && my>mpyofs+13 && my<mpyofs+9+13 && !moving)
\r
2500 ctf=1; str=playmod; cb=1;
\r
2501 cursorblink=systemtime+40; continue;
\r
2504 if (mb==1 && mx>mpxofs+110 && mx<mpxofs+30+110 && my>mpyofs+24 && my<mpyofs+10+24 && !moving)
\r
2506 // insert code for button "Play" here
\r
2507 ButtonPressed(mpxofs+110, mpyofs+24, "Play");
\r
2508 PlayMusic(playmod);
\r
2516 WaitRelease(); continue;
\r
2519 if (mb==1 && mx>mpxofs+142 && mx<mpxofs+30+142 && my>mpyofs+24 && my<mpyofs+10+24 && !moving)
\r
2521 // insert code for button "Stop" here
\r
2522 memset(playingmod, 0, 80);
\r
2523 memset(playmod, 0, 80);
\r
2525 ButtonPressed(mpxofs+142, mpyofs+24, "Stop");
\r
2533 WaitRelease(); continue;
\r
2536 if ((mb==1 && mx>mpxofs+78 && mx<mpxofs+30+78 && my>mpyofs+24 && my<mpyofs+10+24 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
2538 // insert code for button "OK" here
\r
2540 ButtonPressed(mpxofs+78, mpyofs+24, "OK");
\r
2548 WaitRelease(); continue;
\r
2551 if ((mb==1 && mx>mpxofs+142 && mx<mpxofs+30+142 && my>mpyofs+12 && my<mpyofs+10+12 && !moving) || (key[SCAN_ALT] && key[SCAN_B]))
\r
2553 // insert code for button "Browse" here
\r
2554 ButtonPressed(mpxofs+142, mpyofs+12, "Browse");
\r
2562 Browse(4,"*.s3m","*.mod","*.xm",".it",playmod);
\r
2563 WaitRelease(); continue;
\r
2566 if (mb==1 && mx>(mpxofs+mpxsize-9) && (mx<mpxofs+mpxsize-2)
\r
2567 && my>(mpyofs+1) && (my<mpyofs+8) && !moving)
\r
2574 if (mb==1 && mx>mpxofs && mx<mpxofs+mpxsize && my>mpyofs && my<(mpyofs+9) && !moving)
\r
2582 if (mb==1 && !moving)
\r
2592 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
2593 else c=key_ascii_tbl[last_pressed];
\r
2595 if (last_pressed==SCAN_ESC)
\r
2602 if (last_pressed==SCAN_ENTER)
\r
2604 key[SCAN_ENTER]=0;
\r
2611 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
2615 case 0: ctf=1; str=playmod; break;
\r
2616 case 1: ctf=0; str=0; break;
\r
2620 cb=1; cursorblink=systemtime+40;
\r
2624 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
2628 case 0: ctf=1; str=playmod; break;
\r
2629 case 1: ctf=0; str=playmod; break;
\r
2633 cb=1; cursorblink=systemtime+40;
\r
2640 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
2642 str[strlen(str)-1]=0;
\r
2643 key[SCAN_BACKSP]=0;
\r
2647 else if (last_pressed==SCAN_BACKSP)
\r
2661 int zexsize=135, zeysize=86;
\r
2662 int zexofs=80, zeyofs=40;
\r
2664 void ZoneEdDialog()
\r
2665 { char done=0, moving=0;
\r
2666 int mxo, myo, cursorblink, i=0;
\r
2667 char ctf=0, cb=0, c, t, *str;
\r
2668 char nstr1[80], nstr2[80], nstr3[80], nstr4[80];
\r
2671 sprintf(nstr1, "%d", zones[i].script);
\r
2672 sprintf(nstr2, "%d", zones[i].percent);
\r
2673 sprintf(nstr3, "%d", zones[i].delay);
\r
2674 sprintf(nstr4, "%d", zones[i].entityscript);
\r
2681 if (ctf && systemtime >= cursorblink)
\r
2684 cursorblink = systemtime+40;
\r
2688 zexofs = (mx-mxo);
\r
2689 zeyofs = (my-myo);
\r
2690 if (!mb) moving=0;
\r
2691 if (zexofs<16) zexofs = 16;
\r
2692 if (zeyofs<16) zeyofs = 16;
\r
2693 if (zexofs+zexsize>335) zexofs = 336-zexsize;
\r
2694 if (zeyofs+zeysize>sy+16) zeyofs = (sy+16)-zeysize;
\r
2697 Window(zexofs, zeyofs, zexofs+zexsize, zeyofs+zeysize, "Zone Editor");
\r
2698 GotoXY(zexofs+8, zeyofs+12); printstring("Name:");
\r
2699 TextField(zexofs+30, zeyofs+10, 100, zones[i].name, ctf == 1 ? cb : 0);
\r
2700 GotoXY(zexofs+5, zeyofs+22); printstring("Script:");
\r
2701 TextField(zexofs+30, zeyofs+20, 100, nstr1, ctf == 2 ? cb : 0);
\r
2702 GotoXY(zexofs+2, zeyofs+32); printstring("Chance:");
\r
2703 TextField(zexofs+30, zeyofs+30, 100, nstr2, ctf == 3 ? cb : 0);
\r
2704 GotoXY(zexofs+7, zeyofs+42); printstring("Delay:");
\r
2705 TextField(zexofs+30, zeyofs+40, 100, nstr3, ctf == 4 ? cb : 0);
\r
2706 GotoXY(zexofs+4, zeyofs+52); printstring("Entity:");
\r
2707 TextField(zexofs+30, zeyofs+50, 100, nstr4, ctf == 5 ? cb : 0);
\r
2708 CheckBox(zexofs+20, zeyofs+61, zones[i].aaa);
\r
2709 GotoXY(zexofs+31, zeyofs+62); printstring("Allow Adjacent Activation");
\r
2710 Button(zexofs+99, zeyofs+71, "OK");
\r
2711 GotoXY(zexofs+12, zeyofs+73); printstring("Zone");
\r
2712 GotoXY(zexofs+30, zeyofs+73);
\r
2713 sprintf(strbuf,"%d",i); printstring(strbuf);
\r
2717 CheckTimerStuff();
\r
2720 if (mb==1 && mx>zexofs+30 && mx<zexofs+100+30 && my>zeyofs+10 && my<zeyofs+9+10 && !moving)
\r
2722 ctf=1; str=zones[i].name; cb=1;
\r
2723 cursorblink=systemtime+40; continue;
\r
2726 if (mb==1 && mx>zexofs+30 && mx<zexofs+100+30 && my>zeyofs+20 && my<zeyofs+9+20 && !moving)
\r
2728 ctf=2; str=nstr1; cb=1;
\r
2729 cursorblink=systemtime+40; continue;
\r
2732 if (mb==1 && mx>zexofs+30 && mx<zexofs+100+30 && my>zeyofs+30 && my<zeyofs+9+30 && !moving)
\r
2734 ctf=3; str=nstr2; cb=1;
\r
2735 cursorblink=systemtime+40; continue;
\r
2738 if (mb==1 && mx>zexofs+30 && mx<zexofs+100+30 && my>zeyofs+40 && my<zeyofs+9+40 && !moving)
\r
2740 ctf=4; str=nstr3; cb=1;
\r
2741 cursorblink=systemtime+40; continue;
\r
2744 if (mb==1 && mx>zexofs+30 && mx<zexofs+100+30 && my>zeyofs+50 && my<zeyofs+9+50 && !moving)
\r
2746 ctf=5; str=nstr4; cb=1;
\r
2747 cursorblink=systemtime+40; continue;
\r
2750 if (mb==1 && mx>zexofs+20 && mx<zexofs+8+20 && my>zeyofs+61 && my<zeyofs+7+61 && !moving)
\r
2752 zones[i].aaa ^= 1; WaitRelease(); continue;
\r
2755 if ((mb==1 && mx>zexofs+99 && mx<zexofs+30+99 && my>zeyofs+71 && my<zeyofs+10+71 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
2757 // insert code for button "OK" here
\r
2759 ButtonPressed(zexofs+99, zeyofs+71, "OK");
\r
2767 WaitRelease(); continue;
\r
2770 if (mb==1 && mx>(zexofs+zexsize-9) && (mx<zexofs+zexsize-2)
\r
2771 && my>(zeyofs+1) && (my<zeyofs+8) && !moving)
\r
2778 if (mb==1 && mx>zexofs && mx<zexofs+zexsize && my>zeyofs && my<(zeyofs+9) && !moving)
\r
2786 if (mb==1 && !moving)
\r
2796 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
2797 else c=key_ascii_tbl[last_pressed];
\r
2799 if (last_pressed==SCAN_ESC)
\r
2805 if (last_pressed==SCAN_UP)
\r
2807 zones[i].script=atoi(nstr1);
\r
2808 zones[i].percent=atoi(nstr2);
\r
2809 zones[i].delay=atoi(nstr3);
\r
2810 zones[i].entityscript=atoi(nstr4);
\r
2811 if (i<255) i++; else i=0;
\r
2812 last_pressed=0; key[SCAN_UP]=0;
\r
2813 sprintf(nstr1, "%d", zones[i].script);
\r
2814 sprintf(nstr2, "%d", zones[i].percent);
\r
2815 sprintf(nstr3, "%d", zones[i].delay);
\r
2816 sprintf(nstr4, "%d", zones[i].entityscript);
\r
2819 if (last_pressed==SCAN_DOWN)
\r
2821 zones[i].script=atoi(nstr1);
\r
2822 zones[i].percent=atoi(nstr2);
\r
2823 zones[i].delay=atoi(nstr3);
\r
2824 zones[i].entityscript=atoi(nstr4);
\r
2825 if (i) i--; else i=255;
\r
2826 last_pressed=0; key[SCAN_DOWN]=0;
\r
2827 sprintf(nstr1, "%d", zones[i].script);
\r
2828 sprintf(nstr2, "%d", zones[i].percent);
\r
2829 sprintf(nstr3, "%d", zones[i].delay);
\r
2830 sprintf(nstr4, "%d", zones[i].entityscript);
\r
2833 if (last_pressed==SCAN_ENTER)
\r
2835 key[SCAN_ENTER]=0;
\r
2842 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
2846 case 0: ctf=1; str=zones[i].name; break;
\r
2847 case 1: ctf=2; str=nstr1; break;
\r
2848 case 2: ctf=3; str=nstr2; break;
\r
2849 case 3: ctf=4; str=nstr3; break;
\r
2850 case 4: ctf=5; str=nstr4; break;
\r
2851 case 5: ctf=0; str=0; break;
\r
2855 cb=1; cursorblink=systemtime+40;
\r
2859 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
2863 case 0: ctf=5; str=nstr4; break;
\r
2864 case 1: ctf=0; str=0; break;
\r
2865 case 2: ctf=1; str=zones[i].name; break;
\r
2866 case 3: ctf=2; str=nstr1; break;
\r
2867 case 4: ctf=3; str=nstr2; break;
\r
2868 case 5: ctf=4; str=nstr3; break;
\r
2872 cb=1; cursorblink=systemtime+40;
\r
2879 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
2881 str[strlen(str)-1]=0;
\r
2882 key[SCAN_BACKSP]=0;
\r
2886 else if (last_pressed==SCAN_BACKSP)
\r
2900 zones[i].script=atoi(nstr1);
\r
2901 zones[i].percent=atoi(nstr2);
\r
2902 zones[i].delay=atoi(nstr3);
\r
2903 zones[i].entityscript=atoi(nstr4);
\r
2906 int exsize=180, eysize=175;
\r
2907 int exofs=70, eyofs=30;
\r
2909 void EntityEditor(int i)
\r
2910 { char done=0, moving=0;
\r
2911 int mxo, myo, cursorblink;
\r
2912 char ctf=0, cb=0, c, t, *str;
\r
2913 char nstr1[80], nstr2[80], nstr3[80], nstr4[80], nstr5[80], nstr6[80], nstr7[80], nstr8[80], nstr9[80], nstr10[80], nstr11[80], nstr12[80], nstr13[80];
\r
2915 sprintf(nstr1, "%d", entity[i].x);
\r
2916 sprintf(nstr2, "%d", entity[i].y);
\r
2917 sprintf(nstr3, "%d", entity[i].chrindex);
\r
2918 sprintf(nstr4, "%d", entity[i].speed);
\r
2919 sprintf(nstr5, "%d", entity[i].actscript);
\r
2920 sprintf(nstr6, "%d", entity[i].movecode);
\r
2921 sprintf(nstr7, "%d", entity[i].step);
\r
2922 sprintf(nstr8, "%d", entity[i].data2);
\r
2923 sprintf(nstr9, "%d", entity[i].data3);
\r
2924 sprintf(nstr10, "%d", entity[i].delay);
\r
2925 sprintf(nstr11, "%d", entity[i].data5);
\r
2926 sprintf(nstr12, "%d", entity[i].data6);
\r
2927 sprintf(nstr13, "%d", entity[i].movescript);
\r
2934 if (ctf && systemtime >= cursorblink)
\r
2937 cursorblink = systemtime+40;
\r
2943 if (!mb) moving=0;
\r
2944 if (exofs<16) exofs = 16;
\r
2945 if (eyofs<16) eyofs = 16;
\r
2946 if (exofs+exsize>335) exofs = 336-exsize;
\r
2947 if (eyofs+eysize>sy+16) eyofs = (sy+16)-eysize;
\r
2950 Window(exofs, eyofs, exofs+exsize, eyofs+eysize, "Entity Editor");
\r
2951 GotoXY(exofs+7, eyofs+13); printstring("Desc:");
\r
2952 TextField(exofs+26, eyofs+11, 80, entity[i].desc, ctf == 1 ? cb : 0);
\r
2953 GotoXY(exofs+19, eyofs+23); printstring("X:");
\r
2954 TextField(exofs+26, eyofs+21, 80, nstr1, ctf == 2 ? cb : 0);
\r
2955 GotoXY(exofs+19, eyofs+33); printstring("Y:");
\r
2956 TextField(exofs+26, eyofs+31, 80, nstr2, ctf == 3 ? cb : 0);
\r
2957 GotoXY(exofs+11, eyofs+43); printstring("CHR:");
\r
2958 TextField(exofs+26, eyofs+41, 80, nstr3, ctf == 4 ? cb : 0);
\r
2961 // entity image goes here (just above chr list button)
\r
2964 BigButton(exofs+116, eyofs+61, "CHR List");
\r
2965 BigButton(exofs+115, eyofs+153, "Scripts");
\r
2966 GotoXY(exofs+2, eyofs+155); printstring("Movescript:");
\r
2967 HLine(exofs+1, eyofs+73, 178, white);
\r
2968 GotoXY(exofs+3, eyofs+53); printstring("Speed:");
\r
2969 TextField(exofs+26, eyofs+51, 80, nstr4, ctf == 5 ? cb : 0);
\r
2970 TextField(exofs+26, eyofs+61, 80, nstr5, ctf == 6 ? cb : 0);
\r
2971 GotoXY(exofs+107, eyofs+79); printstring("Is Obstruction");
\r
2972 CheckBox(exofs+161, eyofs+87, entity[i].obsmode1);
\r
2973 GotoXY(exofs+102, eyofs+88); printstring("Is Obstructable");
\r
2974 CheckBox(exofs+161, eyofs+78, entity[i].obsmode2);
\r
2975 GotoXY(exofs+24, eyofs+79); printstring("Auto Face");
\r
2976 CheckBox(exofs+61, eyofs+78, entity[i].face);
\r
2977 GotoXY(exofs+10, eyofs+88); printstring("Activ. Method");
\r
2978 CheckBox(exofs+61, eyofs+87, entity[i].actm);
\r
2979 HLine(exofs+1, eyofs+98, 178, white);
\r
2980 GotoXY(exofs+126, eyofs+166); printstring("Entity");
\r
2981 GotoXY(exofs+6, eyofs+104); printstring("Move Code:");
\r
2982 TextField(exofs+47, eyofs+103, 80, nstr6, ctf == 7 ? cb : 0);
\r
2983 TextField(exofs+30, eyofs+115, 40, nstr7, ctf == 8 ? cb : 0);
\r
2984 TextField(exofs+30, eyofs+125, 40, nstr8, ctf == 9 ? cb : 0);
\r
2985 TextField(exofs+30, eyofs+135, 40, nstr9, ctf == 10 ? cb : 0);
\r
2986 TextField(exofs+113, eyofs+115, 40, nstr10, ctf == 11 ? cb : 0);
\r
2987 TextField(exofs+113, eyofs+125, 40, nstr11, ctf == 12 ? cb : 0);
\r
2988 TextField(exofs+113, eyofs+135, 40, nstr12, ctf == 13 ? cb : 0);
\r
2989 HLine(exofs+1, eyofs+148, 178, white);
\r
2990 TextField(exofs+46, eyofs+153, 60, nstr13, ctf == 14 ? cb : 0);
\r
2991 GotoXY(exofs+5, eyofs+63); printstring("Activ:");
\r
2992 GotoXY(exofs+152, eyofs+166);
\r
2993 sprintf(strbuf, "%d/%d", i, entities-1); printstring(strbuf);
\r
2994 entity[i].movecode=atoi(nstr6);
\r
2995 if (ctf!=4) entity[i].chrindex=atoi(nstr3);
\r
2997 switch (entity[i].movecode)
\r
2999 case 0: GotoXY(exofs+131, eyofs+104); printstring("Stopped"); break;
\r
3000 case 1: GotoXY(exofs+131, eyofs+104); printstring("Wander");
\r
3001 GotoXY(exofs+11, eyofs+116); printstring("Step:");
\r
3002 GotoXY(exofs+90, eyofs+116); printstring("Delay:"); break;
\r
3003 case 2: GotoXY(exofs+131, eyofs+104); printstring("Wander Zone");
\r
3004 GotoXY(exofs+11, eyofs+116); printstring("Step:");
\r
3005 GotoXY(exofs+90, eyofs+116); printstring("Delay:");
\r
3006 GotoXY(exofs+10, eyofs+126); printstring("Zone:"); break;
\r
3007 case 3: GotoXY(exofs+131, eyofs+104); printstring("Wander Box");
\r
3008 GotoXY(exofs+11, eyofs+116); printstring("Step:");
\r
3009 GotoXY(exofs+90, eyofs+116); printstring("Delay:");
\r
3010 GotoXY(exofs+21, eyofs+126); printstring("X1:");
\r
3011 GotoXY(exofs+21, eyofs+136); printstring("Y1:");
\r
3012 GotoXY(exofs+102, eyofs+126); printstring("X2:");
\r
3013 GotoXY(exofs+102, eyofs+136); printstring("Y2:"); break;
\r
3014 case 4: GotoXY(exofs+131, eyofs+104); printstring("Scripted"); break;
\r
3016 switch (entity[i].actm)
\r
3018 case 0: GotoXY(exofs+72, eyofs+88); printstring("Actv"); break;
\r
3019 case 1: GotoXY(exofs+72, eyofs+88); printstring("Adjc"); break;
\r
3022 if (chrs[entity[i].chrindex].frame)
\r
3023 TCopySprite(exofs+143-(chrs[entity[i].chrindex].fx/2),
\r
3024 eyofs+31-(chrs[entity[i].chrindex].fy/2),
\r
3025 chrs[entity[i].chrindex].fx, chrs[entity[i].chrindex].fy,
\r
3026 chrs[entity[i].chrindex].frame);
\r
3030 CheckTimerStuff();
\r
3033 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+11 && my<eyofs+9+11 && !moving)
\r
3035 ctf=1; str=entity[i].desc; cb=1;
\r
3036 cursorblink=systemtime+40; continue;
\r
3039 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+21 && my<eyofs+9+21 && !moving)
\r
3041 ctf=2; str=nstr1; cb=1;
\r
3042 cursorblink=systemtime+40; continue;
\r
3045 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+31 && my<eyofs+9+31 && !moving)
\r
3047 ctf=3; str=nstr2; cb=1;
\r
3048 cursorblink=systemtime+40; continue;
\r
3051 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+41 && my<eyofs+9+41 && !moving)
\r
3053 ctf=4; str=nstr3; cb=1;
\r
3054 cursorblink=systemtime+40; continue;
\r
3057 if (mb==1 && mx>exofs+116 && mx<exofs+50+116 && my>eyofs+61 && my<eyofs+10+61 && !moving)
\r
3059 // insert code for button "CHR List" here
\r
3060 BigButtonPressed(exofs+116, eyofs+61, "CHR List");
\r
3070 WaitRelease(); continue;
\r
3073 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+51 && my<eyofs+9+51 && !moving)
\r
3075 ctf=5; str=nstr4; cb=1;
\r
3076 cursorblink=systemtime+40; continue;
\r
3079 if (mb==1 && mx>exofs+26 && mx<exofs+80+26 && my>eyofs+61 && my<eyofs+9+61 && !moving)
\r
3081 ctf=6; str=nstr5; cb=1;
\r
3082 cursorblink=systemtime+40; continue;
\r
3085 if (mb==1 && mx>exofs+115 && mx<exofs+50+115 && my>eyofs+153 && my<eyofs+10+153 && !moving)
\r
3087 // insert code for button "Scripts..." here
\r
3088 BigButtonPressed(exofs+115, eyofs+153, "Scripts");
\r
3096 MoveScriptDialog();
\r
3097 WaitRelease(); continue;
\r
3100 if (mb==1 && mx>exofs+161 && mx<exofs+8+161 && my>eyofs+87 && my<eyofs+7+87 && !moving)
\r
3102 entity[i].obsmode1 ^= 1; WaitRelease(); continue;
\r
3105 if (mb==1 && mx>exofs+161 && mx<exofs+8+161 && my>eyofs+78 && my<eyofs+7+78 && !moving)
\r
3107 entity[i].obsmode2 ^= 1; WaitRelease(); continue;
\r
3110 if (mb==1 && mx>exofs+61 && mx<exofs+8+61 && my>eyofs+78 && my<eyofs+7+78 && !moving)
\r
3112 entity[i].face ^= 1; WaitRelease(); continue;
\r
3115 if (mb==1 && mx>exofs+61 && mx<exofs+8+61 && my>eyofs+87 && my<eyofs+7+87 && !moving)
\r
3117 entity[i].actm ^= 1; WaitRelease(); continue;
\r
3120 if (mb==1 && mx>exofs+47 && mx<exofs+80+47 && my>eyofs+103 && my<eyofs+9+103 && !moving)
\r
3122 ctf=7; str=nstr6; cb=1;
\r
3123 cursorblink=systemtime+40; continue;
\r
3126 if (mb==1 && mx>exofs+30 && mx<exofs+40+30 && my>eyofs+115 && my<eyofs+9+115 && !moving)
\r
3128 ctf=8; str=nstr7; cb=1;
\r
3129 cursorblink=systemtime+40; continue;
\r
3132 if (mb==1 && mx>exofs+30 && mx<exofs+40+30 && my>eyofs+125 && my<eyofs+9+125 && !moving)
\r
3134 ctf=9; str=nstr8; cb=1;
\r
3135 cursorblink=systemtime+40; continue;
\r
3138 if (mb==1 && mx>exofs+30 && mx<exofs+40+30 && my>eyofs+135 && my<eyofs+9+135 && !moving)
\r
3140 ctf=10; str=nstr9; cb=1;
\r
3141 cursorblink=systemtime+40; continue;
\r
3144 if (mb==1 && mx>exofs+113 && mx<exofs+40+113 && my>eyofs+115 && my<eyofs+9+115 && !moving)
\r
3146 ctf=11; str=nstr10; cb=1;
\r
3147 cursorblink=systemtime+40; continue;
\r
3150 if (mb==1 && mx>exofs+113 && mx<exofs+40+113 && my>eyofs+125 && my<eyofs+9+125 && !moving)
\r
3152 ctf=12; str=nstr11; cb=1;
\r
3153 cursorblink=systemtime+40; continue;
\r
3156 if (mb==1 && mx>exofs+113 && mx<exofs+40+113 && my>eyofs+135 && my<eyofs+9+135 && !moving)
\r
3158 ctf=13; str=nstr12; cb=1;
\r
3159 cursorblink=systemtime+40; continue;
\r
3162 if (mb==1 && mx>exofs+46 && mx<exofs+60+46 && my>eyofs+153 && my<eyofs+9+153 && !moving)
\r
3164 ctf=14; str=nstr13; cb=1;
\r
3165 cursorblink=systemtime+40; continue;
\r
3168 if (mb==1 && mx>(exofs+exsize-9) && (mx<exofs+exsize-2)
\r
3169 && my>(eyofs+1) && (my<eyofs+8) && !moving)
\r
3176 if (mb==1 && mx>exofs && mx<exofs+exsize && my>eyofs && my<(eyofs+9) && !moving)
\r
3184 if (mb==1 && !moving)
\r
3194 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
3195 else c=key_ascii_tbl[last_pressed];
\r
3197 if (last_pressed==SCAN_ESC)
\r
3204 if (last_pressed==SCAN_UP)
\r
3206 entity[i].x=atoi(nstr1);
\r
3207 entity[i].y=atoi(nstr2);
\r
3208 entity[i].chrindex=atoi(nstr3);
\r
3209 entity[i].speed=atoi(nstr4);
\r
3210 entity[i].actscript=atoi(nstr5);
\r
3211 entity[i].movecode=atoi(nstr6);
\r
3212 entity[i].step=atoi(nstr7);
\r
3213 entity[i].data2=atoi(nstr8);
\r
3214 entity[i].data3=atoi(nstr9);
\r
3215 entity[i].delay=atoi(nstr10);
\r
3216 entity[i].data5=atoi(nstr11);
\r
3217 entity[i].data6=atoi(nstr12);
\r
3218 entity[i].movescript=atoi(nstr13);
\r
3220 if (i<entities-1) i++; else i=0;
\r
3221 last_pressed=0; key[SCAN_UP]=0;
\r
3223 sprintf(nstr1, "%d", entity[i].x);
\r
3224 sprintf(nstr2, "%d", entity[i].y);
\r
3225 sprintf(nstr3, "%d", entity[i].chrindex);
\r
3226 sprintf(nstr4, "%d", entity[i].speed);
\r
3227 sprintf(nstr5, "%d", entity[i].actscript);
\r
3228 sprintf(nstr6, "%d", entity[i].movecode);
\r
3229 sprintf(nstr7, "%d", entity[i].step);
\r
3230 sprintf(nstr8, "%d", entity[i].data2);
\r
3231 sprintf(nstr9, "%d", entity[i].data3);
\r
3232 sprintf(nstr10, "%d", entity[i].delay);
\r
3233 sprintf(nstr11, "%d", entity[i].data5);
\r
3234 sprintf(nstr12, "%d", entity[i].data6);
\r
3235 sprintf(nstr13, "%d", entity[i].movescript);
\r
3238 if (last_pressed==SCAN_DOWN)
\r
3240 entity[i].x=atoi(nstr1);
\r
3241 entity[i].y=atoi(nstr2);
\r
3242 entity[i].chrindex=atoi(nstr3);
\r
3243 entity[i].speed=atoi(nstr4);
\r
3244 entity[i].actscript=atoi(nstr5);
\r
3245 entity[i].movecode=atoi(nstr6);
\r
3246 entity[i].step=atoi(nstr7);
\r
3247 entity[i].data2=atoi(nstr8);
\r
3248 entity[i].data3=atoi(nstr9);
\r
3249 entity[i].delay=atoi(nstr10);
\r
3250 entity[i].data5=atoi(nstr11);
\r
3251 entity[i].data6=atoi(nstr12);
\r
3252 entity[i].movescript=atoi(nstr13);
\r
3254 if (i) i--; else i=entities-1;
\r
3255 last_pressed=0; key[SCAN_DOWN]=0;
\r
3257 sprintf(nstr1, "%d", entity[i].x);
\r
3258 sprintf(nstr2, "%d", entity[i].y);
\r
3259 sprintf(nstr3, "%d", entity[i].chrindex);
\r
3260 sprintf(nstr4, "%d", entity[i].speed);
\r
3261 sprintf(nstr5, "%d", entity[i].actscript);
\r
3262 sprintf(nstr6, "%d", entity[i].movecode);
\r
3263 sprintf(nstr7, "%d", entity[i].step);
\r
3264 sprintf(nstr8, "%d", entity[i].data2);
\r
3265 sprintf(nstr9, "%d", entity[i].data3);
\r
3266 sprintf(nstr10, "%d", entity[i].delay);
\r
3267 sprintf(nstr11, "%d", entity[i].data5);
\r
3268 sprintf(nstr12, "%d", entity[i].data6);
\r
3269 sprintf(nstr13, "%d", entity[i].movescript);
\r
3273 if (last_pressed==SCAN_ENTER)
\r
3275 key[SCAN_ENTER]=0;
\r
3282 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
3286 case 0: ctf=1; str=entity[i].desc; break;
\r
3287 case 1: ctf=2; str=nstr1; break;
\r
3288 case 2: ctf=3; str=nstr2; break;
\r
3289 case 3: ctf=4; str=nstr3; break;
\r
3290 case 4: ctf=5; str=nstr4; break;
\r
3291 case 5: ctf=6; str=nstr5; break;
\r
3292 case 6: ctf=7; str=nstr6; break;
\r
3293 case 7: ctf=8; str=nstr7; break;
\r
3294 case 8: ctf=9; str=nstr8; break;
\r
3295 case 9: ctf=10; str=nstr9; break;
\r
3296 case 10: ctf=11; str=nstr10; break;
\r
3297 case 11: ctf=12; str=nstr11; break;
\r
3298 case 12: ctf=13; str=nstr12; break;
\r
3299 case 13: ctf=14; str=nstr13; break;
\r
3300 case 14: ctf=0; str=0; break;
\r
3304 cb=1; cursorblink=systemtime+40;
\r
3308 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
3312 case 0: ctf=13; str=nstr12; break;
\r
3313 case 1: ctf=0; str=0; break;
\r
3314 case 2: ctf=1; str=entity[i].desc; break;
\r
3315 case 3: ctf=2; str=nstr1; break;
\r
3316 case 4: ctf=3; str=nstr2; break;
\r
3317 case 5: ctf=4; str=nstr3; break;
\r
3318 case 6: ctf=5; str=nstr4; break;
\r
3319 case 7: ctf=6; str=nstr5; break;
\r
3320 case 8: ctf=7; str=nstr6; break;
\r
3321 case 9: ctf=8; str=nstr7; break;
\r
3322 case 10: ctf=9; str=nstr8; break;
\r
3323 case 11: ctf=10; str=nstr9; break;
\r
3324 case 12: ctf=11; str=nstr10; break;
\r
3325 case 13: ctf=12; str=nstr11; break;
\r
3329 cb=1; cursorblink=systemtime+40;
\r
3336 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
3338 str[strlen(str)-1]=0;
\r
3339 key[SCAN_BACKSP]=0;
\r
3343 else if (last_pressed==SCAN_BACKSP)
\r
3355 entity[i].x=atoi(nstr1);
\r
3356 entity[i].y=atoi(nstr2);
\r
3357 entity[i].chrindex=atoi(nstr3);
\r
3358 entity[i].speed=atoi(nstr4);
\r
3359 entity[i].actscript=atoi(nstr5);
\r
3360 entity[i].movecode=atoi(nstr6);
\r
3361 entity[i].step=atoi(nstr7);
\r
3362 entity[i].data2=atoi(nstr8);
\r
3363 entity[i].data3=atoi(nstr9);
\r
3364 entity[i].delay=atoi(nstr10);
\r
3365 entity[i].data5=atoi(nstr11);
\r
3366 entity[i].data6=atoi(nstr12);
\r
3367 entity[i].movescript=atoi(nstr13);
\r
3370 int clxsize=170, clysize=78;
\r
3371 int clxofs=105, clyofs=80;
\r
3375 { char done=0, moving=0;
\r
3376 int mxo, myo, cursorblink;
\r
3377 char ctf=0, cb=0, c, t, *str;
\r
3385 if (ctf && systemtime >= cursorblink)
\r
3388 cursorblink = systemtime+40;
\r
3392 clxofs = (mx-mxo);
\r
3393 clyofs = (my-myo);
\r
3394 if (!mb) moving=0;
\r
3395 if (clxofs<16) clxofs = 16;
\r
3396 if (clyofs<16) clyofs = 16;
\r
3397 if (clxofs+clxsize>335) clxofs = 336-clxsize;
\r
3398 if (clyofs+clysize>sy+16) clyofs = (sy+16)-clysize;
\r
3401 Window(clxofs, clyofs, clxofs+clxsize, clyofs+clysize, "Entity CHR Reference Index");
\r
3402 TextField(clxofs+14, clyofs+11, 120, chrlist[base].t, ctf == 1 ? cb : 0);
\r
3403 TextField(clxofs+14, clyofs+22, 120, chrlist[base+1].t, ctf == 2 ? cb : 0);
\r
3404 TextField(clxofs+14, clyofs+33, 120, chrlist[base+2].t, ctf == 3 ? cb : 0);
\r
3405 TextField(clxofs+14, clyofs+44, 120, chrlist[base+3].t, ctf == 4 ? cb : 0);
\r
3406 TextField(clxofs+14, clyofs+55, 120, chrlist[base+4].t, ctf == 5 ? cb : 0);
\r
3407 Button(clxofs+137, clyofs+65, "OK");
\r
3408 Button(clxofs+137, clyofs+10, "Browse");
\r
3409 Button(clxofs+137, clyofs+21, "Browse");
\r
3410 Button(clxofs+137, clyofs+32, "Browse");
\r
3411 Button(clxofs+137, clyofs+43, "Browse");
\r
3412 Button(clxofs+137, clyofs+54, "Browse");
\r
3413 GotoXY(clxofs+3, clyofs+11); sprintf(strbuf,"%d:", base); printstring(strbuf);
\r
3414 GotoXY(clxofs+3, clyofs+22); sprintf(strbuf,"%d:", base+1); printstring(strbuf);
\r
3415 GotoXY(clxofs+3, clyofs+33); sprintf(strbuf,"%d:", base+2); printstring(strbuf);
\r
3416 GotoXY(clxofs+3, clyofs+44); sprintf(strbuf,"%d:", base+3); printstring(strbuf);
\r
3417 GotoXY(clxofs+3, clyofs+55); sprintf(strbuf,"%d:", base+4); printstring(strbuf);
\r
3421 CheckTimerStuff();
\r
3424 if (mb==1 && mx>clxofs+14 && mx<clxofs+120+14 && my>clyofs+11 && my<clyofs+9+11 && !moving)
\r
3426 ctf=1; str=chrlist[base].t; cb=1;
\r
3427 cursorblink=systemtime+40; continue;
\r
3430 if (mb==1 && mx>clxofs+14 && mx<clxofs+120+14 && my>clyofs+22 && my<clyofs+9+22 && !moving)
\r
3432 ctf=2; str=chrlist[base+1].t; cb=1;
\r
3433 cursorblink=systemtime+40; continue;
\r
3436 if (mb==1 && mx>clxofs+14 && mx<clxofs+120+14 && my>clyofs+33 && my<clyofs+9+33 && !moving)
\r
3438 ctf=3; str=chrlist[base+2].t; cb=1;
\r
3439 cursorblink=systemtime+40; continue;
\r
3442 if (mb==1 && mx>clxofs+14 && mx<clxofs+120+14 && my>clyofs+44 && my<clyofs+9+44 && !moving)
\r
3444 ctf=4; str=chrlist[base+3].t; cb=1;
\r
3445 cursorblink=systemtime+40; continue;
\r
3448 if (mb==1 && mx>clxofs+14 && mx<clxofs+120+14 && my>clyofs+55 && my<clyofs+9+55 && !moving)
\r
3450 ctf=5; str=chrlist[base+4].t; cb=1;
\r
3451 cursorblink=systemtime+40; continue;
\r
3454 if ((mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+65 && my<clyofs+10+65 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
3456 // insert code for button "OK" here
\r
3458 ButtonPressed(clxofs+137, clyofs+65, "OK");
\r
3466 WaitRelease(); continue;
\r
3469 if (mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+10 && my<clyofs+10+10 && !moving)
\r
3471 // insert code for button "Browse" here
\r
3472 ButtonPressed(clxofs+137, clyofs+10, "Browse");
\r
3480 Browse(1,"*.chr","","","",chrlist[base].t);
\r
3481 WaitRelease(); continue;
\r
3484 if (mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+21 && my<clyofs+10+21 && !moving)
\r
3486 // insert code for button "Browse" here
\r
3487 ButtonPressed(clxofs+137, clyofs+21, "Browse");
\r
3495 Browse(1,"*.chr","","","",chrlist[base+1].t);
\r
3496 WaitRelease(); continue;
\r
3499 if (mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+32 && my<clyofs+10+32 && !moving)
\r
3501 // insert code for button "Browse" here
\r
3502 ButtonPressed(clxofs+137, clyofs+32, "Browse");
\r
3510 Browse(1,"*.chr","","","",chrlist[base+2].t);
\r
3511 WaitRelease(); continue;
\r
3514 if (mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+43 && my<clyofs+10+43 && !moving)
\r
3516 // insert code for button "Browse" here
\r
3517 ButtonPressed(clxofs+137, clyofs+43, "Browse");
\r
3525 Browse(1,"*.chr","","","",chrlist[base+3].t);
\r
3526 WaitRelease(); continue;
\r
3529 if (mb==1 && mx>clxofs+137 && mx<clxofs+30+137 && my>clyofs+54 && my<clyofs+10+54 && !moving)
\r
3531 // insert code for button "Browse" here
\r
3532 ButtonPressed(clxofs+137, clyofs+54, "Browse");
\r
3540 Browse(1,"*.chr","","","",chrlist[base+4].t);
\r
3541 WaitRelease(); continue;
\r
3544 if (mb==1 && mx>(clxofs+clxsize-9) && (mx<clxofs+clxsize-2)
\r
3545 && my>(clyofs+1) && (my<clyofs+8) && !moving)
\r
3552 if (mb==1 && mx>clxofs && mx<clxofs+clxsize && my>clyofs && my<(clyofs+9) && !moving)
\r
3560 if (mb==1 && !moving)
\r
3570 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
3571 else c=key_ascii_tbl[last_pressed];
\r
3573 if (last_pressed==SCAN_ESC)
\r
3586 if (key[SCAN_DOWN])
\r
3589 if (base<95) base++;
\r
3593 if (last_pressed==SCAN_ENTER)
\r
3595 key[SCAN_ENTER]=0;
\r
3602 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
3606 case 0: ctf=1; str=chrlist[base].t; break;
\r
3607 case 1: ctf=2; str=chrlist[base+1].t; break;
\r
3608 case 2: ctf=3; str=chrlist[base+2].t; break;
\r
3609 case 3: ctf=4; str=chrlist[base+3].t; break;
\r
3610 case 4: ctf=5; str=chrlist[base+4].t; break;
\r
3611 case 5: ctf=0; str=0; break;
\r
3615 cb=1; cursorblink=systemtime+40;
\r
3619 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
3623 case 0: ctf=5; str=chrlist[base].t; break;
\r
3624 case 1: ctf=0; str=chrlist[base].t; break;
\r
3625 case 2: ctf=1; str=chrlist[base+1].t; break;
\r
3626 case 3: ctf=2; str=chrlist[base+2].t; break;
\r
3627 case 4: ctf=3; str=chrlist[base+3].t; break;
\r
3628 case 5: ctf=4; str=chrlist[base+4].t; break;
\r
3632 cb=1; cursorblink=systemtime+40;
\r
3639 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
3641 str[strlen(str)-1]=0;
\r
3642 key[SCAN_BACKSP]=0;
\r
3646 else if (last_pressed==SCAN_BACKSP)
\r
3660 int msxsize=181, msysize=77;
\r
3661 int msxofs=70, msyofs=50;
\r
3664 void MoveScriptDialog()
\r
3665 { char done=0, moving=0;
\r
3666 int mxo, myo, cursorblink;
\r
3667 char ctf=0, cb=0, c, t, *str;
\r
3675 if (ctf && systemtime >= cursorblink)
\r
3678 cursorblink = systemtime+40;
\r
3682 msxofs = (mx-mxo);
\r
3683 msyofs = (my-myo);
\r
3684 if (!mb) moving=0;
\r
3685 if (msxofs<16) msxofs = 16;
\r
3686 if (msyofs<16) msyofs = 16;
\r
3687 if (msxofs+msxsize>335) msxofs = 336-msxsize;
\r
3688 if (msyofs+msysize>sy+16) msyofs = (sy+16)-msysize;
\r
3691 Window(msxofs, msyofs, msxofs+msxsize, msyofs+msysize, "Movement Script Editor");
\r
3692 TextField(msxofs+15, msyofs+12, 160, ms[base1].t, ctf == 1 ? cb : 0);
\r
3693 TextField(msxofs+15, msyofs+22, 160, ms[base1+1].t, ctf == 2 ? cb : 0);
\r
3694 TextField(msxofs+15, msyofs+32, 160, ms[base1+2].t, ctf == 3 ? cb : 0);
\r
3695 TextField(msxofs+15, msyofs+42, 160, ms[base1+3].t, ctf == 4 ? cb : 0);
\r
3696 TextField(msxofs+15, msyofs+52, 160, ms[base1+4].t, ctf == 5 ? cb : 0);
\r
3697 Button(msxofs+146, msyofs+63, "OK");
\r
3698 GotoXY(msxofs+3, msyofs+11); sprintf(strbuf,"%d:", base1); printstring(strbuf);
\r
3699 GotoXY(msxofs+3, msyofs+22); sprintf(strbuf,"%d:", base1+1); printstring(strbuf);
\r
3700 GotoXY(msxofs+3, msyofs+33); sprintf(strbuf,"%d:", base1+2); printstring(strbuf);
\r
3701 GotoXY(msxofs+3, msyofs+44); sprintf(strbuf,"%d:", base1+3); printstring(strbuf);
\r
3702 GotoXY(msxofs+3, msyofs+55); sprintf(strbuf,"%d:", base1+4); printstring(strbuf);
\r
3706 CheckTimerStuff();
\r
3709 if (mb==1 && mx>msxofs+15 && mx<msxofs+160+15 && my>msyofs+12 && my<msyofs+10+12 && !moving)
\r
3711 ctf=1; str=ms[base1].t; cb=1;
\r
3712 cursorblink=systemtime+40; continue;
\r
3715 if (mb==1 && mx>msxofs+15 && mx<msxofs+160+15 && my>msyofs+22 && my<msyofs+9+22 && !moving)
\r
3717 ctf=2; str=ms[base1+1].t; cb=1;
\r
3718 cursorblink=systemtime+40; continue;
\r
3721 if (mb==1 && mx>msxofs+15 && mx<msxofs+160+15 && my>msyofs+32 && my<msyofs+9+32 && !moving)
\r
3723 ctf=3; str=ms[base1+2].t; cb=1;
\r
3724 cursorblink=systemtime+40; continue;
\r
3727 if (mb==1 && mx>msxofs+15 && mx<msxofs+160+15 && my>msyofs+42 && my<msyofs+9+42 && !moving)
\r
3729 ctf=4; str=ms[base1+3].t; cb=1;
\r
3730 cursorblink=systemtime+40; continue;
\r
3733 if (mb==1 && mx>msxofs+15 && mx<msxofs+160+15 && my>msyofs+52 && my<msyofs+9+52 && !moving)
\r
3735 ctf=5; str=ms[base1+4].t; cb=1;
\r
3736 cursorblink=systemtime+40; continue;
\r
3739 if ((mb==1 && mx>msxofs+146 && mx<msxofs+30+146 && my>msyofs+63 && my<msyofs+10+63 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
3741 // insert code for button "OK" here
\r
3743 ButtonPressed(msxofs+146, msyofs+63, "OK");
\r
3751 WaitRelease(); continue;
\r
3754 if (mb==1 && mx>(msxofs+msxsize-9) && (mx<msxofs+msxsize-2)
\r
3755 && my>(msyofs+1) && (my<msyofs+8) && !moving)
\r
3762 if (mb==1 && mx>msxofs && mx<msxofs+msxsize && my>msyofs && my<(msyofs+9) && !moving)
\r
3770 if (mb==1 && !moving)
\r
3780 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
3781 else c=key_ascii_tbl[last_pressed];
\r
3783 if (last_pressed==SCAN_ESC)
\r
3792 if (base1) base1--;
\r
3796 if (key[SCAN_DOWN])
\r
3799 if (base1<95) base1++;
\r
3804 if (last_pressed==SCAN_ENTER)
\r
3806 key[SCAN_ENTER]=0;
\r
3813 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
3817 case 0: ctf=1; str=ms[base1].t; break;
\r
3818 case 1: ctf=2; str=ms[base1+1].t; break;
\r
3819 case 2: ctf=3; str=ms[base1+2].t; break;
\r
3820 case 3: ctf=4; str=ms[base1+3].t; break;
\r
3821 case 4: ctf=5; str=ms[base1+4].t; break;
\r
3822 case 5: ctf=0; str=0; break;
\r
3826 cb=1; cursorblink=systemtime+40;
\r
3830 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
3834 case 0: ctf=5; str=ms[base1+4].t; break;
\r
3835 case 1: ctf=0; str=0; break;
\r
3836 case 2: ctf=1; str=ms[base1].t; break;
\r
3837 case 3: ctf=2; str=ms[base1+1].t; break;
\r
3838 case 4: ctf=3; str=ms[base1+2].t; break;
\r
3839 case 5: ctf=4; str=ms[base1+3].t; break;
\r
3843 cb=1; cursorblink=systemtime+40;
\r
3850 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
3852 str[strlen(str)-1]=0;
\r
3853 key[SCAN_BACKSP]=0;
\r
3857 else if (last_pressed==SCAN_BACKSP)
\r
3871 int prxsize=150, prysize=80;
\r
3872 int prxofs=50, pryofs=60;
\r
3874 void MapPropertiesDialog()
\r
3875 { char done=0, moving=0;
\r
3876 int mxo, myo, cursorblink;
\r
3877 char ctf=0, cb=0, c, t, *str;
\r
3885 if (ctf && systemtime >= cursorblink)
\r
3888 cursorblink = systemtime+40;
\r
3892 prxofs = (mx-mxo);
\r
3893 pryofs = (my-myo);
\r
3894 if (!mb) moving=0;
\r
3895 if (prxofs<16) prxofs = 16;
\r
3896 if (pryofs<16) pryofs = 16;
\r
3897 if (prxofs+prxsize>335) prxofs = 336-prxsize;
\r
3898 if (pryofs+prysize>sy+16) pryofs = (sy+16)-prysize;
\r
3901 Window(prxofs, pryofs, prxofs+prxsize, pryofs+prysize, "MAP Properties");
\r
3902 GotoXY(prxofs+10, pryofs+23); printstring("Music:");
\r
3903 TextField(prxofs+33, pryofs+11, 112, mapname, ctf == 1 ? cb : 0);
\r
3904 TextField(prxofs+33, pryofs+21, 112, musname, ctf == 2 ? cb : 0);
\r
3905 GotoXY(prxofs+18, pryofs+33); printstring("VSP:");
\r
3906 TextField(prxofs+33, pryofs+31, 112, vspname, ctf == 3 ? cb : 0);
\r
3907 GotoXY(prxofs+3, pryofs+43); printstring("rstring:");
\r
3908 TextField(prxofs+33, pryofs+41, 112, rstring, ctf == 4 ? cb : 0);
\r
3909 BigButton(prxofs+97, pryofs+56, "Resize MAP");
\r
3910 HLine(prxofs+1, pryofs+53, 148, white);
\r
3911 GotoXY(prxofs+3, pryofs+58); printstring("xsize:");
\r
3912 sprintf(strbuf,"%d",layer[0].sizex); printstring(strbuf);
\r
3913 GotoXY(prxofs+49, pryofs+58); printstring("ysize:");
\r
3914 sprintf(strbuf,"%d",layer[0].sizey); printstring(strbuf);
\r
3915 Button(prxofs+117, pryofs+67, "OK");
\r
3916 GotoXY(prxofs+16, pryofs+13); printstring("MAP:");
\r
3920 CheckTimerStuff();
\r
3923 if (mb==1 && mx>prxofs+33 && mx<prxofs+112+33 && my>pryofs+11 && my<pryofs+9+11 && !moving)
\r
3925 ctf=1; str=mapname; cb=1;
\r
3926 cursorblink=systemtime+40; continue;
\r
3929 if (mb==1 && mx>prxofs+33 && mx<prxofs+112+33 && my>pryofs+21 && my<pryofs+9+21 && !moving)
\r
3931 ctf=2; str=musname; cb=1;
\r
3932 cursorblink=systemtime+40; continue;
\r
3935 if (mb==1 && mx>prxofs+33 && mx<prxofs+112+33 && my>pryofs+31 && my<pryofs+9+31 && !moving)
\r
3937 ctf=3; str=vspname; cb=1;
\r
3938 cursorblink=systemtime+40; continue;
\r
3941 if (mb==1 && mx>prxofs+33 && mx<prxofs+112+33 && my>pryofs+41 && my<pryofs+9+41 && !moving)
\r
3943 ctf=4; str=rstring; cb=1;
\r
3944 cursorblink=systemtime+40; continue;
\r
3947 if (mb==1 && mx>prxofs+97 && mx<prxofs+30+97 && my>pryofs+56 && my<pryofs+10+56 && !moving)
\r
3949 // insert code for button "Resize MAP" here
\r
3950 BigButtonPressed(prxofs+97, pryofs+56, "Resize MAP");
\r
3959 ResizeMapDialog();
\r
3960 WaitRelease(); continue;
\r
3963 if ((mb==1 && mx>prxofs+117 && mx<prxofs+30+117 && my>pryofs+67 && my<pryofs+10+67 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
3965 // insert code for button "OK" here
\r
3966 ButtonPressed(prxofs+117, pryofs+67, "OK");
\r
3975 WaitRelease(); continue;
\r
3978 if (mb==1 && mx>(prxofs+prxsize-9) && (mx<prxofs+prxsize-2)
\r
3979 && my>(pryofs+1) && (my<pryofs+8) && !moving)
\r
3986 if (mb==1 && mx>prxofs && mx<prxofs+prxsize && my>pryofs && my<(pryofs+9) && !moving)
\r
3994 if (mb==1 && !moving)
\r
4004 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
4005 else c=key_ascii_tbl[last_pressed];
\r
4007 if (last_pressed==SCAN_ESC)
\r
4014 if (last_pressed==SCAN_ENTER)
\r
4016 key[SCAN_ENTER]=0;
\r
4023 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
4027 case 0: ctf=1; str=mapname; break;
\r
4028 case 1: ctf=2; str=musname; break;
\r
4029 case 2: ctf=3; str=vspname; break;
\r
4030 case 3: ctf=4; str=rstring; break;
\r
4031 case 4: ctf=0; str=0; break;
\r
4035 cb=1; cursorblink=systemtime+40;
\r
4039 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
4043 case 0: ctf=4; str=rstring; break;
\r
4044 case 1: ctf=0; str=0; break;
\r
4045 case 2: ctf=1; str=mapname; break;
\r
4046 case 3: ctf=2; str=musname; break;
\r
4047 case 4: ctf=3; str=vspname; break;
\r
4051 cb=1; cursorblink=systemtime+40;
\r
4058 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
4060 str[strlen(str)-1]=0;
\r
4061 key[SCAN_BACKSP]=0;
\r
4065 else if (last_pressed==SCAN_BACKSP)
\r
4081 int rsxsize=134, rsysize=44;
\r
4082 int rsxofs=20, rsyofs=20;
\r
4084 static void PutByte(byte *to, byte v, int x, int y, int w, int h)
\r
4086 if (x<0 || x>=w || y<0 || y>=h)
\r
4092 static byte GetByte(byte *from, int x, int y, int w, int h)
\r
4094 if (x<0 || x>=w || y<0 || y>=h)
\r
4097 return from[(y*w)+x];
\r
4100 static void PutWord(word *to, word v, int x, int y, int w, int h)
\r
4102 if (x<0 || x>=w || y<0 || y>=h)
\r
4108 static word GetWord(word *from, int x, int y, int w, int h)
\r
4110 if (x<0 || x>=w || y<0 || y>=h)
\r
4113 return from[(y*w)+x];
\r
4116 void ResizeMapDialog()
\r
4117 { char done=0, moving=0;
\r
4118 int mxo, myo, cursorblink, basex, basey, i; //, xl, yl;
\r
4119 char ctf=0, cb=0, c, t;
\r
4120 char *str, *tb; //, *s1, *d1;
\r
4121 char nstr1[80], nstr2[80];
\r
4122 word *tbw; //, *s=NULL,*d=NULL;
\r
4126 basex=layer[0].sizex;
\r
4127 basey=layer[0].sizey;
\r
4128 sprintf(nstr1, "%d", basex);
\r
4129 sprintf(nstr2, "%d", basey);
\r
4136 if (ctf && systemtime >= cursorblink)
\r
4139 cursorblink = systemtime+40;
\r
4143 rsxofs = (mx-mxo);
\r
4144 rsyofs = (my-myo);
\r
4145 if (!mb) moving=0;
\r
4146 if (rsxofs<16) rsxofs = 16;
\r
4147 if (rsyofs<16) rsyofs = 16;
\r
4148 if (rsxofs+rsxsize>335) rsxofs = 336-rsxsize;
\r
4149 if (rsyofs+rsysize>sy+16) rsyofs = (sy+16)-rsysize;
\r
4152 Window(rsxofs, rsyofs, rsxofs+rsxsize, rsyofs+rsysize, "Resize MAP");
\r
4153 GotoXY(rsxofs+4, rsyofs+12); printstring("Base X:");
\r
4154 GotoXY(rsxofs+4, rsyofs+22); printstring("Base Y:");
\r
4155 TextField(rsxofs+30, rsyofs+10, 100, nstr1, ctf == 1 ? cb : 0);
\r
4156 TextField(rsxofs+30, rsyofs+20, 100, nstr2, ctf == 2 ? cb : 0);
\r
4157 Button(rsxofs+69, rsyofs+31, "Resize");
\r
4158 Button(rsxofs+101, rsyofs+31, "Cancel");
\r
4162 CheckTimerStuff();
\r
4165 if (mb==1 && mx>rsxofs+30 && mx<rsxofs+100+30 && my>rsyofs+10 && my<rsyofs+9+10 && !moving)
\r
4167 ctf=1; str=nstr1; cb=1;
\r
4168 cursorblink=systemtime+40; continue;
\r
4171 if (mb==1 && mx>rsxofs+30 && mx<rsxofs+100+30 && my>rsyofs+20 && my<rsyofs+9+20 && !moving)
\r
4173 ctf=2; str=nstr2; cb=1;
\r
4174 cursorblink=systemtime+40; continue;
\r
4177 if (mb==1 && mx>rsxofs+69 && mx<rsxofs+30+69 && my>rsyofs+31 && my<rsyofs+10+31 && !moving)
\r
4181 // insert code for button "Resize" here
\r
4182 ButtonPressed(rsxofs+69, rsyofs+31, "Resize");
\r
4191 basex=atoi(nstr1);
\r
4192 basey=atoi(nstr2);
\r
4194 tb = (char *)valloc(basex*basey,"tilebuf",0);
\r
4195 for (b=0; b<basey; ++b)
\r
4196 for (a=0; a<basex; ++a)
\r
4198 GetByte(obstruct,a,b,layer[0].sizex,layer[0].sizey),
\r
4203 tb = (char *)valloc(basex*basey,"tilebuf",0);
\r
4204 for (b=0; b<basey; ++b)
\r
4205 for (a=0; a<basex; ++a)
\r
4207 GetByte(zone,a,b,layer[0].sizex,layer[0].sizey),
\r
4212 for (i=0; i<numlayers; i++)
\r
4214 tbw=(word *)valloc(basex*basey*2,"tilebuf",0);
\r
4215 //memset(tbw, 0, basex*basey*2);
\r
4216 for (b=0; b<basey; ++b)
\r
4217 for (a=0; a<basex; ++a)
\r
4219 GetWord(layers[i],a,b,layer[i].sizex,layer[i].sizey),
\r
4225 for (i=0; i<numlayers; ++i)
\r
4227 layer[i].sizex=basex;
\r
4228 layer[i].sizey=basey;
\r
4231 WaitRelease(); continue;
\r
4234 if (mb==1 && mx>rsxofs+101 && mx<rsxofs+30+101 && my>rsyofs+31 && my<rsyofs+10+31 && !moving)
\r
4236 // insert code for button "Cancel" here
\r
4238 ButtonPressed(rsxofs+101, rsyofs+31, "Cancel");
\r
4246 WaitRelease(); continue;
\r
4249 if (mb==1 && mx>(rsxofs+rsxsize-9) && (mx<rsxofs+rsxsize-2)
\r
4250 && my>(rsyofs+1) && (my<rsyofs+8) && !moving)
\r
4257 if (mb==1 && mx>rsxofs && mx<rsxofs+rsxsize && my>rsyofs && my<(rsyofs+9) && !moving)
\r
4265 if (mb==1 && !moving)
\r
4275 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
4276 else c=key_ascii_tbl[last_pressed];
\r
4278 if (last_pressed==SCAN_ESC)
\r
4285 if (last_pressed==SCAN_ENTER)
\r
4287 key[SCAN_ENTER]=0;
\r
4294 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
4298 case 0: ctf=1; str=nstr1; break;
\r
4299 case 1: ctf=2; str=nstr2; break;
\r
4300 case 2: ctf=0; str=0; break;
\r
4304 cb=1; cursorblink=systemtime+40;
\r
4308 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
4312 case 0: ctf=2; str=nstr2; break;
\r
4313 case 1: ctf=0; str=0; break;
\r
4314 case 2: ctf=1; str=nstr1; break;
\r
4318 cb=1; cursorblink=systemtime+40;
\r
4325 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
4327 str[strlen(str)-1]=0;
\r
4328 key[SCAN_BACKSP]=0;
\r
4332 else if (last_pressed==SCAN_BACKSP)
\r
4344 basex=atoi(nstr1);
\r
4345 basey=atoi(nstr2);
\r
4348 int cdxsize=150, cdysize=45;
\r
4349 int cdxofs=110, cdyofs=70;
\r
4353 { char done=0, moving=0;
\r
4354 int mxo, myo, cursorblink;
\r
4355 char ctf=0, cb=0, c, t, *str;
\r
4363 if (ctf && systemtime >= cursorblink)
\r
4366 cursorblink = systemtime+40;
\r
4370 cdxofs = (mx-mxo);
\r
4371 cdyofs = (my-myo);
\r
4372 if (!mb) moving=0;
\r
4373 if (cdxofs<16) cdxofs = 16;
\r
4374 if (cdyofs<16) cdyofs = 16;
\r
4375 if (cdxofs+cdxsize>335) cdxofs = 336-cdxsize;
\r
4376 if (cdyofs+cdysize>sy+16) cdyofs = (sy+16)-cdysize;
\r
4379 Window(cdxofs, cdyofs, cdxofs+cdxsize, cdyofs+cdysize, "CD Player");
\r
4380 Button(cdxofs+53, cdyofs+10, "Play");
\r
4381 Button(cdxofs+53, cdyofs+21, "Stop");
\r
4382 Button(cdxofs+85, cdyofs+10, "Eject");
\r
4383 Button(cdxofs+85, cdyofs+21, "Close");
\r
4384 Button(cdxofs+117, cdyofs+10, "Next");
\r
4385 Button(cdxofs+117, cdyofs+21, "Prev");
\r
4386 Button(cdxofs+117, cdyofs+32, "OK");
\r
4387 GotoXY(cdxofs+4, cdyofs+18); printstring("Track ");
\r
4388 sprintf(strbuf,"%d",curtrack); printstring(strbuf);
\r
4392 CheckTimerStuff();
\r
4395 if (mb==1 && mx>cdxofs+53 && mx<cdxofs+30+53 && my>cdyofs+10 && my<cdyofs+10+10 && !moving)
\r
4397 // insert code for button "Play" here
\r
4398 ButtonPressed(cdxofs+53, cdyofs+10, "Play");
\r
4401 //CD_Play(curtrack);
\r
4408 WaitRelease(); continue;
\r
4411 if (mb==1 && mx>cdxofs+53 && mx<cdxofs+30+53 && my>cdyofs+21 && my<cdyofs+10+21 && !moving)
\r
4413 // insert code for button "Stop" here
\r
4414 ButtonPressed(cdxofs+53, cdyofs+21, "Stop");
\r
4424 WaitRelease(); continue;
\r
4427 if (mb==1 && mx>cdxofs+85 && mx<cdxofs+30+85 && my>cdyofs+10 && my<cdyofs+10+10 && !moving)
\r
4429 // insert code for button "Eject" here
\r
4430 ButtonPressed(cdxofs+85, cdyofs+10, "Eject");
\r
4440 WaitRelease(); continue;
\r
4443 if (mb==1 && mx>cdxofs+85 && mx<cdxofs+30+85 && my>cdyofs+21 && my<cdyofs+10+21 && !moving)
\r
4445 // insert code for button "Close" here
\r
4446 ButtonPressed(cdxofs+85, cdyofs+21, "Close");
\r
4449 //CD_Close_Door();
\r
4456 WaitRelease(); continue;
\r
4459 if (mb==1 && mx>cdxofs+117 && mx<cdxofs+30+117 && my>cdyofs+10 && my<cdyofs+10+10 && !moving)
\r
4461 // insert code for button "Next" here
\r
4462 ButtonPressed(cdxofs+117, cdyofs+10, "Next");
\r
4471 WaitRelease(); continue;
\r
4474 if (mb==1 && mx>cdxofs+117 && mx<cdxofs+30+117 && my>cdyofs+21 && my<cdyofs+10+21 && !moving)
\r
4476 // insert code for button "Prev" here
\r
4477 ButtonPressed(cdxofs+117, cdyofs+21, "Prev");
\r
4479 if (curtrack>1) curtrack--;
\r
4486 WaitRelease(); continue;
\r
4489 if ((mb==1 && mx>cdxofs+117 && mx<cdxofs+30+117 && my>cdyofs+32 && my<cdyofs+10+32 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
4491 // insert code for button "OK" here
\r
4492 ButtonPressed(cdxofs+117, cdyofs+32, "OK");
\r
4501 WaitRelease(); continue;
\r
4504 if (mb==1 && mx>(cdxofs+cdxsize-9) && (mx<cdxofs+cdxsize-2)
\r
4505 && my>(cdyofs+1) && (my<cdyofs+8) && !moving)
\r
4512 if (mb==1 && mx>cdxofs && mx<cdxofs+cdxsize && my>cdyofs && my<(cdyofs+9) && !moving)
\r
4520 if (mb==1 && !moving)
\r
4530 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
4531 else c=key_ascii_tbl[last_pressed];
\r
4533 if (last_pressed==SCAN_ESC)
\r
4540 if (last_pressed==SCAN_ENTER)
\r
4542 key[SCAN_ENTER]=0;
\r
4552 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
4554 str[strlen(str)-1]=0;
\r
4555 key[SCAN_BACKSP]=0;
\r
4559 else if (last_pressed==SCAN_BACKSP)
\r
4573 int ntxsize=130, nytsize=51;
\r
4574 int ntxofs=110, ntyofs=70;
\r
4576 void NoticeDialog()
\r
4577 { char done=0, moving=0;
\r
4578 int mxo, myo, cursorblink;
\r
4579 char ctf=0, cb=0, c, t, *str;
\r
4587 if (ctf && systemtime >= cursorblink)
\r
4590 cursorblink = systemtime+40;
\r
4594 ntxofs = (mx-mxo);
\r
4595 ntyofs = (my-myo);
\r
4596 if (!mb) moving=0;
\r
4597 if (ntxofs<16) ntxofs = 16;
\r
4598 if (ntyofs<16) ntyofs = 16;
\r
4599 if (ntxofs+ntxsize>335) ntxofs = 336-ntxsize;
\r
4600 if (ntyofs+nytsize>sy+16) ntyofs = (sy+16)-nytsize;
\r
4603 Window(ntxofs, ntyofs, ntxofs+ntxsize, ntyofs+nytsize, "Notice!");
\r
4604 GotoXY(ntxofs+20, ntyofs+20); printstring("Don't forget to add this");
\r
4605 GotoXY(ntxofs+14, ntyofs+26); printstring("layer to the Render String!");
\r
4606 Button(ntxofs+50, ntyofs+36, "OK");
\r
4607 GotoXY(ntxofs+25, ntyofs+14); printstring("Layer has been added.");
\r
4611 CheckTimerStuff();
\r
4614 if ((mb==1 && mx>ntxofs+50 && mx<ntxofs+30+50 && my>ntyofs+36 && my<ntyofs+10+36 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
4616 // insert code for button "OK" here
\r
4617 ButtonPressed(ntxofs+50, ntyofs+36, "OK");
\r
4626 WaitRelease(); continue;
\r
4629 if (mb==1 && mx>(ntxofs+ntxsize-9) && (mx<ntxofs+ntxsize-2)
\r
4630 && my>(ntyofs+1) && (my<ntyofs+8) && !moving)
\r
4637 if (mb==1 && mx>ntxofs && mx<ntxofs+ntxsize && my>ntyofs && my<(ntyofs+9) && !moving)
\r
4645 if (mb==1 && !moving)
\r
4655 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
4656 else c=key_ascii_tbl[last_pressed];
\r
4658 if (last_pressed==SCAN_ESC)
\r
4665 if (last_pressed==SCAN_ENTER)
\r
4667 key[SCAN_ENTER]=0;
\r
4677 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
4679 str[strlen(str)-1]=0;
\r
4680 key[SCAN_BACKSP]=0;
\r
4684 else if (last_pressed==SCAN_BACKSP)
\r
4698 int oxsize=150, oysize=98;
\r
4699 int oxofs=120, oyofs=70;
\r
4700 extern char vcedprog[80];
\r
4702 void OptionsDialog()
\r
4703 { char done=0, moving=0;
\r
4704 int mxo, myo, cursorblink;
\r
4705 char ctf=0, cb=0, c, t, *str;
\r
4706 char nstr1[80], nstr2[80], nstr3[80], nstr4[80];
\r
4708 sprintf(nstr1, "%d", winbg);
\r
4709 sprintf(nstr2, "%d", titlebg);
\r
4710 sprintf(nstr3, "%d", brightw);
\r
4711 sprintf(nstr4, "%d", darkw);
\r
4718 if (ctf && systemtime >= cursorblink)
\r
4721 cursorblink = systemtime+40;
\r
4727 if (!mb) moving=0;
\r
4728 if (oxofs<16) oxofs = 16;
\r
4729 if (oyofs<16) oyofs = 16;
\r
4730 if (oxofs+oxsize>335) oxofs = 336-oxsize;
\r
4731 if (oyofs+oysize>sy+16) oyofs = (sy+16)-oysize;
\r
4734 Window(oxofs, oyofs, oxofs+oxsize, oyofs+oysize, "MapEd Options");
\r
4735 GotoXY(oxofs+16, oyofs+12); printstring("Smooth Scroll");
\r
4736 CheckBox(oxofs+5, oyofs+11, scrollmode);
\r
4737 GotoXY(oxofs+16, oyofs+20); printstring("Tile Highlight");
\r
4738 CheckBox(oxofs+5, oyofs+19, mh);
\r
4739 GotoXY(oxofs+38, oyofs+31); printstring("Window Background");
\r
4740 TextField(oxofs+5, oyofs+29, 30, nstr1, ctf == 1 ? cb : 0);
\r
4741 TextField(oxofs+5, oyofs+39, 30, nstr2, ctf == 2 ? cb : 0);
\r
4742 GotoXY(oxofs+38, oyofs+41); printstring("Titlebar Background");
\r
4743 CheckBox(oxofs+74, oyofs+11, vm);
\r
4744 GotoXY(oxofs+84, oyofs+12); printstring("320x240 driver");
\r
4745 CheckBox(oxofs+74, oyofs+19, mouse_scroll);
\r
4746 GotoXY(oxofs+84, oyofs+20); printstring("Mouse Scrolling");
\r
4747 TextField(oxofs+5, oyofs+49, 30, nstr3, ctf == 3 ? cb : 0);
\r
4748 TextField(oxofs+5, oyofs+59, 30, nstr4, ctf == 4 ? cb : 0);
\r
4749 GotoXY(oxofs+38, oyofs+51); printstring("White");
\r
4750 GotoXY(oxofs+38, oyofs+61); printstring("Shadow");
\r
4751 Button(oxofs+60, oyofs+85, "OK");
\r
4752 HLine(oxofs+1, oyofs+71, 148, white);
\r
4753 GotoXY(oxofs+3, oyofs+76); printstring("Editor:");
\r
4754 TextField(oxofs+28, oyofs+74, 118, vcedprog, ctf == 5 ? cb : 0);
\r
4758 CheckTimerStuff();
\r
4761 if (mb==1 && mx>oxofs+5 && mx<oxofs+8+5 && my>oyofs+11 && my<oyofs+7+11 && !moving)
\r
4763 xwin=xwin>>4; xwin=xwin<<4;
\r
4764 ywin=ywin>>4; ywin=ywin<<4;
\r
4765 scrollmode ^= 1; WaitRelease(); continue;
\r
4768 if (mb==1 && mx>oxofs+5 && mx<oxofs+8+5 && my>oyofs+19 && my<oyofs+7+19 && !moving)
\r
4770 mh ^= 1; WaitRelease(); continue;
\r
4773 if (mb==1 && mx>oxofs+5 && mx<oxofs+30+5 && my>oyofs+29 && my<oyofs+9+29 && !moving)
\r
4775 ctf=1; str=nstr1; cb=1;
\r
4776 cursorblink=systemtime+40; continue;
\r
4779 if (mb==1 && mx>oxofs+5 && mx<oxofs+30+5 && my>oyofs+39 && my<oyofs+9+39 && !moving)
\r
4781 ctf=2; str=nstr2; cb=1;
\r
4782 cursorblink=systemtime+40; continue;
\r
4785 if (mb==1 && mx>oxofs+74 && mx<oxofs+8+74 && my>oyofs+11 && my<oyofs+7+11 && !moving)
\r
4787 vm ^= 1; WaitRelease();
\r
4790 set_intensity(63);
\r
4795 if (mb==1 && mx>oxofs+74 && mx<oxofs+8+74 && my>oyofs+19 && my<oyofs+7+19 && !moving)
\r
4797 mouse_scroll ^= 1; WaitRelease(); continue;
\r
4800 if (mb==1 && mx>oxofs+5 && mx<oxofs+30+5 && my>oyofs+49 && my<oyofs+9+49 && !moving)
\r
4802 ctf=3; str=nstr3; cb=1;
\r
4803 cursorblink=systemtime+40; continue;
\r
4806 if (mb==1 && mx>oxofs+5 && mx<oxofs+30+5 && my>oyofs+59 && my<oyofs+9+59 && !moving)
\r
4808 ctf=4; str=nstr4; cb=1;
\r
4809 cursorblink=systemtime+40; continue;
\r
4812 if ((mb==1 && mx>oxofs+60 && mx<oxofs+30+60 && my>oyofs+85 && my<oyofs+10+85 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
4814 // insert code for button "OK" here
\r
4815 ButtonPressed(oxofs+60, oyofs+85, "OK");
\r
4824 WaitRelease(); continue;
\r
4827 if (mb==1 && mx>oxofs+28 && mx<oxofs+118+28 && my>oyofs+74 && my<oyofs+9+74 && !moving)
\r
4829 ctf=5; str=vcedprog; cb=1;
\r
4830 cursorblink=systemtime+40; continue;
\r
4833 if (mb==1 && mx>(oxofs+oxsize-9) && (mx<oxofs+oxsize-2)
\r
4834 && my>(oyofs+1) && (my<oyofs+8) && !moving)
\r
4841 if (mb==1 && mx>oxofs && mx<oxofs+oxsize && my>oyofs && my<(oyofs+9) && !moving)
\r
4849 if (mb==1 && !moving)
\r
4859 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
4860 else c=key_ascii_tbl[last_pressed];
\r
4862 if (last_pressed==SCAN_ESC)
\r
4869 if (last_pressed==SCAN_ENTER)
\r
4871 key[SCAN_ENTER]=0;
\r
4878 if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT])
\r
4882 case 0: ctf=1; str=nstr1; break;
\r
4883 case 1: ctf=2; str=nstr2; break;
\r
4884 case 2: ctf=3; str=nstr3; break;
\r
4885 case 3: ctf=4; str=nstr4; break;
\r
4886 case 4: ctf=5; str=vcedprog; break;
\r
4887 case 5: ctf=0; str=0; break;
\r
4891 cb=1; cursorblink=systemtime+40;
\r
4895 if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT])
\r
4899 case 0: ctf=5; str=vcedprog; break;
\r
4900 case 1: ctf=0; str=0; break;
\r
4901 case 2: ctf=1; str=nstr1; break;
\r
4902 case 3: ctf=2; str=nstr2; break;
\r
4903 case 4: ctf=3; str=nstr3; break;
\r
4904 case 5: ctf=4; str=nstr4; break;
\r
4908 cb=1; cursorblink=systemtime+40;
\r
4915 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
4917 str[strlen(str)-1]=0;
\r
4918 key[SCAN_BACKSP]=0;
\r
4922 else if (last_pressed==SCAN_BACKSP)
\r
4934 winbg=atoi(nstr1);
\r
4935 titlebg=atoi(nstr2);
\r
4936 brightw=atoi(nstr3);
\r
4937 darkw=atoi(nstr4);
\r
4940 int vcexsize=200, vceysize=60;
\r
4941 int vcexofs=76, vceyofs=70;
\r
4943 void VCNotify(char *msg)
\r
4944 { char done=0, moving=0;
\r
4945 int mxo, myo, cursorblink;
\r
4946 char ctf=0, cb=0, c, t, *str;
\r
4954 if (ctf && systemtime >= cursorblink)
\r
4957 cursorblink = systemtime+40;
\r
4961 vcexofs = (mx-mxo);
\r
4962 vceyofs = (my-myo);
\r
4963 if (!mb) moving=0;
\r
4964 if (vcexofs<16) vcexofs = 16;
\r
4965 if (vceyofs<16) vceyofs = 16;
\r
4966 if (vcexofs+vcexsize>335) vcexofs = 336-vcexsize;
\r
4967 if (vceyofs+vceysize>sy+16) vceyofs = (sy+16)-vceysize;
\r
4970 Window(vcexofs, vceyofs, vcexofs+vcexsize, vceyofs+vceysize, "VergeC Error Report");
\r
4971 Button(vcexofs+85, vceyofs+41, "OK");
\r
4972 GotoXY(vcexofs+29, vceyofs+17); printstring("VCC has reported the following error:");
\r
4973 GotoXY(vcexofs+100-(pixels(msg)/2), vceyofs+23); printstring(msg);
\r
4977 CheckTimerStuff();
\r
4980 if ((mb==1 && mx>vcexofs+85 && mx<vcexofs+30+85 && my>vceyofs+41 && my<vceyofs+10+41 && !moving) || (key[SCAN_ENTER] && !ctf))
\r
4982 // insert code for button "OK" here
\r
4983 ButtonPressed(vcexofs+85, vceyofs+41, "OK");
\r
4992 WaitRelease(); continue;
\r
4995 if (mb==1 && mx>(vcexofs+vcexsize-9) && (mx<vcexofs+vcexsize-2)
\r
4996 && my>(vceyofs+1) && (my<vceyofs+8) && !moving)
\r
5003 if (mb==1 && mx>vcexofs && mx<vcexofs+vcexsize && my>vceyofs && my<(vceyofs+9) && !moving)
\r
5011 if (mb==1 && !moving)
\r
5021 if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed];
\r
5022 else c=key_ascii_tbl[last_pressed];
\r
5024 if (last_pressed==SCAN_ESC)
\r
5031 if (last_pressed==SCAN_ENTER)
\r
5033 key[SCAN_ENTER]=0;
\r
5043 if (last_pressed==SCAN_BACKSP && strlen(str))
\r
5045 str[strlen(str)-1]=0;
\r
5046 key[SCAN_BACKSP]=0;
\r
5050 else if (last_pressed==SCAN_BACKSP)
\r