Created
January 1, 2019 13:43
-
-
Save SibTiger/c37f37fca2cce917e246ebef15b9fb16 to your computer and use it in GitHub Desktop.
TGRDM3's TITLEMAP - features slideshow and world environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
============================================================= | |
Author | |
-------- | |
Author: Nicholas "Tiger" Gautier | |
Email: Nicholas.Gautier.Tiger@Gmail.com | |
Website: https://github.com/SibTiger/TGRDM3 | |
------------------------------------------------------------- | |
Map Details | |
------------- | |
Map Name: Title Map | |
Creation Date: 6 May. 2016 | |
Finished Date: | |
Game Mode: ZDoom Special Map (Not Playable) | |
Map Size: Not Playable | |
Map Comments: This title map is designed to host not only the main title | |
screen, but also hosts the credits as well. | |
------------------------------------------------------------- | |
Map Notes | |
----------- | |
If in case the this map active as a normal playable map, for example: | |
CCMD MAP TITLEMAP or even VoteMap TITLEMAP, this map will try to | |
change maps instantly to avoid players getting stuck or an unplayable | |
game. This feature is mainly in mind for SkullTag and its derivatives. | |
Originally I wanted to have the credits scroll from the bottom to the top, | |
like most commonly have with most games and commonly seen in the movies. | |
However, it was just more easier and takes far less time to code the | |
credits fading in and out. | |
Furthermore, I have implemented the 'Slide Show' feature - which is to be | |
displayed during the credits. However, to be sure that this works | |
efficiently, I had to emulate 'Events' as ACS does not support it natively. | |
------------------------------------------------------------- | |
DON'T PLAGIARIZE OUR WORK! | |
-------------------------- | |
============================================================= | |
*/ | |
// Include the fundamental packages required | |
// ---------------------------------------------- | |
#include "zcommon.acs" | |
#import "Source/StdLib.acs" | |
// ---- | |
// Map Scoped Variables and Declarations | |
// This variable is needed to activate and deactivate the slide show | |
// functionality. This is a work around to Events, as ACS does not | |
// support them. | |
int textureSlideShowActivate = 0; | |
// ---- | |
// Execute specific scripts at map startup; Managed [Server\Master] | |
SCRIPT 1 OPEN | |
{ | |
// Freeze the player in-place | |
FreezePlayer(True); | |
// Game State Check | |
// Avoid players from trying to play this map and potentially breaking - | |
// a live gameserver. | |
GameState(); | |
// Change the player's view to the camera. | |
ChangePointofView(); | |
// Update the music volume | |
MusicVolume(0.8); | |
// World Environment | |
ACS_NamedExecute("WorldEnvironment_Driver", 0, 0, 0, 0); | |
} | |
//Execute specific scripts at map startup; Client Sided | |
SCRIPT 2 OPEN CLIENTSIDE | |
{ | |
//Left blank; nothing to add here. | |
} | |
// World Environment Driver | |
SCRIPT "WorldEnvironment_Driver" (VOID) | |
{ | |
int gameTitleHold = 10 << 16; // 10 seconds | |
do | |
{ | |
// Display the game title | |
DisplayGameTitle(gameTitleHold); | |
// Wait for the Game Title to slowly vanish | |
// Remember that (1 * 35 ~ .98 seconds) | |
Delay (((gameTitleHold >> 16) + 4) * 35); | |
// Dim the Title screen brightness | |
ACS_NamedExecuteWait("MainViewingTitleBrightness", 0, 0, 2, 192); | |
// Hide the title screen textures | |
TitleScreenTexturesUpdate(FALSE); | |
// Run the map slide show | |
textureSlideShowActivate = 1; | |
ACS_NamedExecute("SlideShow", 0, 0, 0, 0); | |
// Run the credits | |
ACS_NamedExecuteWait("Credits", 0, 0, 0, 0); | |
// Show the title screen textures | |
TitleScreenTexturesUpdate(TRUE); | |
// Restore the Title screen brightness | |
ACS_NamedExecuteWait("MainViewingTitleBrightness", 0, 1, 2, 192); | |
// Turn off the slide show | |
textureSlideShowActivate = 0; | |
} while (true); | |
} // World Environment Driver | |
// Update the Player's Point of View to the camera. | |
function void ChangePointofView (void) | |
{ | |
ChangeCamera (1, 0, FALSE); | |
} // ChangePointofView() | |
// This function simply adjusts the main title screen textures. | |
// When running the slide show we need to hide the title screen | |
// textures, but when we need to draw the main title screen - | |
// then display it. | |
// ---- | |
// Parameters | |
// textureSwitch <bool> | |
// false = Hide title screen textures | |
// true = Show title screen textures | |
function void TitleScreenTexturesUpdate (bool textureSwitch) | |
{ | |
// Display the Title Screen textures | |
if (textureSwitch) | |
{ | |
SetLineTexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "TX5_005"); | |
SetLineTexture(6, SIDE_FRONT, TEXTURE_MIDDLE, "TX1_0EG"); | |
SetLineTexture(7, SIDE_FRONT, TEXTURE_MIDDLE, "SP_FACE1"); | |
} // if | |
// Hide the Title Screen textures | |
else | |
{ | |
SetLineTexture(5, SIDE_FRONT, TEXTURE_MIDDLE, "-"); | |
SetLineTexture(6, SIDE_FRONT, TEXTURE_MIDDLE, "-"); | |
SetLineTexture(7, SIDE_FRONT, TEXTURE_MIDDLE, "-"); | |
} // else | |
} // TitleScreenTexturesUpdate() | |
// This script merely dims or restores the brightness level of the main title screen. | |
// ---- | |
// Parameters | |
// brightnessLevel <int> | |
// 0 = Dim the brightness level to a value of '0' | |
// useful for transitioning from one screen to another. | |
// 1 = Restore the brightness level to its original value. | |
// Useful for redisplaying the main title screen. | |
// sectorTag <int> | |
// This variable defines what sector is to be effected. | |
// setBrightness <int> | |
// ` IIF: the parameter 'brightnessLevel' is set to '0', then this parameter must be | |
// set to record the sectors current light level in which to dim. | |
// But, if 'brightnessLevel' is '1', then this parameter must be set to change the | |
// sectors brightness level. but this automatically assumes we start from | |
// '0' as the starting level. | |
SCRIPT "MainViewingTitleBrightness" (int brightnessLevel, int sectorTag, int setBrightness) | |
{ | |
// Delay between light intervals in tics | |
int waitLightUpdate = (1); | |
// ---- | |
// Restore the lighting values | |
if (brightnessLevel) | |
for (int i = 0; i <= setBrightness; ++i) | |
{ | |
Light_ChangeToValue (sectorTag, i); | |
Delay(waitLightUpdate); | |
} // for | |
// Dim the lights to a value of '0' | |
if (!brightnessLevel) | |
for (int j = setBrightness; j >= 0; --j) | |
{ | |
Light_ChangeToValue (sectorTag, j); | |
Delay(waitLightUpdate); | |
} // for | |
} // MainViewingTitleBrightness() | |
// Displays the game title on the screen; TGR-style. | |
// ---- | |
// Parameters | |
// holdMSG <int> | |
// The amount of time (in seconds) to hold the message on the screen. | |
function void DisplayGameTitle (int holdMSG) | |
{ | |
// Using larger font style | |
SetFont("BIGFONT"); | |
// Enforce a fixed HudSize and forcefully stretch the hud messages if needed. | |
// Minimum Screen Resolution Requirement is exactly this. | |
SetHudSize(320, 200, FALSE); | |
// Display the title | |
HudMessageBold(l:"ProjectName"; // Message | |
// Type of HudMessage | |
HUDMSG_FADEINOUT | // Draws with a fade in and fade out [In Time && Out Time]) | |
HUDMSG_ALPHA | // Uses opacity | |
HUDMSG_LAYER_OVERHUD, // Hud message is displayed on-top of the player's Hud | |
0, // ID | |
CR_GRAY, // Colour | |
160.0, // Fixed Axis: X | |
80.0, // Fixed Axis: Y | |
holdMSG, // Hold Time [In Seconds] | |
3.0, // In Time [In Seconds] | |
5.0, // Out Time [In Seconds] | |
0.3 // Alpha | |
); | |
} // DisplayGameTitle() | |
// This function will alter the music's volume | |
// ---- | |
// Parameters | |
// fixedNum <int> | |
// A fixed number from 0.0 -> 1.0 that is used to adjust the volume level of the music. | |
function void MusicVolume (int fixedNum) | |
{ | |
SetMusicVolume(fixedNum); | |
} // MusicVolume() | |
#region Slide Show | |
// This array is designed to only hold the texture names; these will be used | |
// for the slide show. | |
#define slideShowSize 18 | |
str slideShowPictures[slideShowSize] = {"Inter_01", "Inter_02", "Inter_03", | |
"Inter_04", "Inter_05", "Inter_06", | |
"Inter_07", "Inter_08", "Inter_09", | |
"Inter_10", "Inter_11", "Inter_12", | |
"Inter_13", "Inter_14", "Inter_15", | |
"Inter_16", "Inter_97", "Inter_98"}; | |
// Slide Show Functionality | |
// This script is designed to setup and display the map slide show. | |
SCRIPT "SlideShow" (VOID) | |
{ | |
// Randomize the array's index contents | |
SlideShow_Randomize(); | |
// Display the slide show | |
ACS_NamedExecute("SlideShow_Execute", 0, 1, 0, 0); | |
// Illuminate the sector | |
ACS_NamedExecuteWait("MainViewingTitleBrightness", 0, 1, 3, 144); | |
// Because ACS does not have events, this loop will routinely check | |
// if the slide show should stop running. This is done to check | |
// a Map variable. When toggled, this function will properly | |
// revert its actions. | |
while (textureSlideShowActivate) | |
Delay(1); | |
// Stop the Slide Show | |
ACS_NamedTerminate("SlideShow_Execute", 0); | |
// Darken the sector | |
ACS_NamedExecuteWait("MainViewingTitleBrightness", 0, 0, 3, 144); | |
// Restore the SideDef used for the Slide Show to a default texture. | |
ACS_NamedExecute("SlideShow_Execute", 0, 0, 0, 0); | |
} // SlideShow() | |
// This function is going to randomize the index values within the array. | |
// Fisher-Yates Shuffle Modern Algorithm | |
function void SlideShow_Randomize (VOID) | |
{ | |
// Declarations needed for the algorithm | |
// Used for randomly selected indexes | |
int n; | |
// Keeps the value of the highlighted index | |
int temp; | |
// ---- | |
// Randomization algorithm | |
for (int i = (slideShowSize - 1); i > 0; --i) | |
{ | |
// Fetch a random index to switch with another index. | |
n = Random(0,i); | |
// Only switch index values if and only if the randomly selected | |
// index is NOT the highlighted index itself. | |
if (n != i) | |
{ | |
// Save the highlighted index (not randomized) to a variable | |
temp = slideShowPictures[i]; | |
// Switch the randomly selected index with the highlighted index. | |
slideShowPictures[i] = slideShowPictures[n]; | |
// Replace the randomly selected index's value with the highlighted index. | |
slideShowPictures[n] = temp; | |
} // if | |
} // for | |
} // SlideShow_Randomize() | |
// This script is designed to rotate the texture sidedef with the textures defined | |
// within the texture array. | |
// ---- | |
// Parameters | |
// slideShowMode <int> | |
// 0 = Change the SideDef to a default texture | |
// 1 = Enable the Slide Show functionality | |
SCRIPT "SlideShow_Execute" (int slideShowMode) | |
{ | |
// Restore the SideDef texture to the default value as defined. | |
if (!slideShowMode) | |
SetLineTexture(4, SIDE_FRONT, TEXTURE_MIDDLE, "ASHWALL2"); | |
// Start the Slide Show | |
else | |
{ | |
// We're going to use this variable to scan the array. | |
int i = 0; | |
do | |
{ | |
// Change the texture | |
SetLineTexture(4, SIDE_FRONT, TEXTURE_MIDDLE, slideShowPictures[i]); | |
// Update the variable, but be sure we stay within the array. | |
if (i < (slideShowSize - 1)) | |
i++; | |
else | |
i = 0; | |
// Wait before transitioning to the sequence | |
Delay(10 * 35); | |
} while (textureSlideShowActivate); | |
} // Else | |
} // SlideShow_Execute() | |
#endregion | |
#region Credits | |
// This script manages front layer | |
SCRIPT "Credits" (VOID) | |
{ | |
ACS_NamedExecuteWait("Credits_Tools", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_GameContent", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_MapDesign", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Graphics", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Textures", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Textures1", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Textures2", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Sounds", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Sounds1", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Music", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_VisualEffects", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Engines", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_Support", 0, 0, 0, 0); | |
ACS_NamedExecuteWait("Credits_SpecialThanks", 0, 0, 0, 0); | |
} // Credits () | |
// Credits: Tools used and their respective owners. | |
SCRIPT "Credits_Tools" (VOID) | |
{ | |
DisplayCreditMessage("Credits_ToolsUsed", 160.0, 30.1, true); | |
DisplayCreditMessage("7Zip\nAudacity\nBootless Star\nDoomWord\nDuplicate File Checker\nGimp\nGZDoom Builder\nMSPaint\nNotepad++\nPNG Compressor\nSLADE 3\n", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Tools() | |
// Credits: Game contents and the like used in the game | |
SCRIPT "Credits_GameContent" (VOID) | |
{ | |
DisplayCreditMessage("Credits_GameContent", 160.0, 30.1, true); | |
DisplayCreditMessage("Enjay\nGhastly_dragon\nKeksdose\nTormentor667", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_GameContent() | |
// Credits: Map Concepts and Design | |
SCRIPT "Credits_MapDesign" (VOID) | |
{ | |
DisplayCreditMessage("Credits_MapDesign", 160.0, 30.1, true); | |
DisplayCreditMessage("Tiger", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_MapDesign() | |
// Credits: Graphics used in the game. | |
SCRIPT "Credits_Graphics" (VOID) | |
{ | |
DisplayCreditMessage("Credits_Graphics", 160.0, 30.1, true); | |
DisplayCreditMessage("Dancso\nDoomJedi\nHazeBandicoot\nidSoftware\nPerkristian\nSkullTag Team\nTeam Hellspawn\nVoxelbro", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Graphics() | |
// Credits: Textures used in the game. | |
SCRIPT "Credits_Textures" (VOID) | |
{ | |
DisplayCreditMessage("Credits_Textures", 160.0, 30.1, true); | |
DisplayCreditMessage("2mbrown\nSTDOM\nREQUIEM\nd1gfxd2\ndecontex\nDGDBTXTR\nerattex1\nGOTHICTX\ngraphtx1\ncelticsh\ngraphtx3", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Textures() | |
// Credits: Textures used in the game. | |
SCRIPT "Credits_Textures1" (VOID) | |
{ | |
DisplayCreditMessage("Credits_TexturesCont", 160.0, 30.1, true); | |
DisplayCreditMessage("mortres\nnb_recol\nnb5texd2\npptex\ncrudream\ndoomnoir\nNmnCorp1\nNmncorp2\nsmdm\nduel32f\nRETRES", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Textures1() | |
// Credits: Textures used in the game. | |
SCRIPT "Credits_Textures2" (VOID) | |
{ | |
DisplayCreditMessage("Credits_TexturesCont", 160.0, 30.1, true); | |
DisplayCreditMessage("Minigunner\nprintz\nogrodtex\npsytex\ndoompotp\ndrdrtextures\nBAK_LEG\nGZDoom Builder", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Textures1() | |
// Credits: Sounds used in the game. | |
SCRIPT "Credits_Sounds" (VOID) | |
{ | |
DisplayCreditMessage("Credits_Sounds", 160.0, 30.1, true); | |
DisplayCreditMessage("Arctura\nAudionautics\nBatuhan\nBouncyTEM\nEquality_X12\nidSoftware\nkbnevel", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Sounds() | |
// Credits: Sounds used in the game -- CONTINUED | |
SCRIPT "Credits_Sounds1" (VOID) | |
{ | |
DisplayCreditMessage("Credits_SoundsCont", 160.0, 30.1, true); | |
DisplayCreditMessage("mario1298\nnhaudio\nPerkristian\nppfpower87\nRobinhood76\nryanconway\nSevin7", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Sounds1() | |
// Credits: Music used within the game. | |
SCRIPT "Credits_Music" (VOID) | |
{ | |
DisplayCreditMessage("Credits_Music", 160.0, 30.1, true); | |
DisplayCreditMessage("Jay Reichard\nTeamTNT", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Music() | |
// Credits: Fancy visual effects used in the game. | |
SCRIPT "Credits_VisualEffects" (VOID) | |
{ | |
DisplayCreditMessage("Credits_VisualEffects", 160.0, 30.1, true); | |
DisplayCreditMessage("Enjay\nGhastly_dragon\nKeksdose\nPerkristian\nTormentor667", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_VisualEffects() | |
// Credits: Special thanks for those that made Doom even better and continued support | |
SCRIPT "Credits_Engines" (VOID) | |
{ | |
DisplayCreditMessage("Credits_DoomPorts", 160.0, 30.1, true); | |
DisplayCreditMessage("Carnevil\nGraf Zahl\nRandi\nTorr Samaho\nAnd various contributors", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Engines() | |
// Credits: Supporters and helpers; without them, I am not sure where I would be today with this project | |
SCRIPT "Credits_Support" (VOID) | |
{ | |
DisplayCreditMessage("Credits_Support", 160.0, 30.1, true); | |
DisplayCreditMessage("Affliction\nEdward850\nEruanna\nKate\nQent\nRivecoder\nTheMisterCat\nTorr Samaho\nTribeam\nZDoom Community", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_Support() | |
// Credits: Special thanks | |
SCRIPT "Credits_SpecialThanks" (VOID) | |
{ | |
DisplayCreditMessage("Credits_SpecialThanks", 160.0, 30.1, true); | |
DisplayCreditMessage("Deathz0r\nDreambit\nDRD Team\nid Software\nMy family\nProf. Faghihi\nRealm667", 160.0, 100.0, false); | |
// Before we conclude this script, wait for the messages to fade off the screen. | |
ACS_NamedExecuteWait("CreditTransitionDelay", 0, 0, 0, 0); | |
} // Credits_SpecialThanks() | |
// A dedicated function for displaying the message in a certain perspective. | |
// This function must be called properly to display the text in a scroll like field. | |
// ---- | |
// Parameters: | |
// stringMSG <String> | |
// The message that is being printed onto the display screen. | |
// x <int> | |
// The 'x' value on the Cartesian plane to shift the message. | |
// y <int> | |
// The 'y' value on the Cartesian plane to shift the message. | |
// boldMSG <bool> | |
// true = The message string is to be considered bold. Useful for | |
// category headers. | |
// false = the message string is NOT to be considered bold. Useful for | |
// standard information. | |
function void DisplayCreditMessage (str stringMSG, int x, int y, bool boldMSG) | |
{ | |
// How long to hold the message on the screen | |
int messageHoldTime = 10 << 16; // 10 Seconds | |
// Enforce a fixed HudSize and forcefully stretch the hud messages if needed. | |
// Minimum Screen Resolution Requirement is exactly this. | |
// Though, its minimum but not exactly recommended. | |
SetHudSize(320, 200, FALSE); | |
// If the HudMessage should be bold; useful for category headers. | |
if (boldMSG) | |
HudMessageBold(l:stringMSG; // Message | |
// Type of HudMessage | |
HUDMSG_FADEINOUT | // Draws with a fade in and fade out [In Time && Out Time]) | |
HUDMSG_LAYER_OVERHUD, // Hud message is displayed on top of the player's Hud | |
0, // ID | |
CR_DARKGREEN, | |
x, // x value on the Cartesian plane | |
y, // y value on the Cartesian plane | |
messageHoldTime, // Hold time (seconds)) | |
3.0, // In Time [In Seconds] | |
5.0 // Out Time [In Seconds] | |
); | |
// If the HudMessage should be regular; useful for regular information. | |
if (!boldMSG) | |
HudMessage(s:stringMSG; // Message | |
// Type of HudMessage | |
HUDMSG_FADEINOUT | // Draws with a fade in and fade out [In Time && Out Time]) | |
HUDMSG_LAYER_OVERHUD, // Hud message is displayed on top of the player's Hud | |
0, // ID | |
CR_GRAY, | |
x, // x value on the Cartesian plane | |
y, // y value on the Cartesian plane | |
messageHoldTime, // Hold time (seconds)) | |
3.0, // In Time [In Seconds] | |
5.0 // Out Time [In Seconds] | |
); | |
} // DisplayCreditMessage() | |
// This script one purpose only; as scripts do not wait for void function types, this script | |
// is designed to enforce a nice unified delay. This will reduce redundancies within the code | |
SCRIPT "CreditTransitionDelay" (VOID) | |
{ | |
Delay (18 * 35); | |
} // CreditTransitionDelay() | |
#endregion | |
#region Check Game State | |
// Freeze the player's movement | |
function void FreezePlayer (bool freezeState) | |
{ | |
if (freezeState) | |
// Avoid any movement from the start, if requested | |
Thing_Stop (1); | |
// Freeze or unfreeze the player. If freeze is true, they can only use the +use instruction | |
SetPlayerProperty (1, freezeState, PROP_TOTALLYFROZEN); | |
// Note: the first argument must be '1' to effect all players, 0 only effects the activator. | |
// As noted in this page: http://zdoom.org/wiki/SetPlayerProperty | |
} // FreezePlayer() | |
// Avoid this map being ran as a traditional playable map. | |
// This is mainly intended for dedicated multiplayer engines like SkullTag and Zandronum. | |
// If in case players accidentally VoteMap to this map, this algorithm will try to forcibly | |
// to change the map to something playable. | |
function void GameState (void) | |
{ | |
// Check the GameType | |
if (GameStateCheck()) | |
// GameState is Title Map; everything is fine. | |
return; | |
else | |
// GameState is _NOT_ title map. | |
GameState_ChangeMap(); | |
} // GameState() | |
// Be sure that the game state is set to the Title Map. | |
// This is needed if in case players decide to VoteMap into this map in an active game environment. | |
// ---------- | |
// OUTPUT: | |
// TRUE == GameType is SET to Title Map | |
// FALSE == GameType is NOT set to Title Map | |
// ---------- | |
function bool GameStateCheck(void) | |
{ | |
if (GameType() != GAME_TITLE_MAP) | |
// Title Map is NOT set! | |
return FALSE; | |
// Title Map is set | |
return TRUE; | |
} // GameStateCheck() | |
// When called, this will forcibly change the map to something more playable. | |
function void GameState_ChangeMap (void) | |
{ | |
// Output messages of this event, this might be useful for when +logfile is used. | |
Log(l:"ERR_TitleMapBadSetup"); | |
Log(l:"Action_ForceChangeMap"); | |
// Change the map forcibly | |
ChangeLevel( | |
"START", // Go to specific map | |
0, // Player's position | |
// Flags | |
CHANGELEVEL_NOINTERMISSION | // Disable intermission | |
CHANGELEVEL_PRERAISEWEAPON | // Player's weapons are ready | |
CHANGELEVEL_RESETHEALTH | // Restore full health | |
CHANGELEVEL_RESETINVENTORY, // Revert player's inventory | |
-1 // Change skill level [-1 == No change] | |
); | |
} // GameState_ChangeMap() | |
// This script will automatically execute right before the intermission takes place. | |
// This script only has a limited time-window to execute, so keep the executions limited and straight to the point. | |
SCRIPT "LeavingMap" UNLOADING | |
{ | |
// Unfreeze player | |
FreezePlayer(false); | |
} // LeavingMap() | |
#endregion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment