Beispiel #1
0
void brush_paint( brush_t* brush, UBYTE ypos )
{
	UBYTE free_tile = 0;
	set_bkg_tiles( brush->x.b.h, ypos, 1, 1, &free_tile );
	set_bkg_tiles( brush->x.b.h+1, ypos, 1, 1, &free_tile );
	set_bkg_tiles( brush->x.b.h-1, ypos, 1, 1, &free_tile );
}
Beispiel #2
0
/**
 * Adds a row or column of white cells.
 */
void spawnCells() {
	BYTE x, y, ix, iy;
	// Add white cell
	// Random event
	x = (UBYTE)rand() % 2;
	// Horizontal line
	if(x == 0) {
		y = (UBYTE)rand() % MAPH;
		ix = 2;
		iy = 2 + (y << 1);
		for(x = 0; x < MAPW; ++x) {
			map[x + (y << 3)] = CELL_WHITE; //map[x + y*MAPW] = 1;
			set_bkg_tiles(ix, iy, 2, 2, white_cell_tiles);
			ix += 2;
		}
	}
	// Vertical line
	else {
		x = (UBYTE)rand() % MAPW;
		ix = 2 + (x << 1);
		iy = 2;
		for(y = 0; y < MAPH; ++y) {
			map[x + (y << 3)] = CELL_WHITE; //map[x + y*MAPW] = 1;
			set_bkg_tiles(ix, iy, 2, 2, white_cell_tiles);
			iy += 2;
		}
	}
}
Beispiel #3
0
int main()
{
  /* Transfer color palettes */
  set_bkg_palette( 7, 1, &bar_p[0] );
  set_bkg_palette( 6, 1, &bar_p[4] );
  set_bkg_palette( 5, 1, &bar_p[8] );
  set_bkg_palette( 4, 1, &bar_p[12] );
  set_bkg_palette( 3, 1, &bar_p[16] );
  set_bkg_palette( 2, 1, &bar_p[20] );
  set_bkg_palette( 1, 1, &bar_p[24] );
  set_bkg_palette( 0, 1, &bar_p[28] );

  /* CHR code transfer */
  set_bkg_data( 0x0, 32, bar_c );

  /* Select VRAM bank 1 */
  VBK_REG = 1;
  /* Set attributes */
  set_bkg_tiles( 0, 0, bar_mWidth, bar_mHeight, bar_a );

  /* Select VRAM bank 0 */
  VBK_REG = 0;
  /* Set data */
  set_bkg_tiles( 0, 0, bar_mWidth, bar_mHeight, bar_m );

  SHOW_BKG;
  enable_interrupts();
  DISPLAY_ON;

  /* Loop forever */
  while(1)
    ;

  return(0);
}
Beispiel #4
0
void DISP_MOJI()
{
	UBYTE x, y, i;

	unsigned char first[MOJI_MAX] = "ハムコモジハ コンナフウニ";  // ハム子文字は半角カタカナで書く
	unsigned char second[MOJI_MAX] = "ツカウコトガ デキマス。"; // 14文字以内にする
	unsigned char third[MOJI_MAX] = "ヒラガナガ ツカエルッテ";
	unsigned char fourth[MOJI_MAX] = "カナリ ウレシクナリマス。";

	x = y = 2;

		for( i = 0; i < MOJI_MAX; i++ ){     // 一文字ずつ出てくるようにするためのループ

			set_bkg_tiles( x + i, y, 1, 1, &first[i] );
			delay(100);      // 速さの調節
		}

		for( i = 0; i < MOJI_MAX; i++ ){

			set_bkg_tiles( x + i, y + 2, 1, 1, &second[i] );
			delay(100);
		}

		set_bkg_tiles( x, y + 6, MOJI_MAX, 1, third );
		set_bkg_tiles( x + 2, y + 8, MOJI_MAX, 1, fourth );

}
Beispiel #5
0
void empty_screen (void)
{
	UBYTE temp1;
	
	HIDE_BKG;
	HIDE_SPRITES;
	
	VBK_REG = 0;
	SWITCH_ROM_MBC1(1);
	for (temp1=0; temp1<40; temp1++)
	{
		move_sprite(temp1,0,200);
		set_sprite_prop (temp1,0);
	}
	
	for (temp1=0; temp1<20; temp1++)
	{
		set_bkg_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		set_win_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		
		VBK_REG = 1;
		set_bkg_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		set_win_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		VBK_REG = 0;
	}
	
	move_bkg (0,0);
	SWITCH_ROM_MBC1(0);
	SHOW_BKG;
	SHOW_SPRITES;
}
Beispiel #6
0
unsigned int mainMenu()
{
   int selection;
   unsigned long int loopCount;

   DISPLAY_OFF;
   HIDE_BKG;

   move_bkg(0,0);

   set_bkg_palette( 7, 1, &menuPalCGB[28] );
   set_bkg_palette( 6, 1, &menuPalCGB[24] );
   set_bkg_palette( 5, 1, &menuPalCGB[20] );
   set_bkg_palette( 4, 1, &menuPalCGB[16] );
   set_bkg_palette( 3, 1, &menuPalCGB[12] );
   set_bkg_palette( 2, 1, &menuPalCGB[8] );
   set_bkg_palette( 1, 1, &menuPalCGB[4] );
   set_bkg_palette( 0, 1, &menuPalCGB[0] );

   set_bkg_data( 0, 141, menuTiles );

   VBK_REG = 1;
   set_bkg_tiles(0,0,menuMapWidth,menuMapHeight,menuPal);

   VBK_REG = 0;
   set_bkg_tiles(0,0,menuMapWidth,menuMapHeight,menuMap);

   SHOW_BKG;
   DISPLAY_ON;

   setupPointer();

   loopCount = 0;
   do
   {
      loopCount++;
      if((loopCount % 125) == 0)
         updatePointer(); /* animate the pointer */

      selection = checkButtons();

   } while(!selection); /* user hasn't made a selection */
   set_sprite_tile(0, 0); /* set to straight pointer while waiting */
   while(joypad() & (J_A | J_START)); /* wait for the user to let up */

   /* "Shoot" the pointer across the screen */
   loopCount = 0;
   while((pointerX + loopCount) <= 168)
   {
   	move_sprite(0, pointerX + loopCount, pointerYPositions[currSelection]);
      loopCount++;
      delay(4);
   }


   hidePointer();

   return selection;
}
Beispiel #7
0
void break_button(UBYTE x, UBYTE y)
{
	if(x <= 3 && y <= 3){
		set_bkg_tiles(x * 3 + 1, y * 3 + 5, 3, 3, break_tile);
	}
	if((x == 4 || x == 5) && (y <= 2)){
		set_bkg_tiles(x * 3 + 2, y * 3 + 5, 3, 3, break_tile);
	}
	if((x == 4 || x == 5) && (y == 3)){
		set_bkg_tiles(14, 14, 6, 3, dialing_break);
	}
}
Beispiel #8
0
void press_button(UBYTE x, UBYTE y)
{
	if(x <= 3 && y <= 3){
		set_bkg_tiles(x * 3 + 1, y * 3 + 5, 3, 3, press_tile);
	}
	if((x == 4 || x == 5) && (y <= 2)){
		set_bkg_tiles(x * 3 + 2, y * 3 + 5, 3, 3, press_tile);
	}
	if((x == 4 || x == 5) && (y == 3)){
		set_bkg_tiles(14, 14, 6, 3, dialing_press);
	}
}
void main(){
	int xpos = 8 + GRAPHICS_WIDTH / 2;
	int ypos = 16 + GRAPHICS_HEIGHT / 2;
	int count = 0;
	int joy, i;
	set_sprite_data(0, 1, crosshair_tiledata);
	set_sprite_data(1, 6, explode_tiledata);
	SWITCH_ROM_MBC1(3);
	set_bkg_data(0, 179, title_tiledata);
	set_bkg_tiles(0, 0, 20, 18, title_tilemap);
	SHOW_BKG;
	DISPLAY_ON;
	waitpad(J_START);
	DISPLAY_OFF;
	SWITCH_ROM_MBC1(2);
	set_bkg_data(0, 182, earth_tiledata);
	set_bkg_tiles(0, 0, 20, 18, earth_tilemap);
	set_sprite_tile(0,0);
	move_sprite(0, xpos, ypos);
	SHOW_SPRITES;
	DISPLAY_ON;
	waitpadup();
	while (1){
		wait_vbl_done();
		joy = joypad();
		if (joy & J_UP && ypos > 14)
			--ypos;
		if (joy & J_DOWN && ypos < GRAPHICS_HEIGHT + 13)
			++ypos;
		if (joy & J_LEFT && xpos > 8)
			--xpos;
		if (joy & J_RIGHT && xpos < GRAPHICS_WIDTH + 8)
			++xpos;
		if (joy & J_A || joy & J_B){
			++count;
			move_sprite(count, xpos - 2, ypos - 2);
			for (i = 1; i != 7; ++i){
				set_sprite_tile(count, i);
				wait_vbl_done();
				wait_vbl_done();
			}
			set_sprite_tile(count, 4);
			set_sprite_prop(count, 1 << 4);
			if (count == 39){
				delay(500);
				end();
			}
		}		
		move_sprite(0, xpos, ypos);
	}
}
Beispiel #10
0
void background_init(){
  UBYTE i, j, k;
  SHOW_BKG;
  BGP_REG = background_palettes[player_data.position.z];

  /* Initialize the background */
  // load background tiles into VRAM
  set_bkg_data(0x01, BACKGROUND_DATA_SIZE, background_sprite_data);

  background_data.speed.x.w = 0;
  background_data.speed.y.w = 0;

  // create a random background
  for(i = 0, k=0; i != 32; i++){
    for(j = 0; j != 32; j++){
      k++;
      if (k == BACKGROUND_DATA_SIZE){
        k = 0;
      }
      set_bkg_tiles(i, j, 
                    1, 1, 
                    background_tiles +
                      (((UBYTE)rand()) % BACKGROUND_DATA_SIZE));
    }
  }

  //start at 0,0
  background_data.position.x.w = 0;
  background_data.position.y.w = 0;
  SCX_REG = 0;
  SCY_REG = 0;
}
void main()
{
    printf("Welcome to GAMEBOY\nProgramming");
    printf("\n-------------------\n");
    printf("  (\\" "\\" "_/)    (\\" "\\" "_/)\n");
    printf("  (0.o)    (0.o)\n");
    printf("  (> <)    (> <)\n");
    printf("-------------------\n");
    printf("PROGRAMED BY JAMES \n");
    printf("\nPress Start");
    waitpad(J_START);  // other keys are J_A, J_UP, J_SELECT, etc.
    //printf("\nIsn't it easy!");

    // Turn the display off
    DISPLAY_OFF;

    // Load up the tile data
    set_bkg_data(0,255,logo_tile_data);

    // Switch to VRAM
    VBK_REG = 1;

    // Switch out of VRAM
    VBK_REG = 0;

    // Set screen x,y pos to 0,0 and draw the map 20,18(size of the screen)
    set_bkg_tiles(0,0,20,18,logo_map_data);

    // Show the background
    SHOW_BKG;

    // Turn the display on
    DISPLAY_ON;
}
Beispiel #12
0
void INIT()
{
	UBYTE i;

	disable_interrupts();
	HIDE_BKG;
	HIDE_SPRITES;
	HIDE_WIN;
	DISPLAY_OFF;

	set_bkg_data( 0, 5, bgtile1 );
	set_bkg_tiles( 0, 0, bgmap3Width, bgmap3Height, bgmap3 );

	set_sprite_data( 0, 32, girl );
	SPRITES_8x8;

	gx = gy = 1;
	gd = 2;
	gp = 1;

	SET_MOVE_SPRITE();

	for( i = 0; i < 4; i++ ){
		set_sprite_prop( i, 0 );
	}

	SHOW_BKG;
	SHOW_SPRITES;
	DISPLAY_ON;
	enable_interrupts();
}
Beispiel #13
0
/*
	CAUTION: Don't display the NULL code
*/
void disp(char str[MAX_DTMF])
{
	UBYTE no, left_pos;
	UBYTE i, start_ch, end_ch;
	char work[MAX_DTMF];

	clr_disp();

	no = 0;
	while(str[no]){
		no++;
	}

	if(no >= LCD_WIDTH){
		start_ch = no - LCD_WIDTH;
		end_ch = LCD_WIDTH;
	}
	else{
		start_ch = 0;
		end_ch = no;
	}
	for(i = 0;i < end_ch;i++){
		work[i] = str[i+start_ch];
	}
	work[end_ch] = 0x00;

	disp_lcd(end_ch, work);

	left_pos = 19 - end_ch;
	set_bkg_tiles(left_pos, 2, end_ch, LCD_HIGHT, disp_tile);
}
Beispiel #14
0
void cls()
{
	for(j=0;j!=20;j++) bkg[j]= 0x00U;
	for(j=0;j!=18;j++) {
		set_bkg_tiles(0,j,20,1,bkg);
	}
}
Beispiel #15
0
void hideLogo() {
	char* p = bg_map;
	set_bkg_data(0, background_tileset_size, background_tileset);
	for (y = 2; y < flappybird_map_height+2; ++y ) {
		set_bkg_tiles(4, y, flappybird_map_width, 1, p);
		p += flappybird_map_width;
	}
}
Beispiel #16
0
void showMainScreen()
{
	cls();
	currentScreen = 1;
	bkg[0]=66;set_bkg_tiles(3,3,1,1,bkg);
	bkg[0]=67;set_bkg_tiles(7,3,1,1,bkg);
	bkg[0]=68;set_bkg_tiles(11,3,1,1,bkg);
	bkg[0]=69;set_bkg_tiles(15,3,1,1,bkg);
	
	for(j=0;j!=28;j++) {
		bkg[0] = bkg[1] = 1;
		set_bkg_tiles(tableData[j][0],tableData[j][1],2,1,bkg);
	}
	
	updateDisplay();
    showCursor();
}
void back()                  /* bkg func */
{
 set_bkg_data(1,3,briks);      /* start bkg display (platforms,ladders etc.) */
 for(x=0;x<20;x++)
 {
   for(y=0;y<40;y++)
   set_bkg_tiles(x,y,1,1,bkgtilea); 
 }

  for(i=0;i<array_size;i=i+5) /* gets the x,y coords from lev_data array */
   {
    j=i+1;
    k=i+2;
    l=i+3;
    m=i+4;  
    x=lev_data[i];
    u=lev_data[j];
    y=lev_data[k];
    v=lev_data[l];
    w=lev_data[m];

     if(w==1)                /* draws the bricks */
      {  for(x;x<u;x++)
          {
           set_bkg_tiles(x,y,1,1,brik);
           }

       if((v-y)!=2)
        { for(y;y<u;y++)
           {
            set_bkg_tiles(x,y,1,1,brik);
            }
        }
       }
    if(w==2)                 /* draws the ladders */
      {  
       if((v-y)!=2)
        { for(y;y<v;y++)
           {
            set_bkg_tiles(x,y,1,1,ladder);
            }
        }
       }
    }
 SHOW_BKG;                             
}                            /* end of bkg func */ 
Beispiel #18
0
void DISP_MOJI()
{
    UBYTE x, y;

    unsigned char first[MOJI_MAX] = "ÊѺӼÞÊ ºÝÅ̳Æ";  // ƒnƒ€Žq•¶Žš‚Í”¼ŠpƒJƒ^ƒJƒi‚Å�‘‚­
    unsigned char second[MOJI_MAX] = "¶³ºÄ¶Þ Ã޷Ͻ¡"; // 14•¶ŽšˆÈ“à‚É‚·‚é
    unsigned char third[MOJI_MAX] = "Ë׶ÞÅ¶Þ Â¶´Ù¯Ã";
    unsigned char fourth[MOJI_MAX] = "¶ÅØ ³Ú¼¸ÅØϽ¡";

    x = y = 2;

    set_bkg_tiles( x, y, MOJI_MAX, 1, first );
    set_bkg_tiles( x, y + 2, MOJI_MAX, 1, second );
    set_bkg_tiles( x, y + 6, MOJI_MAX, 1, third );
    set_bkg_tiles( x + 2, y + 8, MOJI_MAX, 1, fourth );

}
Beispiel #19
0
void init_bkg()
{
	/* Initialize the background */
	set_bkg_data( 0, 9, frame_lcd);
	set_bkg_data( 9, 9, break_btn);
	set_bkg_data(18, 9, press_btn);
	
	set_bkg_tiles(0, 0, 20, 18, dtmf_tile);
}
void end(){
	wait_vbl_done();
	DISPLAY_OFF;
	HIDE_SPRITES;
	SWITCH_ROM_MBC1(1);
	set_bkg_data(0, 221, end_tiledata);
	set_bkg_tiles(0, 0, 20, 18, end_tilemap);
	SHOW_BKG;
	DISPLAY_ON;
	while(1);
}
Beispiel #21
0
void main()
{
	INT8 i;
	UINT8 input;

	UFIX16 amount;
	amount.U16 = 0x0000U;


	set_bkg_data(0, 42, roadTiles);
	set_bkg_tiles(0, 0, 32, 32, roadGrid);

	offsetIndex = 0;
	for (i = 0; i < 80; i++)
	{
		roadOffset[i] = 0;
	}

	SPRITES_8x8;
	SHOW_SPRITES;
	SHOW_BKG;
	HIDE_WIN;

	LYC_REG = 0x07U;
	STAT_REG = 0x20U;
	set_interrupts(VBL_IFLAG | LCD_IFLAG);

	add_LCD(HBLANK);
	add_VBL(VBLANK);

	enable_interrupts();

	frameReady = 0;
	while (1)
	{
		if (frameReady == 0)
		{
			input = joypad();
			if (input & J_LEFT)
			{
				amount.U8.intp -= 10;
			}

			if (input & J_RIGHT)
			{
				amount.U8.intp += 10;
			}

			MoveHr(&amount);

			frameReady = 1;
		}
	}
}
Beispiel #22
0
void draw_number(UBYTE number, UBYTE x, UBYTE y) {
	UBYTE temp;
	unsigned char nummap[3];

	nummap[0]=(number / 100) + 201;
	temp = number / 10;
	if(temp>9) temp = temp  % 10;
	nummap[1]=temp+201;
	if(number>9) { nummap[2]=(number % 10)+201; } else { nummap[2]=number+201; }

	set_bkg_tiles( x, y, 3, 1, nummap);
}
Beispiel #23
0
void empty_screen (void)
{
	UBYTE temp1;

	//DISPLAY_OFF;
	HIDE_BKG;
	HIDE_SPRITES;
	
	VBK_REG = 0;
	ENABLE_RAM_MBC1;

	for (temp1=0; temp1<40; temp1++)
	{
		move_sprite(temp1,0,200);
		set_sprite_prop (temp1,0);
	}

	SWITCH_ROM_MBC1(4);
	for (temp1=0; temp1<20; temp1++)
	{
		set_bkg_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		set_win_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		
		VBK_REG = 1;
		set_bkg_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		set_win_tiles (0,temp1,20,1,(unsigned char *) &cEMPTY[0]);   
		VBK_REG = 0;
	}
	SWITCH_ROM_MBC1(0);
	DISABLE_RAM_MBC1;
	move_bkg (0,0);
	
	SHOW_BKG;
	SHOW_SPRITES;
	//DISPLAY_ON;

}
Beispiel #24
0
void setPlayMarker()
{
	for(j=0;j!=4;j++) {
		if(!j) {
			bkg[0] = markerMapTiles[j][(2U + noteStatus[0])];
		} else if (j==1) {
			bkg[0] = markerMapTiles[j][(2U + noteStatus[2])];
		} else if (j==2) {
			bkg[0] = markerMapTiles[j][(2U + noteStatus[4])];
		} else {
			bkg[0] = markerMapTiles[j][(2U + noteStatus[6])];
		}
		set_bkg_tiles(markerMapTiles[j][0],markerMapTiles[j][1U],1U,1U,bkg);
	}
}
Beispiel #25
0
/**
 * Updates all white cells to be black and removes
 * black cells.
 */
void updateMap() {
	UBYTE x, y, i, ix, iy, black_exp;

	black_exp = switch_delay << 1;
	// Check cell timers
	iy = 2;
	for(y = 0; y < MAPH; ++y) {
		ix = 2;
		for(x = 0; x < MAPW; ++x) {
			i = x + (y<<3); // x + (y*MAPW)
			// Switch white cells
			if(map[i] == CELL_WHITE) {
				map[i] = CELL_BLACK;
				set_bkg_tiles(ix, iy, 2, 2, black_cell_tiles);
			}
			else if(map[i] == CELL_BLACK) {
				map[i] = CELL_NORMAL;
				set_bkg_tiles(ix, iy, 2, 2, normal_cell_tiles);
			}
			ix += 2;
		}
		iy += 2;
	}
}
Beispiel #26
0
/**
 * Draws the title screen
 * and halts until START is pushed.
 */
void showTitle() {
	UWORD seed;

	// Load titlescreen and seed RNG
	DISPLAY_OFF;
	LCDC_REG = B8(01000001);
	set_bkg_data(0, title_dataLen, title_data);
	set_bkg_tiles(0, 0, 20, 18, title_tiles);
	DISPLAY_ON;

	waitpad(J_START);
	seed = DIV_REG;

	waitpadup();
	seed |= (UWORD)DIV_REG << 8;
	initarand(seed);
}
Beispiel #27
0
main(){
	UBYTE counter,x,y;
	x=40;
	y=17;
	
	disable_interrupts();
	DISPLAY_OFF;
	
	/*load background
	 *
	 */
	set_bkg_data(0,4,backgroundcharacters);
	for(counter=0;counter<=16;counter+=2)
		set_bkg_tiles( 0, counter, 20, 2, bgmap);
	
	//load sprite
	SPRITES_8x8;
	set_sprite_data(0, 1, spritetiles);
	set_sprite_tile(0,0);
	move_sprite(0,x,y);
	
	SHOW_BKG;
	SHOW_SPRITES; 
	DISPLAY_ON;
	enable_interrupts();
	
	while(1) {
	/* Skip four VBLs (slow down animation) */
		for(counter = 0; counter < 4; counter++){
			wait_vbl_done();
		}
		counter = joypad();
		
		if(counter & J_UP)
			y--;
		if(counter & J_DOWN)
			y++;
		if(counter & J_LEFT)
			x--;
		if(counter & J_RIGHT)
			x++;
			
		move_sprite(0,x,y);
	}
}
void main()
{
     // Load up the tile data
     set_bkg_data(0,255,logo_tile_data);

     // Switch to VRAM
     VBK_REG = 1;

     // Switch out of VRAM
     VBK_REG = 0;

     // Set screen x,y pos to 0,0 and draw the map 20,18(size of the screen)
     set_bkg_tiles(0,0,20,18,logo_map_data);

     // Show the background
     SHOW_BKG;

     // Turn the display on
     DISPLAY_ON; 
}
Beispiel #29
0
/*--------------------------------------------------------*/
void INIT()
{
	UBYTE i;

	printf(" ");

	disable_interrupts();
	HIDE_BKG;
	HIDE_SPRITES;
	HIDE_WIN;
	DISPLAY_OFF;

	set_bkg_data( 0, 5, bgtile1 );
	set_bkg_data( 160, 65, hamumoji );    // ハム子文字に使うタイルデータ 160番〜 65枚 hamumoji(で作ったタイル)をセットする

	set_sprite_data( 0, 32, hamuko );
	SPRITES_8x8;

	SHOW_BKG;
	SHOW_SPRITES;
	DISPLAY_ON;
	enable_interrupts();

	//------------------------------乱数の初期化の為にオープニングにメッセージを追加
	OPENING_MESSAGE();
	RANSUU_INIT();
	//------------------------------

	set_bkg_tiles( 0, 0, bgmap4Width, bgmap4Height, bgmap4 );

	hx = hy = 1;
	hd = 2;
	hp = 0;

	SET_MOVE_HAMUKO();

	for( i = 0; i < 4; i++ ){
		set_sprite_prop( i, 0 );
	}

}
Beispiel #30
0
void generate_visual_map( unsigned char* _map )
{
    unsigned char tile;
    unsigned char x;
    unsigned char y;

    HIDE_BKG;

    // build visible map from "REAAUHLL MAP"
    // TODO fix so that y and x start from the player position (minus the screensize or something?)
    for (y = 0; y < MAP_VISIBLE_SIZE; y++)
    {
        for (x = 0; x < MAP_VISIBLE_SIZE; x++)
        {
            tile = calculate_tile(x, y, _map);
            set_bkg_tiles(x, y, 1, 1, &(_bktiles[tile]));
        }
    }
    //set_bkg_tiles(0, 0, 16, 1, &_bktiles[0]); // DEBUG view all possible wall-combinations

    SHOW_BKG;

}