84 lines
1.7 KiB
Plaintext
84 lines
1.7 KiB
Plaintext
/***
|
|
|
|
People used to make text adventures.
|
|
This might get you started.
|
|
|
|
***/
|
|
|
|
|
|
$PI,"<sword>",1$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define ROOM_NULL 0
|
|
#define ROOM_LIVING 1
|
|
#define ROOM_CLOSET 2
|
|
#define ROOM_BED 3
|
|
|
|
U8 sword_room=ROOM_CLOSET;
|
|
U8 cur_room=ROOM_LIVING;
|
|
|
|
void ShowPossessions()
|
|
{
|
|
coutln "You have";
|
|
if (sword_room==ROOM_NULL) {
|
|
PutGrElem($IB,"<sword>",1$,$IS,"size",1$);
|
|
coutln "$$CM,0,15$$";
|
|
}
|
|
}
|
|
|
|
void ShowContents()
|
|
{
|
|
coutln "You See";
|
|
if (sword_room==cur_room) {
|
|
PutGrElem($IB,"<sword>",2$,$IS,"size",3$);
|
|
coutln "$$CM,0,15$$";
|
|
}
|
|
}
|
|
|
|
void MyAdventure()
|
|
{
|
|
I8 ch=0;
|
|
while (ch!=CH_ESC && ch!=CH_CTRLQ) {
|
|
switch (cur_room) {
|
|
case ROOM_LIVING:
|
|
coutln "Living room";
|
|
break;
|
|
case ROOM_CLOSET:
|
|
coutln "Closet";
|
|
break;
|
|
case ROOM_BED:
|
|
coutln "Bed Room";
|
|
break;
|
|
}
|
|
ShowContents;
|
|
ShowPossessions;
|
|
ch=ToUpper(GetChar(NULL,FALSE));
|
|
if (ch=='L') cur_room=ROOM_LIVING;
|
|
if (ch=='C') cur_room=ROOM_CLOSET;
|
|
if (ch=='B') cur_room=ROOM_BED;
|
|
if (ch=='P' && cur_room==sword_room)
|
|
sword_room=ROOM_NULL;
|
|
if (ch=='D' && sword_room==ROOM_NULL)
|
|
sword_room=cur_room;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
MyAdventure;
|
|
|