summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/Script.c
diff options
context:
space:
mode:
authorMittendrein Markus <maxmitti@gmx.net>2016-03-04 21:27:02 +0100
committerMittendrein Markus <maxmitti@gmx.net>2016-03-04 21:27:12 +0100
commit1642ec65eaf83b8c1a6b1ea44d65331475fd3bf2 (patch)
treeb46e2f61f6a223e8c2c54536da324f502a99b948 /TemplePushing.c4s/Script.c
parent2fa1ef2fe4dcd5c47d1ccca68d1dba79399ea2c6 (diff)
downloadtempelschubsen-1642ec65eaf83b8c1a6b1ea44d65331475fd3bf2.tar.gz
tempelschubsen-1642ec65eaf83b8c1a6b1ea44d65331475fd3bf2.zip
Move some mode-specific stuff into the modes' scripts
Diffstat (limited to 'TemplePushing.c4s/Script.c')
-rw-r--r--TemplePushing.c4s/Script.c77
1 files changed, 13 insertions, 64 deletions
diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c
index 81de435..0022e8a 100644
--- a/TemplePushing.c4s/Script.c
+++ b/TemplePushing.c4s/Script.c
@@ -2,8 +2,6 @@
#strict 2
-static const MODE_Classic = 0, MODE_Magic = 1, MODE_Festive = 2, MODE_Apocalyptic = 3, MODE_Knightly = 4;
-
static const SBRD_FirstRow = 0;
static const SBRD_TeamSortCol = -3, SBRD_SortCol = -2, SBRD_NameCol = -1, SBRD_RelaunchesCol = 0, SBRD_ScoreCol = 1;
static const SORT_SORTCOL_Team = 0, SORT_SORTCOL_Player = 1, SORT_SORTCOL_Leaver = 2;
@@ -25,6 +23,7 @@ static suddendeathEnabled;
static loadingSection;
static eliminatedPlayers;
static gameStartMessage, countdown, gameStarted, gameOver;
+static ambienceSounds;
func Initialize()
{
@@ -192,56 +191,24 @@ func Script0()
LoadScenarioSection(DefinitionCall(sectionID, "SectionName"));
loadingSection = false;
section = CreateObject(sectionID, 0, 0, NO_OWNER);
+ ambienceSounds = mode->~AmbienceSounds() || section->~SectionAmbienceSounds() || [];
+ mode = CreateObject(mode, 0, 0, NO_OWNER);
+
+
+ if (mode->~Gamma()) SetGamma(mode->Gamma());
// Create spawnpoints
- if (mode != MODE_Apocalyptic)
+ if (!mode->~NoSpawnpoints())
{
var spawnPointSpawner = CreateObject(SPSR, 0, 0, NO_OWNER);
spawnPointSpawner->SetLocations(section->SpawnpointLocations());
- if (mode == MODE_Classic)
- {
- spawnPointSpawner->SetDefinitions([[ROCK, 5], [SCRL, 5], [FLNT, 4], [SFLN, 9], [STFN, 3], [EFLN, 5], [FBMP, 4]]);
- spawnPointSpawner->SetSpawnInterval(800);
- }
- if (mode == MODE_Festive)
- {
- spawnPointSpawner->SetDefinitions([[TSWB, 7], [SCRL, 5], [ICE1, 3]]);
- spawnPointSpawner->SetSpawnInterval(600);
- }
- if (mode == MODE_Knightly)
- {
- spawnPointSpawner->SetDefinitions([[SFLN, 3], [EFLN,3], [SWOR, 5], [AXE1, 5], [SPER, 2], [ARWP, 5], [SCRL, 5], [FARP, 3]]);
- spawnPointSpawner->SetSpawnInterval(800);
- }
- if (mode == MODE_Magic)
- {
- if (suddendeathEnabled) spawnPointSpawner->SetDefinitions([[SCRL, 19]]);
- else spawnPointSpawner->SetDefinitions([[SCRL, 19], [GBLT, 1]]);
- spawnPointSpawner->SetSpawnInterval(750);
- spawnPointSpawner->SetSpawnpointGamma(RGB(5, 5, 10), RGB(80, 80, 150), RGB(200, 200, 255));
- }
+ spawnPointSpawner->SetDefinitions(mode->SpawnpointDefinitions());
+ spawnPointSpawner->SetSpawnInterval(mode->SpawnpointInterval());
+
spawnPointSpawner->CreateSpawnPoints();
}
- // Effects for apocalypse mode
- if (mode == MODE_Apocalyptic)
- {
- AddEffect("CreateTeraFlints", 0, 20, 90);
- AddEffect("ShakeScreen", 0, 20, 50);
- AddEffect("Bottom", 0, 20, 2);
- AddEffect("SkyAdjust", 0, 20, 1);
- }
-
- // Effects for festive mode
- if (mode == MODE_Festive)
- {
- if (ambienceEnabled) CreateObject(SNOR, 0, 0, NO_OWNER);
- SetSkyAdjust(RGB(189, 189, 255));
- SetGamma(RGB(0, 0, 50), RGB(100, 100, 128), RGB(200, 200, 255));
- SetScrollSpells([MICS, ABLA, MFWV, MLGT, MGPL, ICNL, AFST, MDFL, MGCY, MATT]);
- }
-
// Create melee goal
CreateObject(MELE, 0, 0, NO_OWNER);
@@ -252,24 +219,6 @@ func Script0()
if (rotateInJumpEnabled) CreateObject(RIJP, 0, 0, NO_OWNER);
CreateObject(OFDR, 0, 0, NO_OWNER);
- // Create mode objects
- if (mode == MODE_Magic)
- {
- CreateObject(MLPG, 0, 0, NO_OWNER);
- }
- if (mode == MODE_Festive)
- {
- CreateObject(FSTV, 0, 0, NO_OWNER);
- }
- if (mode == MODE_Knightly)
- {
- CreateObject(MKNI, 0, 0, NO_OWNER);
- }
- if (mode == MODE_Apocalyptic)
- {
- CreateObject(APCE, 0, 0, NO_OWNER);
- }
-
SetScoreboardData(SBRD_Caption, SBRD_NameCol, " "); // Make sure the name column gets created first
// Deathmatch?
@@ -486,7 +435,7 @@ global func StartGameOverEffect()
global func FxGameOverStart(object pTarget, int iEffectNumber)
{
- EffectVar(0, pTarget, iEffectNumber) = section->SectionAmbienceSounds();
+ EffectVar(0, pTarget, iEffectNumber) = ambienceSounds;
}
global func FxGameOverTimer(object pTarget, int iEffectNumber, int iEffectTime)
@@ -599,7 +548,7 @@ func LaunchClonk(int player, object clonk, bool relaunch)
}
// No corpses in apocalypse mode
- if (mode == MODE_Apocalyptic) clonk->LocalN("removeOnDeath") = true;
+ if (mode->~NoCorpses()) clonk->LocalN("removeOnDeath") = true;
// Enable rotation in jump for the clonk if allowed by rule
if (FindObject(RIJP)) clonk->LocalN("rotateInJump") = true;
@@ -705,7 +654,7 @@ global func WantsAmbienceSounds(int player)
func DoAmbienceSounds(int player)
{
- for (var sound in section->SectionAmbienceSounds())
+ for (var sound in ambienceSounds)
{
Sound(sound[0], true, 0, sound[1], player + 1, WantsAmbienceSounds(player) * 2 - 1);
}