示例#1
0
/*
 * 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;
}