예제 #1
0
void CG_AddPMItemBig( popupMessageBigType_t type, const char* message, qhandle_t shader ) {
	pmListItemBig_t* listItem = CG_FindFreePMItem2();
	if ( !listItem ) {
		return;
	}

	if ( shader ) {
		listItem->shader = shader;
	} else {
		listItem->shader = cgs.media.pmImages[type];
	}

	listItem->inuse = true;
	listItem->type = type;
	listItem->next = NULL;
	Q_strncpyz( listItem->message, message, sizeof( cg_pmStackBig[0].message ) );

	if ( !cg_pmWaitingListBig ) {
		cg_pmWaitingListBig = listItem;
		listItem->time = cg.time;

		CG_PMItemBigSound( listItem );
	} else {
		pmListItemBig_t* loop = cg_pmWaitingListBig;
		while ( loop->next ) {
			loop = loop->next;
		}

		loop->next = listItem;
	}
}
예제 #2
0
void CG_UpdatePMLists(void)
{
	pmListItem_t    *listItem;
	pmListItem_t    *lastItem;
	pmListItemBig_t *listItem2;

	if ((listItem = cg_pmWaitingList))
	{
		int t = cg_popupTime.integer + listItem->time;

		if (cg.time > t)
		{
			if (listItem->next)
			{
				// there's another item waiting to come on, so move to old list
				cg_pmWaitingList       = listItem->next;
				cg_pmWaitingList->time = cg.time; // set time we popped up at

				CG_AddToListFront(&cg_pmOldList, listItem);
			}
			else
			{
				if (cg.time > t + cg_popupStayTime.integer + cg_popupFadeTime.integer)
				{
					// we're gone completely
					cg_pmWaitingList = NULL;
					listItem->inuse  = qfalse;
					listItem->next   = NULL;
				}
				else
				{
					// just sit where we are, no pressure to do anything...
				}
			}
		}
	}

	listItem = cg_pmOldList;
	lastItem = NULL;
	while (listItem)
	{
		int t = cg_popupTime.integer + listItem->time + cg_popupStayTime.integer + cg_popupFadeTime.integer;

		if (cg.time > t)
		{
			// nuke this, and everything below it (though there shouldn't BE anything below us anyway)
			pmListItem_t *next;

			if (!lastItem)
			{
				// we're the top of the old list, so set to NULL
				cg_pmOldList = NULL;
			}
			else
			{
				lastItem->next = NULL;
			}

			do
			{
				next = listItem->next;

				listItem->next  = NULL;
				listItem->inuse = qfalse;

			}
			while ((listItem = next));


			break;
		}

		lastItem = listItem;
		listItem = listItem->next;
	}

	if ((listItem2 = cg_pmWaitingListBig))
	{
		int t = PM_BIGPOPUP_TIME + listItem2->time;

		if (cg.time > t)
		{
			if (listItem2->next)
			{
				// there's another item waiting to come on, so kill us and shove the next one to the front
				cg_pmWaitingListBig       = listItem2->next;
				cg_pmWaitingListBig->time = cg.time; // set time we popped up at

				CG_PMItemBigSound(cg_pmWaitingListBig);

				listItem2->inuse = qfalse;
				listItem2->next  = NULL;
			}
			else
			{
				if (cg.time > t + cg_popupStayTime.integer + cg_popupFadeTime.integer)
				{
					// we're gone completely
					cg_pmWaitingListBig = NULL;
					listItem2->inuse    = qfalse;
					listItem2->next     = NULL;
				}
				else
				{
					// just sit where we are, no pressure to do anything...
				}
			}
		}
	}
}