Example #1
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;
}
Example #2
0
void main()
{
	ENABLE_RAM_MBC1;
	SWITCH_ROM_MBC1(7);
    kwakwa_screen();
	//disable_APA();
	credits = 0U;
	while(1)
	{
		ENABLE_RAM_MBC1;
		SWITCH_ROM_MBC1(7);
		title_screen();
		credits = 0U;
		reset_game();
		disable_APA();
		while(credits == 0U)
		{

			game_screen();

		}
		//disable_APA();
		ENABLE_RAM_MBC1;
		SWITCH_ROM_MBC1(7);
		credits_screen();
		disable_APA();
	}
}
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);
	}
}
Example #4
0
void init_background()
{
    HIDE_BKG;
    SWITCH_ROM_MBC1(4);
    set_bkg_data(0, 0x21, bkgdata);
    SHOW_BKG;

    generate_visual_map( _tmpmap );

}
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);
}
Example #6
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;

}
Example #7
0
void PushBank(UINT8 b)
{
  StackPush(bank_stack, b);
  SWITCH_ROM_MBC1(b);
}
Example #8
0
void manage_physics_lvl1(PLAYER* player)
{

	if(player->box.x == 8U && player->box.y == 136U && (player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1 )
	{

		player->newX = 160U-PLAYER_SIZE;
		player->newY = 136U;
		player->booleanState = player->booleanState | TRANSITIONNING;
		player->state = CROUCHTRANSITIONIN;
		player->timer = 0U;
		player->img_index = 0U;

		player->nextLevel = LEVEL2;
		//switch_to_level(LEVEL2);

	}else if(player->box.x >= 104U && player->box.x <= 136U && player->box.y == PLAYER_SIZE+8U && player->state == CLIMBWALK)
	{

		player->box.y = 135U;
		switch_to_level(LEVEL4);
	}else if(player->box.x == 8U && player->box.y == 80U &&
			(player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == -1 )
	{

		player->newX = 160U-PLAYER_SIZE;
		player->newY = 80U;
		player->booleanState = player->booleanState | TRANSITIONNING;
		player->state = CROUCHTRANSITIONIN;
		player->timer = 0U;
		player->img_index = 0U;

		player->nextLevel = LEVEL2;

	}else if(player->box.x == 72U-PLAYER_SIZE && player->box.y == 80U &&
			(player->state == CROUCHWALK || player->state == CROUCH) && player->dirX == 1 )
	{

		player->newX = 72U-2U;
		player->newY = 80U;
		player->booleanState = player->booleanState | TRANSITIONNING;
		player->state = CROUCHTRANSITIONIN;
		player->timer = 0U;
		player->img_index = 0U;

		player->nextLevel = NOLEVEL;
		//switch_to_level(LEVEL2);

	}
	else if(player->box.x == 80U && player->box.y == 80U &&
			(player->state == CROUCHWALK || player->state == CROUCH)&& player->dirX == -1 )
	{

		player->newX = 72U-PLAYER_SIZE+8U;
		player->newY = 80U;
		player->booleanState = player->booleanState | TRANSITIONNING;
		player->state = CROUCHTRANSITIONIN;
		player->timer = 0U;
		player->img_index = 0U;

		player->nextLevel = NOLEVEL;
		//switch_to_level(LEVEL2);

	}
	if(player->key != NULL && checkCollision(&(player->key->box), locks_lvl1[0].box))
	{
		player->key->box.x = player->key->originX;
		player->key->box.y = player->key->originY;
		player->key->used = 1U;
		player->key = NULL;
		locks_lvl1[0].box->x = 0U;
		locks_lvl1[0].box->y = 0U;
		locks_lvl1[0].box->w = 0U;
		locks_lvl1[0].box->h = 0U;
		locks_lvl1[0].locked = 0U;
		victory();
		SWITCH_ROM_MBC1(6);

	}
	/*if(checkCollision(&(enemy_lvl1[0].box), &(player->box)))
	{
		manage_enemy_collision(player, (ENEMY*) enemy_lvl1);
	}*/

}