예제 #1
0
//--------------------------------------------------------------------------------------------------
void Be2::DoAction2(BeUnit* Unit, BRect dest)
{//punch
	BBitmap* Frame[4];
	BRect Origine = Position;
	int direction, decalage;
	
	Frame[0] = GetAnim(Type, 5, 0, PlayerColor); //swing
	Frame[1] = GetAnimFlip(Type, 5, 0, PlayerColor);
	Frame[2] = GetAnim(Type, 5, 1, PlayerColor); //punch
	Frame[3] = GetAnimFlip(Type, 5, 1, PlayerColor);

	//where do we go ?
	if(Position.left > dest.left || dest.left == 0)
	{dest.OffsetBy(32,0); direction = 1; decalage = -10;}
	
	else
	{dest.OffsetBy(-32,0); direction = 0; decalage = 10;}

	DoAction1(this, dest);

	BBitmap* idle = CurrentImage;
	BRect Invalidator;
	
	Invalidator = Position; 
	Position.OffsetBy(decalage, 0); //moving forward 1
	CurrentImage = Frame[0+direction]; 
	Update(Invalidator); 
	snooze(SPEED * 2);

	Invalidator = Position; 
	Position.OffsetBy(decalage, 0); //moving forward 2	
	Update(Invalidator); 
	snooze(SPEED);

	CurrentImage = Frame[2+direction]; //punch
	Update(Position); 
	Unit->Hit(!((bool) direction));
	Unit->SetHP(-3); //3 damage
	Recovery -= 3; //6 (2 walk) - 3 = 3
	
	Invalidator = Position; 
	Position.OffsetBy(-decalage, 0); //back off 1
	CurrentImage = Frame[0+direction]; 
	Update(Invalidator); snooze(SPEED);

	Invalidator = Position; 
	Position.OffsetBy(-decalage, 0); //back off 2
	Update(Invalidator); 
	snooze(SPEED);
	
	CurrentImage = idle; Update(Invalidator);

	DoAction1(this, Origine); //retourne a la case depart

	//clean up
	delete Frame[0];
	delete Frame[1];
	delete Frame[2];
	delete Frame[3];
} 
예제 #2
0
//--------------------------------------------------------------------------------------------------
void Be5::DoAction6(BeUnit* b, BRect r)
{
	BBitmap* casting = GetAnim(Type, 2, 0, PlayerColor);
	BBitmap* beSign = GetAnim(Type, 6, 1, PlayerColor);
	BBitmap* idle = CurrentImage;
	CurrentImage = casting;
	Update(Position); 
	snooze(SPEED * 2);

	SEffect()->Position = Position; 
	SEffect()->CurrentImage = beSign;
	SEffect()->Valid = true;

	rgb_color c;
	for(int a = 15; a != 255; a+=16)
	{
		for(int i = 0; i < 32; i++)
			for(int j = 0; j < 32; j++)
			{
				c = ((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)];
				if(!(c.red == 255 && c.green == 0 && c.blue == 255))
					((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)].alpha = a;
			}
		Update(Position);
		snooze((int)(SPEED/2));
	}

	SEffect()->Valid = false;
	Update(Position); //enleve la trace

	CurrentImage = idle; 
	Update(Position);
	delete casting;
	delete beSign;
}
예제 #3
0
//-----------------------------------------------------------------
void Be2::Kill()
{
	BBitmap* Frame[3];
	
	Frame[0] = GetAnim(Type, 6, 1, PlayerColor);
	Frame[1] = GetAnimFlip(Type, 6, 1, PlayerColor);
	Frame[2] = GetAnim(Type, 6, 2, PlayerColor);
	delete CurrentImage;

	CurrentImage = Frame[0]; 
	Update(Position); 
	snooze(SPEED * 2);
	CurrentImage = Frame[1]; 
	Update(Position); 
	snooze(SPEED * 2);
	CurrentImage = Frame[0]; 
	Update(Position); 
	snooze(SPEED * 2);
	CurrentImage = Frame[1]; 
	Update(Position); 
	snooze(SPEED * 2);
	CurrentImage = Frame[2]; 
	Update(Position); 
	snooze(SPEED * 4);

	//clean up
	delete Frame[0];
	delete Frame[1];
	//don't erase Frame[3].
}
예제 #4
0
//--------------------------------------------------------------------------------------------------
void Be2::DoAction6(BeUnit* b, BRect r)
{
	BBitmap* Frame[2];
	
	Frame[0] = GetAnim(Type, 3, 0, PlayerColor);
	Frame[1] = GetAnim(Type, 3, 1, PlayerColor);

	BBitmap* idle = CurrentImage;

	CurrentImage = Frame[0]; 
	Update(Position); 
	snooze(SPEED * 4);

	CurrentImage = Frame[1]; 
	Update(Position); 
	snooze(SPEED * 4);

	CurrentImage = Frame[0]; 
	Update(Position); 
	snooze(SPEED * 2);
	
	CurrentImage = idle; 
	Update(Position);

	//clean up
	delete Frame[0];
	delete Frame[1];
}
예제 #5
0
void idActor::SyncAnimChannels( int channel, int syncToChannel, int blendFrames ) {
	idAnimator		*headAnimator;
	//idAFAttachment	*headEnt;
	int				anim;
	idAnimBlend		*syncAnim;
	int				starttime;
	int				blendTime;
	int				cycle;

	blendTime = FRAME2MS( blendFrames );
	if ( channel == ANIMCHANNEL_HEAD ) {
#if 0
		headEnt = head.GetEntity();
		if ( headEnt ) {
			headAnimator = headEnt->GetAnimator();
			syncAnim = animator.CurrentAnim( syncToChannel );
			if ( syncAnim ) {
				anim = headAnimator->GetAnim( syncAnim->AnimFullName() );
				if ( !anim ) {
					anim = headAnimator->GetAnim( syncAnim->AnimName() );
				}
				if ( anim ) {
					cycle = animator.CurrentAnim( syncToChannel )->GetCycleCount();
					starttime = animator.CurrentAnim( syncToChannel )->GetStartTime();
					headAnimator->PlayAnim( ANIMCHANNEL_ALL, anim, gameLocal.time, blendTime );
					headAnimator->CurrentAnim( ANIMCHANNEL_ALL )->SetCycleCount( cycle );
					headAnimator->CurrentAnim( ANIMCHANNEL_ALL )->SetStartTime( starttime );
				} else {
					headEnt->PlayIdleAnim( blendTime );
				}
			}
		}
#endif
	} else if ( syncToChannel == ANIMCHANNEL_HEAD ) {
#if 0
		headEnt = head.GetEntity();
		if ( headEnt ) {
			headAnimator = headEnt->GetAnimator();
			syncAnim = headAnimator->CurrentAnim( ANIMCHANNEL_ALL );
			if ( syncAnim ) {
				anim = GetAnim( channel, syncAnim->AnimFullName() );
				if ( !anim ) {
					anim = GetAnim( channel, syncAnim->AnimName() );
				}
				if ( anim ) {
					cycle = headAnimator->CurrentAnim( ANIMCHANNEL_ALL )->GetCycleCount();
					starttime = headAnimator->CurrentAnim( ANIMCHANNEL_ALL )->GetStartTime();
					animator.PlayAnim( channel, anim, gameLocal.time, blendTime );
					animator.CurrentAnim( channel )->SetCycleCount( cycle );
					animator.CurrentAnim( channel )->SetStartTime( starttime );
				}
			}
		}
#endif
	} else {
		animator.SyncAnimChannels( channel, syncToChannel, gameLocal.time, blendTime );
	}
}
예제 #6
0
void LocationDlg::RefreshAnimsText()
{
	wxTreeItemIdValue cookie;
	wxTreeItemId id;

	uint i, num = m_pAnimPaths->size();
	for (i = 0; i < num; i++)
	{
		vtAnimEntry &entry = m_pAnimPaths->at(i);
		vtAnimPath *anim = GetAnim(i);
		vtAnimPathEngine *eng = GetEngine(i);

		if (id.IsOk())
			id = GetAnimTree()->GetNextChild(m_root, cookie);
		else
			id = GetAnimTree()->GetFirstChild(m_root, cookie);

		wxString str(entry.m_Name, wxConvUTF8);
		wxString str2;
		str2.Printf(_T(" (%.1f/%.1f, %d)"), eng->GetTime(),
			(float) anim->GetLastTime(), anim->NumPoints());
		str += str2;
		GetAnimTree()->SetItemText(id, str);
	}
}
예제 #7
0
void LocationDlg::RefreshAnims()
{
	GetAnimTree()->DeleteAllItems();
	m_root = GetAnimTree()->AddRoot(_T("Root"));

	if (!m_pAnimPaths)
		return;

	wxString str;
	uint i, num = m_pAnimPaths->size();

	for (i = 0; i < num; i++)
	{
		wxTreeItemId id = GetAnimTree()->AppendItem(m_root, _T("anim"));

		vtAnimPath *anim = GetAnim(i);
		vtAnimPath::TimeControlPointMap &tcm = anim->GetTimeControlPointMap();
		vtAnimPath::TimeControlPointMap::iterator iter;

		int count = 0;
		for (iter = tcm.begin(); iter != tcm.end(); iter++)
		{
			anim->GetFirstTime();
			str.Printf(_("%d: time %lf"), count, iter->first);
			GetAnimTree()->AppendItem(id, str);
			count++;
		}
	}

	RefreshAnimsText();
}
예제 #8
0
//-----------------------------------------------------------------------------------
//		Purpose	: Animation의 Hit Time을 얻어온다.                
//		Return	: Hit의 마지막 Time (Skill 시전시의 마지막 Hit가 필요)
//-----------------------------------------------------------------------------------
DWORD sMODELTOOL_CHAR_TBLDAT::GetSkillAnimationSkillCancelTime(ANIMATIONID skillAnimationId)
{
	sCHAR_DATA_INFO * pCharAnimData = GetAnim( ITEM_TYPE_UNKNOWN, skillAnimationId );
	if( NULL == pCharAnimData )
	{
		return 0;
	}
	if (false == pCharAnimData->bDataLoaded)
	{
		return 0;
	}

	if (0 == pCharAnimData->byHitCount)
	{
		return 0;
	}

	if (NTL_MAX_SIZE_HIT < pCharAnimData->byHitCount)
	{
		_ASSERT(0);
		return 0;
	}

	return (DWORD) ( 1000.0f * pCharAnimData->fSkillCancelTime );
}
예제 #9
0
/*
===============
idActor::Event_PlayAnim
===============
*/
void idActor::Event_PlayAnim( int channel, const char* animname )
{
	const int	anim = GetAnim( channel, animname );
	if( !anim )
	{
		if( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() )
		{
			gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) );
		}
		else
		{
			gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), GetEntityDefName() );
		}
		idThread::ReturnInt( 0 );
		return;
	}
	
	if ( ANIMCHANNEL_ALL == channel )
	{
		// start from 1, skip ANIMCHANNEL_ALL
		for ( int i = 1; i < ANIMCHANNEL_COUNT; ++i )
			InternalPlayAnim( i, anim );
	}
	else
		InternalPlayAnim( channel, anim );

	idThread::ReturnInt( 1 );
}
예제 #10
0
	void SpriteAnimation::Stop(const std::string &name)
	{
		animation = GetAnim(name);
		if (animation)
		{
			animation->isPlaying = false;
		}
	}
예제 #11
0
void C_Animation::SetFlags(long ID,long flags)
{
	ANIM_RES *anim;

	anim=GetAnim(ID);
	if(anim)
		anim->flags=flags;
}
예제 #12
0
long C_Animation::GetFlags(long ID)
{
	ANIM_RES *anim;

	anim=GetAnim(ID);
	if(anim)
		return(anim->flags);
	return(0);
}
예제 #13
0
	void SpriteAnimation::Play(const std::string &name)
	{
		animation = GetAnim(name);
		if (animation)
		{
			animation->isPlaying = true;
		}

	}
예제 #14
0
ANIM_RES *C_Animation::LoadAnim(long ID,char *filename)
{
	ANIM_RES *cur,*NewAnim;
	UI_HANDLE ifp;
	long size;

	if(GetAnim(ID))
		return(NULL);

	ifp=UI_OPEN(filename,"rb");

	if(ifp == NULL)
		return(NULL);

	size=UI_FILESIZE(ifp);

	if(!size)
	{
		UI_CLOSE(ifp);
		return(FALSE);
	}

	NewAnim=new ANIM_RES;
	NewAnim->ID=ID;
	NewAnim->Anim=(ANIMATION *)((void*)new char [size+1]);
	NewAnim->flags=0;
	NewAnim->Next=NULL;

	if(NewAnim->Anim == NULL)
	{
		delete NewAnim;
		UI_CLOSE(ifp);
		return(NULL);
	}
	if(UI_READ(NewAnim->Anim,size,1,ifp) != 1)
	{
		delete NewAnim->Anim;
		delete NewAnim;
		UI_CLOSE(ifp);
		return(NULL);
	}
	UI_CLOSE(ifp);

	ConvertAnim(NewAnim->Anim);
	cur=Root_;
	if(cur == NULL)
	{
		Root_=NewAnim;
	}
	else
	{
		while(cur->Next)
			cur=cur->Next;
		cur->Next=NewAnim;
	}
	return(NewAnim);
}
예제 #15
0
/*
================
idActor::Event_HasAnim
================
*/
void idActor::Event_HasAnim( int channel, const char* animname )
{
	if( GetAnim( channel, animname ) != 0 )
	{
		idThread::ReturnFloat( 1.0f );
	}
	else
	{
		idThread::ReturnFloat( 0.0f );
	}
}
예제 #16
0
void LocationDlg::UpdateSlider()
{
	if (m_iAnim != -1)
	{
		// time slider
		float fTotalTime = GetAnim(m_iAnim)->GetLastTime();
		float fTime = GetEngine(m_iAnim)->GetTime();
		m_iPos = (int) (fTime / fTotalTime * 1000);
		GetAnimPos()->SetValue(m_iPos);
	}
}
예제 #17
0
int AnimManager::AddAnim(AnimationComponent& animComponent, const std::string& animName,
	int startFrame, int endFrame, bool animLoop)
{
	if(GetAnim(animComponent.animPrefix + animName) != -1) return -1;

	animMap[animComponent.animPrefix + animName] = animInfoVector.size();
	animInfoVector.push_back(animInfo());
	animInfoVector.back().start = startFrame;
	animInfoVector.back().end = endFrame;
	animInfoVector.back().loop = animLoop;

	return animInfoVector.size()-1;
}
예제 #18
0
void LocationDlg::OnAnimPosSlider( wxCommandEvent &event )
{
	if (m_iAnim == -1)
		return;

	TransferDataFromWindow();

	float fTotalTime = GetAnim(m_iAnim)->GetLastTime();
	vtAnimPathEngine *eng = GetEngine(m_iAnim);
	eng->SetTime(m_iPos * fTotalTime / 1000);
	if (m_bActive)
		eng->UpdateTargets();
}
예제 #19
0
//--------------------------------------------------------------------------------------------------
void Be5::Stupid()
{
	BBitmap* interogation = GetAnim(Type, 7, 1, PlayerColor);
	BBitmap* casting = GetAnim(Type, 2, 0, PlayerColor);
	BBitmap* idle = CurrentImage;
	
	CurrentImage = casting;
	Update(Position); 
	snooze(SPEED * 2);

	SEffect()->Position = Position; 
	SEffect()->CurrentImage = interogation;
	SEffect()->Valid = true;

	rgb_color c;
	for(int a = 15; a != 255; a+=16)
	{
		for(int i = 0; i < 32; i++)
			for(int j = 0; j < 32; j++)
			{
				c = ((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)];
				if(!(c.red == 255 && c.green == 0 && c.blue == 255))
					((rgb_color *)SEffect()->CurrentImage->Bits())[(i*32 + j)].alpha = a;
			}
		Update(Position);
		snooze((int)(SPEED/2));
	}

	SEffect()->Valid = false;
	Update(Position);

	CurrentImage = idle; 
	Update(Position);

	//clean up
	delete casting;
	delete interogation;
}
예제 #20
0
//-----------------------------------------------------------------------------------
//		Purpose	:
//		Return	:
//-----------------------------------------------------------------------------------
DWORD sMODELTOOL_CHAR_TBLDAT::GetNpcAttackDurationTime(BYTE byAttackType)
{
	sCHAR_DATA_INFO * pCharAnimData = GetAnim( ITEM_TYPE_UNKNOWN, (ANIMATIONID) ( byAttackType + ATTACK_ANIMATION_START ) ); // 임시
	if( NULL == pCharAnimData )
	{
		return 0;
	}
	if (false == pCharAnimData->bDataLoaded)
	{
		return 0;
	}

	return (DWORD) ( 1000.0f * pCharAnimData->fDurationTime );
}
예제 #21
0
/*
================
idActor::Event_CheckAnim
================
*/
void idActor::Event_CheckAnim( int channel, const char* animname )
{
	if( !GetAnim( channel, animname ) )
	{
		if( animPrefix.Length() )
		{
			gameLocal.Error( "Can't find anim '%s_%s' for '%s'", animPrefix.c_str(), animname, name.c_str() );
		}
		else
		{
			gameLocal.Error( "Can't find anim '%s' for '%s'", animname, name.c_str() );
		}
	}
}
예제 #22
0
//-----------------------------------------------------------------------------------
//		Purpose	: Animation의 Hit Time을 얻어온다.                
//		Return	: Hit의 첫번째 Time (Skill 시전시의 첫번째 Hit가 필요)
//-----------------------------------------------------------------------------------
DWORD sMODELTOOL_CHAR_TBLDAT::GetSkillAnimationFirstHitTime(ANIMATIONID skillAnimationId)
{
	sCHAR_DATA_INFO * pCharAnimData = GetAnim( ITEM_TYPE_UNKNOWN, skillAnimationId );
	if( NULL == pCharAnimData )
	{
		return 0;
	}
	if (false == pCharAnimData->bDataLoaded)
	{
		return 0;
	}

	return (DWORD) ( 1000.0f * pCharAnimData->aHitTime[0] );
}
예제 #23
0
//-----------------------------------------------------------------------------------
//		Purpose	:
//		Return	:
//-----------------------------------------------------------------------------------
BYTE sMODELTOOL_CHAR_TBLDAT::GetSkillAnimationPushCount(ANIMATIONID skillAnimationId)
{
	sCHAR_DATA_INFO * pCharAnimData = GetAnim( ITEM_TYPE_UNKNOWN, skillAnimationId );
	if( NULL == pCharAnimData )
	{
		return 0;
	}
	if (false == pCharAnimData->bDataLoaded)
	{
		return 0;
	}

	return pCharAnimData->byPushCount;
}
예제 #24
0
bool sMODELTOOL_CHAR_TBLDAT::GetSkillKB2Push( ANIMATIONID skillAnimationId ) 
{
    sCHAR_DATA_INFO * pCharAnimData = GetAnim( ITEM_TYPE_UNKNOWN, skillAnimationId );
    if( NULL == pCharAnimData )
    {
        return false;
    }
    if (false == pCharAnimData->bDataLoaded)
    {
        return false;
    }

    return pCharAnimData->bKB2Push;
}
예제 #25
0
//--------------------------------------------------------------------------------------------------
void Be5::Hit(bool direction)
{
	BBitmap* Ouch = GetAnim(Type, 0, 2, PlayerColor);
	BBitmap* idle = CurrentImage;
	
	CurrentImage = Ouch;
	Update(Position); 
	snooze(SPEED * 2);
	
	CurrentImage = idle; 
	Update(Position);

	delete Ouch;
}
예제 #26
0
//--------------------------------------------------------------------------------------------------
void Be2::DoAction5(BeUnit* Unit, BRect dest) 
{//slow
	BBitmap* Frame[3];
	
	//Load les Images du move pour lui
	Frame[0] = GetAnim(Type, 7, 0, PlayerColor);     
	Frame[1] = GetAnim(Type, 7, 1, PlayerColor); 	
	Frame[2] = GetAnim(Type, 7, 2, PlayerColor); 		

	SEffect()->Position = dest; //slow !
	SEffect()->CurrentImage = Frame[0];
	SEffect()->Valid = true;

	for(int i=0; i<4; i++)
	{
		SEffect()->CurrentImage = Frame[0];
		SEffect()->Update(dest);
		snooze((int)SPEED);
		SEffect()->CurrentImage = Frame[1];
		SEffect()->Update(dest);
		snooze((int)SPEED);
		SEffect()->CurrentImage = Frame[2];
		SEffect()->Update(dest);
		snooze((int)SPEED);
	}
	SEffect()->Valid = false;
	Update(dest); //remet la bonne image
	Unit->CastSlow();
	//on set le nouveau recovery
	Recovery += 5;

	//clean up
	delete Frame[0];
	delete Frame[1];
	delete Frame[2];
}
예제 #27
0
//--------------------------------------------------------------------------------------------------
void Be2::Stupid()
{
	BBitmap* Stupid1 = GetAnim(Type, 1, 0, PlayerColor);
	BBitmap* Stupid2 = GetAnim(Type, 1, 1, PlayerColor);
			
	BBitmap* idle = CurrentImage;
	
	for(int i=0; i<3; i++)
	{
		CurrentImage = Stupid1;
		Update(Position); 
		snooze(SPEED * 2);
	
		CurrentImage = Stupid2;
		Update(Position); 
		snooze(SPEED * 2);
	}
	
	CurrentImage = idle; 
	Update(Position);

	delete Stupid1;
	delete Stupid2;
}
예제 #28
0
void LocationDlg::OnSaveAnim( wxCommandEvent &event )
{
	if (m_iAnim == -1)
		return;
	vtAnimPath *path = GetAnim(m_iAnim);

	wxFileDialog saveFile(NULL, _("Save AnimPath"), _T(""), _T(""),
		FSTRING_VTAP, wxFD_SAVE);
	bool bResult = (saveFile.ShowModal() == wxID_OK);
	if (!bResult)
		return;

	wxString filepath = saveFile.GetPath();
	path->Write(filepath.mb_str(wxConvUTF8));
}
예제 #29
0
void LocationDlg::GetValues()
{
	if (m_iAnim == -1)
		return;

	vtAnimPath *anim = GetAnim(m_iAnim);
	m_bSmooth = (anim->GetInterpMode() == vtAnimPath::CUBIC_SPLINE);
	m_bLoop = anim->GetLoop();

	vtAnimPathEngine *engine = GetEngine(m_iAnim);
	m_bContinuous = engine->GetContinuous();
	m_bPosOnly = engine->GetPosOnly();
	m_fSpeed = engine->GetSpeed();
//  m_bActive = engine->GetEnabled();
}
예제 #30
0
/*
===============
idActor::Event_IdleAnim
===============
*/
void idActor::Event_IdleAnim( int channel, const char* animname )
{
	const int anim = GetAnim( channel, animname );
	if( !anim )
	{
		if( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() )
		{
			gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) );
		}
		else
		{
			gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), GetEntityDefName() );
		}
		
		switch( channel )
		{
			case ANIMCHANNEL_HEAD :
				headAnim.BecomeIdle();
				break;
				
			case ANIMCHANNEL_TORSO :
				torsoAnim.BecomeIdle();
				break;
				
			case ANIMCHANNEL_LEGS :
				legsAnim.BecomeIdle();
				break;
				
			default:
				gameLocal.Error( "Unknown anim group" );
		}
		
		idThread::ReturnInt( false );
		return;
	}
		
	if (ANIMCHANNEL_ALL == channel)
	{
		// start from 1, skip ANIMCHANNEL_ALL
		for (int i = 1; i < ANIMCHANNEL_COUNT; ++i)
			InternalIdleAnim(i, anim);
	}
	else
		InternalIdleAnim(channel, anim);
	
	idThread::ReturnInt(1);
}