home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Hack-Phreak Scene Programs
/
cleanhpvac.zip
/
cleanhpvac
/
ARSRC21.ZIP
/
AR256H5.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-06-02
|
24KB
|
948 lines
// Main file of 2nd module
// this module contains frontend, ending, and tweenturns
// ar256ex is externals that were declared in ar256
// ar256def is defs of mouse and screenmsgs
// ar245h is defs of sqare and monster
// frontend
#include <dos.h>
#include<process.h>
#include <graphics.h>
#include <string.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "ar256h.cpp"
enum tf {true,false};
//#include "ar256m.cpp"
#include "svga256.h"
#include"ar256def.h"
#include "ar256ex.h"
//#include "ar256h2.cpp"
extern screenmsgs s;
extern mouse m;
//extern char equal_flag;
int tweenturns();
int frontend(int);
void getname(int,int,int);
int mark(int,int,int);
int niceellipse(int,int,int,int);
int bigtile(int,int,unsigned char far *,char,char);
int ending();
int ending2();
int bossmsg();
char * endalloc();
void getstrengths();
void besilly(int);
void dimthegreys();
frontend(int pl)
{
char equal_flag=0;
FILE *in;
char *star,*are,*na;
int oldmx,oldmy;
char buf[4];
int i,j,ii,gotname=0,x,y,r;
signed char textx=8;
int cj=1,cursorx[30],cursory[30],cursorcol[30];
char *messages;char pmsgs[3];long timecounter=0,msgcounter=0;
messages=(char *)malloc(900);
//pmsgs=(char *)malloc(21);
strcpy(messages," ARENA v2.0 for DOS -- pure strategy\
in pure SVGA. Written by Ben Peterson using love, patience \
and lots of global variables :) Why not register Arena \
and get the single-player version? Hours of pointless fun! \
Aw, hell, all the things you can say in little scrolling \
shareware messages have already been said. Usually with \
much better scrolling. In fact, I bet nobody ever \
reads this. I bet you just thought: 'Hey, another scrolling \
message. Whee.' and clicked on 'play'. But I have to write \
SOMETHING here in this space I just allocated, don't I? ");
star=(char *)malloc(0x400);
are=(char *)malloc(0x400);
na=(char *)malloc(0x400);
in=fopen("star.dat","rb");
for (i=0;i<0x400;++i)
{
fscanf(in,"%c",&star[i]);
}
fclose(in);
in=fopen("are.dat","rb");
for (i=0;i<0x400;++i)
{
fscanf(in,"%c",&are[i]);
}
fclose(in);
in=fopen("na.dat","rb");
for (i=0;i<0x400;++i)
{
fscanf(in,"%c",&na[i]);
}
fclose(in);
if (pl<2)pl=2;
players=pl; // so that you get # of players = to cmd line names
pcol[0]=0x23;pcol[1]=0x2c;pcol[2]=0x3d;pcol[3]=0x39;
maxmon=29;
width=25;height=25;
//setvisualpage(3);setactivepage(0);
setfillpattern(pattern,0);
bar(0,0,640,250);
m.unsetbounds();
m.wheremouse();
for(i=0;i<20;++i)
{
cursorx[i]=m.x;cursory[i]=m.y;
}
for(i=2;i<26;++i)
{cursorcol[i]=i%16;}
cursorcol[0]=15,cursorcol[1]=15; //set up cursor
for(i=0;i<10;++i)
{
x=random(630),y=random(230);
bigtile(x,y,star,1,0);//color irrelevant
}
setfillpattern(pattern,2);
bar(0,250,640,480);
for(i=0;i<20;++i)
{
r=random(20)+2;
bigtile(i*32,240,tile[r],1,random(15));
}
for(i=0;i<12;++i)
{
r=random(20)+2;
bigtile(i*64,260,tile[r],2,random(15));
}
for(i=0;i<10;++i)
{
r=random(20)+1;
bigtile(i*96,300,tile[r],3,random(15));
}
for(i=0;i<5;++i)
{
r=random(20)+2;
bigtile(i*128,360,tile[r],4,random(15));
}
/* for(y=-240;y<240;++y)
{
for(x=-320;x<320;++x)
{
if(((x*x*5)+(y*y*5))%3)putpixel(x+320,y+240,2);
}
}
*/
setfillstyle(1,0);setcolor(0x0f);
niceellipse(125,150,50,30);
niceellipse(125,250,50,30);
niceellipse(125,350,50,30);
niceellipse(500,150,70,20);
niceellipse(500,225,70,20);
niceellipse(500,300,70,20);
niceellipse(500,375,70,20);
bigtile(220,20,are,3,0); //write logo
bigtile(316,20,na,3,0);
for(i=0;i<4;++i)
{
setfillstyle(1,0);setcolor(0x0f);
fillellipse(220+i*60,420,10,10);setcolor(pcol[i]);
outtextxy(217+i*60,417,itoa(i+1,buf,10));
for(j=0;j<72;j++)
{
setfillstyle(1,j+0x20);
bar(200+i*60,170+j*3,220+i*60,172+j*3);
}
setcolor(0x0f);
for(ii=0;ii<10;ii++)
{
setcolor(27-ii);
rectangle((200+i*60)-ii,170-ii,(220+i*60)+ii,382+ii);
}
}
setfillstyle(1,0);
bar(28*8,13*8,48*8,16*8+6);
for(i=0;i<5;++i)
{
setcolor(18+i);
rectangle(28*8-i,13*8-i,48*8+i,16*8+6+i);//the box the msgs are in
}
niceellipse(155,420,45,20);//play buttons
niceellipse(55,420,48,20);
niceellipse(570,420,40,20);//ballz
niceellipse(480,420,40,20);//UD_monsters
niceellipse(50,200,35,20); //sound
niceellipse(590,200,35,20);//nosound
// fillellipse(500,50,50,20);outtextxy(450,45,"Armies");
// fillellipse(80,30,60,20);outtextxy(30,25,"No Illusions");
// fillellipse(80,70,60,20);outtextxy(30,65,"No True Sight");
setcolor(0xe);
outtextxy(90,145,"2 players");
outtextxy(90,245,"3 players");
outtextxy(90,345,"4 players");
outtextxy(455,145,"Small arena");
outtextxy(455,220,"Normal arena");
outtextxy(455,295,"Large arena");
outtextxy(455,370,"Random arena");
outtextxy(12,417,"RANDOM PLAY");
outtextxy(115,417,"EQUAL PLAY");
outtextxy(555,415,"Orbs");
outtextxy(465,415,"U.D.");
outtextxy(32,195,"Sound");
outtextxy(567,195,"Nosound");
setfillstyle(1,0);
bar(31,41,139,89);bar(501,41,609,89);
rectangle(40,48,130,61);outtextxy(42,51,"1:");outtextxy(58,51,pname[0]);
rectangle(40,68,130,81);outtextxy(42,71,"2:");outtextxy(58,71,pname[1]);
rectangle(510,48,600,61);outtextxy(512,51,"3:");outtextxy(528,51,pname[2]);
rectangle(510,68,600,81);outtextxy(512,71,"4:");outtextxy(528,71,pname[3]);
setcolor(0x0f);
for(i=0;i<15;++i)
{
setcolor(30-i);
rectangle(30-i,40-i,140+i,90+i);rectangle(500-i,40-i,610+i,90+i);
} //draw name entering boxes
moveto(m.x,m.y-17);setcolor(0x0c);
setwritemode(XOR_PUT);penty(2,0);setwritemode(0);//get rid of 1st mouse penty
//-----------MAIN LOOP MAIN LOOP MAIN LOOP WOH YEAH!
for(;;)
{
while(m.wheremouse())
{
++timecounter; // wraps around it's byte...
textx--;if(textx<0)
{ //scroll procedure
textx=8;
++msgcounter;if(msgcounter>610)msgcounter=0;
}
bar(230,113,378,125);
//setcolor(0x07);
for(i=0;i<17;++i)
{
setcolor((msgcounter+i)%24+32);
pmsgs[0]=*(messages+msgcounter+i);
pmsgs[1]=0x00;
outtextxy(233+textx+i*8,116,pmsgs);
}
bar(230,110,238,128);
bar(370,110,378,128);
//delay(5);
if(kbhit())
{
if(getch()=='Q'){closegraph();besilly(1);}//quit! yeah!
}
if(players==2){mark(125,150,32);mark(125,250,0);mark(125,350,0);}
if(players==3){mark(125,150,0);mark(125,250,33);mark(125,350,0);}
if(players==4){mark(125,150,0);mark(125,250,0);mark(125,350,34);}
if(width==15){mark(500,150,35);mark(500,225,0);mark(500,300,0);mark(500,375,0);}
if(width==20){mark(500,150,0);mark(500,225,36);mark(500,300,0);mark(500,375,0);}
if(width==25){mark(500,150,0);mark(500,225,0);mark(500,300,37);mark(500,375,0);}
if(width==0){mark(500,150,0);mark(500,225,0);mark(500,300,0);mark(500,375,38);}
balls?mark(570,420,39):mark(570,420,0);
UD_MONSTERS?mark(480,420,40):mark(480,420,0);
if((m.x!=oldmx)||(m.y!=oldmy))
{
setwritemode(XOR_PUT);
cursorx[26]=m.x,cursory[26]=m.y;
for(cj=1;cj<27;++cj)
{
setcolor(cursorcol[cj]);
moveto(cursorx[cj],cursory[cj]-17);
penty(2,0);
cursorx[cj-1]=cursorx[cj],cursory[cj-1]=cursory[cj],cursorcol[cj-1]=cursorcol[cj];
cursorcol[26]=cursorcol[0];
}
setwritemode(0);
oldmx=m.x;oldmy=m.y;
}
else //if head & tail not in same place, move cursor tail
{
if((cursorx[25]!=cursorx[1])||(cursory[25]!=cursory[1]))
{
setwritemode(XOR_PUT);
cursorx[26]=m.x,cursory[26]=m.y;
for(cj=1;cj<27;++cj)
{
setcolor(cursorcol[cj]);
moveto(cursorx[cj],cursory[cj]-17);
penty(2,0);
cursorx[cj-1]=cursorx[cj],cursory[cj-1]=cursory[cj],cursorcol[cj-1]=cursorcol[cj];
cursorcol[26]=cursorcol[0];
}
}
else // if cursor not busy, delay
{
delay(7);
}
setwritemode(0);
}
}
if(range(125,150,m.x,m.y)<20){bip(4);players=2;}
if(range(125,250,m.x,m.y)<20){bip(5);players=3;}
if(range(125,350,m.x,m.y)<20){bip(6);players=4;}
if(range(500,150,m.x,m.y)<20){bip(7);width=15;height=15;}
if(range(500,225,m.x,m.y)<20){bip(8);width=20;height=20;}
if(range(500,300,m.x,m.y)<20){bip(9);width=25;height=25;}
if(range(500,375,m.x,m.y)<20){bip(10);width=0;height=0;}
if(range(50,200,m.x,m.y)<15){bip(3);noisy=1;}
if(range(590,200,m.x,m.y)<15){bip(3);noisy=0;}
if(range(570,420,m.x,m.y)<15){risingbip(3);balls=balls^0x01;}
if(range(480,420,m.x,m.y)<15){risingbip(4);UD_MONSTERS=UD_MONSTERS^0x01;}
if(range(42,55,m.x,m.y)<10){bip(5);getname(0,58,51);bip(6);}
if(range(42,75,m.x,m.y)<10){bip(6);getname(1,58,71);bip(7);}
if(range(512,55,m.x,m.y)<10){bip(7);getname(2,528,51);bip(8);}
if(range(512,75,m.x,m.y)<10){bip(8);getname(3,528,71);bip(9);}
if((m.x<440)&&(m.x>200)&&(m.y<450)&&(m.y>170)&&(!gotname))
{ //setting colors
i=((m.x-200)/60),j=(pcol[i]);
setfillstyle(1,j);
bar(205+i*60,170+(j-0x20)*3,215+i*60,172+(j-0x20)*3); //erase old marker
j=((m.y-170)/3)+0x20; // first 32 colors not available
//printf("%d %d",pcol[i],j);
pcol[i]=j;
bip(8+(j/4));
setfillstyle(1,0);
bar(205+i*60,170+(j-0x20)*3,215+i*60,172+(j-0x20)*3); //draw new one
setcolor(j);settextstyle(0,0,1);
outtextxy(217+i*60,417,itoa(i+1,buf,10));
}
if(range(155,420,m.x,m.y)<15){equal_flag=1;
break;} //play. woo.
if(range(55,420,m.x,m.y)<15){equal_flag=0;
break;}
gotname=0;
}
if(!width)width=random(20)+10,height=random(20)+10;
pstartx[0]=4,pstartx[1]=width-5,pstartx[2]=width-5,pstartx[3]=4;
pstarty[0]=4,pstarty[1]=height-5,pstarty[2]=4,pstarty[3]=height-5;
for(i=0;i<players;++i)
{
isalive[i]=1;
pgraph[i]=random(3);
if (pgraph[i]==1)pgraph[i]=1;
if (pgraph[i]==2)pgraph[i]=23;
}
setfillstyle(1,0);bar(0,0,640,480);
free(messages);
free(star);free(are);free(na);
if(NOT_REGD)UD_MONSTERS=0;
return(equal_flag);
}
void getname(int player,int x,int y)
{
char chars,c[2],ccol; // c is pointer for benefit of outtextxy
int i;
moveto(m.x,m.y-17);setcolor(0x0e); //blank mouse cursor(?)
setwritemode(XOR_PUT);penty(2,0);
setfillstyle(1,0);settextstyle(0,0,1);
bar(x,y,x+62,y+8);
while(chars<8)
{
++ccol;
setcolor(ccol%16);
rectangle(x+chars*8,y-2,8+x+chars*8,y+9);delay(5);
rectangle(x+chars*8,y-2,8+x+chars*8,y+9);
setcolor(pcol[player]);
if(kbhit())
{
*c=getch();c[1]=0x00; //dont forget to terminate string!
if((*c>0x19)&&(*c<0x7f))//if a printable thang
{
pname[player][chars]=*c;
outtextxy(x+chars*8,y,c);
++chars;
}
if((*c==0x08)&&(chars)) // if delete
{
--chars;
bar(x+chars*8,y,x+8+chars*8,y+8);
pname[player][chars]=0x20;
}
if(*c==0x0d) // if CR
{
for(i=chars;i<9;++i)
{
pname[player][i]=0x00; //dont forget etc etc
}
break;
}
}
}
moveto(m.x,m.y-17);setcolor(0x0e); //blank mouse cursor(?)
penty(2,0);
setwritemode(0);pname[player][8]=0x00;
}
niceellipse(int x,int y,int xrad, int yrad)
{
float i;
fillellipse(x,y,xrad,yrad);
for (i=0;i<3;i++)
{
setcolor(27-i);
ellipse(x,y,0,360,xrad+i,yrad+i);
}
setcolor(0x07);
return(23);
}
mark(int x,int y,int col)
{
y+=3;
int tick[10];
tick[0]=x-21,tick[1]=y+3,tick[2]=x,tick[3]=y+9,tick[4]=x+21,
tick[5]=y+3,tick[6]=x,tick[7]=y+15,tick[8]=x-21,tick[9]=y+3;
setlinestyle(0,0,3);setcolor(col);
//m.offmouse();
drawpoly(5,tick);
//m.onmouse();
setlinestyle(0,0,1);
return(0);
}
bigtile (int tilex,int tiley,unsigned char far *which,char size,char c)
{
int i,px,py;
//if(tile[which][1]!=3)return(1);
for (i=0;i<0x400;++i)
{
px=tilex+(i % 32)*size;py=tiley+(i / 32)*size;
if (which[i] < 0xfe)
{
setfillstyle(1,which[i]);
bar(px,py,px+size,py+size);
}
if (which[i]==0xfe)
{
setfillstyle(1,c);
bar(px,py,px+size,py+size);
}
}
return(0);
}
char *endalloc()
{
char *skulptr;FILE *in;int i;
skulptr=(char *)malloc(0x400);
in=fopen("skull.dat","rb");
for (i=0;i<0x400;++i)
{
fscanf(in,"%c",&skulptr[i]);
}
fclose(in);
return(skulptr);
}
endingtwo()
{
char *skull=(char *)endalloc();
setfillstyle(0,1);setcolor(0x07);setlinestyle(0,0,3);
settextstyle(0,0,3);
bar(100,100,540,330);
rectangle(100,100,540,330);
outtextxy(160,110,"What Lunacy!!");
settextstyle(0,0,1);
outtextxy(110,180,"All the wizards in the game have been destroyed in");
outtextxy(110,190,"their childish and futile squabbling. Justice and");
outtextxy(110,200,"Truth hang their heads as they view the disaster. When");
outtextxy(110,210,"oh when will people ever learn?");
bigtile(250,230,skull,3,0);
getch();
s.bargraph(luck_history,"rolled his dice;","Overall player luck:");
s.graph(tree_history,"defoliated his domain;","Trees standing in any given turn:");
s.graph(attack_history,"reaped his harvest;","Attack power used in any given turn:");
s.graph(strength_history,"allotted his gifts;","Strength of players by turn:");
//dimthegreys();
closegraph();clrscr();m.unsetbounds();
besilly(1);
}
ending()
{
int px,py,i,st;char buf[3];char *skull=(char *)endalloc();
for(i=0;i<players;++i)
{
if(isalive[i]){curpla=i;break;}
}
setfillstyle(0,1);setcolor(0x07);setlinestyle(0,0,3);
bar(100,100,540,380);
rectangle(100,100,540,380);
bigtile(110,110,tile[mon[curpla][0].graphic],2,pcol[curpla]);
settextstyle(0,0,3);setcolor(pcol[curpla]);
outtextxy(175,140,pname[curpla]);
setcolor(0x07);
settextstyle(0,0,2);
outtextxy(110,190,"Is the sole survivor!");
settextstyle(0,0,1);
outtextxy(110,220,"I guess that means we have a winner!");
px=336-moncounter[curpla]*32,py=240; //+16 cos not show wiz
setfillpattern(pattern,0x02);
bar(px-4,py-4,px+moncounter[curpla]*64-64,py+80);//-64 because of not showing wiz.
setfillstyle(1,0);
bar(px-4,py+62,px+moncounter[curpla]*64-64,py+72);
rectangle(px-4,py-4,px+moncounter[curpla]*64-64,py+80);
for (i=1;i<moncounter[curpla];++i)
{
bigtile(px+64*(i-1),py,tile[mon[curpla][i].graphic],2,pcol[curpla]);
st=mon[curpla][i].status;
if(st==0)outtextxy(px+64*i-64,py+64," Gone");
if(st==1)outtextxy(px+64*i-64,py+64," Alive");
if(st==2)outtextxy(px+64*i-64,py+64,"Illusion");
if(st==3)outtextxy(px+64*i-64,py+64," Undead");
if(st==0x11)outtextxy(px+64*(i-1),py+64," Shade");
}
settextstyle(0,0,2);
outtextxy(110,330,"Successful acts of mayhem:");
settextstyle(0,0,1);
for (i=0;i<players;++i)
{
px=130+i*100,py=350;setcolor(pcol[i]);
outtextxy(px,py,pname[i]);outtextxy(px+70,py,itoa(kills[i],buf,10));
}
getch();
s.bargraph(luck_history,"rolled his dice;","Overall player luck:");
s.graph(tree_history,"treated the trees;","Trees standing per turn:");
s.graph(attack_history,"reaped his harvest;","Attack power used per turn:");
s.graph(strength_history,"weighed souls in the balance;","Strength of players by turn:");
setfillstyle(1,0);
bar(0,0,639,479);
bigtile(250,130,skull,4,0);
settextstyle(0,0,2);
setcolor(0x7b);
outtextxy(320-strlen(pname[curpla])*8,280,pname[curpla]);
settextstyle(0,0,1);
outtextxy(190,300,"Is the victor... until next time...");
getch();
dimthegreys();
closegraph();
clrscr();m.unsetbounds();
besilly(1);
}
tweenturns(void)
{
int i,j,ii,jj;
thisturn++;
for(curpla=0;curpla<players;++curpla)
{
if (isalive[curpla])
{
if ((mon[curpla][0].status==0x11)||(mon[curpla][0].status==0))
{
s.decho(curpla);
for(i=0;i<maxmon;++i)
{
mon[curpla][i].status=0;
sq[mon[curpla][i].x][mon[curpla][i].y].whatside=0xff;
}
isalive[curpla]=0;
}
}
}
curpla=4; // this is for mirkwoods
getstrengths();
i=isalive[0]+isalive[1]+isalive[2]+isalive[3];
if(i==1){thisturn++;getstrengths();ending();} // a new lot of strengths are got, so that newly dead wizzes have zeros on the graph
if(i==0){thisturn++;getstrengths();endingtwo();}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if((sq[i][j].land==5)&&(sq[i][j].whose!=5))
{
for(ii=0;ii<3;++ii)
{
for(jj=0;jj<3;++jj)
{
if((i+ii-1>-1)&&(i+ii-1<width)&&(j+jj-1>-1)&&(j+jj-1<height))
{
if((sq[i+ii-1][j+jj-1].whatside!=0xff)&&(sq[i+ii-1][j+jj-1].land!=1)&&(sq[i+ii-1][j+jj-1].land!=10))
{
if(decide(3,mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].defend))
{
drawmap(i,j);
setfillstyle(1,0);bar(482,297,638,351);
rectangle(482,297,638,351);
downbip(1);
outtextxy(485,300,"The vile Mirkwoods");outtextxy(485,310,"Consume a");
setcolor(pcol[sq[i+ii-1][j+jj-1].whatside]);
outtextxy(485,320,mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].name);
mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].status=0;
sq[i+ii-1][j+jj-1].whatside=0xff;
curx=i,cury=j;foom(i+ii-1,j+jj-1);getch();
}
}
}
}
}
} //whee! what fun it is, checking for mirkwood victories!
}
}
for(i=0;i<width;++i) // ages mwoods so they cant attack right after creation
{
for(j=0;j<height;++j)
{
if(sq[i][j].whose==5)sq[i][j].whose=0;
}
}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if(sq[i][j].land==7)
{
for(ii=0;ii<3;++ii)
{
for(jj=0;jj<3;++jj)
{
if((i+ii-1>-1)&&(i+ii-1<width)&&(j+jj-1>-1)&&(j+jj-1<height))
{
if((sq[i+ii-1][j+jj-1].whatside!=0xff)&&(sq[i+ii-1][j+jj-1].land<10))
{
if(mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].immunities==3)
{
continue; //dont hit fire resistors
}
if(decide(3,mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].defend))
{
sq[i+ii-1][j+jj-1].land=7;
drawmap(i,j);
setfillstyle(1,0);bar(482,297,638,351);
rectangle(482,297,638,351);
downbip(1);
outtextxy(485,300,"Sparks leap onto");outtextxy(485,310,"a");
setcolor(pcol[sq[i+ii-1][j+jj-1].whatside]);
outtextxy(500,310,mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].name);
mon[sq[i+ii-1][j+jj-1].whatside][sq[i+ii-1][j+jj-1].whatmonster].status=0;
sq[i+ii-1][j+jj-1].whatside=0xff;
curx=i,cury=j;foom(i+ii-1,j+jj-1);getch();
}
}
if(sq[i+ii-1][j+jj-1].land==6)
{ //if no monster but grass make fire
if(!random(2))sq[i+ii-1][j+jj-1].land=8;
}
}
}
}
} //whee! what fun it is, checking for fires that jump onto monsters
} //and onto grasslands
}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if(sq[i][j].land==7) //put out fires that have been burning.
{
sq[i][j].land=0;
}
}
}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if(sq[i][j].land==8) //age other fires.
{
sq[i][j].land=7;
}
}
}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if(sq[i][j].land==6)
{
for(ii=0;ii<3;++ii)
{
for(jj=0;jj<3;++jj)
{
if((i+ii-1>-1)&&(i+ii-1<width)&&(j+jj-1>-1)&&(j+jj-1<height))
{
if((!random(32))&&(!sq[i+ii-1][j+jj-1].land))
{
sq[i+ii-1][j+jj-1].land=6;
}
}
}
}
} //whee! what fun it is checking for spreading grass!
}
}
return(0);
}
void besilly(int quit)
{
int i,j;char length;
clrscr();
textbackground(4);
cprintf("That was: \n\r");
textcolor(9+BLINK);textbackground(7);
cprintf(" ARENA v2.0 for DOS \n\r");
textcolor(WHITE);textbackground(4);
cprintf(" \n\r");
cprintf(" \n\r");
//cprintf(" \n\r");
cprintf(" Register");
textcolor(LIGHTRED);
cprintf(" Arena for the laughable price of just 10 pounds or \n\r");
cprintf(" 15 dollars -- and recieve the single-player version with \n\r");
cprintf(" it's choice of malicious yet intriguing AI opponents and it's \n\r");
cprintf(" monster editor. \n\r");
textcolor(7);
cprintf(" For instructions on registering, see the accompanying \n\r");
cprintf(" ARENA.TXT file. You can email me at: \n\r");
cprintf(" \n\r");
textcolor(9);
cprintf(" azathoth@zippy.spods.dcs.kcl.ac.uk \n\r");
cprintf(" \n\r");
textcolor(7);
cprintf(" for a detailed discussion of this game and it's concepts, \n\r");
cprintf(" or just to say hi. \n\r");
cprintf(" \n\r");
cprintf(" By the way, if you use POV-Ray, check out STEERPIKE'S \n\r");
cprintf(" tutorial available at ftp.povray.org! It's really good. \n\r");
cprintf(" \n\r");
textbackground(7);textcolor(9);
cprintf(" Press something to quit... \n\r");
textcolor(7);textbackground(4);
cprintf(" \n\r");
cprintf(" \n\r");
//cprintf("\n\r");
textbackground(0);
getch();
for(i=0;i<24;++i)
free (tile[i]);
for(i=0;i<8;++i)
{free (shroom[i]);free (terrt[i]);}
exit(0);
}
bossmsg()
{
//system("dir");
system("mem /c /p");
return(1);
}
void dimthegreys()
{
int i,j,ii,c=63;
if (random(3)) // OI!!!!!
{
for(i=8;i>-32;i-=3 )
{
for(j=0;j<16;++j)
{
c=i+j*3;if((c>253)||(c<0))c=0;
setrgbpalette(j+16,c,c,c);
}
}
}
else
{
for(ii=0;ii<16;++ii)
{
delay(50);
for(i=250;i<128+250;++i)
{
for(j=130;j<130+128;++j)
{
c=getpixel(i,j);
if(c>16)putpixel(i,j,--c);
}
}
}
}
}
void getstrengths()
{
int i,j,num;
for(i=0;i<players;++i)
{
num=0;
for(j=0;j<moncounter[i];++j)
{
num+=mon[i][j].power();
}
strength_history[i][thisturn]=num;
}
for(i=0;i<width;++i)
{
for(j=0;j<height;++j)
{
if(sq[i][j].land==1)
{
tree_history[sq[i][j].whose][thisturn]+=5;
}
}
}
}