Пример #1
0
void cMenu_Item :: Set_Active( bool nactive /* = 0 */ )
{
	active = nactive;
	m_rot_z = 0;
	Set_Scale( 1 );

	if( !nactive )
	{
		Set_Color_Combine( 0, 0, 0, 0 );
	}
}
Пример #2
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();
 }
Пример #3
0
void cBall :: Draw( cSurface_Request *request /* = NULL */ )
{
	if( !m_valid_draw )
	{
		return;
	}

	// don't draw if leveleditor mode
	if( editor_level_enabled )
	{
		return;
	}

	if( m_ball_type == FIREBALL_DEFAULT )
	{
		Set_Color_Combine( m_glim_counter, m_glim_counter / 1.2f, m_glim_counter / 2, GL_ADD );
	}
	else if( m_ball_type == ICEBALL_DEFAULT )
	{
		Set_Color_Combine( m_glim_counter / 2.5f, m_glim_counter / 2.5f, m_glim_counter / 1.7f, GL_ADD );
	}

	cMovingSprite::Draw( request );
}
Пример #4
0
void cMushroom :: Set_Type( SpriteType ntype )
{
	// already set
	if( m_type == ntype )
	{
		return;
	}

	Set_Color_Combine( 0, 0, 0, 0 );
	Clear_Images();

	if( ntype == TYPE_MUSHROOM_DEFAULT )
	{
		Add_Image( pVideo->Get_Surface( "game/items/mushroom_red.png" ) );
		m_name = _("Mushroom Red");
	}
	else if( ntype == TYPE_MUSHROOM_LIVE_1 )
	{
		Add_Image( pVideo->Get_Surface( "game/items/mushroom_green.png" ) );
		m_name = _("Mushroom 1-UP");
	}
	else if( ntype == TYPE_MUSHROOM_POISON )
	{
		Add_Image( pVideo->Get_Surface( "game/items/mushroom_poison.png" ) );
		m_name = _("Mushroom Poison");
	}
	else if( ntype == TYPE_MUSHROOM_BLUE )
	{
		Add_Image( pVideo->Get_Surface( "game/items/mushroom_blue.png" ) );
		m_name = _("Mushroom Blue");
	}
	else if( ntype == TYPE_MUSHROOM_GHOST )
	{
		Add_Image( pVideo->Get_Surface( "game/items/mushroom_ghost.png" ) );
		m_name = _("Mushroom Ghost");
	}
	else
	{
		printf( "Warning Unknown Mushroom type : %d\n", ntype );
		return;
	}
	
	m_type = ntype;
	
	Set_Image_Num( 0, 1, 0 );
}
Пример #5
0
void cMenu_Item :: Draw( cSurface_Request *request /* = NULL */ )
{
	if( active )
	{
		// rotation is used for the scale state
		if( !m_rot_z )
		{
			Add_Scale( ( 1.2f / m_image->m_w ) * pFramerate->m_speed_factor );
		}
		else
		{
			Add_Scale( -( 1.2f / m_image->m_w ) * pFramerate->m_speed_factor );
		}

		if( m_image->m_w * m_scale_x > m_image->m_w + 10.0f )
		{
			m_rot_z = 0.0001f;
		}
		else if( m_scale_x < 1.0f )
		{
			m_rot_z = 0.0f;
		}
	}

	cHudSprite::Draw( request );

	if( active )
	{
		float strength = m_image->m_w * ( m_scale_x - 1 );

		// boost color to yellow
		Set_Color_Combine( strength / 40, strength / 40, 0, GL_ADD );

		m_pos_x = m_start_pos_x;
		m_pos_y = m_start_pos_y;

		image_menu->Draw();
	}
}
Пример #6
0
 void cMushroom::Update(void)
 {
     if (!m_valid_update || !Is_In_Player_Range())
     {
         return;
     }
     
     if (!m_ground_object)
     {
         if (m_vely < 25.0f)
         {
             Add_Velocity(0.0f, 1.5f);
         }
     }
     else
     {
         m_vely = 0.0f;
     }
     
     if (m_type == TYPE_MUSHROOM_LIVE_1 || m_type == TYPE_MUSHROOM_BLUE)
     {
         counter += pFramerate->m_speed_factor * 0.8f;
         
         while (counter > 1.0f)
         {
             cParticle_Emitter* anim = new cParticle_Emitter();
             anim->Set_Pos(m_col_rect.m_x + Get_Random_Float(0, m_col_rect.m_w), m_col_rect.m_y + Get_Random_Float(0, m_col_rect.m_h));
             anim->Set_Pos_Z(m_pos_z - 0.000001f);
             anim->Set_Direction_Range(180, 180);
             anim->Set_Scale(0.4f, 0.1f);
             
             if (m_type == TYPE_MUSHROOM_LIVE_1)
             {
                 anim->Set_Time_to_Live(0.4f);
                 anim->Set_Color(Color(static_cast<Uint8>(rand() % 30), 100 + (rand() % 150), rand() % 30));
                 anim->Set_Speed(0.5f, 0.5f);
                 anim->Set_Blending(BLEND_ADD);
             }
             else if (m_type == TYPE_MUSHROOM_BLUE)
             {
                 anim->Set_Time_to_Live(0.6f);
                 anim->Set_Color(Color(static_cast<Uint8>(180 + (rand() % 50)), 180 + (rand() % 50), 255, 128));
                 anim->Set_Speed(0.2f, 0.1f);
             }
             
             anim->Set_Image(pVideo->Get_Surface("animation/particles/light.png"));
             
             pAnimation_Manager->Add(anim);
             
             counter--;
         }
         
         if (m_type == TYPE_MUSHROOM_BLUE)
         {
             float new_glim = m_combine_color[2];
             
             if (glim_mod)
             {
                 new_glim += pFramerate->m_speed_factor * 0.02f;
                 
                 if (new_glim > 0.5f)
                 {
                     new_glim = 1.0f;
                     glim_mod = 0;
                 }
             }
             else
             {
                 new_glim -= pFramerate->m_speed_factor * 0.02f;
                 
                 if (new_glim < 0.0f)
                 {
                     new_glim = 0.0f;
                     glim_mod = 1;
                 }
             }
             
             Set_Color_Combine(new_glim * 0.1f, new_glim * 0.1f, new_glim, GL_ADD);
         }
     }
     else if (m_type == TYPE_MUSHROOM_POISON)
     {
         if (m_ground_object)
         {
             counter += pFramerate->m_speed_factor * 0.7f;
             
             while (counter > 1.0f)
             {
                 cParticle_Emitter* anim = new cParticle_Emitter();
                 anim->Set_Emitter_Rect(m_col_rect.m_x + (m_col_rect.m_w * 0.3f), m_col_rect.m_y + (m_col_rect.m_h * 0.91f), Get_Random_Float(0, m_col_rect.m_w * 0.4f), 0);
                 anim->Set_Time_to_Live(1.4f, 0.4f);
                 anim->Set_Scale(0.7f, 0.2f);
                 anim->Set_Color(Color(static_cast<Uint8>(120 + rand() % 40), 190 + (rand() % 60), 0 + rand() % 10));
                 anim->Set_Blending(BLEND_ADD);
                 anim->Set_Speed(0.0f, 0.0f);
                 anim->Set_Image(pVideo->Get_Surface("animation/particles/slime_1.png"));
                 
                 pAnimation_Manager->Add(anim);
                 
                 counter--;
             }
         }
     }
 }