|
39 | 39 | // External functions |
40 | 40 |
|
41 | 41 | extern void R_ExecuteSetViewSize(void); // [crispy] for clean screenshot |
| 42 | +extern void S_InitScript(void); // [crispy] multiple episodes |
42 | 43 |
|
43 | 44 | // Functions |
44 | 45 |
|
@@ -69,6 +70,7 @@ gameaction_t gameaction; |
69 | 70 | gamestate_t gamestate; |
70 | 71 | skill_t gameskill; |
71 | 72 | //boolean respawnmonsters; |
| 73 | +int prev_episode; // [crispy] previous episode up until InitEpisode |
72 | 74 | int gameepisode; |
73 | 75 | int gamemap; |
74 | 76 | int prevmap; |
@@ -1918,6 +1920,8 @@ void G_StartNewGame(skill_t skill) |
1918 | 1920 | int realMap; |
1919 | 1921 |
|
1920 | 1922 | G_StartNewInit(); |
| 1923 | + // [crispy] re-init scripts and mapinfo to support multiple episodes |
| 1924 | + H2_InitEpisode(false); |
1921 | 1925 | realMap = P_TranslateMap(1); |
1922 | 1926 | if (realMap == -1) |
1923 | 1927 | { |
@@ -2282,7 +2286,8 @@ void G_InitNew(skill_t skill, int episode, int map) |
2282 | 2286 | } |
2283 | 2287 | paused = false; |
2284 | 2288 | viewactive = true; |
2285 | | - gameepisode = episode; |
| 2289 | + // [crispy] don't let e. g. demo episode overwrite gameepisode |
| 2290 | + // gameepisode = episode; |
2286 | 2291 | gamemap = map; |
2287 | 2292 | gameskill = skill; |
2288 | 2293 | BorderNeedRefresh = true; |
@@ -2728,3 +2733,34 @@ boolean G_CheckDemoStatus(void) |
2728 | 2733 |
|
2729 | 2734 | return false; |
2730 | 2735 | } |
| 2736 | + |
| 2737 | +/* |
| 2738 | +=============================================================================== |
| 2739 | +
|
| 2740 | + [crispy] Additional Functions |
| 2741 | +
|
| 2742 | +=============================================================================== |
| 2743 | +*/ |
| 2744 | + |
| 2745 | +/* |
| 2746 | +=================== |
| 2747 | += |
| 2748 | += H2_InitEpisode |
| 2749 | += |
| 2750 | += (Re-)Init episode related MapInfo and Sound Scripts |
| 2751 | += to support multiple episodes in Hexen. |
| 2752 | +=================== |
| 2753 | +*/ |
| 2754 | + |
| 2755 | +void H2_InitEpisode(bool forceinit) |
| 2756 | +{ |
| 2757 | + if (!crispy->havedeathkings) |
| 2758 | + return; |
| 2759 | + |
| 2760 | + if (forceinit || (prev_episode != gameepisode)) |
| 2761 | + { |
| 2762 | + S_InitScript(); |
| 2763 | + InitMapInfo(); |
| 2764 | + prev_episode = gameepisode; |
| 2765 | + } |
| 2766 | +} |
0 commit comments