In my review of the Agon Light – a single-board computer based around a Z80 CPU – I mentioned that as well as Z80 assembly, there is a good version of the LLVM C/C++ compiler that the Paul Cawte and some in the community has been working on.
Let’s see how far we can get porting my forever-work-in-progress dungeon game to the computer!
Agon C/C++ Compiler: AgDev
AgDev is a port of the TI-84-CE calculator C/C++ tools for Agon Light and it uses the extremely capable and mature LLVM to generate Z80 and eZ80 ADL code. This means you can essentially make full use of the capabilities of the modern Z80 chip or you can treat it as a classic Z80.
To get it up and running you will need to follow the instructions, and I am sure these instructions will mature over time as more people test them out so I won’t attempt to duplicate them here.
When I followed the instructions on my Mac I got the following error:
[compiling] src/main.c
In file included from src/main.c:10:
/Users/chrisg/Agdev/include/stdio.h:4:10: fatal error: 'cdefs.h' file not found
#include <cdefs.h>
^~~~~~~~~
1 error generated.
make: *** [obj/src/main.c.bc] Error 1
The reason turned out to be I was following the instructions but moving files around using Finder! You MUST use the terminal command line to copy the files, otherwise you get the same issue.
Converting Dungeon for Agon Light

Dungeon is a conversion of my work in progress top-down dungeon-delving game. As it is being coded in ANSI C it should “just work”, but of course reality is always different to our “should“, and this is no different.
For all my tutorials I tend to lean towards the same cross-platform dungeon crawler that I have been mainly so-far writing for Commodore machines using BASIC or CC65, and have also developed playable demos using using TRSE.
Commodore machines use 6502 family processors, they have their own character set with some quirks, and CC65 has a Conio.h library that really helps when programming text mode games.
That said, I got it working to a point! Add dungeon.bin to your SD Card or emulator SD Card folder and load as normal.
While the code is still based on PETSCII and therefore the custom characters and maps are messed up, you can move your little guy around, kill things, open doors and so on.
I won’t go into all the general-purpose C code and game logic here, I will keep that in the main series. For today let’s just look at what is unique about this port.
Game Instructions:
- Doors open with keys, or by hitting them repeatedly with your face until you break them (or you run out of health).
- Pick up all the idols to proceed to the next room.
- Gather loot and health.
- Avoid goblins and rats.
Keyboard Controls
W
A S D
F = Fireball (fires in your direction of travel - you need to pick up a potion to top up your magic first)
O/P = Stab Left or Right (you need to pick up a sword first)
Agon C Libraries
AgDev provides two C libraries that help us tremendously.
vdp_key allows us to access keyboard data and check for key presses over the serial connection between the ESP32 and the Z80 processor.
vdp_vdu enables VDU command strings over the same terminal line, and the ability to manipulate FabGL graphics. This means, as well as being able to clear the screen and position the cursor, etc, you will see cool graphics functions available such as:
- vdp_draw_bitmap()
- vdp_load_bitmap()
- vdp_load_bitmap_file()
- vdp_load_sprite_bitmaps()
- vdp_create_sprite()
- vdp_select_sprite()
- vdp_move_sprite_to()
- vdp_move_sprite_by()
- vdp_show_sprite()
These graphics capabilities along with the complexity of supporting yet another text mode is why I didn’t persist with porting over from PETSCII because if I am doing a conversion rather than sticking with the pure cross-platform code, I think the Agon deserves a graphical treatment.
No Conio? No Problem!
My existing C code uses Conio.h but Agon does not have that library – oh no!
Fortunately, the heavy-lifting of supplying the most rudimentary input and output is already done, so I can repurpose my existing keyboard and movement code by translating the existing function names into the Agon world using those aforementioned libraries.
/*
Duplicate or similar to CONIO functions
*/
void cursor(char onoff) {
// Turning off flashing cursor
putch(23); putch(1); putch(onoff);
}
// Clear screen
void clrscr() {
//vdp_mode(3); - Doesn't work, send the characters instead!
char mode[2] = {22,3};
mos_puts(mode,2,0);
vdp_clear_screen();
cursor(0);
}
// Get character from keyboard
int cgetc() {
return inchar();
}
// Position cursor
void gotoxy(char x, char y) {
vdp_cursor_tab(y,x);
}
// Put a character at screen coord
void cputcxy(int x, int y, char c) {
vdp_cursor_tab(y,x);
putch(c); putch(8);
}
/* END OF CONIO */
Custom Character Set

The eagle-eyed folks might notice, despite my saying I didn’t persist with text mode, that there is a little graphical guy in the earlier screenshot.
Agon Light has the ability to use custom “user defined” characters in a similar way to the Vic 20, C64, BBC, and so on.
You simply supply the UDC code 23, followed by the character number you wish to change, and then the 8 rows of bits, like so:
| 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | |
| 0 | ||||||||
| 0 | ||||||||
| X | X | 40 | ||||||
| 0 | ||||||||
| X | X | 68 | ||||||
| X | X | X | 56 | |||||
| 0 | ||||||||
| 0 |
Rename src/udc.bak to main.c and compile, you will see the custom character set output to your screen.
This took me right back to my childhood sat on the floor with graph paper working out my game graphics!
Full C Code (So Far)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <string.h>
#include <agon/vdp_vdu.h>
#include <agon/vdp_key.h>
// Global key variable
bool run=true;
bool in_play=false;
bool obstruction=false;
unsigned int timer,delay;
unsigned int key,i,c,ex,ey,ax,ay;
unsigned char x=19;
unsigned char y=8;
unsigned char old_x, old_y, direction_x, direction_y, fx, fy;
unsigned char room=0;
unsigned char buffer [sizeof(int)*8+1];
// Player
unsigned char keys,idols,potion=0;
int health=100;
int magic=0;
unsigned int score=0;
bool sword = false;
// Enemy
unsigned int enemy_count=0;
struct enemy {
unsigned char tile;
unsigned char room;
unsigned char x;
unsigned char y;
unsigned char old_x;
unsigned char old_y;
char health;
unsigned char strength;
unsigned char speed;
unsigned char armour;
};
unsigned int this_enemy = 0;
struct enemy enemies[1000];
uint8_t FONT_AGON_DATA[256*8];
static const uint8_t FONT_AGON[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //
0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x00, // !
0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, // "
0x36, 0x36, 0x7f, 0x36, 0x7f, 0x36, 0x36, 0x00, // #
0x0c, 0x3f, 0x68, 0x3e, 0x0b, 0x7e, 0x18, 0x00, // $
0x60, 0x66, 0x0c, 0x18, 0x30, 0x66, 0x06, 0x00, // %
0x38, 0x6c, 0x6c, 0x38, 0x6d, 0x66, 0x3b, 0x00, // &
0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, // '
0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, // (
0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, // )
0x00, 0x18, 0x7e, 0x3c, 0x7e, 0x18, 0x00, 0x00, // *
0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, // +
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, // ,
0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, // -
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, // .
0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, // /
0x3c, 0x66, 0x6e, 0x7e, 0x76, 0x66, 0x3c, 0x00, // 0
0x18, 0x38, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, // 1
0x3c, 0x66, 0x06, 0x0c, 0x18, 0x30, 0x7e, 0x00, // 2
0x3c, 0x66, 0x06, 0x1c, 0x06, 0x66, 0x3c, 0x00, // 3
0x0c, 0x1c, 0x3c, 0x6c, 0x7e, 0x0c, 0x0c, 0x00, // 4
0x7e, 0x60, 0x7c, 0x06, 0x06, 0x66, 0x3c, 0x00, // 5
0x1c, 0x30, 0x60, 0x7c, 0x66, 0x66, 0x3c, 0x00, // 6
0x7e, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00, // 7
0x3c, 0x66, 0x66, 0x3c, 0x66, 0x66, 0x3c, 0x00, // 8
0x3c, 0x66, 0x66, 0x3e, 0x06, 0x0c, 0x38, 0x00, // 9
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, // :
0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x30, // ;
0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, // <
0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00, // =
0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, // >
0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00, // ?
0x3c, 0x66, 0x6e, 0x6a, 0x6e, 0x60, 0x3c, 0x00, // @
0x3c, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, // A
0x7c, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x7c, 0x00, // B
0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x00, // C
0x78, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0x78, 0x00, // D
0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x7e, 0x00, // E
0x7e, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x00, // F
0x3c, 0x66, 0x60, 0x6e, 0x66, 0x66, 0x3c, 0x00, // G
0x66, 0x66, 0x66, 0x7e, 0x66, 0x66, 0x66, 0x00, // H
0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, // I
0x3e, 0x0c, 0x0c, 0x0c, 0x0c, 0x6c, 0x38, 0x00, // J
0x66, 0x6c, 0x78, 0x70, 0x78, 0x6c, 0x66, 0x00, // K
0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7e, 0x00, // L
0x63, 0x77, 0x6b, 0x6b, 0x63, 0x63, 0x63, 0x00, // M
0x66, 0x66, 0x76, 0x7e, 0x6e, 0x66, 0x66, 0x00, // N
0x3c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, // O
0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x00, // P
0x3c, 0x66, 0x66, 0x66, 0x6a, 0x6c, 0x36, 0x00, // Q
0x7c, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x00, // R
0x3c, 0x66, 0x60, 0x3c, 0x06, 0x66, 0x3c, 0x00, // S
0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // T
0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, // U
0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, // V
0x63, 0x63, 0x6b, 0x6b, 0x7f, 0x77, 0x63, 0x00, // W
0x66, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x66, 0x00, // X
0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x00, // Y
0x7e, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x7e, 0x00, // Z
0x7c, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7c, 0x00, // [
0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, //
0x3e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3e, 0x00, // ]
0x18, 0x3c, 0x66, 0x42, 0x00, 0x00, 0x00, 0x00, // ^
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, // _
0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, // `
0x00, 0x00, 0x3c, 0x06, 0x3e, 0x66, 0x3e, 0x00, // a 97
0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x7c, 0x00, // b
0x00, 0x00, 0x3c, 0x66, 0x60, 0x66, 0x3c, 0x00, // c
0x06, 0x06, 0x3e, 0x66, 0x66, 0x66, 0x3e, 0x00, // d
0x00, 0x00, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00, // e
0x1c, 0x30, 0x30, 0x7c, 0x30, 0x30, 0x30, 0x00, // f
0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x3c, // g
0x60, 0x60, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, // h
0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00, // i
0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0x0c, 0x0c, 0x78, // j
0x60, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0x00, // k
0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, // l
0x00, 0x00, 0x36, 0x7f, 0x6b, 0x6b, 0x63, 0x00, // m
0x00, 0x00, 0x7c, 0x66, 0x66, 0x66, 0x66, 0x00, // n
0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x00, // o
0x00, 0x00, 0x7c, 0x66, 0x66, 0x7c, 0x60, 0x60, // p
0x00, 0x00, 0x3e, 0x66, 0x66, 0x3e, 0x06, 0x07, // q
0x00, 0x00, 0x6c, 0x76, 0x60, 0x60, 0x60, 0x00, // r
0x00, 0x00, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x00, // s
0x30, 0x30, 0x78, 0x30, 0x30, 0x30, 0x1e, 0x00, // t
0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3e, 0x00, // u
0x00, 0x00, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, // v
0x00, 0x00, 0x63, 0x6b, 0x6b, 0x7f, 0x36, 0x00, // w
0x00, 0x00, 0x66, 0x3c, 0x18, 0x3c, 0x66, 0x00, // x
0x00, 0x00, 0x66, 0x66, 0x66, 0x3e, 0x06, 0x3c, // y
0x00, 0x00, 0x7e, 0x0c, 0x18, 0x30, 0x7e, 0x00, // z
0x0c, 0x18, 0x18, 0x70, 0x18, 0x18, 0x0c, 0x00, // {
0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, // |
0x30, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x30, 0x00, // }
0x66, 0xd6, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, // ~
0x3c, 0x42, 0x9d, 0xb1, 0xb1, 0x9d, 0x42, 0x3c, // © (should be delete)
0x3C, 0x62, 0xF8, 0x60, 0xF8, 0x62, 0x3C, 0x00, // &80 euro symbol
0x00, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, // &81 block (teletext)
0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, // &82 single low quotation mark
0x00, 0x0C, 0x18, 0x18, 0x3C, 0x18, 0x18, 0x70, // &83 small letter f with hook
0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x6C, 0xD8, // &84 double low quotation mark
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x54, 0x00, // &85 horizontal ellipsis
0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00, // &86 dagger
0x18, 0x18, 0x7E, 0x18, 0x18, 0x7E, 0x18, 0x18, // &87 double dagger
0x10, 0x38, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // &88 circumflex accent
0xC6, 0xCC, 0x18, 0x30, 0x60, 0xDB, 0x1B, 0x00, // &89 per mille
0x38, 0x7C, 0xC6, 0x70, 0x1C, 0xC6, 0x7C, 0x00, // &8A capital S caron
0x00, 0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0x00, // &8B left angle quotation mark
0x7E, 0xD8, 0xD8, 0xDE, 0xD8, 0xD8, 0x7E, 0x00, // &8C capital OE ligature
0x30, 0x78, 0xFC, 0x30, 0x30, 0x30, 0x30, 0x00, // &8D up arrow (teletext)
0x38, 0xFE, 0x0C, 0x18, 0x30, 0x60, 0xFE, 0x00, // &8E capital Z caron
0x00, 0x20, 0x60, 0xFE, 0x60, 0x20, 0x00, 0x00, // &8F left arrow (teletext)
0x00, 0x08, 0x0C, 0xFE, 0x0C, 0x08, 0x00, 0x00, // &90 right arrow (teletext)
0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, // &91 left single quotation mark
0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, // &92 right single quotation mark
0x6C, 0x6C, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, // &93 left double quotation mark
0x36, 0x36, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, // &94 right double quotation mark
0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, // &95 bullet
0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x00, 0x00, // &96 en dash
0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, // &97 em dash
0x36, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // &98 small tilde
0xEA, 0x4E, 0x4A, 0x4A, 0x00, 0x00, 0x00, 0x00, // &99 trade mark sign
0x6C, 0x38, 0x7C, 0xC0, 0x78, 0x0C, 0xF8, 0x00, // &9A small S caron
0x00, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x00, 0x00, // &9B right angle quotation mark
0x00, 0x00, 0x7E, 0xDB, 0xDF, 0xD8, 0x7F, 0x00, // &9C small OE ligature
0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x00, // &9D double line (teletext)
0x6C, 0x38, 0x7C, 0x18, 0x30, 0x60, 0x7C, 0x00, // &9E small Z caron
0xCC, 0x00, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x00, // &9F capital Y diaeresis
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // &A0 non-breaking space
0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, // ¡
0x00, 0x18, 0x7E, 0xD8, 0xD8, 0x7E, 0x18, 0x00, // ¢
0x1c, 0x36, 0x30, 0x7c, 0x30, 0x30, 0x7e, 0x00, // £
0x66, 0x3C, 0x66, 0x3C, 0x66, 0x00, 0x00, 0x00, // ¤
0xC3, 0x66, 0x3C, 0x18, 0x3C, 0x18, 0x18, 0x00, // ¥
0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, // ¦
0x3C, 0x60, 0x3C, 0x66, 0x66, 0x3C, 0x06, 0x3C, // §
0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ¨
0x7E, 0x81, 0x9D, 0xB1, 0xB1, 0x9D, 0x81, 0x7E, // ©
0x3C, 0x6C, 0x6C, 0x3E, 0x00, 0x7E, 0x00, 0x00, // ª
0x00, 0x33, 0x66, 0xCC, 0x66, 0x33, 0x00, 0x00, // «
0x00, 0x7E, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, // ¬
0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, // soft hyphen
0x7E, 0x81, 0xB9, 0xA5, 0xB9, 0xA5, 0x81, 0x7E, // ®
0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ¯
0x3C, 0x66, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, // °
0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x7E, 0x00, // ±
0x70, 0x18, 0x30, 0x60, 0x78, 0x00, 0x00, 0x00, // ²
0x78, 0x0C, 0x18, 0x0C, 0x78, 0x00, 0x00, 0x00, // ³
0x0C, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, // ´
0x00, 0x00, 0x66, 0x66, 0x66, 0x7C, 0x60, 0xC0, // µ
0x3E, 0x7A, 0x7A, 0x3A, 0x1A, 0x1A, 0x1A, 0x00, // ¶
0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, // ·
0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x18, 0x00, // ¸
0x30, 0x70, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, // ¹
0x38, 0x6C, 0x6C, 0x38, 0x00, 0x7C, 0x00, 0x00, // º
0x00, 0xCC, 0x66, 0x33, 0x66, 0xCC, 0x00, 0x00, // »
0x43, 0xC6, 0x4C, 0x5A, 0x36, 0x6A, 0xCF, 0x02, // ¼
0x40, 0xC6, 0x4C, 0x5E, 0x33, 0x66, 0xCC, 0x0F, // ½
0xC0, 0x23, 0x66, 0x2D, 0xDB, 0x35, 0x67, 0x01, // ¾
0x18, 0x00, 0x18, 0x30, 0x60, 0x66, 0x3C, 0x00, // ¿
0x70, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x00, // À
0x0E, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x00, // Á
0x18, 0x66, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x00, // Â
0x76, 0xDC, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x00, // Ã
0x66, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x00, // Ä
0x18, 0x18, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x00, // Å
0x3F, 0x6C, 0xCC, 0xFE, 0xCC, 0xCC, 0xCF, 0x00, // Æ
0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x18, // Ç
0x70, 0x00, 0xFE, 0xC0, 0xF0, 0xC0, 0xFE, 0x00, // È
0x0E, 0x00, 0xFE, 0xC0, 0xF0, 0xC0, 0xFE, 0x00, // É
0x18, 0x66, 0x00, 0xFE, 0xF0, 0xC0, 0xFE, 0x00, // Ê
0x66, 0x00, 0xFE, 0xC0, 0xF0, 0xC0, 0xFE, 0x00, // Ë
0x70, 0x00, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x00, // Ì
0x0E, 0x00, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x00, // Í
0x18, 0x66, 0x00, 0x7E, 0x18, 0x18, 0x7E, 0x00, // Î
0x66, 0x00, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x00, // Ï
0x78, 0x6C, 0x66, 0xF6, 0x66, 0x6C, 0x78, 0x00, // Ð
0x76, 0xDC, 0x00, 0xC6, 0xF6, 0xDE, 0xC6, 0x00, // Ñ
0x70, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ò
0x0E, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ó
0x18, 0x66, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, // Ô
0x76, 0xDC, 0x00, 0x7C, 0xC6, 0xC6, 0x7C, 0x00, // Õ
0x66, 0x00, 0x7C, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ö
0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00, 0x00, // ×
0x3E, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x7C, 0x00, // Ø
0x70, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ù
0x0E, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ú
0x18, 0x66, 0x00, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Û
0x66, 0x00, 0xC6, 0xC6, 0xC6, 0xC6, 0x7C, 0x00, // Ü
0x0E, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x00, // Ý
0xC0, 0xC0, 0xFC, 0xC6, 0xFC, 0xC0, 0xC0, 0x00, // Þ
0x3C, 0x66, 0x66, 0x6C, 0x66, 0x66, 0x6C, 0x00, // ß
0x70, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // à
0x0E, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // á
0x18, 0x66, 0x00, 0x3E, 0x66, 0xC6, 0x7E, 0x00, // â
0x76, 0xDC, 0x00, 0x3E, 0x66, 0xC6, 0x7E, 0x00, // ã
0x66, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00, // ä
0x18, 0x18, 0x00, 0x3E, 0x66, 0xC6, 0x7E, 0x00, // å
0x00, 0x00, 0x7E, 0x1B, 0x7F, 0xD8, 0x77, 0x00, // æ
0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x3C, 0x18, // ç
0x70, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // è
0x0E, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // é
0x18, 0x66, 0x00, 0x3C, 0x7E, 0x60, 0x3C, 0x00, // ê
0x66, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00, // ë
0x70, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // ì
0x0E, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // í
0x18, 0x66, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00, // î
0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3C, 0x00, // ï
0x0C, 0x3E, 0x0C, 0x7C, 0xCC, 0xCC, 0x78, 0x00, // ð
0x76, 0xDC, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x00, // ñ
0x70, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // ò
0x0E, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // ó
0x18, 0x66, 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x00, // ô
0x76, 0xDC, 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x00, // õ
0x66, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00, // ö
0x18, 0x18, 0x00, 0x7E, 0x00, 0x18, 0x18, 0x00, // ÷
0x00, 0x02, 0x7C, 0xCE, 0xD6, 0xE6, 0x7C, 0x80, // ø
0x70, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // ù
0x0E, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // ú
0x18, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x00, // û
0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00, // ü
0x0E, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C, // ý
0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, // þ
0x66, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x3C // ÿ
};
unsigned char chars[]={
92, 87,233, 89, 57, 30, 20, 54,
16, 40, 40, 68,124, 68,238, 0,
252, 66, 66,124, 66, 66,252, 0,
56, 68,130,128,130, 68, 56, 0,
252, 66, 66, 66, 66, 66,252, 0,
254, 66, 72,120, 72, 66,254, 0,
254, 66, 72,120, 72, 64,224, 0,
60, 66,128,142,130, 66, 60, 0,
238, 68,124, 68, 68, 68,238, 0,
254, 16, 16, 16, 16, 16,254, 0,
124, 16, 16, 16,144,144, 96, 0,
238, 68, 72,112, 72, 68,238, 0,
224, 64, 64, 64, 66, 66,254, 0,
238, 84, 84, 84, 68, 68,238, 0,
238,100, 84, 84, 76, 76,228, 0,
56, 68,130,130,130, 68, 56, 0,
252, 66, 66, 66,124, 64,224, 0,
56, 68,130,130,146, 76, 58, 0,
252, 66, 66, 66,124, 72,238, 0,
124,130,128,124, 2,130,124, 0,
254,146, 16, 16, 16, 16, 56, 0,
238, 68, 68, 68, 68, 68, 56, 0,
238, 68, 68, 40, 40, 40, 16, 0,
238, 68, 68, 84, 84,108, 68, 0,
238, 68, 40, 16, 40, 68,238, 0,
238, 68, 40, 40, 16, 16, 56, 0,
254,132, 8, 16, 32, 66,254, 0,
60, 48, 48, 48, 48, 48, 60, 0,
};
unsigned char tiles[]={
12, 18, 48,124, 48, 98,252, 0,
60, 12, 12, 12, 12, 12, 60, 0,
0, 2, 4, 8, 80, 32, 80,128,
0, 64, 32, 16, 10, 4, 10, 1,
0, 0, 0, 0, 0, 0, 0, 0,
24, 24, 24, 24, 0, 0, 24, 0,
102,102,102, 0, 0, 0, 0, 0,
254,212,170,212,170,212,170, 0,
24, 62, 96, 60, 6,124, 24, 0,
0, 32, 80,143, 85, 37, 0, 0,
8,148, 72, 46, 26, 36,108, 0,
6, 12, 24, 0, 0, 0, 0, 0,
12, 24, 48, 48, 48, 24, 12, 0,
48, 24, 12, 12, 12, 24, 48, 0,
129,102, 44,195, 52,102,129, 0,
0, 24, 24,126, 24, 24, 0, 0,
0, 0, 0, 0, 0, 24, 24, 48,
0, 0, 0,126, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 24, 0,
0, 3, 6, 12, 24, 48, 96, 0,
56, 68,130,130,130, 68, 56, 0,
48, 80,144, 16, 16, 16,254, 0,
124,130, 2,124,128,130,254, 0,
254,132, 8, 28,130,130,124, 0,
12, 24, 40, 74,254, 10, 28, 0,
254,130,252, 2,130,130,124, 0,
124,130,128,252,130,130,124, 0,
254,132, 8, 8, 16, 16, 56, 0,
124,130,130,124,130,130,124, 0,
124,130,130,130,124, 4,120, 0,
0, 0, 24, 0, 0, 24, 0, 0,
0, 0, 24, 0, 0, 24, 24, 48,
0,126, 0, 60, 0, 24, 0, 0,
239,138, 12, 0,254,170,128, 0,
0, 0, 24, 0, 60, 0,126, 0,
60, 66, 66, 28, 16, 0, 16, 0,
0, 60, 66, 66, 70, 66,126, 0,
8, 28, 62,127,127, 28, 62, 0,
0, 60, 66, 66, 70, 66,126, 0,
0, 0, 0,255, 0, 0, 0, 0,
0, 0,255,255, 0, 0, 0, 0,
0,255,255, 0, 0, 0, 0, 0,
0, 0, 0, 0,255,255, 0, 0,
48, 48, 48, 48, 48, 48, 48, 48,
12, 12, 12, 12, 12, 12, 12, 12,
0, 0, 0,224,240, 56, 24, 24,
24, 24, 28, 15, 7, 0, 0, 0,
24, 24, 56,240,224, 0, 0, 0,
192,192,192,192,192,192,255,255,
192,224,112, 56, 28, 14, 7, 3,
3, 7, 14, 28, 56,112,224,192,
255,255,192,192,192,192,192,192,
255,255, 3, 3, 3, 3, 3, 3,
8, 24,153,126, 60, 60,102,129,
0, 0, 0, 0, 0,255,255, 0,
54,127,107, 99, 42, 28, 8, 0,
96, 96, 96, 96, 96, 96, 96, 96,
0, 0, 0, 7, 15, 28, 24, 24,
195,231,126, 60, 60,126,231,195,
0, 60,126,102,102,126, 60, 0,
24, 60,114, 98, 36, 24, 60, 0,
6, 6, 6, 6, 6, 6, 6, 6,
16, 56,124,226,100, 40, 16, 0,
24, 24, 24,255,255, 24, 24, 24,
96, 8, 72, 48, 0, 96,144,144,
24, 24, 24, 24, 24, 24, 24, 24,
0, 12, 2, 2, 44,124,236, 0,
255,127, 63, 31, 15, 7, 3, 1,
0, 0, 0, 0, 0, 0, 0, 0,
240,240,240,240,240,240,240,240,
0, 0, 0, 0,255,255,255,255,
255, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,255,
192,192,192,192,192,192,192,192,
204,135, 48,102, 8,147,199, 70,
3, 3, 3, 3, 3, 3, 3, 3,
0, 0, 0, 0,131, 92,100,171,
255,254,252,248,240,224,192,128,
3, 3, 3, 3, 3, 3, 3, 3,
24, 24, 24, 31, 31, 24, 24, 24,
0, 0, 0, 0, 15, 15, 15, 15,
24, 24, 24, 31, 31, 0, 0, 0,
0, 0, 0,248,248, 24, 24, 24,
0, 0, 0, 0, 0, 0,255,255,
0, 0, 0, 31, 31, 24, 24, 24,
24, 24, 24,255,255, 0, 0, 0,
0, 0, 0,255,255, 24, 24, 24,
24, 24, 24,248,248, 24, 24, 24,
192,192,192,192,192,192,192,192,
224,224,224,224,224,224,224,224,
7, 7, 7, 7, 7, 7, 7, 7,
255,255, 0, 0, 0, 0, 0, 0,
255,255,255, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,255,255,255,
3, 3, 3, 3, 3, 3,255,255,
0, 0, 0, 0,240,240,240,240,
15, 15, 15, 15, 0, 0, 0, 0,
24, 24, 24,248,248, 0, 0, 0,
240,240,240,240, 0, 0, 0, 0,
240,240,240,240, 15, 15, 15, 15,
195,153,145,145,159,153,195,255,
239,215,215,187,131,187, 17,255,
3,189,189,131,189,189, 3,255,
199,187,125,127,125,187,199,255,
3,189,189,189,189,189, 3,255,
1,189,183,135,183,189, 1,255,
1,189,183,135,183,191, 31,255,
195,189,127,113,125,189,195,255,
17,187,131,187,187,187, 17,255,
1,239,239,239,239,239, 1,255,
131,239,239,239,111,111,159,255,
17,187,183,143,183,187, 17,255,
31,191,191,191,189,189, 1,255,
17,171,171,171,187,187, 17,255,
17,155,171,171,179,179, 27,255,
199,187,125,125,125,187,199,255,
3,189,189,189,131,191, 31,255,
199,187,125,125,109,179,197,255,
3,189,189,189,131,183, 17,255,
131,125,127,131,253,125,131,255,
1,109,239,239,239,239,199,255,
17,187,187,187,187,187,199,255,
17,187,187,215,215,215,239,255,
17,187,187,171,171,147,187,255,
17,187,215,239,215,187, 17,255,
17,187,215,215,239,239,199,255,
1,123,247,239,223,189, 1,255,
195,207,207,207,207,207,195,255,
243,237,207,131,207,157, 3,255,
195,243,243,243,243,243,195,255,
255,231,195,129,231,231,231,231,
255,239,207,128,128,207,239,255,
255,255,255,255,255,255,255,255,
231,231,231,231,255,255,231,255,
153,153,153,255,255,255,255,255,
153,153, 0,153, 0,153,153,255,
231,193,159,195,249,131,231,255,
157,153,243,231,207,153,185,255,
195,153,195,199,152,153,192,255,
249,243,231,255,255,255,255,255,
243,231,207,207,207,231,243,255,
207,231,243,243,243,231,207,255,
255,153,195, 0,195,153,255,255,
255,231,231,129,231,231,255,255,
255,255,255,255,255,231,231,207,
255,255,255,129,255,255,255,255,
255,255,255,255,255,231,231,255,
255,252,249,243,231,207,159,255,
195,153,145,137,153,153,195,255,
231,231,199,231,231,231,129,255,
195,153,249,243,207,159,129,255,
195,153,249,227,249,153,195,255,
249,241,225,153,128,249,249,255,
129,159,131,249,249,153,195,255,
195,153,159,131,153,153,195,255,
129,153,243,231,231,231,231,255,
195,153,153,195,153,153,195,255,
195,153,153,193,249,153,195,255,
255,255,231,255,255,231,255,255,
255,255,231,255,255,231,231,207,
241,231,207,159,207,231,241,255,
255,255,129,255,129,255,255,255,
143,231,243,249,243,231,143,255,
195,153,249,243,231,255,231,255,
255,255,255, 0, 0,255,255,255,
247,227,193,128,128,227,193,255,
231,231,231,231,231,231,231,231,
255,255,255, 0, 0,255,255,255,
255,255, 0, 0,255,255,255,255,
255, 0, 0,255,255,255,255,255,
255,255,255,255, 0, 0,255,255,
207,207,207,207,207,207,207,207,
243,243,243,243,243,243,243,243,
255,255,255, 31, 15,199,231,231,
231,231,227,240,248,255,255,255,
231,231,199, 15, 31,255,255,255,
63, 63, 63, 63, 63, 63, 0, 0,
63, 31,143,199,227,241,248,252,
252,248,241,227,199,143, 31, 63,
0, 0, 63, 63, 63, 63, 63, 63,
0, 0,252,252,252,252,252,252,
255,195,129,129,129,129,195,255,
255,255,255,255,255, 0, 0,255,
201,128,128,128,193,227,247,255,
159,159,159,159,159,159,159,159,
255,255,255,248,240,227,231,231,
60, 24,129,195,195,129, 24, 60,
255,195,129,153,153,129,195,255,
231,231,153,153,231,231,195,255,
249,249,249,249,249,249,249,249,
247,227,193,128,193,227,247,255,
231,231,231, 0, 0,231,231,231,
63, 63,207,207, 63, 63,207,207,
231,231,231,231,231,231,231,231,
255,255,252,193,137,201,201,255,
0,128,192,224,240,248,252,254,
255,255,255,255,255,255,255,255,
15, 15, 15, 15, 15, 15, 15, 15,
255,255,255,255, 0, 0, 0, 0,
0,255,255,255,255,255,255,255,
255,255,255,255,255,255,255, 0,
63, 63, 63, 63, 63, 63, 63, 63,
51, 51,204,204, 51, 51,204,204,
252,252,252,252,252,252,252,252,
255,255,255,255, 51, 51,204,204,
0, 1, 3, 7, 15, 31, 63,127,
252,252,252,252,252,252,252,252,
231,231,231,224,224,231,231,231,
255,255,255,255,240,240,240,240,
231,231,231,224,224,255,255,255,
255,255,255, 7, 7,231,231,231,
255,255,255,255,255,255, 0, 0,
255,255,255,224,224,231,231,231,
231,231,231, 0, 0,255,255,255,
255,255,255, 0, 0,231,231,231,
231,231,231, 7, 7,231,231,231,
63, 63, 63, 63, 63, 63, 63, 63,
31, 31, 31, 31, 31, 31, 31, 31,
248,248,248,248,248,248,248,248,
0, 0,255,255,255,255,255,255,
0, 0, 0,255,255,255,255,255,
255,255,255,255,255, 0, 0, 0,
252,252,252,252,252,252, 0, 0,
255,255,255,255, 15, 15, 15, 15,
240,240,240,240,255,255,255,255,
231,231,231, 7, 7,255,255,255,
15, 15, 15, 15,255,255,255,255,
15, 15, 15, 15,240,240,240,240
};
unsigned char rooms[] = {
// Room 1
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 0, 32, 32, 32, 32, 32, 11, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 81, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,102,102,102,102, 45,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 83, 32,102, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 36, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 11, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 83, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 11, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 30, 32, 88, 32, 32, 32, 32, 9, 32, 32, 32, 32, 38, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 94, 32, 32, 32, 32,102, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 36, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
,// room 2
105,120,120,120,120,120,120,120, 97, 61, 61, 97,120,120,120,120,120,120,120, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
117, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,121, 98, 98, 98, 98, 98, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 90, 32, 94, 94, 94, 94, 94, 94, 94, 94, 94, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32,127, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,117,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
117, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 90, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 90, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 97,117, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,117, 97, 32, 32, 90, 32, 94, 94, 94, 94, 94, 94, 94, 94, 94, 32, 32, 32, 32, 32, 97,
127, 98, 98, 98, 98, 98, 98,117, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,120,120,120,120,120,120,120, 97, 61, 61, 97,120,120,120,120,120,120,120, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
// room 3
,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 87, 87, 87, 87, 32, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 87, 87, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32,
32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 88, 83, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32,
32, 87, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 87, 32, 87, 32, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 87, 87, 32, 32, 38, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 87, 87, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 87, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32,
32, 87, 87, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 87, 45, 87, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32,
32, 32, 87, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 87, 87, 32, 32, 32, 94, 94, 94, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 94, 94, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 87, 32, 32, 94, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
unsigned char game_map[1000];
/*
Duplicate or similar to CONIO functions
*/
void cursor(char onoff) {
// Turning off flashing cursor
putch(23); putch(1); putch(onoff);
}
// Clear screen
void clrscr() {
//vdp_mode(3); - Doesn't work, send the characters instead!
char mode[2] = {22,3};
mos_puts(mode,2,0);
vdp_clear_screen();
cursor(0);
}
// Get character from keyboard
int cgetc() {
return inchar();
}
// Position cursor
void gotoxy(char x, char y) {
vdp_cursor_tab(y,x);
}
// Put a character at screen coord
void cputcxy(int x, int y, char c) {
vdp_cursor_tab(y,x);
putch(c); putch(8);
}
/* END OF CONIO */
unsigned int map(char x, char y) {
unsigned char c;
c = game_map[40*y+x];
return c;
}
void load_room() {
int pos;
clrscr();
gotoxy(0,0);
printf("loading room %d",room+1);
for (pos = 0; pos < 1000; pos++) {
c=rooms[pos+(1000*room)];
// Player x and y
if(c==0) {
y=pos/40;
x=pos % 40;
}
// Goblin
if(c==38) {
// Increment for next enemy (Enemy 0 is counted as no enemy)
enemy_count+=1;
// Create the enemy in the list
enemies[enemy_count].tile = c;
enemies[enemy_count].room = room;
enemies[enemy_count].x = pos % 40;
enemies[enemy_count].y = pos/40;
enemies[enemy_count].old_x = enemies[enemy_count].x;
enemies[enemy_count].old_y = enemies[enemy_count].y;
enemies[enemy_count].health = 30;
enemies[enemy_count].strength = 5;
enemies[enemy_count].speed = 1;
enemies[enemy_count].armour = 10;
}
// Rat
else if (c==94) {
// Increment for next enemy (Enemy 0 is counted as no enemy)
enemy_count+=1;
// Create the enemy in the list
enemies[enemy_count].tile = 158;
enemies[enemy_count].room = room;
enemies[enemy_count].x = pos % 40;
enemies[enemy_count].y = pos/40;
enemies[enemy_count].old_x = enemies[enemy_count].x;
enemies[enemy_count].old_y = enemies[enemy_count].y;
enemies[enemy_count].health = 15;
enemies[enemy_count].strength = 5;
enemies[enemy_count].speed = 2;
enemies[enemy_count].armour = 0;
}
game_map[pos] = c;
}
}
void set_map(char x, char y, int tile) {
// Set the part of the array to the given tile
game_map[40*y+x]=tile;
}
unsigned int dumb_wait(unsigned int delay) {
for(timer=0; timer<delay; timer++) {}
return timer;
}
// Returns the enemy for a given x,y coord
unsigned int which_enemy(unsigned char ex, unsigned char ey) {
if(map(ex,ey)==32) return 0;
// Enemies starts at 1, 0 = no enemy
for(i=1;i<enemy_count+1;i++)
{
if(enemies[i].x == ex && enemies[i].y == ey && enemies[i].health >= 1) return i;
}
// No enemies
return 0;
}
void attack(int weapon, unsigned char ax, unsigned char ay)
{
int rnum = 0;
this_enemy = 0;
this_enemy = which_enemy(ax,ay);
if(this_enemy == 0) {
return;
}
rnum = (rand() % (20 - 1 + 1)) + 1;
if(rnum > enemies[this_enemy].armour+enemies[this_enemy].speed) {
// Damage!
enemies[this_enemy].health-=weapon;
if(enemies[this_enemy].health>0)
{
gotoxy(0,0);
printf("hit!! enemy health: %3d ", enemies[this_enemy].health);
timer=dumb_wait(1000);
}
} else {
gotoxy(0,0);
printf("miss! enemy health: %3d ", enemies[this_enemy].health);
if((x == ax && y == ay)||(x == ax && (y == ay + 1 || y == ay - 1)) || (y == ay && (x == ax + 1 || x == ax - 1)))
{
health -= enemies[this_enemy].strength;
}
timer=dumb_wait(1000);
}
if(enemies[this_enemy].health < 1 ) {
// Success!
gotoxy(0,0);
printf("enemy defeated! ");
// Draw tile in new location
cputcxy(ax,ay,32);
set_map(ax,ay,32);
enemies[this_enemy].tile = 32;
// Up the score
score+=10;
timer=dumb_wait(1000);
}
}
void enemy_attack(unsigned int this_enemy)
{
int rnum = 0;
rnum = (rand() % (20 - 1 + 1)) + 1;
if(rnum > 10) {
// Damage!
if(health < 1 || (health-enemies[this_enemy].strength) < 1)
{
health = 0;
} else {
health-=enemies[this_enemy].strength;
}
gotoxy(0,0);
printf("ouch! health: %3d ", health);
timer=dumb_wait(1000);
} else {
enemies[this_enemy].health -= 5;
if(enemies[this_enemy].health<1) {
enemies[this_enemy].health=0;
// Draw tile in new location
cputcxy(enemies[this_enemy].x,enemies[this_enemy].y,32);
set_map(enemies[this_enemy].x,enemies[this_enemy].y,32);
enemies[this_enemy].tile = 32;
gotoxy(0,0);
printf("enemy defeated! ");
}else {
gotoxy(0,0);
printf("block health: %3d ", health);}
}
timer=dumb_wait(1000);
if(health < 1) {
// Fail!
gotoxy(0,0);
printf("enemy defeated you! ");
health = 0;
timer=dumb_wait(1000);
}
}
// Move the enemies for a given room
void move_enemies() {
unsigned char rnd;
// Enemies starts at 1, 0 = no enemy
for(i=1;i<enemy_count+1;i++)
{
if(enemies[i].room == room && enemies[i].health>0){
enemies[i].old_x = enemies[i].x;
enemies[i].old_y = enemies[i].y;
// Rat is random
if(enemies[i].tile == 158) {
rnd = (rand() % (4)) + 1;
if(rnd == 4) enemies[i].x-=1;
if(rnd == 2) enemies[i].x+=1;
if(rnd == 1) enemies[i].y-=1;
if(rnd == 3) enemies[i].y+=1;
}
// Gobbo goes for player
if(enemies[i].tile == 38) {
if(enemies[i].x > x) enemies[i].x-=1;
if(enemies[i].x < x) enemies[i].x+=1;
if(enemies[i].y > y) enemies[i].y-=1;
if(enemies[i].y < y) enemies[i].y+=1;
}
// Redraw
c=map(enemies[i].x,enemies[i].y);
if(c!=32) {
enemies[i].x = enemies[i].old_x;
enemies[i].y = enemies[i].old_y;
if(c==64) enemy_attack(i);
}else{
set_map(enemies[i].old_x, enemies[i].old_y, 32);
cputcxy(enemies[i].old_x, enemies[i].old_y, 32);
}
set_map(enemies[i].x, enemies[i].y, enemies[i].tile);
cputcxy(enemies[i].x, enemies[i].y,enemies[i].tile);
}
}
}
void draw_screen() {
int row,col;
for(row=0; row<25; row++)
{
for(col=0; col < 40; col++){
cputcxy(col,row,map(col,row));
}
};
}
void draw_momentary_object(unsigned char obj_old_x, unsigned char obj_old_y, unsigned char obj_x, unsigned char obj_y, unsigned char obj_tile, unsigned int delay) {
// Replace tile
cputcxy(obj_old_x,obj_old_y,map(obj_old_x,obj_old_y));
// Draw tile in new location
cputcxy(obj_x,obj_y,obj_tile);
// Delay
timer=dumb_wait(delay);
// Replace tile again
cputcxy(obj_x,obj_y,map(obj_x,obj_y));
}
void draw_move(bool replace) {
// Delete the player character
if(!replace) {
set_map(old_x, old_y, 32);
}
// Draw new location
cputcxy(old_x,old_y,map(old_x,old_y));
cputcxy(x,y,64);
set_map(x, y, 64);
}
void title_screen() {
unsigned int i=0;
unsigned char this_ch=0;
gotoxy(0,0);
for(unsigned int ch=64; ch < 90; ch++)
{
putch(23); putch(ch);
for(char b=0; b<8; b++){
putch(chars[i]);
i++;
}
}
clrscr();
gotoxy(0,9);
printf("AGON DUNGEON\n a game by retrogamecoders.com\n PRESS A KEY");
key=cgetc();
in_play=true;
}
bool game_over() {
clrscr();
printf("game over\n\n");
timer=dumb_wait(1000);
printf("ah, such a shame,\nyou were doing so well!\n\n");
timer=dumb_wait(1000);
printf("score:%03d\n\nplay again (y/n)?",score);
key=cgetc();
in_play=false;
if(key=='n') {
return false;
} else {
return true;
}
}
void game_loop() {
gotoxy(0,24);
printf(" k: %02d S: %03d *: %03d score: %04d", keys,health, magic, score);
// Change direction
if(x != old_x || y != old_y) {
direction_x = x-old_x;
direction_y = y-old_y;
}
move_enemies();
// Backup the location
old_x = x;
old_y = y;
//if(kbhit()) { Remove comment to make more action than turn-based
// Check keys;
switch (key=cgetc())
{
case 'w':
if(y>0) y--;
break;
case 'a':
if(x>0) x--;
break;
case 'A':
case 'o':
if(sword==true) {
draw_momentary_object(x-1,y,x-1,y,131,2000);
attack(10,x-1,y);
}
break;
case 's':
if(y<24) y++;
break;
case 'd':
if(x<39) x++;
break;
case 'D':
case 'p':
if(sword==true) {
draw_momentary_object(x+1,y,x+1,y,131,2000);
attack(10,x+1,y);
}
break;
case 'f':
if(magic > 5) {
magic-=5;
fx = x+direction_x;
fy = y+direction_y;
c=map(fx,fy);
while(c==32 && magic > 0) {
draw_momentary_object(fx,fy,fx,fy,'*',200);
magic-=1;
fx = fx+direction_x;
fy = fy+direction_y;
c=map(fx,fy);
}
attack(10,fx,fy);
}
break;
case 'Q':
case 3:
in_play = false;
break;
default:
// Figure out scan codes
//gotoxy(0,0);
//printf("%d",key);
break;
}
//} Remove comment to make more action than turn-based
gotoxy(0,0);
printf(" ");
// Anything in our path?
obstruction=false;
c=map(x,y);
// Collision
switch (c)
{
case 102:
case 166:
// Wall
obstruction=true;
break;
case 37:
case 11: // Key +1
keys+=1;
break;
case 9:
case 66:
case 130:
case 45:
if(keys>0)
{
keys-=1;
score+=5;
obstruction=false;
}else{
// Not enough keys to unlock!
set_map(x, y, 28); // turn into partially open
health-=10; // lose 10 health
obstruction=true;
}
break;
case 28: // Partially open door
if(keys>0)
{
keys-=1;
score+=5;
obstruction=false;
}else{
// Not enough keys to unlock!
set_map(x, y, 32); // turn into fully open
health-=10; // lose 10 health
obstruction=true;
}
break;
case 30: // Sword!
sword=true;
break;
case 36: // Cash money
score+=5;
break;
case 81:
case 145: // Potion
score+=15;
magic+=100;
break;
case 90:
case 154: // Cash money
score+=15;
break;
case 83:
case 147: // Health
health+=25;
if(health>100) health=100; // Can't be more than 100%!
break;
/* Enemies >> */
case 38: // Gobbo
attack(5,x,y);
obstruction=true;
break;
case 158: // Rats
case 222:
attack(5,x,y);
obstruction=true;
break;
/* ^^ Enemies */
case 88:
case 152: // Idol
score+=10;
idols+=1;
if(idols==2) {
room+=1;
load_room();
draw_screen();
idols=0;
}
break;
case 0:
case 64: // Player
break;
default:
// convert integer to ascii: itoa(c,buffer,10);
if(c!=32) {
// Figure out what the code is for tile
gotoxy(0,0);
printf("bumped into ...... %03d",c);
obstruction=true;
}
break;
}
// If obstructed then bounce
if(obstruction) {
x=old_x;
y=old_y;
} else {
draw_move(false);
}
if(health<1) {
in_play = false;
}
}
int main() {
// Use current time as
// seed for random generator
srand(1);
/* Clear Screen */
clrscr();
#ifdef __PET__
// Uppercase/Graphical characterset = 12
POKE(59468,12);
#endif
#ifdef __C64__
// Screen colors back to black + black border
POKE(53281,0);
POKE(53280,0);
// Text color to match PET
POKE(646,5);
// Uppercase/Graphical characterset
POKE(53272,21);
#endif
/* Hide cursor */
cursor(0);
// Titles
title_screen();
// Start running
run=true;
// Should the program end?
while(run){
// Initialize if not already running a game
if (in_play != true) {
keys=0;
health=100;
score=0;
keys=0;
room=0;
potion=0;
magic=0;
enemy_count=0;
sword=false;
}
// Set up the screen
load_room();
draw_screen();
cputcxy(x,y,'@');
// Game on!
in_play = true;
/* Loop until game ends */
while (in_play)
{
game_loop();
}
// Try again or quit?
run=game_over();
}
clrscr();
printf("goodbye!\n\n");
cursor(1);
return(0);
}


My Programming Journey – What’s Yours?