#include "Graphics.h"
#include "Bios.h"
#include "conio.h"
#include "Stdlib.h"
#include "Dos.h"
#define UP 0x4800
#define DOWN 0x5000
#define LEFT 0x4600
#define RIGHT 0x4d00
#define ESC 0x0016
#define VGA256 0x13
#define TEXT 0x03
int x,y,l,sxzy=0,zx=0,xx=5,yy=167;
int x1=5,y1=3,x3=0,y3=0,x4=0,y4=0;
int youlife=50,mylife=30;
int board[100][170];
unsigned char far *video_buff= (char FAR *) 0xa0000000l;
void Setvideomode (int mode)
{Union regs Inregs,outregs;
inregs.h.ah=0;
inregs.h.al= (unsigned char) mode;
Int86 (0x10,&inregs,&outregs);
}
void V_line (int y0,int y1,int x,unsigned int color)
{unsigned int address,n,temp;
Address=320*y0+x;
for (n=0;n<=y1-y0;n++)
{
if (y0>y1)
{
Temp=y1;
Y1=y0;
Y0=temp;
}
Video_buff[address]=color;
address+=320;
}
}
void H_line (int x0,int x1,int y,unsigned int color)
{unsigned int address,n,temp;
address=320*y+x0;
for (n=0;n<=x1-x0;n++)
{
if (x0>x1)
{
temp=x1;
x1=x0;
X0=temp;
}
Video_buff[address]=color;
Address+=1;
}
}
void P_pixel (int x,int y,unsigned int color)
{Video_buff[y*320+x]=color;
}
void S_square (int x,int y,int side,int color)
{
H_line (X,x+side,y,color);
H_line (X,x+side,y+side,color);
V_line (Y,y+side,x,color);
V_line (Y,y+side,x+side,color);
}
void R_rectangle (int x1,int y1,int x2,int y2,int color)
{
H_line (X1,x2,y1,color);
H_line (X1,x2,y2,color);
V_line (Y1,y2,x1,color);
V_line (Y1,y2,x2,color);
}
void FillRectangle (int x1,int y1,int x2,int y2,int color)
{
int i;
for (i=y1;i<=y2;i++)
{
H_line (X1,x2,i,color);
}
}
void Ground ()/* Draw outer frame * *
{R_rectangle (104,20,207,190,7);
}
void Delzx ()/* Remove fist after each punch
{delay (1000);
S_square (x3,y3,5,0);
S_square (x3,y3-6,5,0);
x3=0;
y3=0;
}
void Me ()/* Draw myself/
{int cas=0;
if (sxzy==18432)/* If you press the key, move Up/
{yy-=5;
if (yy < y1+30)
yy+=5;
if (yy==12)
yy=17;
}
if (sxzy==20480)/* If you press the key, move Down * *
{yy+=5;
if (yy==172)
yy=167;
}
if (sxzy==19200)/* If you press the left button, move to the left.
{xx--;
if (xx==-1)
xx=0;
}
if (sxzy==19712)/* If you press the right button, move to the right.
{xx++;
if (xx==13)
xx=12;
}
sxzy=0;
for (x=xx;x<5+xx;x++)/* To build a skeleton for yourself * *
{
if (X==XX)/* Left hand * *
{
y=167;
Board[x][yy]=1;
if (zx==11386)
{
board[x][yy-12]=3;
board[x][yy-11]=3;
if ((Yy-11 < y1+30) && (xx>=x1 && xx<=x1+4))
youlife--;
Cas=1;
zx=0;
}
x + +;
}
if (x==xx+4)/* Right hand *
{
y=167;
Board[x][yy]=1;
if (zx==11640)
{
board[x][yy-12]=3;
board[x][yy-11]=3;
if ((Yy-11 < y1+30) && (xx+4<=x1+4 && xx+4>=x1))
youlife--;
cas=2;
zx=0;
}