TIP: Click on subject to list as thread! ANSI
echo: public_domain
to: All
from: Matthew Parker
date: 1996-01-12 23:56:28
subject: bounce.c

/*                                                                           */
/* Written by Matthew Parker and released to the public domain               */
/*                                                                           */
/*                                                                           */
/*  Just a quick program I wrote. It's only based on what bounce.moo does as */
/* I couldn't properly understand the moo file. Define WALL if you want a    */
/* wall. This is my first attempt at writing a program like this so if it is */
/* not very well written and full of bugs you know why. The source looks     */
/* fairly ugly IMO but it is free for anyone who wants it. Should work with
 */ /* Borland and Watcom.                                                 
     */
/*                                                                           */
/* Note: Yes I know that the clr isn't very compatible put the program only  */
/*       works with colour screen adapters anyway.                           */
/*                                                                           */

/* #define WALL */

#include 
#include 
#include 
#include 

#define MAXBALLS 25
#define ESC 27
#define RED   0x0400
#define GREEN 0x0200
#define BLUE  0x0100
#define WHITE 0x0f00

void clr(void);
#pragma aux clr=\
    "mov ax,3"\
    "int 10h"\
    modify [ax];

#ifdef __BORLANDC__
void clr(void)
{
    asm{
        mov ax,3
        int 10h
    }
}
#endif

int x[MAXBALLS],y[MAXBALLS],xd[MAXBALLS],yd[MAXBALLS],colour[MAXBALLS];

main()
{
    int i,select[]={RED,GREEN,BLUE,WHITE};
    unsigned int far *screen=MK_FP(0xb800,0);

    srand((unsigned)time(NULL));

    clr();

#ifdef WALL
    for(i=0;i<30;i++)
        *(screen+(8*80)+i+4)=0x7f00|' ';
#endif

    for(i=0;i=3)&&(x[i]<35))
                    yd[i]=-1;
                if((x[i]==3)&&(y[i]==8))
                    xd[i]=1;
                if((y[i]==9)&&(x[i]>=4)&&(x[i]<34))
                    yd[i]=1;
                if((x[i]==34)&&(y[i]==7))
                    xd[i]=-1;
#endif
                if(x[i]==0)
                    xd[i]=1;
                if(y[i]==0)
                    yd[i]=1;
                if(x[i]==79)
                    xd[i]=-1;
                if(y[i]==24)
                    yd[i]=-1;

                *(screen+(y[i]*80+x[i]))=colour[i]|' ';

                x[i]=x[i]+xd[i];
                y[i]=y[i]+yd[i];
                *(screen+(y[i]*80+x[i]))=colour[i]|0x4;/*diamond character*/
            }
#ifdef WALL
            for(i=0;i<30;i++)
                *(screen+(8*80)+i+4)=0x7f00|' ';
#endif
            delay(60);
        }

        if(getch()==ESC)
            break;
    }
    clr();
    return 0;
}


Matthew Parker
@EOT:

--- MsgedSQ 3.30
* Origin: Blueee Lilly Snowy (3:711/934.31)
SEEN-BY: 690/718 711/809 934
@PATH: 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.