Exemplo n.º 1
0
void CG_DrawPMItems( void ) {
	vec4_t colour = { 0.f, 0.f, 0.f, 1.f };
	vec4_t colourText = { 1.f, 1.f, 1.f, 1.f };
	float t;
	int i, size;
	pmListItem_t* listItem = cg_pmOldList;
	float y = 360;
	
	if (!tj_drawCPM.integer)
		return;

	if( cg_drawSmallPopupIcons.integer ) {
		size = PM_ICON_SIZE_SMALL;

		y += 4;
	} else {
		size = PM_ICON_SIZE_NORMAL;
	}

	if( cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 ) {
		y -= 20;
	}

	if( !cg_pmWaitingList ) {
		return;
	}

	t = cg_pmWaitingList->time + CG_TimeForPopup( cg_pmWaitingList->type ) + PM_WAITTIME;
	if( cg.time > t ) {
		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
	}

	trap_R_SetColor( colourText );
	CG_DrawPic( 4, y, size, size, cg_pmWaitingList->shader );
	trap_R_SetColor( NULL );
	CG_Text_Paint_Ext( 4 + size + 2, y + 12, 0.2f, 0.2f, colourText, cg_pmWaitingList->message, 0, 0, 0, &cgs.media.limboFont2 );

	for( i = 0; i < 4 && listItem; i++, listItem = listItem->next ) {
		y -= size + 2;

		t = listItem->time + CG_TimeForPopup( listItem->type ) + PM_WAITTIME;
		if( cg.time > t ) {
			colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
		} else {
			colourText[3] = colour[3] = 1.f;
		}

		trap_R_SetColor( colourText );
		CG_DrawPic( 4, y, size, size, listItem->shader );
		trap_R_SetColor( NULL );
		CG_Text_Paint_Ext( 4 + size + 2, y + 12, 0.2f, 0.2f, colourText, listItem->message, 0, 0, 0, &cgs.media.limboFont2 );
	}
}
Exemplo n.º 2
0
void CG_UpdatePMLists( void ) {
	pmListItem_t* listItem;
	pmListItem_t* lastItem;
	pmListItemBig_t* listItem2;

	if ( ( listItem = cg_pmWaitingList ) ) {
		int t = ( CG_TimeForPopup( listItem->type ) + 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 + PM_WAITTIME + PM_FADETIME ) {
					// we're gone completely
					cg_pmWaitingList = NULL;
					listItem->inuse = false;
					listItem->next = NULL;
				} else {
					// just sit where we are, no pressure to do anything...
				}
			}
		}
	}

	listItem = cg_pmOldList;
	lastItem = NULL;
	while ( listItem ) {
		int t = ( CG_TimeForPopup( listItem->type ) + listItem->time + PM_WAITTIME + PM_FADETIME );
		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 = false;

			} while ( ( listItem = next ) );


			break;
		}

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


	if ( ( listItem2 = cg_pmWaitingListBig ) ) {
		int t = CG_TimeForBigPopup( listItem2->type ) + 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 = false;
				listItem2->next = NULL;
			} else {
				if ( cg.time > t + PM_WAITTIME + PM_FADETIME ) {
					// we're gone completely
					cg_pmWaitingListBig = NULL;
					listItem2->inuse = false;
					listItem2->next = NULL;
				} else {
					// just sit where we are, no pressure to do anything...
				}
			}
		}
	}
}
Exemplo n.º 3
0
void CG_DrawPMItems( void ) {
	vec4_t colour = { 0.f, 0.f, 0.f, 1.f };
	vec4_t colourText = { 1.f, 1.f, 1.f, 1.f };
	float t;
	int i, size;
	pmListItem_t* listItem = cg_pmOldList;
	int x = cg.hud.cpmtext[0];
	int y = cg.hud.cpmtext[1];
	float scaleVal;

	if( cg_drawSmallPopupIcons.integer ) {
		size = PM_ICON_SIZE_SMALL;

		y += 4;
	} else {
		size = PM_ICON_SIZE_NORMAL;
	}

	if( 
		(
			cg.hudEditor.showHudEditor ||
			cg.snap->ps.persistant[PERS_RESPAWNS_LEFT] >= 0 
		) && 
		cg.hud.livesleft[0] == 4 && cg.hud.livesleft[1] == 360 && 
		cg.hud.cpmtext[0] == 4 && cg.hud.cpmtext[1] == 360 
	) {
		y -= 20;
	}

	if( !cg_pmWaitingList || cg.hud.cpmtext[0] < 0 ) {
		return;
	}

	t = cg_pmWaitingList->time + CG_TimeForPopup( cg_pmWaitingList->type ) + PM_WAITTIME;
	if( cg.time > t ) {
		colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
	}

	scaleVal = cg.hud.cpmtext[2]/100.f;
	trap_R_SetColor( colourText );
	CG_DrawPic( x, y, size, size, cg_pmWaitingList->shader );
	trap_R_SetColor( NULL );
	CG_Text_Paint_Ext( x + size + 2, y + 12, scaleVal, scaleVal,
		colourText, cg_pmWaitingList->message, 
		0, 0, 0, &cgs.media.font3 );

	for( i = 0; i < 4 && listItem; i++, listItem = listItem->next ) {
		y -= size + 2;

		t = listItem->time + CG_TimeForPopup( listItem->type ) + PM_WAITTIME;
		if( cg.time > t ) {
			colourText[3] = colour[3] = 1 - ((cg.time - t) / (float)PM_FADETIME);
		} else {
			colourText[3] = colour[3] = 1.f;
		}

		trap_R_SetColor( colourText );
		CG_DrawPic( x, y, size, size, listItem->shader );
		trap_R_SetColor( NULL );
		CG_Text_Paint_Ext( x + size + 2, y + 12, scaleVal, scaleVal, 
			colourText, listItem->message, 
			0, 0, 0, &cgs.media.font3 );
	}
}