void horseRaceInit() { udword i; horseGetNumBars(&horseBarInfo); //initialize current bar to the 0th bar localbar=0; for(i=0;i<MAX_MULTIPLAYER_PLAYERS;i++) { horseracestatus.barnum[i] = 0; horseracestatus.percent[i] = 0; horseracestatus.hrstatusstr[i][0] = 0; if (autodownloadmapRequired()) TTimerStart(&hrPlayerDropoutTimers[i],HorseRacePlayerDropoutTime*2.0f); // give double time for autodownloads else TTimerStart(&hrPlayerDropoutTimers[i],HorseRacePlayerDropoutTime); PlayersAlreadyDrawnDropped[i] = FALSE; } for (i=0;i<NUM_CHAT_LINES;i++) { chathistory[i].message[0] = 0; } listInit(&horseCrapRegion.cutouts); JustInit = TRUE; if (!hrScreensHandle) { feCallbackAddMultiple(hrCallBack); feDrawCallbackAddMultiple(hrDrawCallback); hrScreensHandle = feScreensLoad(HR_FIBFile); } if (!ShouldHaveMousePtr) mouseCursorHide(); if (singlePlayerGame) { hrBaseRegion = feScreenStart(&horseCrapRegion, HR_SingleRaceScreen); } else { hrBaseRegion = feScreenStart(&horseCrapRegion, (multiPlayerGame) ? HR_RaceScreen : HR_RaceScreenNotNetwork); } playernamefont = frFontRegister(HR_PlayerNameFont); hrRunning=TRUE; if (RGLtype == SWtype && feShouldSaveMouseCursor()) { rglFeature(RGL_SAVEBUFFER_ON); } hrBackgroundDirty = (RGLtype == SWtype) ? 10000 : 3; hrBackgroundReinit = FALSE; }
void horseGetNumBars(HorseRaceBars *horsebars) { sdword i; bool enablebar[MAX_POSSIBLE_NUM_BARS]; real32 totalperc; dbgAssertOrIgnore(horseTotalNumBars.numBars > 0); for (i=0;i<horseTotalNumBars.numBars;i++) { switch (i) { case DOWNLOADMAP_BAR: enablebar[i] = autodownloadmapRequired(); break; case UNIVERSE_BAR: enablebar[i] = TRUE; break; case ETG_BAR: enablebar[i] = etgHasBeenStarted ? FALSE : TRUE; break; case TEXTURE1_BAR: case TEXTURE2_BAR: #if TR_NIL_TEXTURE enablebar[i] = GLOBAL_NO_TEXTURES ? FALSE : TRUE; #else enablebar[i] = TRUE; #endif break; default: dbgFatalf(DBG_Loc,"You must specify whether or not to load bar %i here",i); break; } } horsebars->numBars = 0; // now, based on enablebar[i], selectively add bars that will be loaded: for (i=0;i<horseTotalNumBars.numBars;i++) { if (enablebar[i]) { horsebars->perc[horsebars->numBars++] = horseTotalNumBars.perc[i]; } } dbgAssertOrIgnore(horsebars->numBars > 0); // now renormalize percentages to 1.0 for (totalperc = 0.0f,i=0;i<horsebars->numBars;i++) { totalperc += horsebars->perc[i]; } dbgAssertOrIgnore(totalperc > 0.0f); if (totalperc != 1.0f) { for (i=0;i<horsebars->numBars;i++) { horsebars->perc[i] /= totalperc; } } }