[unix-pc.general] ESCape problem with tetris/tetrix game

thad@cup.portal.com (Thad P Floryan) (12/04/89)

Having just seen Hans Jespersen's posting of "rocks" (aka asteroids) and tetrix
to unix-pc.sources, had to see if they worked.  :-)

Both are really neat, but I encountered a really bizarre after-game problem
with tetrix.  I sent the attached message to Hans, and am curious if anyone
else is having the same problem.  If you are, would probably be best to send
Hans your speculations and/or fixes so he can update the master sources and
release an official fix (if one is necessary).

Hans can be reached at:

	hjespers@attcan.uucp  (OR)  uunet!attcan!hjespers

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

-------------------- attachment follows --------------------	
Hi!

Just saw your recent postings of "rocks" (aka asteroids) and "tetris" (aka
tetrix).  Really neat!  Thanks for porting and posting them!

But I did discover a strange problem occurring ONLY with tetrix, and it
concerns restoring the proper tty modes after the game.  Specifically, after
playing tetrix, the ESCape key is fooled into sending TWO instead of ONE
escape for each depression.  I first thought it was a problem with my keyboard,
but simply logging out and logging back in cured the problem.

I discovered the problem in EMACS (where the ESCape key is an important one)
and in ksh where the ESCape causes filename completion.

Doing "$ stty -a > prior" before running tetrix and "$ stty -a > after"
reveals nothing changed.  Yet, the action of the ESCape key definitely changes
after running tetrix.

I've never encountered this problem before and am at a loss.  Did/do you have
this problem on your system?  I'm running 3.51a and invoke tetrix from ksh; it
makes no difference invoking tetrix from sh or ksh.  Simply entering "q" upon
seeing the initial tetrix menu (and not playing the game) causes the weird
action of the ESCape key upon exit.

Thad

Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

steveb@shade.UUCP (Steve Barber) (12/05/89)

In article <24708@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
> But I did discover a strange problem occurring ONLY with tetrix, and it
> concerns restoring the proper tty modes after the game.  Specifically, after
> playing tetrix, the ESCape key is fooled into sending TWO instead of ONE
> escape for each depression. I first thought it was a problem with my keyboard
> but simply logging out and logging back in cured the problem.

I noticed this too, although hadn't tracked it down to tetrix that caused
the problem...  I *have* seen this behavior even before the latest version
of tetrix.  I generally notice something's wrong when vi beeps every time I
hit escape.

> I've never encountered this problem before and am at a loss.  Did/do you have
> this problem on your system?  I'm running 3.51a and invoke tetrix from ksh; it
> makes no difference invoking tetrix from sh or ksh.  Simply entering "q" upon
> seeing the initial tetrix menu (and not playing the game) causes the weird
> action of the ESCape key upon exit.
> Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ]

I'm running 3.51a also.

I've also noticed that the new tetrix leaves part of an escape sequence
on the bottom of my screen ("[24").

(Incidentally, I just ran it as ":!windy -b tetrix" from vi, and the escape
problem hasn't happened in this window (yet)).
-- 
--**-Steve Barber----steveb@shade.Ann-Arbor.MI.US----(cmode)-------------------

karl@zip.UUCP (Karl F. Fox) (12/05/89)

In article <24708@cup.portal.com> thad@cup.portal.com (Thad P Floryan) writes:
...
>But I did discover a strange problem occurring ONLY with tetrix, and it
>concerns restoring the proper tty modes after the game.  Specifically, after
>playing tetrix, the ESCape key is fooled into sending TWO instead of ONE
>escape for each depression.  I first thought it was a problem with my keyboard,
>but simply logging out and logging back in cured the problem.

Anyone know what this is for?  I didn't see any mention of it in window(7),
but curses must find it useful:

    % grep ESC /usr/include/sys/window.h
    #define	WIOCSESC	(WIOC|17)	/* set double esc mode */

Also, from curses(3x):

    "In order to initialize the routines, the routine initscr() or
     newterm() must be called before any of the other routines that deal
     with windows and screens are used.  [...] The routine endwin() must
     be called before exiting."

Apply this patch:

Index: tet.c
*** tet.c.ORIG	Mon Dec  4 18:57:42 1989
--- tet.c	Mon Dec  4 18:58:19 1989
***************
*** 409,414 ****
--- 409,415 ----
  	mvaddstr(22,48,"Tetrix says Bye\n");
  	mvaddstr(23,0,"");
  	refresh();
+ 	endwin();
  	sleep(1);
  	ioctl (0, TCSETA, &origtty);
  	exit(0);
-- 
Karl F. Fox, Morning Star Technologies, Inc.               karl@MorningStar.COM

scott@cs.odu.edu (Scott Yelich) (12/08/89)

>  Having just seen Hans Jespersen's posting of "rocks" (aka asteroids)
> and tetrix to unix-pc.sources, had to see if they worked.  :-)

Yes... I compiled tetrix with gcc 1.36 and ti wont play.  I press p and
it gives me the scores.  The only things I can get are the scores and
quit game.

Also, does anyone know a screensaver option that will allow you to run a 
program?  I just zapped getty on a 3b1 and totally lost the machine 8}

Thanx!
--

 -----------------------------------------------------------------------------
 Scott D. Yelich                                 scott@cs.odu.edu [128.82.8.1]
 After he pushed me off the cliff, he asked me, as I fell, ``Why'd you jump?''
 -----------------------------------------------------------------------------