Pararena2/Sources/PlayerStats.c

1 line
14 KiB
C
Raw Normal View History

/*============================================================*/ /*============================================================*/ /*== ==*/ /*== Player Statistics Routines ==*/ /*== ==*/ /*============================================================*/ /*============================================================*/ /*======================================================== Includes */ #include "Globals.h" #include "UnivUtilities.h" #include "PlayerStats.h" /*======================================================== Functions */ /*======================================================== EraseStats */ void EraseStats (short whoBitesIt) { theStats[whoBitesIt - 1].tournamentTime = 0L; theStats[whoBitesIt - 1].bestPlatinumTime = 0L; theStats[whoBitesIt - 1].copperTitles = 0; theStats[whoBitesIt - 1].bronzeTitles = 0; theStats[whoBitesIt - 1].silverTitles = 0; theStats[whoBitesIt - 1].goldTitles = 0; theStats[whoBitesIt - 1].platinumTitles = 0; theStats[whoBitesIt - 1].played = 0; theStats[whoBitesIt - 1].won = 0; theStats[whoBitesIt - 1].goals = 0; theStats[whoBitesIt - 1].fouls = 0; theStats[whoBitesIt - 1].criticals = 0; theStats[whoBitesIt - 1].oppGoals = 0; theStats[whoBitesIt - 1].oppFouls = 0; theStats[whoBitesIt - 1].oppCriticals = 0; theStats[whoBitesIt - 1].georgeState = kUnplayedState; theStats[whoBitesIt - 1].maraState = kUnplayedState; theStats[whoBitesIt - 1].ottoState = kUnplayedState; theStats[whoBitesIt - 1].claireState = kUnplayedState; theStats[whoBitesIt - 1].eazeState = kUnplayedState; theStats[whoBitesIt - 1].teakState = kUnplayedState; teaksThreshholds[whoBitesIt - 1] = 50; } /*======================================================== DrawStatsPopUpItem */ void DrawStatsPopUpItem (void) { #define kBottomMargin 5 Str255 menuItem; short itemLeftMargin; InsetRect(&teamsPopUpRect, 1, 1); EraseRect(&teamsPopUpRect); InsetRect(&teamsPopUpRect, -1, -1); GetItem(teamsPopUp, popUpItemSelected, (StringPtr)&menuItem); itemLeftMargin = (teamsPopUpRect.right - teamsPopUpRect.left - StringWidth(menuItem)) / 2; MoveTo(teamsPopUpRect.left + itemLeftMargin, teamsPopUpRect.bottom - kBottomMargin); DrawString(menuItem); } /*======================================================== DrawStatsPopUp */ void DrawStatsPopUp (void) { #define kLeftMargin 5 #define kRightMargin 5 FrameRect(&teamsPopUpRect); MoveTo(teamsPopUpRect.left + 1, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.bottom); LineTo(teamsPopUpRect.right, teamsPopUpRect.top + 1); DrawStatsPopUpItem(); } /*======================================================== RedrawStatValues */ void RedrawStatValues (void) { Str255 tempStr; Rect tempRect; PicHandle checkPict, xPict; short tempShort, i; if (!isColor) TextMode(srcXor); PenMode(patOr); PenPat(gray); SetRect(&tempRect, 0, 0, 60, 35); OffsetRect(&tempRect, 60, 72); if (theStats[popUpItemSelected - 1].copperTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].copperTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].bronzeTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].bronzeTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].silverTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRect.right - 16, tempRect.bottom - 2); NumToString((long)theStats[popUpItemSelected - 1].silverTitles, tempStr); DrawString(tempStr); ForeColor(blackColor); } OffsetRect(&tempRect, 66, 0); if (theStats[popUpItemSelected - 1].goldTitles == 0) PaintRect(&tempRect); else { ForeColor(yellowColor); MoveTo(tempRec