home *** CD-ROM | disk | FTP | other *** search
-
- ┌┬─── ── ─ ─ ── ───────────────────────────────────────────────────┬─ ∙∙
- ││ Alternative Worlds Presents │
- └┼─────────────────────────────────────────────────────────────────────┐
- ││ Mod Name » FMD-13b.MOD │∙
- ││ Difficulty » █▒▒▒▒▒▒▒▒▒▒ (1/10) │:
- ││ WWIV Version » 4.24 ││
- ││ Date Affected » 06/01/95 ││
- :│ Files Affected » COM.C ││
- ∙│ Description » Multilingual Question Prompts Toggable With Space ││
- └─────────────────────────────────────────────────────────────────────┼┐
- │ A French Mod Division Release - (C) 1995 FMD Software ││
- ∙∙ ─┴─────────────────────────────────────────────────── ── ─ ─ ── ───└┘
-
- => CERTIFIED MOD OF THE MONTH IN WWIVNEWS FOR MAY-JUNE 1994 <=
-
- ┌┬══════════════════┐
- ││ Long Description ││
- └══════════════════┴┘
-
- This modification will give you question prompts when prompting you
- for a yes, no or quit. You will be able to select your option by pressing
- the letter directly or by pressing SPACE to toggle to the next option available
- and it supports multi-languages, it will fit with EVERY language you may have
- on your system. This will replace yes/no prompts and yes/no/quit prompts on
- your system.
-
- Revision A:
-
- Bugs fixed:
-
- - Y/N/Q prompt was moving the wrong way, now moves forward.
- - 424 version has problem to redraw the prompts due to RIP code, this is
- now fixed.
-
- Improvements:
-
- - Arrow Keys support, can now use the arrow keys to toggle the prompt, as
- long as the usual space bar. (Partial code done by JAFO)
- - Ascii prompts now put the selection in upper case, last version showed no
- change between the selections. (Idea from Natas)
- - Implantation of a function called GetAllKeys, that will allow you to use
- the arrow keys and Home/End/Esc key ANYWHERE in WWIV if you replace
- "getkey" by this function.
-
- Revision B:
-
- - Updating for WWIV v4.24
- - Fixed the problem with the "ENTER" call.
-
- ┌┬═══════┐
- ││ Tests ││
- └═══════┴┘
-
- This modification has been tested on a virgin WWIV v4.24 source using
- Borland C++ v4.5
-
- ──────────────────────────────────────────────────────────────────────────────
- Legend
- ╔═══╤══════════════════┐
- │ + │ Add This Line │
- │ - │ Delete This Line │
- │ * │ Modify This Line │
- │ = │ Existing Line │
- └═══╧══════════════════╝
- ───[Step 1]────────────────────────────────────────────────────────────────────
-
- Load COM.C and add those functions before int yn(..) :
-
- void RedrawPrompt(int pos, int redo)
- {
- char s[81], s1[81];
- int i, i2;
-
- i2=(strlen(str_yes)+strlen(str_no)+5);
- if (!okansi())
- {
- strcpy(s, str_yes);
- strcpy(s1, str_no);
- strupr(s);
- strupr(s1);
- }
- if (redo)
- for (i=0;i<i2;i++)
- backspace();
- switch (pos)
- {
- case 0:
- npr("7[3%s/4%s7]9: ", str_yes, (okansi())?str_no:s1);
- break;
- case 1:
- npr("7[4%s3/%s7]9: ", (okansi())?str_yes:s, str_no);
- break;
- }
- }
-
- void RedrawPrompt_ynq(int pos, int redo)
- {
- char s[81],s1[81],s2[81];
- int i, i2;
-
- i2=(strlen(str_yes)+strlen(str_no)+strlen(str_quit)+6);
-
- if (!okansi())
- {
- strcpy(s, str_yes);
- strcpy(s1, str_no);
- strcpy(s2, str_quit);
- strupr(s);
- strupr(s1);
- strupr(s2);
- }
- if (redo)
- for (i=0;i<i2;i++)
- backspace();
- switch (pos)
- {
- case 0:
- npr("7[3%s/4%s3/%s7]9: ", str_yes, okansi()?str_no:s1, str_quit);
- break;
- case 1:
- npr("7[4%s3/%s/3%s7]9: ", okansi()?str_yes:s, str_no, str_quit);
- break;
- case 2:
- npr("7[3%s3/%s/4%s7]9: ", str_yes, str_no, okansi()?str_quit:s2);
- break;
- }
- }
-
- ───[Step 2]────────────────────────────────────────────────────────────────────
-
- Replace the following 3 functions:
-
- int yn(void)
- /* The keyboard is checked for either a Y, N, or C/R to be hit. C/R is
- * assumed to be the same as a N. Yes or No is output, and yn is set to
- * zero if No was returned, and yn() is non-zero if Y was hit.
- */
- {
- char ch=0, pos=0, done=0;
-
- if (menu_on() && rip_popup && (!rip_subset))
- {
- outstr("s\r");
- printmenu(330);
- } else
- RedrawPrompt(pos,0);
- do
- {
- ch=GetAllKeys();
- if (ch==*str_yes)
- done=1;
- else if (ch==*str_no)
- done=1;
- else if (ch==32)
- {
- if (pos==0)
- ch=*str_no;
- else
- ch=*str_yes;
- done=1;
- }
- else if ((ch==72) || (ch==75) || (ch=='8') || (ch=='4'))
- {
- pos--;
- if (pos<0)
- pos=1;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt(pos,1);
- }
- else if ((ch==80) || (ch==77) || (ch=='2') || (ch=='6') || (ch==32))
- {
- pos++;
- if (pos>1)
- pos=0;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt(pos,1);
- }
- } while((!done) && (!hangup));
- if (menu_on() && rip_popup && (!rip_subset))
- {
- printmenu(335);
- outstr("u");
- }
- ansic(1);
- if (ch==*str_yes)
- print_yn(2);
- else
- print_yn(3);
- return(ch == *str_yes);
- }
-
- /****************************************************************************/
-
- int ny(void)
- /* This is the same as yn(), except C/R is assumed to be "Y" */
- {
- char ch=0,pos=1,done=0;
-
- if (menu_on() && rip_popup && (!rip_subset))
- {
- outstr("s\r");
- printmenu(330);
- } else
- RedrawPrompt(pos,0);
- do
- {
- ch=GetAllKeys();
- if (ch==*str_yes)
- done=1;
- else if (ch==*str_no)
- done=1;
- if ((ch==72) || (ch==75) || (ch=='8') || (ch=='4'))
- {
- pos--;
- if (pos<0)
- pos=1;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt(pos,1);
- }
- else if ((ch==80) || (ch==77) || (ch=='2') || (ch=='6') || (ch==32))
- {
- pos++;
- if (pos>1)
- pos=0;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt(pos,1);
- }
- else if (ch==13)
- {
- if (pos==0)
- ch=*str_no;
- else
- ch=*str_yes;
- done=1;
- }
-
- } while((!done) && (!hangup));
- if (menu_on() && rip_popup && (!rip_subset))
- {
- printmenu(335);
- outstr("u");
- }
- ansic(1);
- if (ch==*str_no)
- print_yn(3);
- else
- print_yn(2);
- return((ch == *str_yes) || (ch==13));
- }
-
- /****************************************************************************/
-
- char ynq(void)
- {
- char ch=0,pos=0, done=0;
-
- if (menu_on() && rip_popup && (!rip_subset))
- {
- outstr("s\r");
- printmenu(331);
- } else
- RedrawPrompt_ynq(pos,0);
- do
- {
- ch=GetAllKeys();
- if (ch==*str_yes)
- done=1;
- else if (ch==*str_quit)
- done=1;
- else if (ch==*str_no)
- done=1;
- else if ((ch==72) || (ch==75) || (ch=='8') || (ch=='4'))
- {
- pos++;
- if (pos>2)
- pos=0;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt_ynq(pos,1);
- }
- else if ((ch==80) || (ch==77) || (ch=='2') || (ch=='6'))
- {
- pos--;
- if (pos<0)
- pos=2;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt_ynq(pos,1);
- }
- else if (ch==13)
- {
- switch (pos)
- {
- case 0: ch=*str_no; break;
- case 1: ch=*str_yes; break;
- case 2: ch=*str_quit; break;
- }
- done=1;
- }
- else if (ch==32)
- {
- pos--;
- if (pos<0)
- pos=2;
- if (!(menu_on() && rip_popup && (!rip_subset)))
- RedrawPrompt_ynq(pos, 1);
- done=0;
- }
- } while((!done) && (!hangup));
- if (menu_on() && rip_popup && (!rip_subset))
- {
- printmenu(335);
- outstr("u");
- }
- ansic(1);
- if (ch==*str_yes)
- {
- ch='Y';
- print_yn(2);
- } else if (ch==*str_quit) {
- ch='Q';
- pl(str_quit);
- } else {
- ch='N';
- print_yn(3);
- }
- return(ch);
- }
-
- ───[Step 3]────────────────────────────────────────────────────────────────────
-
- Add the following functions at the end of COM.C
-
- unsigned char InKey(void)
- /* This function is the same than inkey(), but it is done to work with the
- * GetAllKeys() function.
- */
- {
- unsigned char ch=0;
-
- if (x_only)
- return(0);
-
- if (charbufferpointer) {
- if (!charbuffer[charbufferpointer]) {
- charbufferpointer = charbuffer[0] = 0;
- } else {
- if ((charbuffer[charbufferpointer])==3)
- charbuffer[charbufferpointer]=16;
- return(charbuffer[charbufferpointer++]);
- }
- }
- if (kbhitb() || (in_extern == 2)) {
- ch = getchd1();
- lastcon = 1;
- if (!(g_flags & g_flag_allow_extended)) {
- if (!ch) {
- if (in_extern)
- in_extern = 2;
- else {
- ch = getchd1();
- skey(ch);
- if ((ch!=72) // UP
- && (ch!=75) // LEFT
- && (ch!=80) // DOWN
- && (ch!=77) // RIGHT
- && (ch!=71) // HOME
- && (ch!=79)) // END
- ch=0;
- }
- } else if (in_extern)
- in_extern = 1;
- }
- timelastchar1=timer1();
- } else if (incom && comhit()) {
- ch = (get1c() & andwith);
- lastcon = 0;
- }
- if (!(g_flags & g_flag_allow_extended))
- skey1(&ch);
-
- return(ch);
- }
-
- unsigned char GetAllKeys(void)
- /* This function is the same that getkey(), but it allows you to use the
- * arrow keys (remote and locally) and the home/end keys. You can easily
- * add any other extended keys as long as you know its ANSI and Scan code
- * for this key.
- */
- {
- unsigned char ch;
- int beepyet,done=0,pass=0;
- long dd,tv,tv1;
-
- beepyet = 0;
- timelastchar1=timer1();
-
- if (so())
- tv=10920L;
- else
- tv=3276L;
-
- tv1=tv/2;
-
- if (!tagging || (thisuser.sysstatus & sysstatus_no_tag))
- lines_listed = 0;
- do
- {
- switch (pass)
- {
- case 0: if ((ch>31) && (ch<123)) done=1; break;
- case 1:
- if ((incom) && (ch!=255))
- done=1;
- if ((incom) && (ch!='\x1b'))
- {
- switch (ch)
- {
- case 71: return(71); // HOME
- case 72: return(72); // UP
- case 75: return(75); // LEFT
- case 77: return(77); // RIGHT
- case 79: return(79); // END
- case 80: return(80); // DOWN
- default: return(27); // ESC
- }
- }
- break;
- case 2:
- switch(ch)
- {
- case 'A': return(72); // UP
- case 'B': return(80); // DOWN
- case 'C': return(77); // RIGHT
- case 'D': return(75); // LEFT
- case 'K': return(79); // END
- case 'H': return(71); // HOME
- default: return(27); // ESC
- }
- default: done=1;
- }
- do
- {
- while (empty() && !hangup)
- {
- giveup_timeslice();
- dd = timer1();
- if ((dd<timelastchar1) && ((dd+1000)>timelastchar1))
- timelastchar1=dd;
- if (labs(dd - timelastchar1) > 65536L)
- timelastchar1 -= 1572480L;
- if (((dd - timelastchar1) > tv1) && (!beepyet))
- {
- beepyet = 1;
- outchr(7);
- }
- if (labs(dd - timelastchar1) > tv)
- {
- nl();
- if (!in_extern)
- outstr(get_string(924));
- nl();
- hangup = 1;
- }
- checkhangup();
- }
- ch = InKey();
- } while (!ch && !in_extern && !hangup);
- pass++;
- } while (!done && !hangup);
- if (checkit && (ch > 127)) {
- checkit = 0;
- ch = ch & (andwith = 0x7F);
- }
- return(upcase(ch));
- }
-
- ───[Step 4]────────────────────────────────────────────────────────────────────
-
- Do a MAKE FCNS and compile back the BBS, you should be able to see the prompts
- everywhere you want to. You should check your strings files for possible
- (Y/N) or (Y/N/Q) prompts there, and delete them (use the free WWIVsys' string
- editor to do that).
-
- French Proverb: Un tien vaut mieux que deux tu l'auras.
-
- For comments, bug report and suggestion, e-mail at the following address:
-
- Nicolas LeBlanc 2@20302.WWIVnet (aka Spotnick)
- -> spotnick@gamemaster.qc.ca
- Martin Bourdages 242@20306 / 3@20302.WWIVnet (aka Dark Shadow)
- -> martin.bourdages@radio.magicnet.com
-
- => French Mod Division Support Sub <=
- SubType: FMD
- Host: @20302 (WWIVnet)
- Scan sublist for other networks
-
- Read PRODUCTS.FMD for the full list of our support systems.
-
- ───[EOF]──────────────────────────────────────────────────────────────────────
-