void PlayerDeadMessage (void) { if (gameStates.app.bPlayerExploded) { tHUDMessage *pMsgs = gameData.hud.msgs; if ( gameData.multi.players [gameData.multi.nLocalPlayer].lives < 2) { int x, y, w, h, aw; GrSetCurFont ( HUGE_FONT); GrGetStringSize ( TXT_GAME_OVER, &w, &h, &aw); w += 20; h += 8; x = (grdCurCanv->cv_w - w) / 2; y = (grdCurCanv->cv_h - h) / 2; NO_DFX (gameStates.render.grAlpha = 2*7); NO_DFX (GrSetColorRGB (0, 0, 0, 255)); NO_DFX (GrRect ( x, y, x+w, y+h)); gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS; GrString (0x8000, (grdCurCanv->cv_h - grdCurCanv->cv_font->ft_h)/2 + h/8, TXT_GAME_OVER); #if 0 // Automatically exit death after 10 secs if ( gameData.time.xGame > gameStates.app.nPlayerTimeOfDeath + F1_0*10) { SetFunctionMode (FMODE_MENU); gameData.app.nGameMode = GM_GAME_OVER; longjmp ( gameExitPoint, 1); // Exit out of game loop } #endif } GrSetCurFont (GAME_FONT); if (pMsgs->nColor == -1) pMsgs->nColor = RGBA_PAL2 (0, 28, 0); GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0); GrString (0x8000, grdCurCanv->cv_h- (grdCurCanv->cv_font->ft_h+3), TXT_PRESS_ANY_KEY); } }
//------------------------------------------------------------------------------ // Draw a left justfied string void CMenuItem::DrawString (int bIsCurrent, int bTiny) { int w1 = m_w, x = m_x, y = m_y; int l, w, h, aw, tx = 0, t = 0, i; char* p, *s1, measure [2] , *s = m_text; int XTabs [6]; static char s2 [1024]; p = s1 = NULL; l = (int) strlen (s); memcpy (s2, s, l + 1); for (i = 0; i < 6; i++) XTabs [i] = (LHX (nTabs [i])) + x; measure [1] = 0; if (!gameStates.multi.bSurfingNet) { p = strchr (s2, '\t'); if (p && (w1>0)) { *p = '\0'; s1 = p + 1; } } if (w1 > 0) w = w1; fontManager.Current ()->StringSize (s2, w, h, aw); // CHANGED if (RETRO_STYLE) backgroundManager.Top ()->Saved (1)->BlitClipped (CCanvas::Current (), 5, y - 1, backgroundManager.Current ()->Width () - 15, h + 2, 5, y - 1); if (0 && gameStates.multi.bSurfingNet) { for (i = 0;i < l;i++) { if (s2 [i] == '\t' && gameStates.multi.bSurfingNet) { x = XTabs [t]; t++; continue; } measure [0] = s2 [i]; fontManager.Current ()->StringSize (measure, tx, h, aw); GrString (x, y, measure, NULL); x += tx; } } else { DrawHotKeyString (bIsCurrent, bTiny, 1, 0); return; } if (!gameStates.multi.bSurfingNet && p && (w1 > 0)) { fontManager.Current ()->StringSize (s1, w, h, aw); GrString (x + w1 - w, y, s1, NULL); *p = '\t'; } }
void PlayerDeadMessage (void) { if (gameOpts->render.cockpit.bHUDMsgs && gameStates.app.bPlayerExploded) { CHUDMessage *pMsgs = gameData.hud.msgs; if (LOCALPLAYER.lives < 2) { int x, y, w, h, aw; fontManager.SetCurrent (HUGE_FONT); fontManager.Current ()->StringSize (TXT_GAME_OVER, w, h, aw); w += 20; h += 8; x = (CCanvas::Current ()->Width () - w) / 2; y = (CCanvas::Current ()->Height () - h) / 2; gameStates.render.grAlpha = (2 * 7); CCanvas::Current ()->SetColorRGB (0, 0, 0, 255); OglDrawFilledRect (x, y, x + w, y + h); gameStates.render.grAlpha = 1.0f; GrString (0x8000, (CCanvas::Current ()->Height () - CCanvas::Current ()->Font ()->Height ()) / 2 + h / 8, TXT_GAME_OVER, NULL); #if 0 // Automatically exit death after 10 secs if (gameData.time.xGame > gameStates.app.nPlayerTimeOfDeath + I2X (10)) { SetFunctionMode (FMODE_MENU); gameData.app.nGameMode = GM_GAME_OVER; __asm int 3; longjmp (gameExitPoint, 1); // Exit out of game loop }
void ScoreTableDrawCoop () { int i, color; int sorted [MAX_NUM_NET_PLAYERS]; MultiSortKillList (); WIN (DDGRLOCK (dd_grd_curcanv)); grdCurCanv->cvFont = MEDIUM3_FONT; GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY", NULL); grdCurCanv->cvFont = SMALL_FONT; MultiGetKillList (sorted); ScoreTableDrawCoopNames (sorted); for (i=0; i<gameData.multiplayer.nPlayers; i++) { color = sorted [i]; if (gameData.multiplayer.players [sorted [i]].connected==0) GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); else GrSetFontColorRGBi (RGBA_PAL2 (playerColors [color].r, playerColors [color].g, playerColors [color].b), 1, 0, 0); ScoreTableDrawCoopItem (i, sorted); } ScoreTableDrawDeaths (sorted); WIN (DDGRUNLOCK (dd_grd_curcanv)); WINDOS ( DDGrSetCurrentCanvas (NULL), GrSetCurrentCanvas (NULL) ); PA_DFX (pa_set_frontbuffer_current ()); PA_DFX (pa_set_backbuffer_current ()); GrPaletteStepLoad (NULL); GrUpdate (0); }
//------------------------------------------------------------------------------ // Draw a slider and it's string void CMenuItem::DrawSlider (int bIsCurrent, int bTiny) { char* s1 = NULL; char* p = strchr (m_text, '\t'); if (p) { *p = '\0'; s1 = p + 1; } int w, h, aw; fontManager.Current ()->StringSize (m_text, w, h, aw); int y = m_y; if (RETRO_STYLE) backgroundManager.Current ()->BlitClipped (CCanvas::Current (), 5, y, backgroundManager.Current ()->Width () - 15, h, 5, y); DrawHotKeyString (bIsCurrent, bTiny, 1, 0); if (p) { fontManager.Current ()->StringSize (s1, w, h, aw); int x = m_x + m_w - w; if (RETRO_STYLE) { backgroundManager.Current ()->BlitClipped (CCanvas::Current (), x, y, w, 1, x, y); backgroundManager.Current ()->BlitClipped (CCanvas::Current (), x, y + h - 1, w, 1, x, y); } GrString (x, y, s1, NULL); *p = '\t'; } }
void PlayerDeadMessage (void) { if (gameOpts->render.cockpit.bHUDMsgs && gameStates.app.bPlayerExploded) { tHUDMessage *pMsgs = gameData.hud.msgs; if ( LOCALPLAYER.lives < 2) { int x, y, w, h, aw; GrSetCurFont ( HUGE_FONT); GrGetStringSize ( TXT_GAME_OVER, &w, &h, &aw); w += 20; h += 8; x = (grdCurCanv->cv_w - w) / 2; y = (grdCurCanv->cv_h - h) / 2; NO_DFX (gameStates.render.grAlpha = 2*7); NO_DFX (GrSetColorRGB (0, 0, 0, 255)); NO_DFX (GrRect ( x, y, x+w, y+h)); gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS; GrString (0x8000, (grdCurCanv->cv_h - grdCurCanv->cvFont->ftHeight)/2 + h/8, TXT_GAME_OVER); #if 0 // Automatically exit death after 10 secs if ( gameData.time.xGame > gameStates.app.nPlayerTimeOfDeath + F1_0*10) { SetFunctionMode (FMODE_MENU); gameData.app.nGameMode = GM_GAME_OVER; __asm int 3; longjmp ( gameExitPoint, 1); // Exit out of game loop }
//for text itemP, constantly redraw cursor (to achieve flash) void CMenuItem::UpdateCursor (void) { int w, h, aw; fix time = TimerGetApproxSeconds (); int x, y; char* text = m_text; Assert (m_nType == NM_TYPE_INPUT_MENU || m_nType == NM_TYPE_INPUT); while (*text) { fontManager.Current ()->StringSize (text, w, h, aw); if (w > m_w - 10) text++; else break; } if (!*text) w = 0; x = m_x + w; y = m_y; if (time & 0x8000) GrString (x, y, CURSOR_STRING, NULL); else { CCanvas::Current ()->SetColorRGB (0, 0, 0, 255); OglDrawFilledRect (x, y, x + CCanvas::Current ()->Font ()->Width () - 1, y + CCanvas::Current ()->Font ()->Height () - 1); } }
int _CDECL_ GrPrintF (int *idP, int x, int y, const char * format, ...) { static char buffer [1000]; va_list args; va_start (args, format); vsprintf (buffer, format, args); return GrString (x, y, buffer, idP); }
void print_diagnostic( char message[DIAGNOSTIC_MESSAGE_MAX] ) { int w,h,aw; GrSetCurrentCanvas( NULL ); GrSetCurFont(editor_font); GrSetFontColor( CBLACK, CGREY ); GrGetStringSize( message, &w, &h, &aw ); GrString( 4, 583, message ); GrSetFontColor( CBLACK, CWHITE ); GrSetColor( CGREY ); GrRect( 4+w, 583, 799, 599 ); }
int CHUD::DrawBombCount (int& nIdBombCount, int x, int y, int nColor, char* pszBombCount) { CCanvas::Push (); CCanvas::SetCurrent (CurrentGameScreen ()); fontManager.SetColorRGBi (nColor, 1, 0, 1); x = CCanvas::Current ()->Width () - 3 * GAME_FONT->Width () - gameStates.render.fonts.bHires - 1; y = CCanvas::Current ()->Height () - 3 * m_info.nLineSpacing; if ((extraGameInfo [0].nWeaponIcons >= 3) && (CCanvas::Current ()->Height () < 670)) x -= LHX (20); int i = GrString (x, y, pszBombCount, &nIdBombCount); CCanvas::Pop (); return i; }
//------------------------------------------------------------------------------ // Draw string 's' centered on a canvas... if wider than // canvas, then wrap it. void DrawCenteredText (int y, char * s) { char p; int i, l = (int) strlen (s); if (StringWidth (s, l) < CCanvas::Current ()->Width ()) { GrString (0x8000, y, s, NULL); return; } int w = CCanvas::Current ()->Width () - 16; int h = CCanvas::Current ()->Font ()->Height () + 1; for (i = 0; i < l; i++) { if (StringWidth (s, i) > w) { p = s [i]; s [i] = 0; GrString (0x8000, y, s, NULL); s [i] = p; GrString (0x8000, y + h, &s [i], NULL); return; } } }
//----------------------------------------------------------------------- //draw the subtitles for this frame void CSubTitles::Draw (int nFrame) { static int activeSubTitleList [MAX_ACTIVE_SUBTITLES]; static int nActiveSubTitles, nNextSubTitle, nLineSpacing; int t, y; int bMustErase = 0; if (nFrame == 0) { nActiveSubTitles = 0; nNextSubTitle = 0; fontManager.SetCurrent (GAME_FONT); nLineSpacing = CCanvas::Current ()->Font ()->Height () + (CCanvas::Current ()->Font ()->Height () / 4); fontManager.SetColorRGBi (WHITE_RGBA, 1, 0, 0); } //get rid of any subtitles that have expired for (t = 0; t <nActiveSubTitles; ) if (nFrame > m_captions [activeSubTitleList [t]].last_frame) { int t2; for (t2 = t; t2 < nActiveSubTitles - 1; t2++) activeSubTitleList [t2] = activeSubTitleList [t2+1]; nActiveSubTitles--; bMustErase = 1; } else t++; //get any subtitles new for this frame while (nNextSubTitle < m_nCaptions && nFrame >= m_captions [nNextSubTitle].first_frame) { if (nActiveSubTitles >= MAX_ACTIVE_SUBTITLES) Error ("Too many active subtitles!"); activeSubTitleList [nActiveSubTitles++] = nNextSubTitle; nNextSubTitle++; } //find y coordinate for first line of subtitles y = CCanvas::Current ()->Height () - ((nLineSpacing + 1) * MAX_ACTIVE_SUBTITLES + 2); //erase old subtitles if necessary if (bMustErase) { CCanvas::Current ()->SetColorRGB (0, 0, 0, 255); OglDrawFilledRect (0, y, CCanvas::Current ()->Width () - 1, CCanvas::Current ()->Height () - 1); } //now draw the current subtitles for (t = 0; t < nActiveSubTitles; t++) if (activeSubTitleList [t] != -1) { GrString (0x8000, y, m_captions [activeSubTitleList [t]].msg, NULL); y += nLineSpacing + 1; } }
void GameDrawTimeLeft (void) { char temp_string[30]; fix timevar; int i; static int nId = 0; fontManager.SetCurrent (GAME_FONT); //GAME_FONT fontManager.SetColorRGBi (RED_RGBA, 1, 0, 0); timevar = I2X (netGame.GetPlayTimeAllowed () * 5 * 60); i = X2I (timevar - gameStates.app.xThisLevelTime) + 1; sprintf (temp_string, TXT_TIME_LEFT, i); if (i >= 0) nId = GrString (0, 32, temp_string, &nId); }
void kmatrix_redraw () { int i, color; int sorted [MAX_NUM_NET_PLAYERS]; xOffs = (grdCurCanv->cv_bitmap.bm_props.w - 640) / 2; yOffs = (grdCurCanv->cv_bitmap.bm_props.h - 480) / 2; if (xOffs < 0) xOffs = 0; if (yOffs < 0) yOffs = 0; if (gameData.app.nGameMode & GM_MULTI_COOP) { kmatrix_redraw_coop (); return; } MultiSortKillList (); WIN (DDGRLOCK (dd_grd_curcanv)); grdCurCanv->cv_font = MEDIUM3_FONT; GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE ); grdCurCanv->cv_font = SMALL_FONT; MultiGetKillList (sorted); kmatrix_draw_names (sorted); for (i=0; i<gameData.multi.nPlayers; i++) { if (gameData.app.nGameMode & GM_TEAM) color = GetTeam (sorted [i]); else color = sorted [i]; if (gameData.multi.players [sorted [i]].connected==0) GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); else GrSetFontColorRGBi (RGBA_PAL2 (player_rgb [color].r, player_rgb [color].g, player_rgb [color].b), 1, 0, 0); kmatrix_draw_item (i, sorted); } kmatrix_draw_deaths (sorted); #if defined (POLY_ACC) pa_save_clut (); pa_update_clut (grPalette, 0, 256, 0); #endif PA_DFX (pa_set_frontbuffer_current ()); GrUpdate (0); PA_DFX (pa_set_backbuffer_current ()); #if defined (POLY_ACC) pa_restore_clut (); #endif WIN (DDGRUNLOCK (dd_grd_curcanv)); GrPaletteStepLoad (NULL); }
void HUDShowPlayerStats (void) { int h, w, aw, y; double p [3], s [3]; char szStats [50]; static int nIdStats = 0; if (!gameOpts->render.cockpit.bPlayerStats) return; if (HIDE_HUD) return; if (gameStates.render.cockpit.nMode == CM_FULL_COCKPIT) y = 3 * nHUDLineSpacing; else if (gameStates.render.cockpit.nMode == CM_STATUS_BAR) y = 2 * nHUDLineSpacing; else {//if (!SHOW_COCKPIT) { y = 2 * nHUDLineSpacing; if (gameStates.render.fonts.bHires) y += nHUDLineSpacing; } GrSetFontColorRGBi (ORANGE_RGBA, 1, 0, 0); y = 6 + 2 * nHUDLineSpacing; h = (gameData.stats.nDisplayMode - 1) / 2; if ((gameData.stats.nDisplayMode - 1) % 2 == 0) { sprintf (szStats, "%s%d-%d %d-%d %d-%d", h ? "T:" : "", gameData.stats.player [h].nHits [0], gameData.stats.player [h].nMisses [0], gameData.stats.player [h].nHits [1], gameData.stats.player [h].nMisses [1], gameData.stats.player [h].nHits [0] + gameData.stats.player [h].nHits [1], gameData.stats.player [h].nMisses [0] + gameData.stats.player [h].nMisses [1]); } else { s [0] = gameData.stats.player [h].nHits [0] + gameData.stats.player [h].nMisses [0]; s [1] = gameData.stats.player [h].nHits [1] + gameData.stats.player [h].nMisses [1]; s [2] = s [0] + s [1]; p [0] = s [0] ? (gameData.stats.player [h].nHits [0] / s [0]) * 100 : 0; p [1] = s [1] ? (gameData.stats.player [h].nHits [1] / s [1]) * 100 : 0; p [2] = s [2] ? ((gameData.stats.player [h].nHits [0] + gameData.stats.player [h].nHits [1]) / s [2]) * 100 : 0; sprintf (szStats, "%s%1.1f%c %1.1f%c %1.1f%c", h ? "T:" : "", p [0], '%', p [1], '%', p [2], '%'); } GrGetStringSize (szStats, &w, &h, &aw); nIdStats = GrString (grdCurCanv->cv_w - w - HUD_LHX (2), y, szStats, &nIdStats); }
void CMenuItem::DrawInputBox (int w, int x, int y, char* text, int current, int bTiny) { int w1, h1, aw; while (*text) { fontManager.Current ()->StringSize (text, w1, h1, aw); if (w1 > w - 10) text++; else break; } if (!*text) w1 = 0; DrawBlackBox (w, x, y, text, bTiny); if (current) GrString (x + w1 + 1, y, CURSOR_STRING, NULL); }
/* ========================================================================== * DRAWING * ========================================================================== */ void con_draw(void) { #ifdef CONSOLE CON_DrawConsole(Console); CON_UpdateConsole(Console); #else #if 0 char buffer[CON_LINE_LEN+1]; int i,j; for (i = con_line, j=0; j < 20; i = (i+1) % CON_NUM_LINES, j++) { memcpy(buffer, con_display[i], CON_LINE_LEN); buffer[CON_LINE_LEN] = 0; GrString(1, j * 10, buffer, 1); } #endif #endif }
void editor_sub_status( const char *format, ... ) { int w,h,aw; va_list ap; va_start(ap, format); vsprintf(sub_status_line, format, ap); va_end(ap); GrSetCurrentCanvas( NULL ); GrSetCurFont(editor_font); GrSetFontColor( BM_XRGB(0,0,31), CGREY ); GrGetStringSize( sub_status_line, &w, &h, &aw ); GrString( 500, 583, sub_status_line ); GrSetFontColor( CBLACK, CWHITE ); GrSetColor( CGREY ); GrRect( 500+w, 583, 799, 599 ); }
void _CDECL_ scores_rprintf(int x, int y, char * format, ... ) { va_list args; char buffer[128]; int w, h, aw; char *p; va_start(args, format ); vsprintf(buffer,format,args); va_end(args); //replace the digit '1' with special wider 1 for (p=buffer;*p;p++) if (*p=='1') *p=(char)132; GrGetStringSize(buffer, &w, &h, &aw ); GrString( LHX(x)-w+xOffs, LHY(y)+yOffs, buffer ); }
void ScoreTableRedraw () { int i, color; int sorted [MAX_NUM_NET_PLAYERS]; xOffs = (grdCurCanv->cvBitmap.bmProps.w - 640) / 2; yOffs = (grdCurCanv->cvBitmap.bmProps.h - 480) / 2; if (xOffs < 0) xOffs = 0; if (yOffs < 0) yOffs = 0; if (gameData.app.nGameMode & GM_MULTI_COOP) { ScoreTableDrawCoop (); return; } MultiSortKillList (); WIN (DDGRLOCK (dd_grd_curcanv)); grdCurCanv->cvFont = MEDIUM3_FONT; GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE, NULL); grdCurCanv->cvFont = SMALL_FONT; MultiGetKillList (sorted); ScoreTableDrawNames (sorted); for (i=0; i<gameData.multiplayer.nPlayers; i++) { if (gameData.app.nGameMode & GM_TEAM) color = GetTeam (sorted [i]); else color = sorted [i]; if (!gameData.multiplayer.players [sorted [i]].connected) GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); else GrSetFontColorRGBi (RGBA_PAL2 (playerColors [color].r, playerColors [color].g, playerColors [color].b), 1, 0, 0); ScoreTableDrawItem (i, sorted); } ScoreTableDrawDeaths (sorted); PA_DFX (pa_set_frontbuffer_current ()); GrUpdate (0); PA_DFX (pa_set_backbuffer_current ()); WIN (DDGRUNLOCK (dd_grd_curcanv)); GrPaletteStepLoad (NULL); }
void CMenuItem::DrawBlackBox (int w1, int x, int y, const char* s, int bTiny) { int w, h, aw; fontManager.Current ()->StringSize (s, w, h, aw); if (bTiny) { h += 4; y -= 2; } if (w1 == 0) w1 = w; CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (2, 2, 2)); OglDrawFilledRect (x - 1, y - 1, x - 1, y + h - 1); OglDrawFilledRect (x - 1, y - 1, x + w1 - 1, y - 1); CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (5, 5, 5)); OglDrawFilledRect (x, y + h, x + w1, y + h); OglDrawFilledRect (x + w1, y - 1, x + w1, y + h); CCanvas::Current ()->SetColorRGB (0, 0, 0, 255); OglDrawFilledRect (x, y, x + w1 - 1, y + h - 1); GrString (x + 1, y + 1, s, NULL); }
void kmatrix_redraw_coop () { int i, color; int sorted [MAX_NUM_NET_PLAYERS]; MultiSortKillList (); WIN (DDGRLOCK (dd_grd_curcanv)); grdCurCanv->cv_font = MEDIUM3_FONT; GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY" ); grdCurCanv->cv_font = SMALL_FONT; MultiGetKillList (sorted); kmatrix_draw_coop_names (sorted); for (i=0; i<gameData.multi.nPlayers; i++) { color = sorted [i]; if (gameData.multi.players [sorted [i]].connected==0) GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); else GrSetFontColorRGBi (RGBA_PAL2 (player_rgb [color].r, player_rgb [color].g, player_rgb [color].b), 1, 0, 0); kmatrix_draw_coop_item (i, sorted); } kmatrix_draw_deaths (sorted); WIN (DDGRUNLOCK (dd_grd_curcanv)); WINDOS ( DDGrSetCurrentCanvas (NULL), GrSetCurrentCanvas (NULL) ); #if defined (POLY_ACC) pa_save_clut (); pa_update_clut (grPalette, 0, 256, 0); #endif PA_DFX (pa_set_frontbuffer_current ()); PA_DFX (pa_set_backbuffer_current ()); #if defined (POLY_ACC) pa_restore_clut (); #endif GrPaletteStepLoad (NULL); GrUpdate (0); }
void ScoreTableRedraw (void) { int i, color; int sorted [MAX_PLAYERS]; xOffs = (CCanvas::Current ()->Width () - 640) / 2; yOffs = (CCanvas::Current ()->Height () - 480) / 2; if (xOffs < 0) xOffs = 0; if (yOffs < 0) yOffs = 0; if (gameData.app.nGameMode & GM_MULTI_COOP) { ScoreTableDrawCoop (); return; } MultiSortKillList (); fontManager.SetCurrent (MEDIUM3_FONT); GrString (0x8000, LHY (10), TXT_KILL_MATRIX_TITLE, NULL); fontManager.SetCurrent (SMALL_FONT); MultiGetKillList (sorted); ScoreTableDrawNames (sorted); for ( i =0; i<gameData.multiplayer.nPlayers; i++) { if (gameData.app.nGameMode & GM_TEAM) color = GetTeam (sorted [i]); else color = sorted [i]; if (!gameData.multiplayer.players [sorted [i]].connected) fontManager.SetColorRGBi (GRAY_RGBA, 1, 0, 0); else fontManager.SetColorRGBi (RGBA_PAL2 (playerColors [color].red, playerColors [color].green, playerColors [color].blue), 1, 0, 0); ScoreTableDrawItem (i, sorted); } ScoreTableDrawDeaths (sorted); GrUpdate (1); //paletteManager.ResumeEffect (); }
void ScoreTableDrawCoop (void) { int i, color; int sorted [MAX_PLAYERS]; MultiSortKillList (); fontManager.SetCurrent (MEDIUM3_FONT); GrString (0x8000, LHY (10), "COOPERATIVE SUMMARY", NULL); fontManager.SetCurrent (SMALL_FONT); MultiGetKillList (sorted); ScoreTableDrawCoopNames (sorted); for (i=0; i<gameData.multiplayer.nPlayers; i++) { color = sorted [i]; if (gameData.multiplayer.players [sorted [i]].connected==0) fontManager.SetColorRGBi (GRAY_RGBA, 1, 0, 0); else fontManager.SetColorRGBi (RGBA_PAL2 (playerColors [color].red, playerColors [color].green, playerColors [color].blue), 1, 0, 0); ScoreTableDrawCoopItem (i, sorted); } ScoreTableDrawDeaths (sorted); CCanvas::SetCurrent (NULL); //paletteManager.ResumeEffect (); GrUpdate (1); }
void scores_view(int citem) { fix t0 = 0, t1; int c,i,done,looper; int k, bRedraw = 0; sbyte fades[64] = { 1,1,1,2,2,3,4,4,5,6,8,9,10,12,13,15,16,17,19,20,22,23,24,26,27,28,28,29,30,30,31,31,31,31,31,30,30,29,28,28,27,26,24,23,22,20,19,17,16,15,13,12,10,9,8,6,5,4,4,3,2,2,1,1 }; bkg bg; memset (&bg, 0, sizeof (bg)); ReshowScores: scores_read(); SetScreenMode(SCREEN_MENU); WINDOS( DDGrSetCurrentCanvas(NULL), GrSetCurrentCanvas(NULL) ); xOffs = (grdCurCanv->cv_bitmap.bm_props.w - 640) / 2; yOffs = (grdCurCanv->cv_bitmap.bm_props.h - 480) / 2; if (xOffs < 0) xOffs = 0; if (yOffs < 0) yOffs = 0; GameFlushInputs(); done = 0; looper = 0; while(!done) { if (!bRedraw || gameOpts->menus.nStyle) { NMDrawBackground(&bg,xOffs, yOffs, xOffs + 640, xOffs + 480, bRedraw); grdCurCanv->cv_font = MEDIUM3_FONT; WIN(DDGRLOCK(dd_grd_curcanv)); GrString( 0x8000, yOffs + LHY(15), TXT_HIGH_SCORES ); grdCurCanv->cv_font = SMALL_FONT; GrSetFontColorRGBi (RGBA_PAL (31,26,5), 1, 0, 0); GrString( xOffs + LHX(31+33+XX), yOffs + LHY(46+7+YY), TXT_NAME ); GrString( xOffs + LHX(82+33+XX), yOffs + LHY(46+7+YY), TXT_SCORE ); GrString( xOffs + LHX(127+33+XX), yOffs + LHY(46+7+YY), TXT_SKILL ); GrString( xOffs + LHX(170+33+XX), yOffs + LHY(46+7+YY), TXT_LEVELS ); // GrString( 202, 46, "Kills" ); // GrString( 234, 46, "Rescues" ); GrString( xOffs + LHX(288-42+XX), yOffs + LHY(46+7+YY), TXT_TIME ); if ( citem < 0 ) GrString( 0x8000, yOffs + LHY(175), TXT_PRESS_CTRL_R ); GrSetFontColorRGBi (RGBA_PAL (28,28,28), 1, 0, 0); //GrPrintF( 0x8000, yOffs + LHY(31), "%c%s%c - %s", 34, Scores.cool_saying, 34, Scores.stats[0].name ); WIN(DDGRUNLOCK(dd_grd_curcanv)); for (i=0; i<MAX_HIGH_SCORES; i++ ) { //@@if (i==0) { //@@ GrSetFontColorRGBi (RGBA_PAL (28,28,28), 1, 0, 0); //@@} else { //@@ GrSetFontColor( grFadeTable[BM_XRGB(28,28,28)+((28-i*2)*256)], 1, 0, 0); //@@} c = 28 - i * 2; GrSetFontColorRGBi (RGBA_PAL (c, c, c), 1, 0, 0); scores_draw_item( i, Scores.stats + i); } GrPaletteFadeIn( NULL,32, 0); #ifdef OGL if (citem < 0) GrUpdate (0); #endif bRedraw = 1; } if ( citem > -1 ) { t1 = TimerGetFixedSeconds(); //if (t1 - t0 >= F1_0/128 ) { t0 = t1; //@@GrSetFontColor( grFadeTable[fades[looper]*256+BM_XRGB(28,28,28)], -1 ); c = 7 + fades [looper]; GrSetFontColorRGBi (RGBA_PAL (c, c, c), 1, 0, 0); if (++looper > 63) looper=0; if ( citem == MAX_HIGH_SCORES ) scores_draw_item( MAX_HIGH_SCORES, &Last_game ); else scores_draw_item( citem, Scores.stats + citem ); } GrUpdate (0); } for (i=0; i<4; i++ ) if (joy_get_button_down_cnt(i)>0) done=1; for (i=0; i<3; i++ ) if (MouseButtonDownCount(i)>0) done=1; //see if redbook song needs to be restarted songs_check_redbook_repeat(); #ifdef WINDOWS { MSG msg; DoMessageStuff(&msg); if (_RedrawScreen) { _RedrawScreen = FALSE; goto ReshowScores; } DDGRRESTORE; } #endif k = KeyInKey(); switch( k ) { case KEY_CTRLED+KEY_R: if ( citem < 0 ) { // Reset scores... if ( ExecMessageBox( NULL, NULL, 2, TXT_NO, TXT_YES, TXT_RESET_HIGH_SCORES )==1 ) { CFDelete(get_scores_filename(), gameFolders.szDataDir); GrPaletteFadeOut (NULL, 32, 0 ); goto ReshowScores; } } break; case KEY_BACKSP: Int3(); k = 0; break; case KEY_PRINT_SCREEN: SaveScreenShot (NULL, 0); k = 0; break; case KEY_ENTER: case KEY_SPACEBAR: case KEY_ESC: done=1; break; } } // Restore background and exit GrPaletteFadeOut (NULL, 32, 0 ); #ifdef WINDOWS DDGRRESTORE; #endif WINDOS( DDGrSetCurrentCanvas(NULL), GrSetCurrentCanvas(NULL) ); GameFlushInputs(); NMRemoveBackground (&bg); }
void CMenuItem::DrawHotKeyString (int bIsCurrent, int bTiny, int bCreateTextBms, int nDepth) { CBitmap *bmP = m_bmText [bIsCurrent]; if (!*m_text) return; if (m_color) fontManager.SetColorRGBi (m_color, 1, 0, 0); else SetColor (bIsCurrent, bTiny); if (bCreateTextBms && FAST_MENUS && (bmP || (bmP = CreateStringBitmap (m_text, MENU_KEY (m_nKey, - 1), gameData.menu.keyColor, nTabs, m_bCentered, m_w, 0)))) { float fScale = fontManager.Scale (); bmP->Render (CCanvas::Current (), m_x, m_y, int (bmP->Width () * fScale), int (bmP->Height () * fScale), 0, 0, bmP->Width (), bmP->Height (), 1, gameStates.app.bDemoData ? -1 : 0); m_bmText [bIsCurrent] = bmP; } else { int w, h, aw, l, i, x = m_x, y = m_y; char *t, *ps = m_text, s [MENU_MAX_TEXTLEN], ch = 0, ch2; if ((t = strchr (ps, '\n'))) { strncpy (s, ps, sizeof (s)); SetText (s); fontManager.Current ()->StringSize (s, w, h, aw); do { if ((t = strchr (m_text, '\n'))) *t = '\0'; DrawHotKeyString (0, bTiny, 0, nDepth + 1); if (!t) break; SetText (t + 1); m_y += h / 2; m_x = m_xSave; nTabIndex = -1; } while (*(m_text)); } else if ((t = strchr (ps, '\t'))) { strncpy (s, ps, sizeof (s)); SetText (s); fontManager.Current ()->StringSize (s, w, h, aw); do { if ((t = strchr (m_text, '\t'))) *t = '\0'; DrawHotKeyString (0, bTiny, 0, nDepth + 1); if (!t) break; SetText (t + 1); nTabIndex++; } while (*(m_text)); nTabIndex = -1; SetText (ps); m_y = y; } else { l = (int) strlen (m_text); if (bIsCurrent || !m_nKey) i = l; else { ch = MENU_KEY (m_nKey, *ps); for (i = 0; ps [i]; i++) if (ps [i] == ch) break; } strncpy (s, ps, sizeof (s)); s [i] = '\0'; fontManager.Current ()->StringSize (s, w, h, aw); if (nTabIndex >= 0) { x += LHX (nTabs [nTabIndex]); if (!gameStates.multi.bSurfingNet) x += m_w - w; } //m_x = x + w; if (i) { GrString (x, y, s, NULL); #if DBG //GrUpdate (0); #endif } if (i < l) { // print the hotkey x += w; s [i] = ch; ch2 = s [++i]; s [i] = '\0'; SetColor (1, bTiny); GrString (x, y, s + i - 1, NULL); #if DBG //GrUpdate (0); #endif SetColor (0, bTiny); if (i < l) { // print text following the hotkey fontManager.Current ()->StringSize (s + i - 1, w, h, aw); x += w; s [i] = ch2; GrString (x, y, s + i, NULL); } } } } }
void CAutomap::DrawObjects (void) { if (!((gameOpts->render.automap.bTextured & 2) || m_bRadar)) return; int color = IsTeamGame ? GetTeam (gameData.multiplayer.nLocalPlayer) : gameData.multiplayer.nLocalPlayer; // Note link to above if! CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (playerColors [color].red, playerColors [color].green, playerColors [color].blue)); int bTextured = (gameOpts->render.automap.bTextured & 1) && !m_bRadar; if (bTextured) { glDisable (GL_CULL_FACE); glEnable (GL_BLEND); gameStates.render.grAlpha = 0.5f; } glDisable (GL_TEXTURE_2D); glLineWidth (2 * GLfloat (screen.Width ()) / 640.0f); DrawPlayer (OBJECTS + LOCALPLAYER.nObject); if (!m_bRadar) { DrawMarkers (); if ((gameData.marker.nHighlight > -1) && (gameData.marker.szMessage [gameData.marker.nHighlight][0] != 0)) { char msg [10 + MARKER_MESSAGE_LEN + 1]; sprintf (msg, TXT_MARKER_MSG, gameData.marker.nHighlight + 1, gameData.marker.szMessage [(gameData.multiplayer.nLocalPlayer * 2) + gameData.marker.nHighlight]); CCanvas::Current ()->SetColorRGB (196, 0, 0, 255); fontManager.SetCurrent (SMALL_FONT); GrString (5, 20, msg, NULL); } } // Draw player(s)... if (AM_SHOW_PLAYERS) { for (int i = 0; i < gameData.multiplayer.nPlayers; i++) { if ((i != gameData.multiplayer.nLocalPlayer) && AM_SHOW_PLAYER (i)) { if (OBJECTS [gameData.multiplayer.players [i].nObject].info.nType == OBJ_PLAYER) { color = (gameData.app.nGameMode & GM_TEAM) ? GetTeam (i) : i; CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (playerColors [color].red, playerColors [color].green, playerColors [color].blue)); if (bTextured) glEnable (GL_BLEND); DrawPlayer (OBJECTS + gameData.multiplayer.players [i].nObject); } } } } if (bTextured) glEnable (GL_BLEND); CObject* objP = OBJECTS.Buffer (); g3sPoint spherePoint; FORALL_OBJS (objP, i) { int size = objP->info.xSize; switch (objP->info.nType) { case OBJ_HOSTAGE: CCanvas::Current ()->SetColorRGBi (m_colors.nHostage); G3TransformAndEncodePoint (&spherePoint, objP->info.position.vPos); G3DrawSphere (&spherePoint,size, !m_bRadar); break; case OBJ_MONSTERBALL: CCanvas::Current ()->SetColorRGBi (m_colors.nMonsterball); G3TransformAndEncodePoint (&spherePoint, objP->info.position.vPos); G3DrawSphere (&spherePoint,size, !m_bRadar); break; case OBJ_ROBOT: if (AM_SHOW_ROBOTS && ((gameStates.render.bAllVisited && bTextured) || m_visited [0][objP->info.nSegment])) { static int t = 0; static int d = 1; int h = SDL_GetTicks (); if (h - t > 333) { t = h; d = -d; } float fScale = float (h - t) / 333.0f; if (ROBOTINFO (objP->info.nId).companion) { if (d < 0) CCanvas::Current ()->SetColorRGB (0, 123 - int ((123 - 78) * fScale + 0.5f), 151 - int ((151 - 112) * fScale + 0.5f), 255); else CCanvas::Current ()->SetColorRGB (0, 78 + int ((123 - 78) * fScale + 0.5f), 122 + int ((151 - 112) * fScale + 0.5f), 255); } else { if (d < 0) CCanvas::Current ()->SetColorRGB (123 - int ((123 - 78) * fScale + 0.5f), 0, 135 - int ((135 - 96) * fScale + 0.5f), 255); else CCanvas::Current ()->SetColorRGB (78 + int ((123 - 78) * fScale + 0.5f), 0, 96 + int ((135 - 96) * fScale + 0.5f), 255); } G3TransformAndEncodePoint (&spherePoint, objP->info.position.vPos); //transformation.Begin (&objP->info.position.vPos, &objP->info.position.mOrient); G3DrawSphere (&spherePoint, bTextured ? size : (size * 3) / 2, !m_bRadar); //transformation.End (); } break; case OBJ_POWERUP: switch (objP->info.nId) { case POW_KEY_RED: CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (63, 5, 5)); size *= 4; break; case POW_KEY_BLUE: CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (5, 5, 63)); size *= 4; break; case POW_KEY_GOLD: CCanvas::Current ()->SetColorRGBi (RGBA_PAL2 (63, 63, 10)); size *= 4; break; default: if (!(AM_SHOW_POWERUPS (1) && (gameStates.render.bAllVisited || m_visited [0][objP->info.nSegment]))) continue; CCanvas::Current ()->SetColorRGBi (ORANGE_RGBA); //orange break; } G3TransformAndEncodePoint (&spherePoint, objP->info.position.vPos); G3DrawSphere (&spherePoint, size, !m_bRadar); break; } }
void HUDRenderMessages (ubyte nType) { int h, i, n, w, y, aw, yStart, nMsg; char *pszMsg; CHUDMessage *pMsgs = gameData.hud.msgs + nType; if ((pMsgs->nMessages < 0) || (pMsgs->nMessages > HUD_MAX_MSGS)) return; // Get Rob! if ((pMsgs->nMessages < 1) && (nModexHUDMsgs == 0)) return; pMsgs->xTimer -= gameData.time.xFrame; if (pMsgs->xTimer < 0) { // Timer expired... get rid of oldest pszMsg... if (pMsgs->nLast != pMsgs->nFirst) { int temp; //&pMsgs->szMsgs.szMsg [pMsgs->nFirst][0] is deing deleted...; pMsgs->nFirst = (pMsgs->nFirst + 1) % HUD_MAX_MSGS; pMsgs->xTimer = I2X (2); if (!--pMsgs->nMessages) nModexHUDMsgs = 2; temp = nLastMsgYCrd; ClearBackgroundMessages (); // If in status bar mode and no messages, then erase. if (nModexHUDMsgs) nLastMsgYCrd = temp; } } if (pMsgs->nMessages > 0) { if (pMsgs->nColor == (uint) -1) pMsgs->nColor = GREEN_RGBA; if ((gameStates.render.vr.nRenderMode == VR_NONE) && ((gameStates.render.cockpit.nType == CM_STATUS_BAR) || (gameStates.render.cockpit.nType == CM_FULL_SCREEN)) && (gameStates.render.vr.buffers.subRender [0].Top () >= (gameData.render.window.hMax/8))) { // Only display the most recent pszMsg in this mode nMsg = (pMsgs->nFirst + pMsgs->nMessages-1) % HUD_MAX_MSGS; pszMsg = pMsgs->szMsgs [nMsg]; if (strcmp (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg)) { CCanvas::Push (); int ycrd = CCanvas::Current ()->Top () - (SMALL_FONT->Height ()+2); if (ycrd < 0) ycrd = 0; CCanvas::SetCurrent (CurrentGameScreen ()); fontManager.SetCurrent (SMALL_FONT); fontManager.Current ()->StringSize (pszMsg, w, h, aw); ClearBackgroundMessages (); if (pMsgs->nColor == (uint) -1) pMsgs->nColor = GREEN_RGBA; fontManager.SetColorRGBi (pMsgs->nColor, 1, 0, 0); pMsgs->nMsgIds [nMsg] = GrPrintF (pMsgs->nMsgIds + nMsg, (CCanvas::Current ()->Width ()-w) / 2, ycrd, pszMsg); strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg); CCanvas::Pop (); nLastMsgYCrd = ycrd; nLastMsgHeight = h; } } else { fontManager.SetCurrent (SMALL_FONT); if ((gameStates.render.cockpit.nType == CM_FULL_SCREEN) || (gameStates.render.cockpit.nType == CM_LETTERBOX)) { if (gameData.render.window.w == gameData.render.window.wMax) yStart = SMALL_FONT->Height () / 2; else yStart= SMALL_FONT->Height () * 2; } else yStart = SMALL_FONT->Height () / 2; if (gameOpts->render.cockpit.bGuidedInMainView) { tGuidedMissileInfo *gmiP = gameData.objs.guidedMissile + gameData.multiplayer.nLocalPlayer; CObject *gmObjP = gmiP->objP; if (gmObjP && (gmObjP->info.nType == OBJ_WEAPON) && (gmObjP->info.nId == GUIDEDMSL_ID) && (gmObjP->info.nSignature == gmiP->nSignature)) yStart += SMALL_FONT->Height () + 3; } for (i = 0, y = yStart; i < pMsgs->nMessages; i++) { n = (pMsgs->nFirst + i) % HUD_MAX_MSGS; if ((n < 0) || (n >= HUD_MAX_MSGS)) return; // Get Rob!! if (!strcmp (pMsgs->szMsgs [n], "This is a bug.")) return; // Get Rob!! fontManager.Current ()->StringSize (pMsgs->szMsgs [n], w, h, aw); fontManager.SetColorRGBi (pMsgs->nColor, 1, 0, 0); y = yStart + i * (h + 1); if (nType) y += ((2 * HUD_MAX_MSGS - 1) * (h + 1)) / 2; #if 1 GrString ((CCanvas::Current ()->Width ()-w)/2, y, pMsgs->szMsgs [n], NULL); #else pMsgs->nMsgIds [n] = GrString ((CCanvas::Current ()->Width ()-w)/2, y, pMsgs->szMsgs [n], pMsgs->nMsgIds + n); #endif if (!gameOpts->render.cockpit.bSplitHUDMsgs) y += h + 1; } } } else if (CurrentGameScreen ()->Mode () == BM_MODEX) { if (nModexHUDMsgs) { int temp = nLastMsgYCrd; nModexHUDMsgs--; ClearBackgroundMessages (); // If in status bar mode and no messages, then erase. nLastMsgYCrd = temp; } } fontManager.SetCurrent (GAME_FONT); }
void HUDRenderMessages (ubyte nType) { int h, i, n, w, y, aw, yStart, nMsg; char *pszMsg; tHUDMessage *pMsgs = gameData.hud.msgs + nType; if ((pMsgs->nMessages < 0) || (pMsgs->nMessages > HUD_MAX_MSGS)) Int3 (); // Get Rob! if ((pMsgs->nMessages < 1) && (nModexHUDMsgs == 0)) return; pMsgs->xTimer -= gameData.time.xFrame; if ( pMsgs->xTimer < 0) { // Timer expired... get rid of oldest pszMsg... if (pMsgs->nLast != pMsgs->nFirst) { int temp; //&pMsgs->szMsgs.szMsg [pMsgs->nFirst][0] is deing deleted...; pMsgs->nFirst = (pMsgs->nFirst + 1) % HUD_MAX_MSGS; pMsgs->xTimer = F1_0*2; if (!--pMsgs->nMessages) nModexHUDMsgs = 2; temp = nLastMsgYCrd; ClearBackgroundMessages (); // If in status bar mode and no messages, then erase. if (nModexHUDMsgs) nLastMsgYCrd = temp; } } if (pMsgs->nMessages > 0) { if (pMsgs->nColor == -1) pMsgs->nColor = GREEN_RGBA; if ((gameStates.render.vr.nRenderMode == VR_NONE) && ((gameStates.render.cockpit.nMode == CM_STATUS_BAR) || (gameStates.render.cockpit.nMode == CM_FULL_SCREEN)) && (gameStates.render.vr.buffers.subRender [0].cvBitmap.bmProps.y >= (gameData.render.window.hMax/8))) { // Only display the most recent pszMsg in this mode nMsg = (pMsgs->nFirst + pMsgs->nMessages-1) % HUD_MAX_MSGS; pszMsg = pMsgs->szMsgs [nMsg]; if (strcmp (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg)) { int ycrd; WINDOS ( ddgrs_canvas *canv_save = dd_grd_curcanv, gsrCanvas *canv_save = grdCurCanv ); WINDOS ( ycrd = dd_grd_curcanv->yoff - (SMALL_FONT->ftHeight+2), ycrd = grdCurCanv->cvBitmap.bmProps.y - (SMALL_FONT->ftHeight+2) ); if (ycrd < 0) ycrd = 0; WINDOS ( DDGrSetCurrentCanvas (GetCurrentGameScreen ()), GrSetCurrentCanvas (GetCurrentGameScreen ()) ); GrSetCurFont (SMALL_FONT); GrGetStringSize (pszMsg, &w, &h, &aw); ClearBackgroundMessages (); if (grdCurCanv->cvBitmap.bmProps.nType == BM_MODEX) { WIN (Int3 ()); // No no no no .... ycrd -= h; h *= 2; HUDModexMessage ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg, SMALL_FONT, pMsgs->nColor); if (nModexHUDMsgs > 0) { nModexHUDMsgs--; szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage][0] = '!'; } else strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg); } else { WIN (DDGRLOCK (dd_grd_curcanv)); if (pMsgs->nColor == -1) pMsgs->nColor = GREEN_RGBA; GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0); PA_DFX (pa_set_frontbuffer_current ()); PA_DFX (GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg)); PA_DFX (pa_set_backbuffer_current ()); GrPrintF ((grdCurCanv->cvBitmap.bmProps.w-w)/2, ycrd, pszMsg); strcpy (szDisplayedBackgroundMsg [gameStates.render.vr.nCurrentPage], pszMsg); WIN (DDGRUNLOCK (dd_grd_curcanv)); } WINDOS ( DDGrSetCurrentCanvas (canv_save), GrSetCurrentCanvas (canv_save) ); nLastMsgYCrd = ycrd; nLastMsgHeight = h; } } else { GrSetCurFont ( SMALL_FONT); if ((gameStates.render.cockpit.nMode == CM_FULL_SCREEN) || (gameStates.render.cockpit.nMode == CM_LETTERBOX)) { if (gameData.render.window.w == gameData.render.window.wMax) yStart = SMALL_FONT->ftHeight / 2; else yStart= SMALL_FONT->ftHeight * 2; } else yStart = SMALL_FONT->ftHeight / 2; if (gameOpts->render.cockpit.bGuidedInMainView) { tObject *gmP = gameData.objs.guidedMissile [gameData.multiplayer.nLocalPlayer]; if (gmP && (gmP->nType == OBJ_WEAPON) && (gmP->id == GUIDEDMSL_ID) && (gmP->nSignature == gameData.objs.guidedMissileSig [gameData.multiplayer.nLocalPlayer])) yStart += SMALL_FONT->ftHeight + 3; } WIN (DDGRLOCK (dd_grd_curcanv)); for (i = 0, y = yStart; i < pMsgs->nMessages; i++) { n = (pMsgs->nFirst + i) % HUD_MAX_MSGS; if ((n < 0) || (n >= HUD_MAX_MSGS)) Int3 (); // Get Rob!! if (!strcmp (pMsgs->szMsgs [n], "This is a bug.")) Int3 (); // Get Rob!! GrGetStringSize (pMsgs->szMsgs [n], &w, &h, &aw); GrSetFontColorRGBi (pMsgs->nColor, 1, 0, 0); PA_DFX (pa_set_frontbuffer_current ()); y = yStart + i * (h + 1); if (nType) y += ((2 * HUD_MAX_MSGS - 1) * (h + 1)) / 2; PA_DFX (GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y [nType], pMsgs->szMsgs [n])); PA_DFX (pa_set_backbuffer_current ()); GrString ((grdCurCanv->cvBitmap.bmProps.w-w)/2, y, pMsgs->szMsgs [n]); if (!gameOpts->render.cockpit.bSplitHUDMsgs) y += h + 1; } WIN (DDGRUNLOCK (dd_grd_curcanv)); } } else if (GetCurrentGameScreen ()->cvBitmap.bmProps.nType == BM_MODEX) { if (nModexHUDMsgs) { int temp = nLastMsgYCrd; nModexHUDMsgs--; ClearBackgroundMessages (); // If in status bar mode and no messages, then erase. nLastMsgYCrd = temp; } } GrSetCurFont ( GAME_FONT); }
void HUDShowInventoryIcons (void) { grsBitmap *bmP; char szCount [4]; int nIconScale = (gameOpts->render.weaponIcons.bSmall || (gameStates.render.cockpit.nMode != CM_FULL_SCREEN)) ? 3 : 2; int nIconPos = extraGameInfo [0].nWeaponIcons & 1; int fw, fh, faw; int j, n, firstItem, oy = 6, ox = 6, x, y, dy; int w = bmpInventory->bmProps.w, h = bmpInventory->bmProps.w; int wIcon = (int) ((w + nIconScale - 1) / nIconScale * cmScaleX), hIcon = (int) ((h + nIconScale - 1) / nIconScale * cmScaleY); ubyte alpha = gameOpts->render.weaponIcons.alpha; static int nInvFlags [NUM_INV_ITEMS] = { PLAYER_FLAGS_AFTERBURNER, PLAYER_FLAGS_CONVERTER, PLAYER_FLAGS_HEADLIGHT, PLAYER_FLAGS_FULLMAP, PLAYER_FLAGS_AMMO_RACK, PLAYER_FLAGS_QUAD_LASERS, PLAYER_FLAGS_CLOAKED, PLAYER_FLAGS_INVULNERABLE, PLAYER_FLAGS_SLOWMOTION, PLAYER_FLAGS_BULLETTIME }; static int nEnergyType [NUM_INV_ITEMS] = {F1_0, 100 * F1_0, 0, F1_0, 0, F1_0, 0, 0, F1_0, F1_0}; static int nIdItems [NUM_INV_ITEMS] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; dy = (grdCurScreen->scHeight - grdCurCanv->cvBitmap.bmProps.h); if (gameStates.render.cockpit.nMode != CM_STATUS_BAR) //(!SHOW_COCKPIT) y = nIconPos ? grdCurScreen->scHeight - dy - oy : oy + hIcon + 12; else y = oy + hIcon + 12; n = (gameOpts->gameplay.bInventory && (!IsMultiGame || IsCoopGame)) ? NUM_INV_ITEMS : NUM_INV_ITEMS - 2; firstItem = gameStates.app.bD1Mission ? INV_ITEM_QUADLASERS : 0; x = (grdCurScreen->scWidth - (n - firstItem) * wIcon - (n - 1 - firstItem) * ox) / 2; for (j = firstItem; j < n; j++) { int bHave, bArmed, bActive = HUDEquipmentActive (nInvFlags [j]); bmP = bmInvItems + j; HUDBitBlt (nIconScale * - (x + (w - bmP->bmProps.w) / (2 * nIconScale)), nIconScale * - (y - hIcon), bmP, nIconScale * F1_0, 0); //m = 9 - j; *szCount = '\0'; if (j == INV_ITEM_HEADLIGHT) bHave = PlayerHasHeadLight (-1); else if (j == INV_ITEM_INVUL) { if ((bHave = (LOCALPLAYER.nInvuls > 0))) sprintf (szCount, "%d", LOCALPLAYER.nInvuls); else bHave = LOCALPLAYER.flags & nInvFlags [j]; } else if (j == INV_ITEM_CLOAK) { if ((bHave = (LOCALPLAYER.nCloaks > 0))) sprintf (szCount, "%d", LOCALPLAYER.nCloaks); else bHave = LOCALPLAYER.flags & nInvFlags [j]; } else bHave = LOCALPLAYER.flags & nInvFlags [j]; bArmed = (LOCALPLAYER.energy > nEnergyType [j]); if (bHave) { //gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS * 2 / 3; if (bArmed) if (bActive) GrSetColorRGB (255, 208, 0, (ubyte) (alpha * 16)); else GrSetColorRGB (128, 128, 0, (ubyte) (alpha * 16)); else GrSetColorRGB (128, 0, 0, (ubyte) (alpha * 16)); } else { //gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS * 2 / 7; GrSetColorRGB (64, 64, 64, (ubyte) (159 + alpha * 12)); } GrURect (x - 1, y - hIcon - 1, x + wIcon + 2, y + 2); if (bHave) if (bArmed) if (bActive) GrSetColorRGB (255, 208, 0, 255); else GrSetColorRGB (0, 160, 0, 255); else GrSetColorRGB (96, 0, 0, 255); else GrSetColorRGB (64, 64, 64, 255); GrUBox (x - 1, y - hIcon - 1, x + wIcon + 2, y + 2); if (*szCount) { GrGetStringSize (szCount, &fw, &fh, &faw); nIdItems [j] = GrString (x + wIcon + 2 - fw, y - fh, szCount, nIdItems + j); } gameStates.render.grAlpha = GR_ACTUAL_FADE_LEVELS; x += wIcon + ox; } }