/* Copyright (C) 1998 BJ Eirich (aka vecna) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public Lic See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include #include #include "config.h" #include "guicomp.h" #include "maped.h" #include "mouse.h" #include "render.h" #include "timer.h" #include "vdriver.h" #include "keyboard.h" #include "smalfont.h" #include "columns.h" #include "tilesel.h" // ================================= Data ==================================== struct message { char text[44]; // message text int exptime; // message expire time }; struct message messages[6]; // 5-message buffer char num_msgs=0; // number of active messages char playingmod[80]; // currently playing mod. extern char scrollmode; // ================================= Code ==================================== void CheckMessageExpirations() { int i; for (i=0; imessages[i].exptime) { memcpy(messages[i].text, messages[i+1].text, (48*(num_msgs-i+1))); num_msgs--; } } void Message(char *text, int duration) { if (num_msgs<5) { memcpy(messages[num_msgs].text, text, strlen(text)); messages[num_msgs].exptime=systemtime+duration; num_msgs++; return; } memcpy(&messages[0].text, &messages[1].text, 192); memcpy(messages[4].text, text, strlen(text)+1); messages[num_msgs].exptime=systemtime+duration; } void DrawScreenControls() { int i; byte c; if (el<6) { if (pasting) { GotoXY(298-5,tsy-19+13); printstring("P"); } } // Put current-tile boxes if applicable. if (el<6) { FilledBox(298,tsy-19,18,18,white); FilledBox(317,tsy-19,18,18,white); CopySprite(299,tsy-18,16,16,vsp+(256*lt)); CopySprite(318,tsy-18,16,16,vsp+(256*rt)); } if (el==7) { sprintf(strbuf,"Zone %d",curzone); GotoXY(280,tsy-16); printstring(strbuf); GotoXY(280,tsy-10); printstring(zones[curzone].name); c=zone[((((ywin*layer[0].pmulty/layer[0].pdivy)+my-16)/16) * layer[0].sizex)+(((xwin*layer[0].pmultx/layer[0].pdivx)+mx-16)/16)]; if (c) { sprintf(strbuf,"zone %d",c); GotoXY(280,17); printstring(strbuf); GotoXY(280,23); printstring(zones[c].name); } } if (el==8) { sprintf(strbuf,"%d entities",entities); GotoXY(285,17); printstring(strbuf); if (c=EntityThere((mx+xwin-16)/16,(my+ywin-16)/16)) { c--; GotoXY(285,tsy-10); printstring(entity[c].desc); } } // Put the current-tile mouse thingy. GotoXY(17,17); dec_to_asciiz((xwin+mx-16)/16,strbuf); printstring(strbuf); printstring(", "); dec_to_asciiz((ywin+my-16)/16,strbuf); printstring(strbuf); // Put the layer editor/selector. for (i=0; i<6; i++) { if (el==i) c=white; else c=darkw; FilledBox(17+(i*10),tsy-7,9,7,c); if (layertoggle[i]) c=darkred; else c=0; FilledBox(18+(i*10),tsy-6,7,6,c); GotoXY(20+(i*10),tsy-5); dec_to_asciiz(i+1,strbuf); if (i335) dx=336-80; if (dy+89>sy+16) dy=(sy+16)-89; RenderMap(); RenderGUI(); stdwindow(dx, dy, dx+80, dy+89); if (mx>dx && mxdy+2 && mydy+8 && mydy+14 && mydy+20 && mydy+29 && mydy+35 && mydy+41 && mydy+47 && mydy+53 && mydy+59 && mydy+65 && mydy+71 && mydy+80 && my"); GotoXY(dx+3, dy+42); printstring("Options"); GotoXY(dx+3, dy+48); printstring("MOD Player"); GotoXY(dx+3, dy+54); printstring("CD Player"); GotoXY(dx+3, dy+60); printstring("Columns"); GotoXY(dx+3, dy+66); printstring("Execute"); GotoXY(dx+73, dy+66); printstring(">"); GotoXY(dx+3, dy+72); printstring("Exit to DOS"); HLine(dx+2, dy+79, 76, white); GotoXY(dx+3, dy+81); printstring("About MapEd"); DrawMouse(); ShowPage(); CheckTimerStuff(); if (mb==1 && mx>dx && mxdy+2 && mydy+8 && mydy+14 && mydy+20 && mydy+29 && mydy+35 && mydy+41 && mydy+47 && mydy+53 && mydy+59 && mydy+65 && mydy+71 && mydy+80 && my= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { ilxofs = (mx-mxo); ilyofs = (my-myo); if (!mb) moving=0; if (ilxofs<16) ilxofs = 16; if (ilyofs<16) ilyofs = 16; if (ilxofs+ilxsize>335) ilxofs = 336-ilxsize; if (ilyofs+ilysize>sy+16) ilyofs = (sy+16)-ilysize; } Window(ilxofs, ilyofs, ilxofs+ilxsize, ilyofs+ilysize, "Import Image As Layer"); Button(ilxofs+109, ilyofs+12, "Browse"); Button(ilxofs+109, ilyofs+30, "OK"); GotoXY(ilxofs+5, ilyofs+25); printstring("Layer:"); // layer select radio buttons for (i=0; i<6; i++) { CheckBox(ilxofs+29+(i*10), ilyofs+33, chk_layer & (1<ilxofs+109 && mxilyofs+12 && myilxofs+109 && mxilyofs+30 && mynumlayers) { numlayers++; sprintf(rstring, "%s%i", rstring, ly+1); // update render-order } vfree(t); vfree(ovsp); } // ... WaitRelease(); continue; } if (mb==1 && mx>ilxofs+29 && mxilyofs+33 && myilxofs+39 && mxilyofs+33 && my= 2) { chk_layer ^= 2; chk_layer &= 2; //chk_2 ^= 1; //chk_1=0,chk_3=0,chk_4=0,chk_5=0,chk_6=0; WaitRelease(); continue; } } if (mb==1 && mx>ilxofs+49 && mxilyofs+33 && my= 3) { chk_layer ^= 4; chk_layer &= 4; //chk_3 ^= 1; //chk_1=0,chk_2=0,chk_4=0,chk_5=0,chk_6=0; WaitRelease(); continue; } } if (mb==1 && mx>ilxofs+59 && mxilyofs+33 && my= 4) { chk_layer ^= 8; chk_layer &= 8; //chk_4 ^= 1; //chk_1=0,chk_2=0,chk_3=0,chk_5=0,chk_6=0; WaitRelease(); continue; } } if (mb==1 && mx>ilxofs+69 && mxilyofs+33 && my= 5) { chk_layer ^= 16; chk_layer &= 16; //chk_5 ^= 1; //chk_1=0,chk_2=0,chk_3=0,chk_4=0,chk_6=0; WaitRelease(); continue; } } if (mb==1 && mx>ilxofs+79 && mxilyofs+33 && my= 6) { chk_layer ^= 32; chk_layer &= 32; //chk_6 ^= 1; //chk_1=0,chk_2=0,chk_3=0,chk_4=0,chk_5=0; WaitRelease(); continue; } } // if no checkboxes are marked, mark the first. //if (!(chk_1+chk_2+chk_3+chk_4+chk_5+chk_6)) chk_1=1; if (!chk_layer) chk_layer=1; // if (mb==1 && mx>ilxofs+29 && mxilyofs+12 && myilxofs+74 && mxilyofs+58 && myilxofs+74 && mxilyofs+69 && myilxofs+5 && mxilyofs+101 && my if (excessx+excessy) { if (chk_grabexcess) { if (excessx) tilesx++; if (excessy) tilesy++; } else { if (excessx) tilesx--; if (excessy) tilesy--; } if (tilesxilxofs+5 && mxilyofs+110 && myilxofs+5 && mxilyofs+119 && my(ilxofs+ilxsize-9) && (mx(ilyofs+1) && (myilxofs && mxilyofs && my<(ilyofs+9) && !moving) { moving=1; mxo=mx-ilxofs; myo=my-ilyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; // keep minimally required padding if (ctf==1) { if (atoi(str)= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { dtxofs = (mx-mxo); dtyofs = (my-myo); if (!mb) moving=0; if (dtxofs<16) dtxofs = 16; if (dtyofs<16) dtyofs = 16; if (dtxofs+dtxsize>335) dtxofs = 336-dtxsize; if (dtyofs+dtysize>sy+16) dtyofs = (sy+16)-dtysize; } Window(dtxofs, dtyofs, dtxofs+dtxsize, dtyofs+dtysize, "Destroyer"); CheckBox(dtxofs+4, dtyofs+11, zn_check); CheckBox(dtxofs+4, dtyofs+31, ob_check); CheckBox(dtxofs+4, dtyofs+21, zd_check); GotoXY(dtxofs+15, dtyofs+12); printstring("Zones"); GotoXY(dtxofs+15, dtyofs+32); printstring("Obstructions"); GotoXY(dtxofs+15, dtyofs+22); printstring("Zone Data"); Button(dtxofs+68, dtyofs+11, "ok"); Button(dtxofs+68, dtyofs+24, "cancel"); CheckBox(dtxofs+4, dtyofs+41, ent_check); GotoXY(dtxofs+15, dtyofs+42); printstring("Entities"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>dtxofs+4 && mxdtyofs+11 && mydtxofs+4 && mxdtyofs+21 && mydtxofs+4 && mxdtyofs+31 && mydtxofs+4 && mxdtyofs+41 && mydtxofs+68 && mxdtyofs+11 && mydtxofs+68 && mxdtyofs+24 && my(dtxofs+dtxsize-9) && (mx(dtyofs+1) && (mydtxofs && mxdtyofs && my<(dtyofs+9) && !moving) { moving=1; mxo=mx-dtxofs; myo=my-dtyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } void LayersSubMenu(int dx, int dy) { char done=0; //int mxo, myo, cursorblink; do { if (dx<16) dx=16; if (dy<16) dy=16; if (dx+80>335) dx=336-80; if (dy+89>sy+16) dy=(sy+16)-89; RenderMap(); RenderGUI(); stdwindow(dx, dy, dx+80, dy+29); if (mx>dx && mxdy+2 && mydy+8 && mydy+14 && mydy+20 && mydx && mxdy+2 && mydy+8 && mydy+14 && mydy+20 && my335) dx=336-80; if (dy+89>sy+16) dy=(sy+16)-89; RenderMap(); RenderGUI(); stdwindow(dx, dy, dx+80, dy+23); if (mx>dx && mxdy+2 && mydy+8 && mydy+14 && mydx && mxdy+2 && mydy+8 && mydy+14 && my5) i=0; if (i>=numlayers) i=0; sprintf(nstr1, "%d", layer[i].pmultx); sprintf(nstr2, "%d", layer[i].pdivx); sprintf(nstr3, "%d", layer[i].pmulty); sprintf(nstr4, "%d", layer[i].pdivy); sprintf(nstr5, "%d", layer[i].trans); sprintf(nstr6, "%d", layer[i].hline); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { lpxofs = (mx-mxo); lpyofs = (my-myo); if (!mb) moving=0; if (lpxofs<16) lpxofs = 16; if (lpyofs<16) lpyofs = 16; if (lpxofs+lpxsize>335) lpxofs = 336-lpxsize; if (lpyofs+lpysize>sy+16) lpyofs = (sy+16)-lpysize; } Window(lpxofs, lpyofs, lpxofs+lpxsize, lpyofs+lpysize, "Edit Layer Properties"); GotoXY(lpxofs+3, lpyofs+10); printstring("Parallax controls:"); GotoXY(lpxofs+4, lpyofs+21); printstring("MultX:"); GotoXY(lpxofs+12, lpyofs+31); printstring("DivX:"); GotoXY(lpxofs+93, lpyofs+21); printstring("MultY:"); GotoXY(lpxofs+101, lpyofs+31); printstring("DivY:"); TextField(lpxofs+29, lpyofs+19, 60, nstr1, ctf == 1 ? cb : 0); TextField(lpxofs+29, lpyofs+29, 60, nstr2, ctf == 2 ? cb : 0); TextField(lpxofs+118, lpyofs+19, 60, nstr3, ctf == 3 ? cb : 0); TextField(lpxofs+118, lpyofs+29, 60, nstr4, ctf == 4 ? cb : 0); HLine(lpxofs+1, lpyofs+43, 188, white); GotoXY(lpxofs+9, lpyofs+48); printstring("Transparent"); GotoXY(lpxofs+36, lpyofs+58); printstring("HLine"); TextField(lpxofs+56, lpyofs+46, 60, nstr5, ctf == 5 ? cb : 0); TextField(lpxofs+56, lpyofs+56, 60, nstr6, ctf == 6 ? cb : 0); Button(lpxofs+156, lpyofs+55, "OK"); GotoXY(lpxofs+144, lpyofs+47); printstring("Layer"); sprintf(strbuf,"%d",i); GotoXY(lpxofs+168, lpyofs+47); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>lpxofs+29 && mxlpyofs+19 && mylpxofs+29 && mxlpyofs+29 && mylpxofs+118 && mxlpyofs+19 && mylpxofs+118 && mxlpyofs+29 && mylpxofs+56 && mxlpyofs+46 && mylpxofs+56 && mxlpyofs+56 && mylpxofs+156 && mxlpyofs+55 && my(lpxofs+lpxsize-9) && (mx(lpyofs+1) && (mylpxofs && mxlpyofs && my<(lpyofs+9) && !moving) { moving=1; mxo=mx-lpxofs; myo=my-lpyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_UP) { layer[i].pmultx=atoi(nstr1); layer[i].pdivx=atoi(nstr2); layer[i].pmulty=atoi(nstr3); layer[i].pdivy=atoi(nstr4); layer[i].trans=atoi(nstr5); layer[i].hline=atoi(nstr6); last_pressed=0; key[SCAN_UP]=0; if (i) i--; else i=numlayers-1; sprintf(nstr1, "%d", layer[i].pmultx); sprintf(nstr2, "%d", layer[i].pdivx); sprintf(nstr3, "%d", layer[i].pmulty); sprintf(nstr4, "%d", layer[i].pdivy); sprintf(nstr5, "%d", layer[i].trans); sprintf(nstr6, "%d", layer[i].hline); } if (last_pressed==SCAN_DOWN) { layer[i].pmultx=atoi(nstr1); layer[i].pdivx=atoi(nstr2); layer[i].pmulty=atoi(nstr3); layer[i].pdivy=atoi(nstr4); layer[i].trans=atoi(nstr5); layer[i].hline=atoi(nstr6); last_pressed=0; key[SCAN_DOWN]=0; if (i5) i=0; if (i>=numlayers) i=0; sprintf(nstr1, "%d", layer[i].pmultx); sprintf(nstr2, "%d", layer[i].pdivx); sprintf(nstr3, "%d", layer[i].pmulty); sprintf(nstr4, "%d", layer[i].pdivy); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { lpxofs = (mx-mxo); lpyofs = (my-myo); if (!mb) moving=0; if (lpxofs<16) lpxofs = 16; if (lpyofs<16) lpyofs = 16; if (lpxofs+lpxsize>335) lpxofs = 336-lpxsize; if (lpyofs+lpysize>sy+16) lpyofs = (sy+16)-lpysize; } Window(lpxofs, lpyofs, lpxofs+lpxsize, lpyofs+lpysize, "Edit Layer Properties"); GotoXY(lpxofs+3, lpyofs+10); printstring("Parallax controls:"); GotoXY(lpxofs+4, lpyofs+21); printstring("MultX:"); GotoXY(lpxofs+12, lpyofs+31); printstring("DivX:"); GotoXY(lpxofs+93, lpyofs+21); printstring("MultY:"); GotoXY(lpxofs+101, lpyofs+31); printstring("DivY:"); TextField(lpxofs+29, lpyofs+19, 60, nstr1, ctf == 1 ? cb : 0); TextField(lpxofs+29, lpyofs+29, 60, nstr2, ctf == 2 ? cb : 0); TextField(lpxofs+118, lpyofs+19, 60, nstr3, ctf == 3 ? cb : 0); TextField(lpxofs+118, lpyofs+29, 60, nstr4, ctf == 4 ? cb : 0); HLine(lpxofs+1, lpyofs+43, 188, white); GotoXY(lpxofs+6, lpyofs+49); printstring("Transparent"); GotoXY(lpxofs+32, lpyofs+56); printstring("HLine"); CheckBox(lpxofs+56, lpyofs+48, layer[i].trans); CheckBox(lpxofs+56, lpyofs+56, layer[i].hline); Button(lpxofs+156, lpyofs+55, "OK"); GotoXY(lpxofs+144, lpyofs+47); printstring("Layer"); sprintf(strbuf,"%d",i); GotoXY(lpxofs+168, lpyofs+47); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>lpxofs+29 && mxlpyofs+19 && mylpxofs+29 && mxlpyofs+29 && mylpxofs+118 && mxlpyofs+19 && mylpxofs+118 && mxlpyofs+29 && mylpxofs+56 && mxlpyofs+48 && mylpxofs+56 && mxlpyofs+56 && mylpxofs+156 && mxlpyofs+55 && my(lpxofs+lpxsize-9) && (mx(lpyofs+1) && (mylpxofs && mxlpyofs && my<(lpyofs+9) && !moving) { moving=1; mxo=mx-lpxofs; myo=my-lpyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_UP) { layer[i].pmultx=atoi(nstr1); layer[i].pdivx=atoi(nstr2); layer[i].pmulty=atoi(nstr3); layer[i].pdivy=atoi(nstr4); last_pressed=0; key[SCAN_UP]=0; if (i) i--; else i=numlayers-1; sprintf(nstr1, "%d", layer[i].pmultx); sprintf(nstr2, "%d", layer[i].pdivx); sprintf(nstr3, "%d", layer[i].pmulty); sprintf(nstr4, "%d", layer[i].pdivy); } if (last_pressed==SCAN_DOWN) { layer[i].pmultx=atoi(nstr1); layer[i].pdivx=atoi(nstr2); layer[i].pmulty=atoi(nstr3); layer[i].pdivy=atoi(nstr4); last_pressed=0; key[SCAN_DOWN]=0; if (i= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { amxofs = (mx-mxo); amyofs = (my-myo); if (!mb) moving=0; if (amxofs<16) amxofs = 16; if (amyofs<16) amyofs = 16; if (amxofs+amxsize>335) amxofs = 336-amxsize; if (amyofs+amysize>sy+16) amyofs = (sy+16)-amysize; } sprintf(strbuf, "About MapEd %s", ME2_VERSION); Window(amxofs, amyofs, amxofs+amxsize, amyofs+amysize, strbuf); sprintf(strbuf, "MapEd v.%s", ME2_VERSION); GotoXY(amxofs+52, amyofs+16); printstring(strbuf); GotoXY(amxofs+31, amyofs+22); printstring("Copyright (C) 1998 vecna"); GotoXY(amxofs+40, amyofs+28); printstring("All Rights Reserved"); GotoXY(amxofs+(75-pixels("Additional code by Ric")/2), amyofs+41); printstring("Additional code by Ric"); GotoXY(amxofs+(75-pixels("Additional code by aen")/2), amyofs+47); printstring("Additional code by aen"); GotoXY(amxofs+(75-pixels("Additional code by zeromus")/2), amyofs+53); printstring("Additional code by zeromus"); Button(amxofs+60, amyofs+68, "OK"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if ((mb==1 && mx>amxofs+66 && mxamyofs+68 && my(amxofs+amxsize-9) && (mx(amyofs+1) && (myamxofs && mxamyofs && my<(amyofs+9) && !moving) { moving=1; mxo=mx-amxofs; myo=my-amyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB) { switch (ctf) { case 0: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int cnxsize=125, cnysize=50; int cnxofs=114, cnyofs=70; int Confirm(char *message) { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; WaitRelease(); do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { cnxofs = (mx-mxo); cnyofs = (my-myo); if (!mb) moving=0; if (cnxofs<16) cnxofs = 16; if (cnyofs<16) cnyofs = 16; if (cnxofs+cnxsize>335) cnxofs = 336-cnxsize; if (cnyofs+cnysize>sy+16) cnyofs = (sy+16)-cnysize; } Window(cnxofs, cnyofs, cnxofs+cnxsize, cnyofs+cnysize, "Confirm? (Y/N)"); GotoXY(cnxofs+125/2-(pixels(message)/2), cnyofs+15); printstring(message); Button(cnxofs+24, cnyofs+30, "Yes"); Button(cnxofs+69, cnyofs+30, "No"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>cnxofs+24 && mxcnyofs+30 && mycnxofs+69 && mxcnyofs+30 && my(cnxofs+cnxsize-9) && (mx(cnyofs+1) && (mycnxofs && mxcnyofs && my<(cnyofs+9) && !moving) { moving=1; mxo=mx-cnxofs; myo=my-cnyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_N) { key[SCAN_N]=0; done=1; break; } if (last_pressed==SCAN_Y) { key[SCAN_Y]=0; return 1; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB) { switch (ctf) { case 0: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); return 0; } int lmxsize=145, lmysize=36; int lmxofs=80, lmyofs=50; void LoadMAPDialog() { char lmapname[80]; char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; memset(lmapname, 0, 80); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { lmxofs = (mx-mxo); lmyofs = (my-myo); if (!mb) moving=0; if (lmxofs<16) lmxofs = 16; if (lmyofs<16) lmyofs = 16; if (lmxofs+lmxsize>335) lmxofs = 336-lmxsize; if (lmyofs+lmysize>sy+16) lmyofs = (sy+16)-lmysize; } Window(lmxofs, lmyofs, lmxofs+lmxsize, lmyofs+lmysize, "Load MAP"); GotoXY(lmxofs+2, lmyofs+13); printstring("Load MAP:"); TextField(lmxofs+38, lmyofs+11, 70, lmapname, ctf == 1 ? cb : 0); Button(lmxofs+79, lmyofs+22, "OK"); Button(lmxofs+111, lmyofs+22, "Cancel"); Button(lmxofs+111, lmyofs+11, "Browse"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>lmxofs+38 && mxlmyofs+11 && mylmxofs+79 && mxlmyofs+22 && mylmxofs+111 && mxlmyofs+22 && mylmxofs+111 && mxlmyofs+11 && my(lmxofs+lmxsize-9) && (mx(lmyofs+1) && (mylmxofs && mxlmyofs && my<(lmyofs+9) && !moving) { moving=1; mxo=mx-lmxofs; myo=my-lmyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB) { switch (ctf) { case 0: ctf=1; str=lmapname; break; case 1: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int lvxsize=145, lvysize=35; int lvxofs=80, lvyofs=50; void LoadVSPDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; char lvspname[80]; last_pressed=0; memset(lvspname,0,80); do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { lvxofs = (mx-mxo); lvyofs = (my-myo); if (!mb) moving=0; if (lvxofs<16) lvxofs = 16; if (lvyofs<16) lvyofs = 16; if (lvxofs+lvxsize>335) lvxofs = 336-lvxsize; if (lvyofs+lvysize>sy+16) lvyofs = (sy+16)-lvysize; } Window(lvxofs, lvyofs, lvxofs+lvxsize, lvyofs+lvysize, "Load VSP"); GotoXY(lvxofs+2, lvyofs+13); printstring("Load VSP:"); TextField(lvxofs+38, lvyofs+11, 70, lvspname, ctf == 1 ? cb : 0); Button(lvxofs+79, lvyofs+21, "OK"); Button(lvxofs+111, lvyofs+21, "Cancel"); Button(lvxofs+111, lvyofs+10, "Browse"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>lvxofs+38 && mxlvyofs+11 && mylvxofs+79 && mxlvyofs+21 && mylvxofs+111 && mxlvyofs+21 && mylvxofs+111 && mxlvyofs+10 && my(lvxofs+lvxsize-9) && (mx(lvyofs+1) && (mylvxofs && mxlvyofs && my<(lvyofs+9) && !moving) { moving=1; mxo=mx-lvxofs; myo=my-lvyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=lvspname; break; case 1: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=lvspname; break; case 1: ctf=0; str=lvspname; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int mpxsize=175, mpysize=37; int mpxofs=60, mpyofs=60; void MPDialog() { char done=0, moving=0, playmod[80]; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; memset(playmod, 0, 80); do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { mpxofs = (mx-mxo); mpyofs = (my-myo); if (!mb) moving=0; if (mpxofs<16) mpxofs = 16; if (mpyofs<16) mpyofs = 16; if (mpxofs+mpxsize>335) mpxofs = 336-mpxsize; if (mpyofs+mpysize>sy+16) mpyofs = (sy+16)-mpysize; } Window(mpxofs, mpyofs, mpxofs+mpxsize, mpyofs+mpysize, "MOD Player Controls"); GotoXY(mpxofs+2, mpyofs+15); printstring("MOD Playing:"); TextField(mpxofs+49, mpyofs+13, 90, playmod, ctf == 1 ? cb : 0); Button(mpxofs+110, mpyofs+24, "Play"); Button(mpxofs+142, mpyofs+24, "Stop"); Button(mpxofs+78, mpyofs+24, "OK"); Button(mpxofs+142, mpyofs+12, "Browse"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>mpxofs+49 && mxmpyofs+13 && mympxofs+110 && mxmpyofs+24 && mympxofs+142 && mxmpyofs+24 && mympxofs+78 && mxmpyofs+24 && mympxofs+142 && mxmpyofs+12 && my(mpxofs+mpxsize-9) && (mx(mpyofs+1) && (mympxofs && mxmpyofs && my<(mpyofs+9) && !moving) { moving=1; mxo=mx-mpxofs; myo=my-mpyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=playmod; break; case 1: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=playmod; break; case 1: ctf=0; str=playmod; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int zexsize=135, zeysize=86; int zexofs=80, zeyofs=40; void ZoneEdDialog() { char done=0, moving=0; int mxo, myo, cursorblink, i=0; char ctf=0, cb=0, c, t, *str; char nstr1[80], nstr2[80], nstr3[80], nstr4[80]; i=curzone; sprintf(nstr1, "%d", zones[i].script); sprintf(nstr2, "%d", zones[i].percent); sprintf(nstr3, "%d", zones[i].delay); sprintf(nstr4, "%d", zones[i].entityscript); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { zexofs = (mx-mxo); zeyofs = (my-myo); if (!mb) moving=0; if (zexofs<16) zexofs = 16; if (zeyofs<16) zeyofs = 16; if (zexofs+zexsize>335) zexofs = 336-zexsize; if (zeyofs+zeysize>sy+16) zeyofs = (sy+16)-zeysize; } Window(zexofs, zeyofs, zexofs+zexsize, zeyofs+zeysize, "Zone Editor"); GotoXY(zexofs+8, zeyofs+12); printstring("Name:"); TextField(zexofs+30, zeyofs+10, 100, zones[i].name, ctf == 1 ? cb : 0); GotoXY(zexofs+5, zeyofs+22); printstring("Script:"); TextField(zexofs+30, zeyofs+20, 100, nstr1, ctf == 2 ? cb : 0); GotoXY(zexofs+2, zeyofs+32); printstring("Chance:"); TextField(zexofs+30, zeyofs+30, 100, nstr2, ctf == 3 ? cb : 0); GotoXY(zexofs+7, zeyofs+42); printstring("Delay:"); TextField(zexofs+30, zeyofs+40, 100, nstr3, ctf == 4 ? cb : 0); GotoXY(zexofs+4, zeyofs+52); printstring("Entity:"); TextField(zexofs+30, zeyofs+50, 100, nstr4, ctf == 5 ? cb : 0); CheckBox(zexofs+20, zeyofs+61, zones[i].aaa); GotoXY(zexofs+31, zeyofs+62); printstring("Allow Adjacent Activation"); Button(zexofs+99, zeyofs+71, "OK"); GotoXY(zexofs+12, zeyofs+73); printstring("Zone"); GotoXY(zexofs+30, zeyofs+73); sprintf(strbuf,"%d",i); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>zexofs+30 && mxzeyofs+10 && myzexofs+30 && mxzeyofs+20 && myzexofs+30 && mxzeyofs+30 && myzexofs+30 && mxzeyofs+40 && myzexofs+30 && mxzeyofs+50 && myzexofs+20 && mxzeyofs+61 && myzexofs+99 && mxzeyofs+71 && my(zexofs+zexsize-9) && (mx(zeyofs+1) && (myzexofs && mxzeyofs && my<(zeyofs+9) && !moving) { moving=1; mxo=mx-zexofs; myo=my-zeyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_UP) { zones[i].script=atoi(nstr1); zones[i].percent=atoi(nstr2); zones[i].delay=atoi(nstr3); zones[i].entityscript=atoi(nstr4); if (i<255) i++; else i=0; last_pressed=0; key[SCAN_UP]=0; sprintf(nstr1, "%d", zones[i].script); sprintf(nstr2, "%d", zones[i].percent); sprintf(nstr3, "%d", zones[i].delay); sprintf(nstr4, "%d", zones[i].entityscript); continue; } if (last_pressed==SCAN_DOWN) { zones[i].script=atoi(nstr1); zones[i].percent=atoi(nstr2); zones[i].delay=atoi(nstr3); zones[i].entityscript=atoi(nstr4); if (i) i--; else i=255; last_pressed=0; key[SCAN_DOWN]=0; sprintf(nstr1, "%d", zones[i].script); sprintf(nstr2, "%d", zones[i].percent); sprintf(nstr3, "%d", zones[i].delay); sprintf(nstr4, "%d", zones[i].entityscript); continue; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=zones[i].name; break; case 1: ctf=2; str=nstr1; break; case 2: ctf=3; str=nstr2; break; case 3: ctf=4; str=nstr3; break; case 4: ctf=5; str=nstr4; break; case 5: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=5; str=nstr4; break; case 1: ctf=0; str=0; break; case 2: ctf=1; str=zones[i].name; break; case 3: ctf=2; str=nstr1; break; case 4: ctf=3; str=nstr2; break; case 5: ctf=4; str=nstr3; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); curzone=i; zones[i].script=atoi(nstr1); zones[i].percent=atoi(nstr2); zones[i].delay=atoi(nstr3); zones[i].entityscript=atoi(nstr4); } int exsize=180, eysize=175; int exofs=70, eyofs=30; void EntityEditor(int i) { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; 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]; sprintf(nstr1, "%d", entity[i].x); sprintf(nstr2, "%d", entity[i].y); sprintf(nstr3, "%d", entity[i].chrindex); sprintf(nstr4, "%d", entity[i].speed); sprintf(nstr5, "%d", entity[i].actscript); sprintf(nstr6, "%d", entity[i].movecode); sprintf(nstr7, "%d", entity[i].step); sprintf(nstr8, "%d", entity[i].data2); sprintf(nstr9, "%d", entity[i].data3); sprintf(nstr10, "%d", entity[i].delay); sprintf(nstr11, "%d", entity[i].data5); sprintf(nstr12, "%d", entity[i].data6); sprintf(nstr13, "%d", entity[i].movescript); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { exofs = (mx-mxo); eyofs = (my-myo); if (!mb) moving=0; if (exofs<16) exofs = 16; if (eyofs<16) eyofs = 16; if (exofs+exsize>335) exofs = 336-exsize; if (eyofs+eysize>sy+16) eyofs = (sy+16)-eysize; } Window(exofs, eyofs, exofs+exsize, eyofs+eysize, "Entity Editor"); GotoXY(exofs+7, eyofs+13); printstring("Desc:"); TextField(exofs+26, eyofs+11, 80, entity[i].desc, ctf == 1 ? cb : 0); GotoXY(exofs+19, eyofs+23); printstring("X:"); TextField(exofs+26, eyofs+21, 80, nstr1, ctf == 2 ? cb : 0); GotoXY(exofs+19, eyofs+33); printstring("Y:"); TextField(exofs+26, eyofs+31, 80, nstr2, ctf == 3 ? cb : 0); GotoXY(exofs+11, eyofs+43); printstring("CHR:"); TextField(exofs+26, eyofs+41, 80, nstr3, ctf == 4 ? cb : 0); // *** // entity image goes here (just above chr list button) // *** BigButton(exofs+116, eyofs+61, "CHR List"); BigButton(exofs+115, eyofs+153, "Scripts"); GotoXY(exofs+2, eyofs+155); printstring("Movescript:"); HLine(exofs+1, eyofs+73, 178, white); GotoXY(exofs+3, eyofs+53); printstring("Speed:"); TextField(exofs+26, eyofs+51, 80, nstr4, ctf == 5 ? cb : 0); TextField(exofs+26, eyofs+61, 80, nstr5, ctf == 6 ? cb : 0); GotoXY(exofs+107, eyofs+79); printstring("Is Obstruction"); CheckBox(exofs+161, eyofs+87, entity[i].obsmode1); GotoXY(exofs+102, eyofs+88); printstring("Is Obstructable"); CheckBox(exofs+161, eyofs+78, entity[i].obsmode2); GotoXY(exofs+24, eyofs+79); printstring("Auto Face"); CheckBox(exofs+61, eyofs+78, entity[i].face); GotoXY(exofs+10, eyofs+88); printstring("Activ. Method"); CheckBox(exofs+61, eyofs+87, entity[i].actm); HLine(exofs+1, eyofs+98, 178, white); GotoXY(exofs+126, eyofs+166); printstring("Entity"); GotoXY(exofs+6, eyofs+104); printstring("Move Code:"); TextField(exofs+47, eyofs+103, 80, nstr6, ctf == 7 ? cb : 0); TextField(exofs+30, eyofs+115, 40, nstr7, ctf == 8 ? cb : 0); TextField(exofs+30, eyofs+125, 40, nstr8, ctf == 9 ? cb : 0); TextField(exofs+30, eyofs+135, 40, nstr9, ctf == 10 ? cb : 0); TextField(exofs+113, eyofs+115, 40, nstr10, ctf == 11 ? cb : 0); TextField(exofs+113, eyofs+125, 40, nstr11, ctf == 12 ? cb : 0); TextField(exofs+113, eyofs+135, 40, nstr12, ctf == 13 ? cb : 0); HLine(exofs+1, eyofs+148, 178, white); TextField(exofs+46, eyofs+153, 60, nstr13, ctf == 14 ? cb : 0); GotoXY(exofs+5, eyofs+63); printstring("Activ:"); GotoXY(exofs+152, eyofs+166); sprintf(strbuf, "%d/%d", i, entities-1); printstring(strbuf); entity[i].movecode=atoi(nstr6); if (ctf!=4) entity[i].chrindex=atoi(nstr3); switch (entity[i].movecode) { case 0: GotoXY(exofs+131, eyofs+104); printstring("Stopped"); break; case 1: GotoXY(exofs+131, eyofs+104); printstring("Wander"); GotoXY(exofs+11, eyofs+116); printstring("Step:"); GotoXY(exofs+90, eyofs+116); printstring("Delay:"); break; case 2: GotoXY(exofs+131, eyofs+104); printstring("Wander Zone"); GotoXY(exofs+11, eyofs+116); printstring("Step:"); GotoXY(exofs+90, eyofs+116); printstring("Delay:"); GotoXY(exofs+10, eyofs+126); printstring("Zone:"); break; case 3: GotoXY(exofs+131, eyofs+104); printstring("Wander Box"); GotoXY(exofs+11, eyofs+116); printstring("Step:"); GotoXY(exofs+90, eyofs+116); printstring("Delay:"); GotoXY(exofs+21, eyofs+126); printstring("X1:"); GotoXY(exofs+21, eyofs+136); printstring("Y1:"); GotoXY(exofs+102, eyofs+126); printstring("X2:"); GotoXY(exofs+102, eyofs+136); printstring("Y2:"); break; case 4: GotoXY(exofs+131, eyofs+104); printstring("Scripted"); break; } switch (entity[i].actm) { case 0: GotoXY(exofs+72, eyofs+88); printstring("Actv"); break; case 1: GotoXY(exofs+72, eyofs+88); printstring("Adjc"); break; } if (chrs[entity[i].chrindex].frame) TCopySprite(exofs+143-(chrs[entity[i].chrindex].fx/2), eyofs+31-(chrs[entity[i].chrindex].fy/2), chrs[entity[i].chrindex].fx, chrs[entity[i].chrindex].fy, chrs[entity[i].chrindex].frame); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>exofs+26 && mxeyofs+11 && myexofs+26 && mxeyofs+21 && myexofs+26 && mxeyofs+31 && myexofs+26 && mxeyofs+41 && myexofs+116 && mxeyofs+61 && myexofs+26 && mxeyofs+51 && myexofs+26 && mxeyofs+61 && myexofs+115 && mxeyofs+153 && myexofs+161 && mxeyofs+87 && myexofs+161 && mxeyofs+78 && myexofs+61 && mxeyofs+78 && myexofs+61 && mxeyofs+87 && myexofs+47 && mxeyofs+103 && myexofs+30 && mxeyofs+115 && myexofs+30 && mxeyofs+125 && myexofs+30 && mxeyofs+135 && myexofs+113 && mxeyofs+115 && myexofs+113 && mxeyofs+125 && myexofs+113 && mxeyofs+135 && myexofs+46 && mxeyofs+153 && my(exofs+exsize-9) && (mx(eyofs+1) && (myexofs && mxeyofs && my<(eyofs+9) && !moving) { moving=1; mxo=mx-exofs; myo=my-eyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_UP) { entity[i].x=atoi(nstr1); entity[i].y=atoi(nstr2); entity[i].chrindex=atoi(nstr3); entity[i].speed=atoi(nstr4); entity[i].actscript=atoi(nstr5); entity[i].movecode=atoi(nstr6); entity[i].step=atoi(nstr7); entity[i].data2=atoi(nstr8); entity[i].data3=atoi(nstr9); entity[i].delay=atoi(nstr10); entity[i].data5=atoi(nstr11); entity[i].data6=atoi(nstr12); entity[i].movescript=atoi(nstr13); if (i= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { clxofs = (mx-mxo); clyofs = (my-myo); if (!mb) moving=0; if (clxofs<16) clxofs = 16; if (clyofs<16) clyofs = 16; if (clxofs+clxsize>335) clxofs = 336-clxsize; if (clyofs+clysize>sy+16) clyofs = (sy+16)-clysize; } Window(clxofs, clyofs, clxofs+clxsize, clyofs+clysize, "Entity CHR Reference Index"); TextField(clxofs+14, clyofs+11, 120, chrlist[base].t, ctf == 1 ? cb : 0); TextField(clxofs+14, clyofs+22, 120, chrlist[base+1].t, ctf == 2 ? cb : 0); TextField(clxofs+14, clyofs+33, 120, chrlist[base+2].t, ctf == 3 ? cb : 0); TextField(clxofs+14, clyofs+44, 120, chrlist[base+3].t, ctf == 4 ? cb : 0); TextField(clxofs+14, clyofs+55, 120, chrlist[base+4].t, ctf == 5 ? cb : 0); Button(clxofs+137, clyofs+65, "OK"); Button(clxofs+137, clyofs+10, "Browse"); Button(clxofs+137, clyofs+21, "Browse"); Button(clxofs+137, clyofs+32, "Browse"); Button(clxofs+137, clyofs+43, "Browse"); Button(clxofs+137, clyofs+54, "Browse"); GotoXY(clxofs+3, clyofs+11); sprintf(strbuf,"%d:", base); printstring(strbuf); GotoXY(clxofs+3, clyofs+22); sprintf(strbuf,"%d:", base+1); printstring(strbuf); GotoXY(clxofs+3, clyofs+33); sprintf(strbuf,"%d:", base+2); printstring(strbuf); GotoXY(clxofs+3, clyofs+44); sprintf(strbuf,"%d:", base+3); printstring(strbuf); GotoXY(clxofs+3, clyofs+55); sprintf(strbuf,"%d:", base+4); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>clxofs+14 && mxclyofs+11 && myclxofs+14 && mxclyofs+22 && myclxofs+14 && mxclyofs+33 && myclxofs+14 && mxclyofs+44 && myclxofs+14 && mxclyofs+55 && myclxofs+137 && mxclyofs+65 && myclxofs+137 && mxclyofs+10 && myclxofs+137 && mxclyofs+21 && myclxofs+137 && mxclyofs+32 && myclxofs+137 && mxclyofs+43 && myclxofs+137 && mxclyofs+54 && my(clxofs+clxsize-9) && (mx(clyofs+1) && (myclxofs && mxclyofs && my<(clyofs+9) && !moving) { moving=1; mxo=mx-clxofs; myo=my-clyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (key[SCAN_UP]) { key[SCAN_UP]=0; if (base) base--; last_pressed=0; continue; } if (key[SCAN_DOWN]) { key[SCAN_DOWN]=0; if (base<95) base++; last_pressed=0; continue; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=chrlist[base].t; break; case 1: ctf=2; str=chrlist[base+1].t; break; case 2: ctf=3; str=chrlist[base+2].t; break; case 3: ctf=4; str=chrlist[base+3].t; break; case 4: ctf=5; str=chrlist[base+4].t; break; case 5: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=5; str=chrlist[base].t; break; case 1: ctf=0; str=chrlist[base].t; break; case 2: ctf=1; str=chrlist[base+1].t; break; case 3: ctf=2; str=chrlist[base+2].t; break; case 4: ctf=3; str=chrlist[base+3].t; break; case 5: ctf=4; str=chrlist[base+4].t; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int msxsize=181, msysize=77; int msxofs=70, msyofs=50; char base1=0; void MoveScriptDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { msxofs = (mx-mxo); msyofs = (my-myo); if (!mb) moving=0; if (msxofs<16) msxofs = 16; if (msyofs<16) msyofs = 16; if (msxofs+msxsize>335) msxofs = 336-msxsize; if (msyofs+msysize>sy+16) msyofs = (sy+16)-msysize; } Window(msxofs, msyofs, msxofs+msxsize, msyofs+msysize, "Movement Script Editor"); TextField(msxofs+15, msyofs+12, 160, ms[base1].t, ctf == 1 ? cb : 0); TextField(msxofs+15, msyofs+22, 160, ms[base1+1].t, ctf == 2 ? cb : 0); TextField(msxofs+15, msyofs+32, 160, ms[base1+2].t, ctf == 3 ? cb : 0); TextField(msxofs+15, msyofs+42, 160, ms[base1+3].t, ctf == 4 ? cb : 0); TextField(msxofs+15, msyofs+52, 160, ms[base1+4].t, ctf == 5 ? cb : 0); Button(msxofs+146, msyofs+63, "OK"); GotoXY(msxofs+3, msyofs+11); sprintf(strbuf,"%d:", base1); printstring(strbuf); GotoXY(msxofs+3, msyofs+22); sprintf(strbuf,"%d:", base1+1); printstring(strbuf); GotoXY(msxofs+3, msyofs+33); sprintf(strbuf,"%d:", base1+2); printstring(strbuf); GotoXY(msxofs+3, msyofs+44); sprintf(strbuf,"%d:", base1+3); printstring(strbuf); GotoXY(msxofs+3, msyofs+55); sprintf(strbuf,"%d:", base1+4); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>msxofs+15 && mxmsyofs+12 && mymsxofs+15 && mxmsyofs+22 && mymsxofs+15 && mxmsyofs+32 && mymsxofs+15 && mxmsyofs+42 && mymsxofs+15 && mxmsyofs+52 && mymsxofs+146 && mxmsyofs+63 && my(msxofs+msxsize-9) && (mx(msyofs+1) && (mymsxofs && mxmsyofs && my<(msyofs+9) && !moving) { moving=1; mxo=mx-msxofs; myo=my-msyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (key[SCAN_UP]) { key[SCAN_UP]=0; if (base1) base1--; last_pressed=0; continue; } if (key[SCAN_DOWN]) { key[SCAN_DOWN]=0; if (base1<95) base1++; last_pressed=0; continue; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=ms[base1].t; break; case 1: ctf=2; str=ms[base1+1].t; break; case 2: ctf=3; str=ms[base1+2].t; break; case 3: ctf=4; str=ms[base1+3].t; break; case 4: ctf=5; str=ms[base1+4].t; break; case 5: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=5; str=ms[base1+4].t; break; case 1: ctf=0; str=0; break; case 2: ctf=1; str=ms[base1].t; break; case 3: ctf=2; str=ms[base1+1].t; break; case 4: ctf=3; str=ms[base1+2].t; break; case 5: ctf=4; str=ms[base1+3].t; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int prxsize=150, prysize=80; int prxofs=50, pryofs=60; void MapPropertiesDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { prxofs = (mx-mxo); pryofs = (my-myo); if (!mb) moving=0; if (prxofs<16) prxofs = 16; if (pryofs<16) pryofs = 16; if (prxofs+prxsize>335) prxofs = 336-prxsize; if (pryofs+prysize>sy+16) pryofs = (sy+16)-prysize; } Window(prxofs, pryofs, prxofs+prxsize, pryofs+prysize, "MAP Properties"); GotoXY(prxofs+10, pryofs+23); printstring("Music:"); TextField(prxofs+33, pryofs+11, 112, mapname, ctf == 1 ? cb : 0); TextField(prxofs+33, pryofs+21, 112, musname, ctf == 2 ? cb : 0); GotoXY(prxofs+18, pryofs+33); printstring("VSP:"); TextField(prxofs+33, pryofs+31, 112, vspname, ctf == 3 ? cb : 0); GotoXY(prxofs+3, pryofs+43); printstring("rstring:"); TextField(prxofs+33, pryofs+41, 112, rstring, ctf == 4 ? cb : 0); BigButton(prxofs+97, pryofs+56, "Resize MAP"); HLine(prxofs+1, pryofs+53, 148, white); GotoXY(prxofs+3, pryofs+58); printstring("xsize:"); sprintf(strbuf,"%d",layer[0].sizex); printstring(strbuf); GotoXY(prxofs+49, pryofs+58); printstring("ysize:"); sprintf(strbuf,"%d",layer[0].sizey); printstring(strbuf); Button(prxofs+117, pryofs+67, "OK"); GotoXY(prxofs+16, pryofs+13); printstring("MAP:"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>prxofs+33 && mxpryofs+11 && myprxofs+33 && mxpryofs+21 && myprxofs+33 && mxpryofs+31 && myprxofs+33 && mxpryofs+41 && myprxofs+97 && mxpryofs+56 && myprxofs+117 && mxpryofs+67 && my(prxofs+prxsize-9) && (mx(pryofs+1) && (myprxofs && mxpryofs && my<(pryofs+9) && !moving) { moving=1; mxo=mx-prxofs; myo=my-pryofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=mapname; break; case 1: ctf=2; str=musname; break; case 2: ctf=3; str=vspname; break; case 3: ctf=4; str=rstring; break; case 4: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=4; str=rstring; break; case 1: ctf=0; str=0; break; case 2: ctf=1; str=mapname; break; case 3: ctf=2; str=musname; break; case 4: ctf=3; str=vspname; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int rsxsize=134, rsysize=44; int rsxofs=20, rsyofs=20; static void PutByte(byte *to, byte v, int x, int y, int w, int h) { if (x<0 || x>=w || y<0 || y>=h) return; to[(y*w)+x]=v; } static byte GetByte(byte *from, int x, int y, int w, int h) { if (x<0 || x>=w || y<0 || y>=h) return 0; return from[(y*w)+x]; } static void PutWord(word *to, word v, int x, int y, int w, int h) { if (x<0 || x>=w || y<0 || y>=h) return; to[(y*w)+x]=v; } static word GetWord(word *from, int x, int y, int w, int h) { if (x<0 || x>=w || y<0 || y>=h) return 0; return from[(y*w)+x]; } void ResizeMapDialog() { char done=0, moving=0; int mxo, myo, cursorblink, basex, basey, i; //, xl, yl; char ctf=0, cb=0, c, t; char *str, *tb; //, *s1, *d1; char nstr1[80], nstr2[80]; word *tbw; //, *s=NULL,*d=NULL; //int temp_width; int a,b; basex=layer[0].sizex; basey=layer[0].sizey; sprintf(nstr1, "%d", basex); sprintf(nstr2, "%d", basey); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { rsxofs = (mx-mxo); rsyofs = (my-myo); if (!mb) moving=0; if (rsxofs<16) rsxofs = 16; if (rsyofs<16) rsyofs = 16; if (rsxofs+rsxsize>335) rsxofs = 336-rsxsize; if (rsyofs+rsysize>sy+16) rsyofs = (sy+16)-rsysize; } Window(rsxofs, rsyofs, rsxofs+rsxsize, rsyofs+rsysize, "Resize MAP"); GotoXY(rsxofs+4, rsyofs+12); printstring("Base X:"); GotoXY(rsxofs+4, rsyofs+22); printstring("Base Y:"); TextField(rsxofs+30, rsyofs+10, 100, nstr1, ctf == 1 ? cb : 0); TextField(rsxofs+30, rsyofs+20, 100, nstr2, ctf == 2 ? cb : 0); Button(rsxofs+69, rsyofs+31, "Resize"); Button(rsxofs+101, rsyofs+31, "Cancel"); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>rsxofs+30 && mxrsyofs+10 && myrsxofs+30 && mxrsyofs+20 && myrsxofs+69 && mxrsyofs+31 && myrsxofs+101 && mxrsyofs+31 && my(rsxofs+rsxsize-9) && (mx(rsyofs+1) && (myrsxofs && mxrsyofs && my<(rsyofs+9) && !moving) { moving=1; mxo=mx-rsxofs; myo=my-rsyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=nstr1; break; case 1: ctf=2; str=nstr2; break; case 2: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=2; str=nstr2; break; case 1: ctf=0; str=0; break; case 2: ctf=1; str=nstr1; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); basex=atoi(nstr1); basey=atoi(nstr2); } int cdxsize=150, cdysize=45; int cdxofs=110, cdyofs=70; char curtrack=1; void CDDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { cdxofs = (mx-mxo); cdyofs = (my-myo); if (!mb) moving=0; if (cdxofs<16) cdxofs = 16; if (cdyofs<16) cdyofs = 16; if (cdxofs+cdxsize>335) cdxofs = 336-cdxsize; if (cdyofs+cdysize>sy+16) cdyofs = (sy+16)-cdysize; } Window(cdxofs, cdyofs, cdxofs+cdxsize, cdyofs+cdysize, "CD Player"); Button(cdxofs+53, cdyofs+10, "Play"); Button(cdxofs+53, cdyofs+21, "Stop"); Button(cdxofs+85, cdyofs+10, "Eject"); Button(cdxofs+85, cdyofs+21, "Close"); Button(cdxofs+117, cdyofs+10, "Next"); Button(cdxofs+117, cdyofs+21, "Prev"); Button(cdxofs+117, cdyofs+32, "OK"); GotoXY(cdxofs+4, cdyofs+18); printstring("Track "); sprintf(strbuf,"%d",curtrack); printstring(strbuf); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>cdxofs+53 && mxcdyofs+10 && mycdxofs+53 && mxcdyofs+21 && mycdxofs+85 && mxcdyofs+10 && mycdxofs+85 && mxcdyofs+21 && mycdxofs+117 && mxcdyofs+10 && mycdxofs+117 && mxcdyofs+21 && my1) curtrack--; while (mb) { ReadMouse(); ShowPage(); ReadMouse(); } WaitRelease(); continue; } if ((mb==1 && mx>cdxofs+117 && mxcdyofs+32 && my(cdxofs+cdxsize-9) && (mx(cdyofs+1) && (mycdxofs && mxcdyofs && my<(cdyofs+9) && !moving) { moving=1; mxo=mx-cdxofs; myo=my-cdyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int ntxsize=130, nytsize=51; int ntxofs=110, ntyofs=70; void NoticeDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { ntxofs = (mx-mxo); ntyofs = (my-myo); if (!mb) moving=0; if (ntxofs<16) ntxofs = 16; if (ntyofs<16) ntyofs = 16; if (ntxofs+ntxsize>335) ntxofs = 336-ntxsize; if (ntyofs+nytsize>sy+16) ntyofs = (sy+16)-nytsize; } Window(ntxofs, ntyofs, ntxofs+ntxsize, ntyofs+nytsize, "Notice!"); GotoXY(ntxofs+20, ntyofs+20); printstring("Don't forget to add this"); GotoXY(ntxofs+14, ntyofs+26); printstring("layer to the Render String!"); Button(ntxofs+50, ntyofs+36, "OK"); GotoXY(ntxofs+25, ntyofs+14); printstring("Layer has been added."); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if ((mb==1 && mx>ntxofs+50 && mxntyofs+36 && my(ntxofs+ntxsize-9) && (mx(ntyofs+1) && (myntxofs && mxntyofs && my<(ntyofs+9) && !moving) { moving=1; mxo=mx-ntxofs; myo=my-ntyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); } int oxsize=150, oysize=98; int oxofs=120, oyofs=70; extern char vcedprog[80]; void OptionsDialog() { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; char nstr1[80], nstr2[80], nstr3[80], nstr4[80]; sprintf(nstr1, "%d", winbg); sprintf(nstr2, "%d", titlebg); sprintf(nstr3, "%d", brightw); sprintf(nstr4, "%d", darkw); last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { oxofs = (mx-mxo); oyofs = (my-myo); if (!mb) moving=0; if (oxofs<16) oxofs = 16; if (oyofs<16) oyofs = 16; if (oxofs+oxsize>335) oxofs = 336-oxsize; if (oyofs+oysize>sy+16) oyofs = (sy+16)-oysize; } Window(oxofs, oyofs, oxofs+oxsize, oyofs+oysize, "MapEd Options"); GotoXY(oxofs+16, oyofs+12); printstring("Smooth Scroll"); CheckBox(oxofs+5, oyofs+11, scrollmode); GotoXY(oxofs+16, oyofs+20); printstring("Tile Highlight"); CheckBox(oxofs+5, oyofs+19, mh); GotoXY(oxofs+38, oyofs+31); printstring("Window Background"); TextField(oxofs+5, oyofs+29, 30, nstr1, ctf == 1 ? cb : 0); TextField(oxofs+5, oyofs+39, 30, nstr2, ctf == 2 ? cb : 0); GotoXY(oxofs+38, oyofs+41); printstring("Titlebar Background"); CheckBox(oxofs+74, oyofs+11, vm); GotoXY(oxofs+84, oyofs+12); printstring("320x240 driver"); CheckBox(oxofs+74, oyofs+19, mouse_scroll); GotoXY(oxofs+84, oyofs+20); printstring("Mouse Scrolling"); TextField(oxofs+5, oyofs+49, 30, nstr3, ctf == 3 ? cb : 0); TextField(oxofs+5, oyofs+59, 30, nstr4, ctf == 4 ? cb : 0); GotoXY(oxofs+38, oyofs+51); printstring("White"); GotoXY(oxofs+38, oyofs+61); printstring("Shadow"); Button(oxofs+60, oyofs+85, "OK"); HLine(oxofs+1, oyofs+71, 148, white); GotoXY(oxofs+3, oyofs+76); printstring("Editor:"); TextField(oxofs+28, oyofs+74, 118, vcedprog, ctf == 5 ? cb : 0); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if (mb==1 && mx>oxofs+5 && mxoyofs+11 && my>4; xwin=xwin<<4; ywin=ywin>>4; ywin=ywin<<4; scrollmode ^= 1; WaitRelease(); continue; } if (mb==1 && mx>oxofs+5 && mxoyofs+19 && myoxofs+5 && mxoyofs+29 && myoxofs+5 && mxoyofs+39 && myoxofs+74 && mxoyofs+11 && myoxofs+74 && mxoyofs+19 && myoxofs+5 && mxoyofs+49 && myoxofs+5 && mxoyofs+59 && myoxofs+60 && mxoyofs+85 && myoxofs+28 && mxoyofs+74 && my(oxofs+oxsize-9) && (mx(oyofs+1) && (myoxofs && mxoyofs && my<(oyofs+9) && !moving) { moving=1; mxo=mx-oxofs; myo=my-oyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (last_pressed==SCAN_TAB && !key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=1; str=nstr1; break; case 1: ctf=2; str=nstr2; break; case 2: ctf=3; str=nstr3; break; case 3: ctf=4; str=nstr4; break; case 4: ctf=5; str=vcedprog; break; case 5: ctf=0; str=0; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (last_pressed==SCAN_TAB && key[SCAN_LSHIFT]) { switch (ctf) { case 0: ctf=5; str=vcedprog; break; case 1: ctf=0; str=0; break; case 2: ctf=1; str=nstr1; break; case 3: ctf=2; str=nstr2; break; case 4: ctf=3; str=nstr3; break; case 5: ctf=4; str=nstr4; break; } key[SCAN_TAB]=0; last_pressed=0; cb=1; cursorblink=systemtime+40; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); winbg=atoi(nstr1); titlebg=atoi(nstr2); brightw=atoi(nstr3); darkw=atoi(nstr4); } int vcexsize=200, vceysize=60; int vcexofs=76, vceyofs=70; void VCNotify(char *msg) { char done=0, moving=0; int mxo, myo, cursorblink; char ctf=0, cb=0, c, t, *str; last_pressed=0; do { RenderMap(); RenderGUI(); if (ctf && systemtime >= cursorblink) { cb ^= 1; cursorblink = systemtime+40; } if (moving) { vcexofs = (mx-mxo); vceyofs = (my-myo); if (!mb) moving=0; if (vcexofs<16) vcexofs = 16; if (vceyofs<16) vceyofs = 16; if (vcexofs+vcexsize>335) vcexofs = 336-vcexsize; if (vceyofs+vceysize>sy+16) vceyofs = (sy+16)-vceysize; } Window(vcexofs, vceyofs, vcexofs+vcexsize, vceyofs+vceysize, "VergeC Error Report"); Button(vcexofs+85, vceyofs+41, "OK"); GotoXY(vcexofs+29, vceyofs+17); printstring("VCC has reported the following error:"); GotoXY(vcexofs+100-(pixels(msg)/2), vceyofs+23); printstring(msg); DrawMouse(); ShowPage(); CheckTimerStuff(); // input phase if ((mb==1 && mx>vcexofs+85 && mxvceyofs+41 && my(vcexofs+vcexsize-9) && (mx(vceyofs+1) && (myvcexofs && mxvceyofs && my<(vceyofs+9) && !moving) { moving=1; mxo=mx-vcexofs; myo=my-vceyofs; continue; } if (mb==1 && !moving) { ctf=0; cb=0; str=0; WaitRelease(); } if (last_pressed) { if (key[SCAN_LSHIFT] || key[SCAN_RSHIFT]) c=key_shift_tbl[last_pressed]; else c=key_ascii_tbl[last_pressed]; if (last_pressed==SCAN_ESC) { key[SCAN_ESC]=0; done=1; break; } if (last_pressed==SCAN_ENTER) { key[SCAN_ENTER]=0; ctf=0; str=0; last_pressed=0; continue; } if (!ctf) continue; if (last_pressed==SCAN_BACKSP && strlen(str)) { str[strlen(str)-1]=0; key[SCAN_BACKSP]=0; last_pressed=0; continue; } else if (last_pressed==SCAN_BACKSP) { last_pressed=0; continue; } t=strlen(str); str[t]=c; str[t+1]=0; last_pressed=0; } } while (!done); }