示例#1
0
文件: bonusbox.cpp 项目: sKabYY/SMC
void cBonusBox :: Init( void )
{
	m_type = TYPE_BONUS_BOX;
	m_force_best_item = 0;
	m_camera_range = 5000;
	m_can_be_on_ground = 0;

	Set_Animation_Type( "Bonus" );
	m_gold_color = COL_DEFAULT;
	Set_Goldcolor( COL_YELLOW );

	Create_Name();
}
示例#2
0
void cStaticEnemy :: Init( void )
{
	m_type = TYPE_STATIC_ENEMY;
	m_pos_z = 0.094f;
	m_can_be_on_ground = 0;
	m_can_be_hit_from_shell = 0;

	m_path_state = cPath_State();
	Set_Rotation_Speed( 0.0f );
    Set_Speed( 0.0f );
	Set_Static_Image( "enemy/static/blocks/spike_1/2_grey.png" );
	Create_Name();
}
示例#3
0
文件: spikeball.cpp 项目: sKabYY/SMC
void cSpikeball :: Set_Direction( const ObjectDirection dir )
{
	// already set
	if( m_start_direction == dir )
	{
		return;
	}

	cEnemy::Set_Direction( dir, 1 );

	Update_Rotation_Hor( 1 );
	Create_Name();
}
示例#4
0
void cText_Box :: Init( void )
{
	m_type = TYPE_TEXT_BOX;
	box_type = m_type;
	m_can_be_on_ground = 0;

	// default is infinite times activate-able
	Set_Useable_Count( -1, 1 );
	// Spinbox Animation
	Set_Animation_Type( "Default" );

	// todo : editor image needed
	//item_image = NULL;

	Create_Name();
}
示例#5
0
void cEato::Set_Direction(const ObjectDirection dir)
{
    if (m_start_direction == dir)
    {
        return;
    }

    cEnemy::Set_Direction(dir, 1);

    Set_Rotation(0.0f, 0.0f, 0.0f, 1);

    if (m_start_direction == DIR_UP_LEFT)
    {
        Set_Rotation_Y(180.0f, 1);
    }
    else if (m_start_direction == DIR_UP_RIGHT)
    {
    }
    else if (m_start_direction == DIR_LEFT_UP)
    {
        Set_Rotation_Z(90.0f, 1);
        Set_Rotation_X(180.0f, 1);
    }
    else if (m_start_direction == DIR_LEFT_DOWN)
    {
        Set_Rotation_Z(90.0f, 1);
    }
    else if (m_start_direction == DIR_RIGHT_UP)
    {
        Set_Rotation_Z(270.0f, 1);
    }
    else if (m_start_direction == DIR_RIGHT_DOWN)
    {
        Set_Rotation_Z(270.0f, 1);
        Set_Rotation_X(180.0f, 1);
    }
    else if (m_start_direction == DIR_DOWN_LEFT)
    {
        Set_Rotation_X(180.0f, 1);
    }
    else if (m_start_direction == DIR_DOWN_RIGHT)
    {
        Set_Rotation_Z(180.0f, 1);
    }

    Create_Name();
}
示例#6
0
文件: spikeball.cpp 项目: sKabYY/SMC
void cSpikeball :: Set_Color( const DefaultColor &col )
{
	// already set
	if( m_color_type == col )
	{
		return;
	}

	// clear old images
	Clear_Images();

	m_color_type = col;
	std::string filename_dir;

	if( m_color_type == COL_GREY )
	{
		filename_dir = "grey";

		m_kill_points = 400;
		m_fire_resistant = 1;
		m_ice_resistance = 1.0f;
		m_can_be_hit_from_shell = 0;
	}
	else
	{
		printf( "Error : Unknown Spikeball Color %d\n", m_color_type );
		return;
	}

	Update_Velocity_Max();

	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_1.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_2.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_3.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_4.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_5.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_6.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_7.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/walk_8.png" ) );
	Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/turn.png" ) );
	//Add_Image( pVideo->Get_Surface( "enemy/spikeball/" + filename_dir + "/dead.png" ) );

	Set_Image_Num( 0, 1 );
	Create_Name();
}
示例#7
0
 void cStaticEnemy::Set_Static_Image(const std::string& filename)
 {
     if (filename.empty())
     {
         return;
     }
     
     Clear_Images();
     
     m_img_filename = filename;
     
     if (m_img_filename.find(DATA_DIR "/" GAME_PIXMAPS_DIR "/") == 0)
     {
         m_img_filename.erase(0, strlen(DATA_DIR "/" GAME_PIXMAPS_DIR "/"));
     }
     
     Add_Image(pVideo->Get_Surface(filename));
     Set_Image_Num(0, 1);
     Create_Name();
 }
示例#8
0
文件: spinbox.cpp 项目: sKabYY/SMC
void cSpinBox :: Init( void )
{
	m_type = TYPE_SPIN_BOX;
	box_type = m_type;
	m_camera_range = 5000;
	m_can_be_on_ground = 0;

	m_spin_counter = 0.0f;
	m_spin = 0;

	// default is infinite times activate-able
	Set_Useable_Count( -1, 1 );
	// Spinbox Animation
	Set_Animation_Type( "Spin" );

	// editor image
	m_item_image = pVideo->Get_Surface( "game/arrow/small/white/up.png" );

	Create_Name();
}
示例#9
0
void cEato::Set_Image_Dir(std::string dir)
{
    if (dir.empty())
    {
        return;
    }

    if (dir.find(DATA_DIR "/" GAME_PIXMAPS_DIR "/") == 0)
    {
        dir.erase(0, strlen(DATA_DIR "/" GAME_PIXMAPS_DIR "/"));
    }

    if (*(dir.end() - 1) != '/')
    {
        dir.insert(dir.length(), "/");
    }

    if (!File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.png") && !File_Exists(DATA_DIR "/" GAME_PIXMAPS_DIR "/" + dir + "1.settings"))
    {
        printf("Warning : Eato image dir does not exist %s\n", dir.c_str());
        return;
    }

    m_img_dir = dir;

    Clear_Images();

    Add_Image(pVideo->Get_Surface(m_img_dir + "1.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "2.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "3.png"));
    Add_Image(pVideo->Get_Surface(m_img_dir + "2.png"));

    Set_Image_Num(0, 1);

    Set_Animation(1);
    Set_Animation_Image_Range(0, 3);
    Set_Time_All(180, 1);
    Reset_Animation();

    Create_Name();
}
示例#10
0
 void cBaseBox::Set_Invisible(Box_Invisible_Type type)
 {
     if (box_invisible == type)
     {
         return;
     }
     
     Box_Invisible_Type type_old = box_invisible;
     
     box_invisible = type;
     
     if (type_old == BOX_INVISIBLE_MASSIVE || type_old == BOX_INVISIBLE_SEMI_MASSIVE)
     {
         if (type_old == BOX_INVISIBLE_SEMI_MASSIVE)
         {
             m_massive_type = MASS_MASSIVE;
         }
     }
     else if (type_old == BOX_GHOST)
     {
         Set_Color(255, 255, 255, 255);
         Set_Color_Combine(0, 0, 0, 0);
     }
     
     if (type == BOX_INVISIBLE_MASSIVE || type == BOX_INVISIBLE_SEMI_MASSIVE)
     {
         if (type == BOX_INVISIBLE_SEMI_MASSIVE)
         {
             m_massive_type = MASS_PASSIVE;
         }
     }
     else
     {
         Set_Color(192, 192, 255, 128);
         Set_Color_Combine(0.2f, 0.2f, 0.55f, GL_ADD);
     }
     
     Create_Name();
 }
示例#11
0
文件: bonusbox.cpp 项目: sKabYY/SMC
void cBonusBox :: Set_Bonus_Type( SpriteType bonus_type )
{
	// already set
	if( box_type == bonus_type )
	{
		return;
	}

	box_type = bonus_type;

	// set item image
	if( box_type == TYPE_UNDEFINED )
	{
		m_item_image = NULL;
	}
	else if( box_type == TYPE_POWERUP )
	{
		// force always best item
		m_force_best_item = 1;
		m_item_image = pVideo->Get_Surface( "game/editor/unknown.png" );
	}
	else if( box_type == TYPE_MUSHROOM_DEFAULT )
	{
		m_item_image = pVideo->Get_Surface( "game/items/mushroom_red.png" );
	}
	else if( box_type == TYPE_FIREPLANT )
	{
		m_item_image = pVideo->Get_Surface( "game/items/fireplant.png" );
	}
	else if( box_type == TYPE_MUSHROOM_BLUE )
	{
		m_item_image = pVideo->Get_Surface( "game/items/mushroom_blue.png" );
	}
	else if( box_type == TYPE_MUSHROOM_GHOST )
	{
		m_item_image = pVideo->Get_Surface( "game/items/mushroom_ghost.png" );
	}
	else if( box_type == TYPE_MUSHROOM_LIVE_1 )
	{
		m_item_image = pVideo->Get_Surface( "game/items/mushroom_green.png" );
	}
	else if( box_type == TYPE_STAR )
	{
		m_item_image = pVideo->Get_Surface( "game/items/star.png" );
	}
	else if( box_type == TYPE_GOLDPIECE )
	{
		if( m_gold_color == COL_RED )
		{
			m_item_image = pVideo->Get_Surface( "game/items/goldpiece/red/1.png" );
		}
		else
		{
			m_item_image = pVideo->Get_Surface( "game/items/goldpiece/yellow/1.png" );
		}
	}
	else if( box_type == TYPE_MUSHROOM_POISON )
	{
		m_item_image = pVideo->Get_Surface( "game/items/mushroom_poison.png" );
	}
	else
	{
		m_item_image = NULL;
		printf( "Error : Unknown BonusBox Item type : %d\n", box_type );
	}

	// recreate name
	Create_Name();
}