//////////////////////////////////////////////////////////// // Actual game actions //////////////////////////////////////////////////////////// // It seems that these methods should not be called directly // from outside for some reason. // So if you want to start a new game or do load / save, use // the following public methods. // // - DeferedInitNew // - LoadGame // - SaveGame private void DoLoadLevel() { gameAction = GameAction.Nothing; gameState = GameState.Level; var players = options.Players; for (var i = 0; i < Player.MaxPlayerCount; i++) { if (players[i].InGame && players[i].PlayerState == PlayerState.Dead) { players[i].PlayerState = PlayerState.Reborn; } Array.Clear(players[i].Frags, 0, players[i].Frags.Length); } intermission = null; options.Sound.Reset(); world = new World(content, options, this); options.UserInput.Reset(); }
public Animation(Intermission intermission, AnimationInfo info, int number) { im = intermission; this.number = number; type = info.Type; period = info.Period; frameCount = info.Count; locationX = info.X; locationY = info.Y; data = info.Data; patches = new string[frameCount]; for (var i = 0; i < frameCount; i++) { // MONDO HACK! if (im.Info.Episode != 1 || number != 8) { patches[i] = "WIA" + im.Info.Episode + number.ToString("00") + i.ToString("00"); } else { // HACK ALERT! patches[i] = "WIA104" + i.ToString("00"); } } }
private void G_DoCompleted() { gameAction = GameAction.Nothing; for (var i = 0; i < Player.MaxPlayerCount; i++) { if (players[i].InGame) { // take away cards and stuff G_PlayerFinishLevel(i); } } /* * if (automapactive) * { * AM_Stop(); * } */ if (gameMode != GameMode.Commercial) { switch (options.Map) { case 8: gameAction = GameAction.Victory; return; case 9: for (var i = 0; i < Player.MaxPlayerCount; i++) { players[i].DidSecret = true; } break; } } //#if 0 Hmmm - why? if ((options.Map == 8) && (gameMode != GameMode.Commercial)) { // victory gameAction = GameAction.Victory; return; } if ((options.Map == 9) && (gameMode != GameMode.Commercial)) { // exit secret level for (var i = 0; i < Player.MaxPlayerCount; i++) { players[i].DidSecret = true; } } //#endif var wminfo = options.wminfo; wminfo.DidSecret = players[options.ConsolePlayer].DidSecret; wminfo.Epsd = options.Episode - 1; wminfo.Last = options.Map - 1; // wminfo.next is 0 biased, unlike gamemap if (gameMode == GameMode.Commercial) { if (secretexit) { switch (options.Map) { case 15: wminfo.Next = 30; break; case 31: wminfo.Next = 31; break; } } else { switch (options.Map) { case 31: case 32: wminfo.Next = 15; break; default: wminfo.Next = options.Map; break; } } } else { if (secretexit) { // go to secret level wminfo.Next = 8; } else if (options.Map == 9) { // returning from secret level switch (options.Episode) { case 1: wminfo.Next = 3; break; case 2: wminfo.Next = 5; break; case 3: wminfo.Next = 6; break; case 4: wminfo.Next = 2; break; } } else { // go to next level wminfo.Next = options.Map; } } wminfo.maxKills = world.totalKills; wminfo.maxItems = world.totalItems; wminfo.maxSecret = world.totalSecrets; wminfo.maxFrags = 0; if (gameMode == GameMode.Commercial) { wminfo.ParTime = 35 * 30; //cpars[gamemap - 1]; } else { wminfo.ParTime = 35 * 30; //pars[gameepisode][gamemap]; } wminfo.PNum = options.ConsolePlayer; for (var i = 0; i < Player.MaxPlayerCount; i++) { wminfo.Plyr[i].InGame = players[i].InGame; wminfo.Plyr[i].Skills = players[i].KillCount; wminfo.Plyr[i].SItems = players[i].ItemCount; wminfo.Plyr[i].SSecret = players[i].SecretCount; wminfo.Plyr[i].STime = world.levelTime; Array.Copy(players[i].Frags, wminfo.Plyr[i].Frags, Player.MaxPlayerCount); } gameState = GameState.Intermission; //viewactive = false; //automapactive = false; /* * if (statcopy) * { * memcpy(statcopy, &wminfo, sizeof(wminfo)); * } */ //WI_Start(&wminfo); intermission = new Intermission(players, wminfo, options); }
private void G_DoLoadLevel() { /* * // Set the sky map. * // First thing, we have a dummy sky texture name, * // a flat. The data is in the WAD only because * // we look for an actual index, instead of simply * // setting one. * skyflatnum = R_FlatNumForName(SKYFLATNAME); * * // DOOM determines the sky texture to be used * // depending on the current episode, and the game version. * if ((gamemode == commercial) || (gamemode == pack_tnt) || (gamemode == pack_plut)) ||{ || skytexture = R_TextureNumForName("SKY3"); || if (gamemap < 12) || skytexture = R_TextureNumForName("SKY1"); || else || if (gamemap < 21) || skytexture = R_TextureNumForName("SKY2"); ||} */ // for time calculation levelstarttic = gametic; /* * if (wipegamestate == GS_LEVEL) * { * // force a wipe * wipegamestate = -1; * } */ gameState = GameState.Level; for (var i = 0; i < Player.MaxPlayerCount; i++) { if (players[i].InGame && players[i].PlayerState == PlayerState.Dead) { players[i].PlayerState = PlayerState.Reborn; } Array.Clear(players[i].Frags, 0, players[i].Frags.Length); } intermission = null; // P_SetupLevel(gameepisode, gamemap, 0, gameskill); world = new World(resource, options, players); world.Audio = audio; // view the guy you are playing // displayplayer = consoleplayer; // starttime = I_GetTime(); gameAction = GameAction.Nothing; // Z_CheckHeap(); // clear cmd building stuff /* * memset(gamekeydown, 0, sizeof(gamekeydown)); * joyxmove = joyymove = 0; * mousex = mousey = 0; * sendpause = sendsave = paused = false; * memset(mousebuttons, 0, sizeof(mousebuttons)); * memset(joybuttons, 0, sizeof(joybuttons)); */ }
private void DoCompleted() { gameAction = GameAction.Nothing; for (var i = 0; i < Player.MaxPlayerCount; i++) { if (options.Players[i].InGame) { // Take away cards and stuff. options.Players[i].FinishLevel(); } } if (options.GameMode != GameMode.Commercial) { switch (options.Map) { case 8: gameAction = GameAction.Victory; return; case 9: for (var i = 0; i < Player.MaxPlayerCount; i++) { options.Players[i].DidSecret = true; } break; } } if ((options.Map == 8) && (options.GameMode != GameMode.Commercial)) { // Victory. gameAction = GameAction.Victory; return; } if ((options.Map == 9) && (options.GameMode != GameMode.Commercial)) { // Exit secret level. for (var i = 0; i < Player.MaxPlayerCount; i++) { options.Players[i].DidSecret = true; } } var imInfo = options.IntermissionInfo; imInfo.DidSecret = options.Players[options.ConsolePlayer].DidSecret; imInfo.Episode = options.Episode - 1; imInfo.LastLevel = options.Map - 1; // IntermissionInfo.Next is 0 biased, unlike GameOptions.Map. if (options.GameMode == GameMode.Commercial) { if (world.SecretExit) { switch (options.Map) { case 15: imInfo.NextLevel = 30; break; case 31: imInfo.NextLevel = 31; break; } } else { switch (options.Map) { case 31: case 32: imInfo.NextLevel = 15; break; default: imInfo.NextLevel = options.Map; break; } } } else { if (world.SecretExit) { // Go to secret level. imInfo.NextLevel = 8; } else if (options.Map == 9) { // Returning from secret level. switch (options.Episode) { case 1: imInfo.NextLevel = 3; break; case 2: imInfo.NextLevel = 5; break; case 3: imInfo.NextLevel = 6; break; case 4: imInfo.NextLevel = 2; break; } } else { // Go to next level. imInfo.NextLevel = options.Map; } } imInfo.MaxKillCount = world.TotalKills; imInfo.MaxItemCount = world.TotalItems; imInfo.MaxSecretCount = world.TotalSecrets; imInfo.TotalFrags = 0; if (options.GameMode == GameMode.Commercial) { imInfo.ParTime = 35 * DoomInfo.ParTimes.Doom2[options.Map - 1]; } else { imInfo.ParTime = 35 * DoomInfo.ParTimes.Doom1[options.Episode - 1][options.Map - 1]; } var players = options.Players; for (var i = 0; i < Player.MaxPlayerCount; i++) { imInfo.Players[i].InGame = players[i].InGame; imInfo.Players[i].KillCount = players[i].KillCount; imInfo.Players[i].ItemCount = players[i].ItemCount; imInfo.Players[i].SecretCount = players[i].SecretCount; imInfo.Players[i].Time = world.LevelTime; Array.Copy(players[i].Frags, imInfo.Players[i].Frags, Player.MaxPlayerCount); } gameState = GameState.Intermission; intermission = new Intermission(options, imInfo); }