1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
/******************************************************************************\
|----------------------------Bizzle's Labyrinth--------------------------------|
\******************************************************************************/
#include <fstream>
#include <ctime>
#include <stdlib.h>
#include <iostream>
#include <allegro.h>
BITMAP *bufferSPR;
BITMAP *wallSPR;
void buildLevel(int);
int main(){
int x=0;
int y=0;
int a=0;
int b=0;
int c=0;
int *levelload = new int[10000];
allegro_init();
install_keyboard();
set_color_depth(32);
set_gfx_mode( GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0);
bufferSPR = create_bitmap(800, 600);
clear_to_color(bufferSPR, 0x333333);
wallSPR = load_bitmap( "wall.bmp",0);
int map = 1;
buildLevel(map);
//read in room
std::ifstream levelin;
levelin.open("save.txt");
if(!levelin.is_open())
return 0;
while(a<=9999){
levelin>>levelload[a];
a++;}
levelin.close();
std::ofstream levelout;
levelout.open("debug.txt");
if(!levelout.is_open())
return 0;
a=0;
while(a<=9999){
levelout<<levelload[a];
a++;}
levelout.close();
a=b=c=0;
//print room chunk to buffer
while(a<=99){
if(c==10){
b++;
c=0;
}
if(levelload[(b*100)+c]==0){
draw_sprite(bufferSPR,wallSPR,b*32,c*32);
}
c++;
a++;}
//draw buffer
blit(bufferSPR, screen, 0, 0, 0, 0, 800, 600);
readkey();
destroy_bitmap(bufferSPR);
return 0;
}
END_OF_MAIN();
void buildLevel(int map) {
// map builder
|