예제 #1
0
파일: Animation.c 프로젝트: Raugharr/Herald
/*
 * The user must be able to call AnimationStart and AnimationStop when this thread is being executed.
 */
void AnimationQueue() {
	struct LinkedList* _List = NULL;
	struct LnkLst_Node* _Itr = NULL;
	struct Animation* _Animation = NULL;
	int _Time = SDL_GetTicks();

	while(_Itr != NULL) {
		_Animation = (struct Animation*) _Itr->Data;
		if(_Time - _Animation->LastFramePlay >= _Animation->Base->Frames[_Animation->CurrFrame].Speed) {
			AnimationNextFrame(_Animation, _Time);
		}
		_Itr = _Itr->Next;
	}
	_Itr = _List->Front;
	if(_List->Size == 0)
		return;
	SDL_LockMutex(g_AnimationLock);
		do {
			_Animation = (struct Animation*) _Itr->Data;
			DestroyAnimation(_Animation);
			LnkLstRemove(_List, _Itr);
			_Itr = _Itr->Next;
		} while(_Itr != NULL);
	SDL_UnlockMutex(g_AnimationLock);
}
예제 #2
0
void MissionFrameClear(struct MissionFrame* _Data) {
	struct LnkLst_Node* _Itr = NULL;

	DestroyMissionFrame(_Data);
	_Itr = g_GameWorld.MissionFrame.Front;
	while(_Itr != NULL) {
		if(_Itr->Data == _Data) {
			LnkLstRemove(&g_GameWorld.MissionFrame, _Itr);
			return;
		}
		_Itr = _Itr->Next;
	}
	Assert(0);
}
예제 #3
0
struct Retinue* CreateRetinue(struct BigGuy* _Leader) {
	struct Retinue* _Retinue = malloc(sizeof(struct Retinue));
	struct Settlement* _Home = PersonHome(_Leader->Person);

	_Retinue->Happiness = 50;
	_Retinue->Leader = _Leader;
	_Retinue->IsRecruiting = 0;
	_Retinue->FamilySz = 0;
	ConstructArray(&_Retinue->Warriors, 8);
	for(struct LnkLst_Node* _Itr = _Home->FreeWarriors.Front; _Itr != NULL; _Itr = _Itr->Next) {
		if(_Leader->Person == _Itr->Data) {
			LnkLstRemove(&_Home->FreeWarriors, _Itr);
			break;
		}
	}
	_Retinue->RecruitMod = 0;
	return _Retinue;
}