home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FreeWare Collection 2
/
FreeSoftwareCollection2pd199x-jp.img
/
demo
/
help.c
< prev
next >
Wrap
Text File
|
1990-06-14
|
6KB
|
360 lines
#include "demo.h"
void
MusicSwitch()
{
if (MusicFlag) {
MusicStop();
} else {
MusicStart(MusicTable[region]);
}
}
void
InitialStart()
{
int joy;
EGB_writeMode(GWork,0);
ClrObject();
region = 0;
Myx = 1;
Myy = 3;
level = 0;
mapedit();
DispObject();
}
void
SpeedSelect()
{
int joy,select,x,y,bsel,end;
BOX box;
while ((joy & 0xff) != 0xff) {
SND_joy_in_2(0,&joy);
}
EGB_color(GWork,0,6);
EGB_color(GWork,2,6);
EGB_writeMode(GWork,4);
select = 0;
end = 0;
x = select*100+273+4;
y = 416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
do {
SND_joy_in_2(0,&joy);
bsel = select;
if (JoyStatus(joy,RIGHT)) {
if (select < 2) {
select++;
}
} else if (JoyStatus(joy,LEFT)) {
if (select > 0) {
select--;
}
} else if (JoyStatus(joy,TR_A) || JoyStatus(joy,TR_B)) {
switch (select) {
case 0:
WaitCnt = 500;
end = 1;
break;
case 1:
WaitCnt = 200;
end = 1;
break;
case 2:
WaitCnt = 0;
end = 1;
break;
}
}
if (bsel != select) {
x = bsel*100+273+4;
y = 416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
x = select*100+273+4;
y = 416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
}
while ((joy & 0xff) != 0xff) {
SND_joy_in_2(0,&joy);
}
} while(!end);
EGB_writeMode(GWork,0);
}
void
GameSpeed()
{
BOX box;
LINE line;
STRING string;
int cnt;
char *buf;
char *menumes[3] ={
" SLOW ",
"NORMAL",
" FAST "
};
EGB_writeMode(GWork,0);
EGB_color(GWork,0,9);
EGB_color(GWork,2,9);
EGB_paintMode(GWork,0x22);
box.x1 = 273;
box.y1 = 416+8;
box.x2 = 579;
box.y2 = 447+4;
EGB_rectangle(GWork,(char *)&box);
EGB_color(GWork,0,15);
EGB_color(GWork,2,15);
box.x1 = 273+4;
box.y1 = 416+8+4;
box.x2 = 579-4;
box.y2 = 447;
EGB_rectangle(GWork,(char *)&box);
EGB_color(GWork,0,9);
line.no = 2;
line.x1 = 273+4+100-1;
line.y1 = 416+8+4;
line.x2 = 273+4+100-1;
line.y2 = 448;
EGB_unConnect(GWork,(char *)&line);
line.x1 = 273+4+200-1;
line.y1 = 416+8+4;
line.x2 = 273+4+200-1;
line.y2 = 448;
EGB_unConnect(GWork,(char *)&line);
EGB_color(GWork,0,9);
for (cnt=0;cnt<3;cnt++) {
string.x = 273+4-1+cnt*100+2;
string.y = 416+8+4+18;
string.len = 12;
strcpy((char *)string.str,menumes[cnt]);
EGB_sjisString(GWork,(char *)&string);
}
SpeedSelect();
EGB_writeMode(GWork,4);
}
int
MenuSelect()
{
int joy,select,x,y,bsel,ret,end;
BOX box;
EGB_color(GWork,0,6);
EGB_color(GWork,2,6);
EGB_writeMode(GWork,4);
select = 0;
ret = 0;
end = 0;
x = (select / 2)*100+273+4;
y = (select % 2)*21+416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
ret = 0;
do {
SND_joy_in_2(0,&joy);
bsel = select;
if (JoyStatus(joy,UP)) {
if (select % 2) {
select--;
}
} else if (JoyStatus(joy,DOWN)){
if (!(select % 2)) {
select++;
}
} else if (JoyStatus(joy,RIGHT)) {
if ((select / 2) < 2) {
select += 2;
}
} else if (JoyStatus(joy,LEFT)) {
if ((select / 2) > 0) {
select -= 2;
}
} else if (JoyStatus(joy,TR_A) || JoyStatus(joy,TR_B)) {
switch (select) {
case 0:
end = 1;
break;
case 1:
GameSpeed();
end = 1;
break;
case 2:
MusicSwitch();
end = 1;
break;
case 3:
break;
case 4:
/*
InitialStart();
end = 1;
*/
break;
case 5:
end = 1;
ret = 1;
break;
}
}
if (bsel != select) {
x = (bsel / 2)*100+273+4;
y = (bsel % 2)*21+416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
x = (select / 2)*100+273+4;
y = (select % 2)*21+416+8+4;
box.x1 = x;
box.y1 = y;
box.x2 = x+98;
box.y2 = y+19;
EGB_rectangle(GWork,(char *)&box);
}
while ((joy & 0xff) != 0xff) {
SND_joy_in_2(0,&joy);
}
} while(!end);
EGB_writeMode(GWork,0);
return(ret);
}
int
Help()
{
int ret;
GETPUT get;
BOX box;
LINE line;
STRING string;
int cnt;
char *buf;
char *menumes[6] ={
"CANSEL",
" SPEED ",
" MUSIC ",
" ",
" ",
" EXIT "
};
buf = malloc(64*308/2);
get.addr = buf;
get.select = 0x14;
get.x1 = 273;
get.y1 = 416;
get.x2 = 579;
get.y2 = 479;
EGB_getBlock(GWork,(char *)&get);
EGB_color(GWork,0,9);
EGB_color(GWork,2,9);
EGB_paintMode(GWork,0x22);
box.x1 = 273;
box.y1 = 416+8;
box.x2 = 579;
box.y2 = 479-7;
EGB_rectangle(GWork,(char *)&box);
EGB_color(GWork,0,15);
EGB_color(GWork,2,15);
box.x1 = 273+4;
box.y1 = 416+8+4;
box.x2 = 579-4;
box.y2 = 479-7-4;
EGB_rectangle(GWork,(char *)&box);
EGB_color(GWork,0,9);
line.no = 2;
line.x1 = 273+4;
line.y1 = 416+8+4+20;
line.x2 = 579-4;
line.y2 = 416+8+4+20;
EGB_unConnect(GWork,(char *)&line);
line.x1 = 273+4+100-1;
line.y1 = 416+8+4;
line.x2 = 273+4+100-1;
line.y2 = 479-7-4;
EGB_unConnect(GWork,(char *)&line);
line.x1 = 273+4+200-1;
line.y1 = 416+8+4;
line.x2 = 273+4+200-1;
line.y2 = 479-7-4;
EGB_unConnect(GWork,(char *)&line);
EGB_color(GWork,0,9);
for (cnt=0;cnt<6;cnt++) {
string.x = 273+4-1+(cnt/2)*100+2;
string.y = 416+8+4+(cnt%2)*20+18;
string.len = 12;
strcpy((char *)string.str,menumes[cnt]);
EGB_sjisString(GWork,(char *)&string);
}
ret = MenuSelect();
EGB_putBlock(GWork,0,(char *)&get);
free(buf);
return(ret);
}