/* ==================== Objectives_Draw ==================== */ static void Objectives_Draw( centity_t *cent ) { int objCnt,i,lineCnt,maxLines; int total,textYCnt,length,color; vec4_t newColor; objCnt=0; for (i=0;i<MAX_OBJECTIVES;i++) { if (cgs.objectives[i].text[0]) { objCnt++; } } lineCnt = 0; // Count the number of lines. for (i=0;i<objCnt;i++) { if (cgs.objectives[i].text[0]) { lineCnt += Objective_LineCnt(i,cent); } } maxLines = OBJ_SCREEN_HEIGHT /OBJ_NORMAL_LINE_HEIGHT; if (lineCnt > maxLines) // Too many lines? { lineCnt = maxLines; } if (lineCnt==0) // Show there are no objectives { Q_strncpyz(cgs.objectives[0].text,ingame_text[IGT_NONETEXT],sizeof(cgs.objectives[0].text)); } textYCnt = lineCnt * OBJ_NORMAL_LINE_HEIGHT; // For the space between objectives textYCnt += (objCnt-1) * (OBJ_ADDITIONAL_LINE_HEIGHT * PROP_HEIGHT); // Calc starting Y of text total = OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YMARGIN + OBJ_SCREEN_Y2MARGIN + OBJ_SCREEN_Y2MARGIN + OBJ_SCREEN_YBORDERTOP + OBJ_SCREEN_YBORDERBOT + textYCnt; if (OBJ_SCREEN_HEIGHT < total) // This should never happen (but just in case) { total = OBJ_SCREEN_HEIGHT; } missionInfoScreenY = ((OBJ_SCREEN_HEIGHT - total) /2) + (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP); missionYcnt = 0; missionYpos = missionInfoScreenY; // Print top of frame trap_R_SetColor( colorTable[CT_DKPURPLE3]); CG_DrawPic( OBJ_HORIZONTAL_BORDER_X + 10, missionInfoScreenY - (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP) , SCREEN_WIDTH - (OBJ_HORIZONTAL_BORDER_X + OBJ_TEXT_X_BORDER_RIGHT + 10), OBJ_SCREEN_YBORDERTOP, cgs.media.whiteShader); // Middle column // Print bottom of frame CG_DrawPic( OBJ_HORIZONTAL_BORDER_X + 10, missionInfoScreenY - OBJ_SCREEN_YMARGIN + textYCnt + (2 * OBJ_SCREEN_YMARGIN), SCREEN_WIDTH - (OBJ_HORIZONTAL_BORDER_X + OBJ_TEXT_X_BORDER_RIGHT + 10), OBJ_SCREEN_YBORDERBOT, cgs.media.whiteShader); // Middle column length = (missionInfoScreenY - OBJ_SCREEN_YMARGIN + textYCnt + (2 * OBJ_SCREEN_YMARGIN)) - (missionInfoScreenY - (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP)) - 15; // Print left hand column of frame CG_DrawPic( OBJ_HORIZONTAL_BORDER_X, (missionInfoScreenY - (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP)) + 10, OBJ_HORIZONTAL_BORDER_WIDTH, length, cgs.media.whiteShader); // Middle column // Top corner trap_R_SetColor( colorTable[CT_DKPURPLE3]); CG_DrawPic( OBJ_HORIZONTAL_BORDER_X, missionInfoScreenY - (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP), 32, 32, cgs.media.corner_ul_20_30); // Top corner // Bottom corner CG_DrawPic( OBJ_HORIZONTAL_BORDER_X, (missionInfoScreenY - OBJ_SCREEN_YMARGIN + textYCnt + (2 * OBJ_SCREEN_YMARGIN))-5, 32, 32, cgs.media.corner_ll_8_30); // Bottom corner UI_DrawProportionalString( OBJ_HORIZONTAL_BORDER_X + 30, missionInfoScreenY - (OBJ_SCREEN_YMARGIN + OBJ_SCREEN_YBORDERTOP) + 2, ingame_text[IGT_OBJECTIVES],UI_SMALLFONT, colorTable[CT_BLACK]); // Print the background newColor[0] = colorTable[CT_BLACK][0]; newColor[1] = colorTable[CT_BLACK][1]; newColor[2] = colorTable[CT_BLACK][2]; newColor[3] = 0.5; trap_R_SetColor(newColor); CG_DrawPic( (OBJ_TEXT_XPOS - OBJ_TEXT_X_BORDER_LEFT), missionInfoScreenY - OBJ_SCREEN_YMARGIN, SCREEN_WIDTH - ((OBJ_TEXT_XPOS - OBJ_TEXT_X_BORDER_LEFT)+OBJ_TEXT_X_BORDER_RIGHT) , textYCnt + (2 * OBJ_SCREEN_YMARGIN), cgs.media.whiteShader); // Print the lines for (i=0;i<objCnt;i++) { if (cgs.objectives[i].text[0]) { if (cgs.objectives[i].complete) { color = CT_DKGOLD1; } else { color = CT_VLTGOLD1; } ObjectivePrint_Line(i,color,cent); } } }
/* ==================== CG_DrawDataPadObjectives Draw routine for the objective info screen of the data pad. ==================== */ void CG_DrawDataPadObjectives(const centity_t *cent ) { int i,totalY; int iYPixelsPerLine = cgi_R_Font_HeightPixels(cgs.media.qhFontMedium, 1.0f); const short titleXPos = objectiveStartingXpos - 22; // X starting position for title text const short titleYPos = objectiveStartingYpos - 23; // Y starting position for title text const short graphic_size = 16; // Size (width and height) of graphic used to show status of objective const short graphicXpos = objectiveStartingXpos - graphic_size - 8; // Amount of X to backup from text starting position const short graphicYOffset = (iYPixelsPerLine - graphic_size)/2; // Amount of Y to raise graphic so it's in the center of the text line missionInfo_Updated = qfalse; // This will stop the text from flashing cg.missionInfoFlashTime = 0; // zero out objective graphics for (i=0;i<MAX_OBJ_GRAPHICS;i++) { obj_graphics[i] = qfalse; } // Title Text at the top char text[1024]={0}; cgi_SP_GetStringTextString( "SP_INGAME_OBJECTIVES", text, sizeof(text) ); cgi_R_Font_DrawString (titleXPos, titleYPos, text, colorTable[CT_TITLE], cgs.media.qhFontMedium, -1, 1.0f); int missionYcnt = 0; // Print all active objectives for (i=0;i<MAX_OBJECTIVES;i++) { // Is there an objective to see? if (cent->gent->client->sess.mission_objectives[i].display) { // Calculate the Y position totalY = objectiveStartingYpos + (iYPixelsPerLine * (missionYcnt))+(iYPixelsPerLine/2); // Draw graphics that show if mission has been accomplished or not cgi_R_SetColor(colorTable[CT_BLUE3]); CG_DrawPic( (graphicXpos), (totalY-graphicYOffset), graphic_size, graphic_size, cgs.media.messageObjCircle); // Circle in front if (cent->gent->client->sess.mission_objectives[i].status == OBJECTIVE_STAT_SUCCEEDED) { CG_DrawPic( (graphicXpos), (totalY-graphicYOffset), graphic_size, graphic_size, cgs.media.messageLitOn); // Center Dot } // Print current objective text ObjectivePrint_Line(CT_WHITE, i, missionYcnt ); } } // No mission text? if (!missionYcnt) { // Set the message a quarter of the way down and in the center of the text box int messageYPosition = objectiveStartingYpos + (objectiveTextBoxHeight / 4); cgi_SP_GetStringTextString( "SP_INGAME_OBJNONE", text, sizeof(text) ); int messageXPosition = objectiveStartingXpos + (objectiveTextBoxWidth/2) - (cgi_R_Font_StrLenPixels(text, cgs.media.qhFontMedium, 1.0f) /2); cgi_R_Font_DrawString ( messageXPosition, messageYPosition, text, colorTable[CT_WHITE], cgs.media.qhFontMedium, -1, 1.0f); } }