// //////////////////////////////////////////////////////////////////////////// static BOOL gameInit(void) { UDWORD player; scriptInit(); // If this is from a savegame, stop here! if (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION) { // these two lines are the biggest hack in the world. // the reticule seems to get detached from 'reticuleup' // this forces it back in sync... intRemoveReticule(); intAddReticule(); return true; } for(player = 0; player<game.maxPlayers; player++) // clean up only to the player limit for this map.. { cleanMap(player); } for (player = 1; player < MAX_PLAYERS; player++) { // we want to remove disabled AI & all the other players that don't belong if ((game.skDiff[player] == 0 || player >= game.maxPlayers) && (!game.scavengers || player != 7)) { clearPlayer(player, true); // do this quietly debug(LOG_NET, "removing disabled AI (%d) from map.", player); } } if (game.scavengers) // FIXME - not sure if we still need this hack - Per { // ugly hack for now game.skDiff[7] = DIFF_SLIDER_STOPS / 2; } if (NetPlay.isHost) // add oil drums { addOilDrum(NetPlay.playercount * 2); } playerResponding(); // say howdy! return true; }
// //////////////////////////////////////////////////////////////////////////// static bool gameInit(void) { UDWORD player; // If this is from a savegame, stop here! if (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION) { // these two lines are the biggest hack in the world. // the reticule seems to get detached from 'reticuleup' // this forces it back in sync... intRemoveReticule(); intAddReticule(); return true; } for (player = 1; player < MAX_PLAYERS; player++) { // we want to remove disabled AI & all the other players that don't belong if ((game.skDiff[player] == 0 || player >= game.maxPlayers) && player != scavengerPlayer()) { clearPlayer(player, true); // do this quietly debug(LOG_NET, "removing disabled AI (%d) from map.", player); } } if (game.scavengers) // FIXME - not sure if we still need this hack - Per { // ugly hack for now game.skDiff[scavengerPlayer()] = DIFF_SLIDER_STOPS / 2; } unsigned playerCount = 0; for (int index = 0; index < game.maxPlayers; ++index) { playerCount += NetPlay.players[index].ai >= 0 || NetPlay.players[index].allocated; } addOilDrum(playerCount * 2); // Calculating playerCount instead of using NetPlay.playercount, since the latter seems to be 0 for non-hosts. playerResponding(); // say howdy! return true; }
bool stageThreeInitialise() { STRUCTURE *psStr; UDWORD i; DROID *psDroid; bool fromSave = (getSaveGameType() == GTYPE_SAVE_START || getSaveGameType() == GTYPE_SAVE_MIDMISSION); debug(LOG_WZ, "== stageThreeInitialise =="); loopMissionState = LMS_NORMAL; if (!InitRadar()) // After resLoad cause it needs the game palette initialised. { return false; } // reset the clock to normal speed gameTimeResetMod(); if (!init3DView()) // Initialise 3d view stuff. After resLoad cause it needs the game palette initialised. { return false; } effectResetUpdates(); initLighting(0, 0, mapWidth, mapHeight); pie_InitLighting(); if (fromSave) { // these two lines are the biggest hack in the world. // the reticule seems to get detached from 'reticuleup' // this forces it back in sync... intRemoveReticule(); intAddReticule(); } if (bMultiPlayer) { if (!fromSave) { multiGameInit(); } initTemplates(); } preProcessVisibility(); prepareScripts(getLevelLoadType() == GTYPE_SAVE_MIDMISSION || getLevelLoadType() == GTYPE_SAVE_START); if (!fpathInitialise()) { return false; } mapInit(); gridReset(); //if mission screen is up, close it. if (MissionResUp) { intRemoveMissionResultNoAnim(); } // Re-inititialise some static variables. resizeRadar(); setAllPauseStates(false); /* decide if we have to create teams, ONLY in multiplayer mode!*/ if (bMultiPlayer && alliancesSharedVision(game.alliance)) { createTeamAlliances(); /* Update ally vision for pre-placed structures and droids */ for (i = 0; i < MAX_PLAYERS; i++) { if (i != selectedPlayer) { /* Structures */ for (psStr = apsStructLists[i]; psStr; psStr = psStr->psNext) { if (aiCheckAlliances(psStr->player, selectedPlayer)) { visTilesUpdate((BASE_OBJECT *)psStr); } } /* Droids */ for (psDroid = apsDroidLists[i]; psDroid; psDroid = psDroid->psNext) { if (aiCheckAlliances(psDroid->player, selectedPlayer)) { visTilesUpdate((BASE_OBJECT *)psDroid); } } } } } countUpdate(); if (getLevelLoadType() != GTYPE_SAVE_MIDMISSION) { if (getDebugMappingStatus()) { triggerEventCheatMode(true); } eventFireCallbackTrigger((TRIGGER_TYPE)CALL_GAMEINIT); triggerEvent(TRIGGER_GAME_INIT); } return true; }