void kmatrix_draw_names (int *sorted) { int j, x; int color; if (Kmatrix_nomovie_message) { GrSetFontColorRGBi (RED_RGBA, 1, 0, 0); GrPrintF (CENTERSCREEN-LHX (40), LHY (20), " (Movie not played)"); } for (j=0; j<gameData.multi.nPlayers; j++) { if (gameData.app.nGameMode & GM_TEAM) color = GetTeam (sorted [j]); else color = sorted [j]; x = LHX (70 + CENTERING_OFFSET (gameData.multi.nPlayers) + j*25) + xOffs; if (gameData.multi.players [sorted [j]].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); GrPrintF (x, LHY (40) + yOffs, "%c", gameData.multi.players [sorted [j]].callsign [0]); } x = LHX (72 + CENTERING_OFFSET (gameData.multi.nPlayers) + gameData.multi.nPlayers*25) + xOffs; GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); GrPrintF (x, LHY (40) + yOffs, "K/E"); }
void ScoreTableDrawNames (int *sorted) { int j, x; int color; if (gameData.score.bNoMovieMessage) { fontManager.SetColorRGBi (RED_RGBA, 1, 0, 0); GrPrintF (NULL, CENTERSCREEN-LHX (40), LHY (20), " (Movie not played)"); } for (j = 0; j<gameData.multiplayer.nPlayers; j++) { if (gameData.app.nGameMode & GM_TEAM) color = GetTeam (sorted [j]); else color = sorted [j]; x = LHX (70 + CENTERING_OFFSET (gameData.multiplayer.nPlayers) + j*25) + xOffs; if (gameData.multiplayer.players [sorted [j]].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); GrPrintF (NULL, x, LHY (40) + yOffs, "%c", gameData.multiplayer.players [sorted [j]].callsign [0]); } x = LHX (72 + CENTERING_OFFSET (gameData.multiplayer.nPlayers) + gameData.multiplayer.nPlayers*25) + xOffs; fontManager.SetColorRGBi (GRAY_RGBA, 1, 0, 0); GrPrintF (NULL, x, LHY (40) + yOffs, "K/E"); }
void ScoreTableDrawCoopNames (int *sorted) { sorted=sorted; if (gameData.score.bNoMovieMessage) { fontManager.SetColorRGBi (RED_RGBA, 1, 0, 0); GrPrintF (NULL, CENTERSCREEN-LHX (40), LHY (20), " (Movie not played)"); } fontManager.SetColorRGBi (RGBA_PAL2 (63,31,31), 1, 0, 0); GrPrintF (NULL, CENTERSCREEN, LHY (40), "SCORE"); fontManager.SetColorRGBi (RGBA_PAL2 (63,31,31), 1, 0, 0); GrPrintF (NULL, CENTERSCREEN+LHX (50), LHY (40), "DEATHS"); }
void kmatrix_draw_coop_names (int *sorted) { sorted=sorted; if (Kmatrix_nomovie_message) { GrSetFontColorRGBi (RED_RGBA, 1, 0, 0); GrPrintF (CENTERSCREEN-LHX (40), LHY (20), " (Movie not played)"); } GrSetFontColorRGBi (RGBA_PAL2 (63,31,31), 1, 0, 0); GrPrintF (CENTERSCREEN, LHY (40), "SCORE"); GrSetFontColorRGBi (RGBA_PAL2 (63,31,31), 1, 0, 0); GrPrintF (CENTERSCREEN+LHX (50), LHY (40), "DEATHS"); }
void kmatrix_draw_coop_item (int i, int *sorted) { int x, y = LHY (50+i*9) + yOffs; // Print player name. GrPrintF (LHX (CENTERING_OFFSET (gameData.multi.nPlayers)) + xOffs, y, "%s", gameData.multi.players [sorted [i]].callsign); GrPrintF (LHX (CENTERING_OFFSET (gameData.multi.nPlayers)-15) + xOffs,y,"%c",ConditionLetters [gameData.multi.players [sorted [i]].connected]); x = CENTERSCREEN + xOffs; GrSetFontColorRGBi (RGBA_PAL2 (60,40,10),1, 0, 0); GrPrintF (x, y, "%d", gameData.multi.players [sorted [i]].score); x = CENTERSCREEN+LHX (50) + xOffs; GrSetFontColorRGBi (RGBA_PAL2 (60,40,10),1, 0, 0); GrPrintF (x, y, "%d", gameData.multi.players [sorted [i]].netKilledTotal); }
void ScoreTableDrawCoopItem (int i, int *sorted) { int x, y = LHY (50+i*9) + yOffs; // Print CPlayerData name. GrPrintF (NULL, LHX (CENTERING_OFFSET (gameData.multiplayer.nPlayers)) + xOffs, y, "%s", gameData.multiplayer.players [sorted [i]].callsign); GrPrintF (NULL, LHX (CENTERING_OFFSET (gameData.multiplayer.nPlayers)-15) + xOffs,y,"%c",szConditionLetters [gameData.multiplayer.players [sorted [i]].connected]); x = CENTERSCREEN + xOffs; fontManager.SetColorRGBi (RGBA_PAL2 (60,40,10),1, 0, 0); GrPrintF (NULL, x, y, "%d", gameData.multiplayer.players [sorted [i]].score); x = CENTERSCREEN+LHX (50) + xOffs; fontManager.SetColorRGBi (RGBA_PAL2 (60,40,10),1, 0, 0); GrPrintF (NULL, x, y, "%d", gameData.multiplayer.players [sorted [i]].netKilledTotal); }
void scores_draw_item( int i, stats_info * stats ) { char buffer[20]; int y; WIN(DDGRLOCK(dd_grd_curcanv)); y = 7+70+i*9; if (i==0) y -= 8; if ( i==MAX_HIGH_SCORES ) { y += 8; //scores_rprintf( 17+33+XX, y+YY, "" ); } else { scores_rprintf( 17+33+XX, y+YY, "%d.", i+1 ); } if (strlen(stats->name)==0) { GrPrintF( LHX(26+33+XX)+xOffs, LHY(y+YY)+yOffs, TXT_EMPTY ); WIN(DDGRUNLOCK(dd_grd_curcanv)); return; } GrPrintF( LHX(26+33+XX)+xOffs, LHY(y+YY)+yOffs, "%s", stats->name ); int_to_string(stats->score, buffer); scores_rprintf( 109+33+XX, y+YY, "%s", buffer ); GrPrintF( LHX(125+33+XX)+xOffs, LHY(y+YY)+yOffs, "%s", MENU_DIFFICULTY_TEXT(stats->diff_level) ); if ( (stats->starting_level > 0 ) && (stats->ending_level > 0 )) scores_rprintf( 192+33+XX, y+YY, "%d-%d", stats->starting_level, stats->ending_level ); else if ( (stats->starting_level < 0 ) && (stats->ending_level > 0 )) scores_rprintf( 192+33+XX, y+YY, "S%d-%d", -stats->starting_level, stats->ending_level ); else if ( (stats->starting_level < 0 ) && (stats->ending_level < 0 )) scores_rprintf( 192+33+XX, y+YY, "S%d-S%d", -stats->starting_level, -stats->ending_level ); else if ( (stats->starting_level > 0 ) && (stats->ending_level < 0 )) scores_rprintf( 192+33+XX, y+YY, "%d-S%d", stats->starting_level, -stats->ending_level ); { int h, m, s; h = stats->seconds/3600; s = stats->seconds%3600; m = s / 60; s = s % 60; scores_rprintf( 311-42+XX, y+YY, "%d:%02d:%02d", h, m, s ); } WIN(DDGRUNLOCK(dd_grd_curcanv)); }
void ScoreTableDrawItem (int i, int *sorted) { int j, x, y; char temp [10]; y = LHY (50+i*9) + yOffs; // Print CPlayerData name. GrPrintF (NULL, LHX (CENTERING_OFFSET (gameData.multiplayer.nPlayers)) + xOffs, y, "%s", gameData.multiplayer.players [sorted [i]].callsign); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (NULL, LHX (CENTERING_OFFSET (gameData.multiplayer.nPlayers)-15),y,"%c",szConditionLetters [gameData.multiplayer.players [sorted [i]].connected]); for (j=0; j<gameData.multiplayer.nPlayers; j++) { x = LHX (70 + CENTERING_OFFSET (gameData.multiplayer.nPlayers) + j*25) + xOffs; if (sorted [i]==sorted [j]) { if (gameData.multigame.kills.matrix [sorted [i]][sorted [j]] == 0) { fontManager.SetColorRGBi (RGBA_PAL2 (10,10,10), 1, 0, 0); GrPrintF (NULL, x, y, "%d", gameData.multigame.kills.matrix [sorted [i]][sorted [j]]); } else { fontManager.SetColorRGBi (RGBA_PAL2 (25,25,25), 1, 0, 0); GrPrintF (NULL, x, y, "-%d", gameData.multigame.kills.matrix [sorted [i]][sorted [j]]); } } else { if (gameData.multigame.kills.matrix [sorted [i]][sorted [j]] <= 0) { fontManager.SetColorRGBi (RGBA_PAL2 (10,10,10), 1, 0, 0); GrPrintF (NULL, x, y, "%d", gameData.multigame.kills.matrix [sorted [i]][sorted [j]]); } else { fontManager.SetColorRGBi (RGBA_PAL2 (25,25,25), 1, 0, 0); GrPrintF (NULL, x, y, "%d", gameData.multigame.kills.matrix [sorted [i]][sorted [j]]); } } } if (gameData.multiplayer.players [sorted [i]].netKilledTotal + gameData.multiplayer.players [sorted [i]].netKillsTotal==0) sprintf (temp,"N/A"); else sprintf (temp,"%d%%", (int) ((double) ((double)gameData.multiplayer.players [sorted [i]].netKillsTotal/ ((double)gameData.multiplayer.players [sorted [i]].netKilledTotal+ (double)gameData.multiplayer.players [sorted [i]].netKillsTotal))*100.0)); x = LHX (60 + CENTERING_OFFSET (gameData.multiplayer.nPlayers) + gameData.multiplayer.nPlayers*25) + xOffs; fontManager.SetColorRGBi (RGBA_PAL2 (25,25,25),1, 0, 0); GrPrintF (NULL, x ,y,"%4d/%s",gameData.multiplayer.players [sorted [i]].netKillsTotal,temp); }
void ScoreTableDrawCoopDeaths (int *sorted) { int j, x, y; int sw, sh, aw; char reactor_message [50]; y = LHY (55 + gameData.multiplayer.nPlayers * 9) + yOffs; // fontManager.SetColor (gr_getcolor (playerColors [j].r,playerColors [j].g,playerColors [j].b),-1); fontManager.SetColorRGBi (GRAY_RGBA, 1, 0, 0); x = CENTERSCREEN+LHX (50) + xOffs; GrPrintF (NULL, x, y, TXT_DEATHS); for (j=0; j<gameData.multiplayer.nPlayers; j++) { x = CENTERSCREEN+LHX (50) + xOffs; GrPrintF (NULL, x, y, "%d", gameData.multiplayer.players [sorted [j]].netKilledTotal); } y = LHY (55 + 72 + 35) + yOffs; x = LHX (35) + xOffs; fontManager.SetColorRGBi (RGBA_PAL2 (63,20,0), 1, 0, 0); fontManager.Current ()->StringSize ("P-Playing E-Escaped D-Died", sw, sh, aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"P-Playing E-Escaped D-Died"); y += (sh+5); fontManager.Current ()->StringSize ("V-Viewing scores W-Waiting", sw, sh, aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"V-Viewing scores W-Waiting"); y+=LHY (20); fontManager.SetColorRGBi (WHITE_RGBA, 1, 0, 0); if (LOCALPLAYER.connected==7) { fontManager.Current ()->StringSize ("Waiting for other players...",sw, sh, aw); GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"Waiting for other players..."); } else { fontManager.Current ()->StringSize (TXT_PRESS_ANY_KEY2, sw, sh, aw); GrPrintF (NULL, CENTERSCREEN- (sw/2), y, TXT_PRESS_ANY_KEY2); } if (gameData.reactor.countdown.nSecsLeft <=0) ScoreTableReactor (TXT_REACTOR_EXPLODED); else { sprintf (reinterpret_cast<char*> (&reactor_message), "%s: %d %s ", TXT_TIME_REMAINING, gameData.reactor.countdown.nSecsLeft, TXT_SECONDS); ScoreTableReactor (reinterpret_cast<char*> (&reactor_message)); } }
void kmatrix_draw_coop_deaths (int *sorted) { int j, x, y; int sw, sh, aw; char reactor_message [50]; y = LHY (55 + gameData.multi.nPlayers * 9) + yOffs; // GrSetFontColor (gr_getcolor (player_rgb [j].r,player_rgb [j].g,player_rgb [j].b),-1); GrSetFontColorRGBi (GRAY_RGBA, 1, 0, 0); x = CENTERSCREEN+LHX (50) + xOffs; GrPrintF (x, y, TXT_DEATHS); for (j=0; j<gameData.multi.nPlayers; j++) { x = CENTERSCREEN+LHX (50) + xOffs; GrPrintF (x, y, "%d", gameData.multi.players [sorted [j]].netKilledTotal); } y = LHY (55 + 72 + 35) + yOffs; x = LHX (35) + xOffs; GrSetFontColorRGBi (RGBA_PAL2 (63,20,0), 1, 0, 0); GrGetStringSize ("P-Playing E-Escaped D-Died", &sw, &sh, &aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (CENTERSCREEN- (sw/2), y,"P-Playing E-Escaped D-Died"); y += (sh+5); GrGetStringSize ("V-Viewing scores W-Waiting", &sw, &sh, &aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (CENTERSCREEN- (sw/2), y,"V-Viewing scores W-Waiting"); y+=LHY (20); GrSetFontColorRGBi (WHITE_RGBA, 1, 0, 0); if (gameData.multi.players [gameData.multi.nLocalPlayer].connected==7) { GrGetStringSize ("Waiting for other players...",&sw, &sh, &aw); GrPrintF (CENTERSCREEN- (sw/2), y,"Waiting for other players..."); } else { GrGetStringSize (TXT_PRESS_ANY_KEY2, &sw, &sh, &aw); GrPrintF (CENTERSCREEN- (sw/2), y, TXT_PRESS_ANY_KEY2); } if (gameData.reactor.countdown.nSecsLeft <=0) kmatrix_reactor (TXT_REACTOR_EXPLODED); else { sprintf ((char *)&reactor_message, "%s: %d %s ", TXT_TIME_REMAINING, gameData.reactor.countdown.nSecsLeft, TXT_SECONDS); kmatrix_reactor ((char *)&reactor_message); } }
//------------------------------------------------------------------------------ // 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'; } }
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; }
void CHUD::DrawScore (void) { if (cockpit->Hide ()) return; char szScore [40]; int w, h, aw; if ((gameData.hud.msgs [0].nMessages > 0) && (strlen (gameData.hud.msgs [0].szMsgs [gameData.hud.msgs [0].nFirst]) > 38)) return; if ((IsMultiGame && !IsCoopGame)) sprintf (szScore, " %s: %5d", TXT_KILLS, LOCALPLAYER.netKillsTotal); else sprintf (szScore, " %s: %5d", TXT_SCORE, LOCALPLAYER.score); fontManager.Current ()->StringSize (szScore, w, h, aw); fontManager.SetColorRGBi (GREEN_RGBA, 1, 0, 0); GrPrintF (NULL, CCanvas::Current ()->Width () - w - LHX (2), 3, szScore); }
void 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; gr_get_string_size(buffer, &w, &h, &aw ); gr_string( LHX(x)-w, LHY(y), buffer ); }
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 ScoreTableDrawDeaths (int *sorted) { int y,x; int sw, sh, aw; char reactor_message [50]; y = LHY (55 + 72 + 35) + yOffs; x = LHX (35) + xOffs; fontManager.SetColorRGBi (RGBA_PAL2 (63,20,0), 1, 0, 0); fontManager.Current ()->StringSize ("P-Playing E-Escaped D-Died", sw, sh, aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"P-Playing E-Escaped D-Died"); y+= (sh+5); fontManager.Current ()->StringSize ("V-Viewing scores W-Waiting", sw, sh, aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"V-Viewing scores W-Waiting"); y+=LHY (20); fontManager.SetColorRGBi (WHITE_RGBA, 1, 0, 0); if (LOCALPLAYER.connected==7) { fontManager.Current ()->StringSize ("Waiting for other players...",sw, sh, aw); GrPrintF (NULL, CENTERSCREEN- (sw/2), y,"Waiting for other players..."); } else { fontManager.Current ()->StringSize (TXT_PRESS_ANY_KEY2, sw, sh, aw); GrPrintF (NULL, CENTERSCREEN- (sw/2), y, TXT_PRESS_ANY_KEY2); } if (gameData.reactor.countdown.nSecsLeft <=0) ScoreTableReactor (TXT_REACTOR_EXPLODED); else { sprintf (reinterpret_cast<char*> (&reactor_message), "%s: %d %s ", TXT_TIME_REMAINING, gameData.reactor.countdown.nSecsLeft, TXT_SECONDS); ScoreTableReactor (reinterpret_cast<char*> (&reactor_message)); } if (gameData.app.nGameMode & (GM_HOARD | GM_ENTROPY)) ScoreTablePhallic (); }
void kmatrix_draw_deaths (int *sorted) { int y,x; int sw, sh, aw; char reactor_message [50]; y = LHY (55 + 72 + 35) + yOffs; x = LHX (35) + xOffs; GrSetFontColorRGBi (RGBA_PAL2 (63,20,0), 1, 0, 0); GrGetStringSize ("P-Playing E-Escaped D-Died", &sw, &sh, &aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (CENTERSCREEN- (sw/2), y,"P-Playing E-Escaped D-Died"); y+= (sh+5); GrGetStringSize ("V-Viewing scores W-Waiting", &sw, &sh, &aw); if (! ((gameData.app.nGameMode & GM_MODEM) || (gameData.app.nGameMode & GM_SERIAL))) GrPrintF (CENTERSCREEN- (sw/2), y,"V-Viewing scores W-Waiting"); y+=LHY (20); GrSetFontColorRGBi (WHITE_RGBA, 1, 0, 0); if (gameData.multi.players [gameData.multi.nLocalPlayer].connected==7) { GrGetStringSize ("Waiting for other players...",&sw, &sh, &aw); GrPrintF (CENTERSCREEN- (sw/2), y,"Waiting for other players..."); } else { GrGetStringSize (TXT_PRESS_ANY_KEY2, &sw, &sh, &aw); GrPrintF (CENTERSCREEN- (sw/2), y, TXT_PRESS_ANY_KEY2); } if (gameData.reactor.countdown.nSecsLeft <=0) kmatrix_reactor (TXT_REACTOR_EXPLODED); else { sprintf ((char *)&reactor_message, "%s: %d %s ", TXT_TIME_REMAINING, gameData.reactor.countdown.nSecsLeft, TXT_SECONDS); kmatrix_reactor ((char *)&reactor_message); } if (gameData.app.nGameMode & (GM_HOARD | GM_ENTROPY)) kmatrix_phallic (); }
void CHUD::DrawAddedScore (void) { if (cockpit->Hide ()) return; int color; int w, h, aw, nScore, nTime; char szScore [20]; static int nIdTotalScore = 0; if (IsMultiGame && !IsCoopGame) return; if (!(nScore = cockpit->AddedScore ())) return; cockpit->SetScoreTime (nTime = cockpit->ScoreTime () - gameData.time.xFrame); if (nTime > 0) { color = X2I (nTime * 20) + 12; if (color < 10) color = 12; else if (color > 31) color = 30; color = color - (color % 4); // Only allowing colors 12, 16, 20, 24, 28 speeds up gr_getcolor, improves caching if (gameStates.app.cheats.bEnabled) sprintf (szScore, "%s", TXT_CHEATER); else sprintf (szScore, "%5d", nScore); fontManager.Current ()->StringSize (szScore, w, h, aw); fontManager.SetColorRGBi (RGBA_PAL2 (0, color, 0), 1, 0, 0); nIdTotalScore = GrPrintF (&nIdTotalScore, CCanvas::Current ()->Width () - w - LHX (12), m_info.nLineSpacing + 4, szScore); } else { cockpit->SetScoreTime (0); cockpit->SetAddedScore (0, 0); } }
void Werkstuck::LHIX(float dX, float Rwz, float Hwz) { LHX(Xwz+dX,Rwz,Hwz); }
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); } } } } }
CBitmap *CreateStringBitmap ( const char *s, int nKey, uint nKeyColor, int *nTabs, int bCentered, int nMaxWidth, int bForce) { int origColor = CCanvas::Current ()->FontColor (0).index;//to allow easy reseting to default string color with colored strings -MPM int i, x, y, hx, hy, w, h, aw, cw, spacing, nTab, nChars, bHotKey; CBitmap *bmP, *bmfP; tRgbaColorb hc, kc, *pc; ubyte *pf; CPalette *palP = NULL; tRgbColorb *colorP; ubyte c; const char *textP, *text_ptr1, *nextRowP; int letter; CFont* fontP = fontManager.Current (); #if 0 if (!(bForce || (gameOpts->menus.nStyle && gameOpts->menus.bFastMenus))) return NULL; #endif fontP->StringSizeTabbed (s, w, h, aw, nTabs, nMaxWidth); if (!(w && h)) return NULL; if (bForce >= 0) { for (i = 1; i < w; i <<= 2) ; w = i; for (i = 1; i < h; i <<= 2) ; h = i; } if (!(bmP = CBitmap::Create (0, w, h, 4))) return NULL; if (!bmP->Buffer ()) { delete bmP; return NULL; } bmP->SetName ("String Bitmap"); bmP->Clear (); bmP->AddFlags (BM_FLAG_TRANSPARENT); nextRowP = s; y = 0; nTab = 0; nChars = 0; while (nextRowP) { text_ptr1 = nextRowP; nextRowP = NULL; textP = text_ptr1; #if 0 # if DBG if (bCentered) x = (w - fontManager.Current ()->GetLineWidth (textP)) / 2; else x = 0; # else x = bCentered ? (w - fontManager.Current ()->GetLineWidth (textP)) / 2 : 0; # endif #else x = 0; #endif while ((c = *textP)) { if (c == '\n') { nextRowP = textP + 1; y += fontP->Height () + 2; nTab = 0; break; } if (c == '\t') { textP++; if (nTabs && (nTab < 6)) { int w, h, aw; fontManager.Current ()->StringSize (textP, w, h, aw); x = LHX (nTabs [nTab++]); if (!gameStates.multi.bSurfingNet) x += nMaxWidth - w; for (i = 1; i < w; i <<= 2) ; w = i; for (i = 1; i < h; i <<= 2) ; h = i; } continue; } letter = c - fontP->MinChar (); fontP->GetCharWidth (c, textP [1], cw, spacing); if (c <= 0x06) { //not in font, draw as space textP = ScanEmbeddedColors (c, textP, origColor, 128, 2); continue; } if (!fontManager.Current ()->InFont (letter)) { x += spacing; textP++; continue; } if ((bHotKey = ((nKey < 0) && isalnum (c)) || (nKey && ((int) c == nKey)))) nKey = 0; bmfP = (bHotKey && (fontManager.Current () != SMALL_FONT)) ? SELECTED_FONT->Bitmaps () + letter : fontP->Bitmaps () + letter; palP = bmfP->Parent () ? bmfP->Parent ()->Palette () : bmfP->Palette (); nChars++; i = nKeyColor * 3; kc.red = RGBA_RED (nKeyColor); kc.green = RGBA_GREEN (nKeyColor); kc.blue = RGBA_BLUE (nKeyColor); kc.alpha = 255; if (fontP->Flags () & FT_COLOR) { for (hy = 0; hy < bmfP->Height (); hy++) { pc = reinterpret_cast<tRgbaColorb*> (bmP->Buffer ()) + (y + hy) * w + x; pf = bmfP->Buffer () + hy * bmfP->RowSize (); for (hx = bmfP->Width (); hx; hx--, pc++, pf++) if ((c = *pf) != TRANSPARENCY_COLOR) { colorP = palP->Color () + c; pc->red = colorP->red * 4; pc->green = colorP->green * 4; pc->blue = colorP->blue * 4; pc->alpha = 255; } #if DBG else c = c; #endif } } else { if (CCanvas::Current ()->FontColor (0).index < 0) memset (&hc, 0xff, sizeof (hc)); else { if (CCanvas::Current ()->FontColor (0).rgb) { hc = CCanvas::Current ()->FontColor (0).color; } else { colorP = palP->Color () + CCanvas::Current ()->FontColor (0).index; hc.red = colorP->red * 4; hc.green = colorP->green * 4; hc.blue = colorP->blue * 4; } hc.alpha = 255; } for (hy = 0; hy < bmfP->Height (); hy++) { pc = reinterpret_cast<tRgbaColorb*> (bmP->Buffer ()) + (y + hy) * w + x; pf = bmfP->Buffer () + hy * bmfP->RowSize (); for (hx = bmfP->Width (); hx; hx--, pc++, pf++) if (*pf != TRANSPARENCY_COLOR) *pc = bHotKey ? kc : hc; } } x += spacing; textP++; } } bmP->SetPalette (palP); bmP->SetTranspType (-1); return bmP; }
void CCockpit::DrawKillList (void) { CGenericCockpit::DrawKillList (53, CCanvas::Current ()->Height () - LHX (6)); }
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 scores_view(int citem) { grs_canvas *center_canv; fix t1; int i,done,looper; int k; 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 }; ReshowScores: scores_read(); set_screen_mode(SCREEN_MENU); gr_set_current_canvas(NULL); nm_draw_background(0, 0, GWIDTH-1, GHEIGHT-1); // args are x,y,x2,y2 NOT x,y,w,h center_canv = gr_create_sub_canvas(grd_curcanv, GWIDTH/2-LHX(160), 0, LHX(320), GHEIGHT); gr_set_current_canvas(center_canv); grd_curcanv->cv_font = MEDIUM3_FONT; gr_string( 0x8000, LHY(15), TXT_HIGH_SCORES ); grd_curcanv->cv_font = SMALL_FONT; gr_set_fontcolor( BM_XRGB(31,26,5), -1 ); gr_string( LHX(31+33+XX), LHY(46+7+YY), TXT_NAME ); gr_string( LHX(82+33+XX), LHY(46+7+YY), TXT_SCORE ); gr_string( LHX(127+33+XX), LHY(46+7+YY), TXT_SKILL ); gr_string( LHX(170+33+XX), LHY(46+7+YY), TXT_LEVELS ); // gr_string( 202, 46, "Kills" ); // gr_string( 234, 46, "Rescues" ); gr_string( LHX(288-42+XX), LHY(46+7+YY), TXT_TIME ); if ( citem < 0 ) gr_string( 0x8000, LHY(175), TXT_PRESS_CTRL_R ); gr_set_fontcolor( BM_XRGB(28,28,28), -1 ); gr_printf( 0x8000, LHY(31), "%c%s%c - %s", 34, Scores.cool_saying, 34, Scores.stats[0].name ); for (i=0; i<MAX_HIGH_SCORES; i++ ) { //@@if (i==0) { //@@ gr_set_fontcolor( BM_XRGB(28,28,28), -1 ); //@@} else { //@@ gr_set_fontcolor( gr_fade_table[BM_XRGB(28,28,28)+((28-i*2)*256)], -1 ); //@@} gr_set_fontcolor( BM_XRGB(28-i*2,28-i*2,28-i*2), -1 ); scores_draw_item( i, &Scores.stats[i] ); } gr_palette_fade_in( gr_palette,32, 0); #ifdef OGL vid_update(); #endif game_flush_inputs(); done = 0; looper = 0; while(!done) { if ( citem > -1 ) { t1 = timer_get_fixed_seconds(); while ( timer_get_fixed_seconds() < t1+F1_0/128 ); //@@gr_set_fontcolor( gr_fade_table[fades[looper]*256+BM_XRGB(28,28,28)], -1 ); gr_set_fontcolor( BM_XRGB(7+fades[looper],7+fades[looper],7+fades[looper]), -1 ); looper++; 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] ); vid_update(); } for (i=0; i<4; i++ ) if (joy_get_button_down_cnt(i)>0) done=1; for (i=0; i<3; i++ ) if (mouse_button_down_count(i)>0) done=1; //see if redbook song needs to be restarted songs_check_redbook_repeat(); k = newmenu_inkey(); switch( k ) { case KEY_CTRLED+KEY_R: if ( citem < 0 ) { // Reset scores... if ( nm_messagebox( NULL, 2, TXT_NO, TXT_YES, TXT_RESET_HIGH_SCORES )==1 ) { PHYSFS_delete(get_scores_filename()); gr_palette_fade_out( gr_palette, 32, 0 ); goto ReshowScores; } } break; case KEY_BACKSP: Int3(); k = 0; break; case KEY_PRINT_SCREEN: save_screen_shot(0); k = 0; break; case KEY_ENTER: case KEY_SPACEBAR: case KEY_ESC: done=1; break; } } // Restore background and exit gr_palette_fade_out( gr_palette, 32, 0 ); gr_set_current_canvas(NULL); gr_free_sub_canvas(center_canv); game_flush_inputs(); }
void CBackground::DrawArea (int left, int top, int right, int bottom) { #if 0 if (MODERN_STYLE) Draw (); else #endif { if (left < 0) left = 0; if (top < 0) top = 0; int width = right - left + 1; int height = bottom - top + 1; //if (width > nmBackground.Width ()) width = nmBackground.Width (); //if (height > nmBackground.Height ()) height = nmBackground.Height (); right = left + width - 1; bottom = top + height - 1; glDisable (GL_BLEND); if (!backgroundManager.Shadow ()) { CCanvas::Current ()->SetLeft (CCanvas::Current ()->Left () + LHX (10)); CCanvas::Current ()->SetTop (CCanvas::Current ()->Top () + LHX (10)); m_background->RenderFixed (NULL, left, top, width, height); //, LHX (10), LHY (10)); CCanvas::Current ()->SetLeft (CCanvas::Current ()->Left () - LHX (10)); CCanvas::Current ()->SetTop (CCanvas::Current ()->Top () - LHX (10)); } else { m_background->RenderFixed (NULL, left, top, width, height); //, 0, 0); gameStates.render.grAlpha = GrAlpha (2 * 7); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); CCanvas::Current ()->SetColorRGB (0, 0, 0, 200); OglDrawFilledRect (right - 5, top + 5, right - 6, bottom - 5); OglDrawFilledRect (right - 4, top + 4, right - 5, bottom - 5); OglDrawFilledRect (right - 3, top + 3, right - 4, bottom - 5); OglDrawFilledRect (right - 2, top + 2, right - 3, bottom - 5); OglDrawFilledRect (right - 1, top + 1, right - 2, bottom - 5); OglDrawFilledRect (right + 0, top + 0, right - 1, bottom - 5); OglDrawFilledRect (left + 5, bottom - 5, right, bottom - 6); OglDrawFilledRect (left + 4, bottom - 4, right, bottom - 5); OglDrawFilledRect (left + 3, bottom - 3, right, bottom - 4); OglDrawFilledRect (left + 2, bottom - 2, right, bottom - 3); OglDrawFilledRect (left + 1, bottom - 1, right, bottom - 2); OglDrawFilledRect (left + 0, bottom - 0, right, bottom - 1); CCanvas::Current ()->SetColorRGB (255, 255, 255, 50); OglDrawFilledRect (left, top + 0, right - 1, top + 1); OglDrawFilledRect (left, top + 1, right - 2, top + 2); OglDrawFilledRect (left, top + 2, right - 3, top + 3); OglDrawFilledRect (left, top + 3, right - 4, top + 4); OglDrawFilledRect (left, top + 4, right - 5, top + 5); OglDrawFilledRect (left, top + 5, right - 6, top + 6); OglDrawFilledRect (left + 0, top + 6, left + 1, bottom - 1); OglDrawFilledRect (left + 1, top + 6, left + 2, bottom - 2); OglDrawFilledRect (left + 2, top + 6, left + 3, bottom - 3); OglDrawFilledRect (left + 3, top + 6, left + 4, bottom - 4); OglDrawFilledRect (left + 4, top + 6, left + 5, bottom - 5); OglDrawFilledRect (left + 5, top + 6, left + 6, bottom - 6); glDisable (GL_BLEND); } //GrUpdate (0); } gameStates.render.grAlpha = 1.0f; }