//Protot

int onkopaalla(int x,int y,int x2,int y2);
void sample(char *fname,int randi);
void e_sample(char *fname,int randi,int pan);
void cross_fade(BITMAP *what,BITMAP *where,int x,int y,int x2,int y2,int xs,int ys, int speed);
void mess_up(BITMAP *what,BITMAP *where,int ammo);
void mix_multip(BITMAP *what,BITMAP *where,int x,int y,int x2,int y2,int xs,int ys,int ammo);
void book_backround(char *book,BITMAP *war);
void load_map(char *fname);
void save_map(char *fname);
void draw_engine(BITMAP *where,int x,int y);
void adjust_fire_quality();
void setup();
void generate_tempfilename(char * buf);
void operate(int x,int y,int minako);
void read_book(char *book,char *bookpages);

int  get_tile(int x,int y);
void put_tile(int x,int y,int da);
int  get_wall(int x,int y);
void put_wall(int x,int y,int da);
int  get_sprite(int x,int y);
void put_sprite(int x,int y,int da);
int  get_roof(int x,int y);
void put_roof(int x,int y,int da);
int get_second(int x,int y);
void put_second(int x,int y,int da);

//NPC
void release_draw_for_NPCs();
void do_ai();
void move_npc(int who,int suunta);

void game_engine();
void super_console (const FONT *blah, char *format, ...);
void move_to(int suunta);
void credits(BITMAP *war);
void read_line(char *file_name,int line, char *output);
void load_fwcbmp(char *filename,BITMAP *target);
void insert_to_string (char **string, char *from, int *size);
void evolute_player();
void update_time();
int give_time(int type);
void set_world_color();
void set_tiles();
void load_tilet(char *fname);
void convert_map();
void scroll_txt_file(char *fname,int resti,int height,BITMAP *backround);
void show_story(int wa);
void explode_at(int x,int y);
int _inph_intro(void);
int does_list(char this[1024]);
int replace_line(char * filename, int linenum, char * string);
int voidaanko_astua(int x,int y,int suuntaan);

//DEFINET
#define NORTH 0
#define SOUTH 1
#define EAST 2
#define WEST 3
#define NORTHEAST 4
#define SOUTHEAST 5
#define NORTHWEST 6
#define SOUTHWEST 7

#define CFG_FILE "summoner.cfg"

#define YES 1
#define NO 0

#define NUM_OF_DROPS 400
#define NPCS 100
#define MAP_X 600
#define MAP_Y 600

#define ACT1 0
#define ACT2 1
#define ACT3 2
#define ACT4 3
#define ACT5 4
#define ACT6 5

//Seinien tyypit
#define NADA            0
#define OPEN_DOOR       1
#define CLOSE_DOOR      2
#define SWICH_UP        3
#define SWICH_DOWN      4
#define OPEN_JAIL       5
#define CLOSE_JAIL      6
#define UP_FRAME        7
#define END_FRAME_3     8
#define END_FRAME_6     9
#define TORCH           10
#define TREE1           11
#define TREE2           12
#define TREE3           13

//STRUKTIT
BITMAP *map,*bar,*conbuf;
BITMAP *characters[3];
int solids_array[MAP_X][MAP_Y];
int talkwith=-1,gametag=0;

PALLETE pal;
DATAFILE *filu;

int sounds=1,music=1,act=ACT1;
int weather_strenght=0;

typedef struct VIGI
{
int is_playing,looper;
SAMPLE *the_sample;
}VIGI;
VIGI VIGILANTE[30];
int reservoir=0;

void load_vigilante(int which, char *fname);
void handle_vigilante(int which, int x);
void check_if_playing(int which);
void prepare_vigilante();
void free_playing_vigilante();

typedef struct drops
{
int x,y,xpd,ypd,age;
}drops;
drops pisara[NUM_OF_DROPS];

typedef struct LIGT
{
int varattu;
int x;
int y;
int intensity;
}LIGT;
LIGT valox[10];

typedef struct EXPLOSION
{
int x,y,type,mode,frame;
}EXPLOSION;
EXPLOSION kabuum[10];

typedef struct HAHMO
{
char name[20], script_file[30];
int mx,my;
int sx,sy;
int ai;
int healt;
int armour;
int animset,animi,walkmode;
int drawed;
int history;
}HAHMO;
HAHMO NPC[NPCS];

typedef struct PLAYERI
{
int mx,my,sx,sy;   //Co-ords
int hp;            //Hit-points
int hp_max;        //Hit-points Max
int stamina;       //Stamina
int mana;          //Mana
int mana_max;      //Mana Max
int exp;           //Expirience
int exp_needet;    // -::-  needed for next level
int level;         //Current level
int dexterity;     //dexterity
int damage;        //place where to deposit damanage
int defense;       //(armor)
int money;         //Cash
int karma;         //To be evil or more evil
int walk_mode;     //Handler
int hanimo;        //Animation integr
int reppu[36][2];  //Backpack
}PLAYERI;
PLAYERI player;

typedef struct GROUND
{
int solid,animo;
char *step_sound;
}GROUND;
GROUND tile[100];

typedef struct WALLS
{
int solid,type,hides,nosto;
char *name;          
}WALLS;                 
WALLS wall[100];

typedef struct SPRITES
{
int solid;
int type;
char *name;
}SPRITES;
SPRITES sprite[100];

COMPILED_SPRITE *tiilit[100];
COMPILED_SPRITE *spraitit[100];
COMPILED_SPRITE *seinat[100];
COMPILED_SPRITE *katot[100];
