From 32a9632fbca3dd7a88bd3154b84a3773af39c276 Mon Sep 17 00:00:00 2001
From: Jan <>
Date: Mon, 2 Feb 2015 17:55:29 +0100
Subject: TemplePush v6.1.7601.18409.c4s
---
TemplePushing.c4s/Script.c | 699 +++++++++++++++++++++++----------------------
1 file changed, 354 insertions(+), 345 deletions(-)
(limited to 'TemplePushing.c4s/Script.c')
diff --git a/TemplePushing.c4s/Script.c b/TemplePushing.c4s/Script.c
index a37985f..7c0b225 100644
--- a/TemplePushing.c4s/Script.c
+++ b/TemplePushing.c4s/Script.c
@@ -2,217 +2,438 @@
#strict 2
-static const MODE_Normal = 0, MODE_ScrollsOnly = 1, MODE_Cancer = 2;
-static const MENU_Landscape = 0, MENU_Mode = 1, MENU_Settings = 2;
+static const MODE_Classic = 0, MODE_SuddenDeath = 1, MODE_Magic = 2, MODE_Apocalyptic = 3;
-static setupDone, setupPlayer;
-static gameMode;
-static landscape;
-static deathmatchEnabled, deathmatchKillLimit;
-static relaunches, playerScore, teamScore;
-static g_iSaveSectIndex,szSection;
-static pChooser,iDif;
+static section, mode;
+static numRelaunches;
+static deathmatchEnabled, deathmatchWinScore;
+static playerDeaths, playerScore, teamScore;
+static ambienceEnabled;
+static loadingSection;
+static gameStartMessage, countdown, gameStarted, gameOver;
func Initialize()
{
- // Create background sound, fog and rain
- SoundLevel("Ambiente", 50);
- for (var i; i < 300; ++i)
- {
- CreateParticle("Fog", Random(LandscapeWidth()), Random(LandscapeHeight()) + 500, RandomX(3, 9), 0, RandomX(1000, 1500));
- }
- CreateObject(RAIN, 0, 0, NO_OWNER);
+ ShowLobby();
- // Moving brick
- CreateObject(BRK2, 225, 150, NO_OWNER);
- CreateObject(BRK2, 985, 150, NO_OWNER);
-
// Initial values
- deathmatchKillLimit = 20;
- setupDone = false;
- setupPlayer = -1;
- relaunches = CreateArray();
+ deathmatchWinScore = 20;
+ playerDeaths = CreateArray();
playerScore = CreateArray();
teamScore = CreateArray();
-
- // Initialize scoreboard
- SetScoreboardData(SBRD_Caption, 0, "{{MELE}}");
- SetScoreboardData(SBRD_Caption, 1, "{{GBLT}}");
- SetScoreboardData(SBRD_Caption, 2, "{{CXIV}}");
- DoScoreboardShow(1);
-
+ countdown = 5;
+
+ // Create setup menu
+ var menu = CreateObject(SPMU, 0, 0, NO_OWNER);
+ menu->LocalN("extinguisherEnabled") = false;
+ menu->LocalN("rotateInJumpEnabled") = true;
+ menu->LocalN("numRelaunches") = 10;
+ menu->LocalN("deathmatchWinScore") = 25;
+ menu->LocalN("ambienceEnabled") = true;
+
ScriptGo(true);
}
+func TeamRow(int team) { return 1 + team * 1000; }
+func PlayerRow(int player) { return TeamRow(GetPlayerTeam(player)) + GetPlayerID(player); }
+
func InitializePlayer(int player)
{
- if (!setupDone && setupPlayer == -1)
+ if (LobbyActive()) return;
+
+ var team = GetPlayerTeam(player);
+ playerDeaths[GetPlayerID(player)] = 0;
+ if (team) SetScoreboardData(TeamRow(team), SBRD_Caption, Format("%s", GetTeamColor(team), GetTeamName(team)), TeamRow(team));
+ SetScoreboardData(PlayerRow(player), SBRD_Caption, GetTaggedPlayerName(player), PlayerRow(player));
+ UpdateScoreboard(player);
+ SortScoreboard(SBRD_Caption);
+ LaunchClonk(player, GetCrew(player));
+}
+
+func RemovePlayer(int player)
+{
+ if (!LobbyActive())
{
- setupPlayer = player;
- ShowSetup();
+ // Leaver?
+ var relaunchesLeft = numRelaunches - playerDeaths[GetPlayerID(player)];
+ if (!deathmatchEnabled && relaunchesLeft >= 0 || deathmatchEnabled && !gameOver) SetScoreboardData(PlayerRow(player), 0, "{{SLVR}}");
}
+}
- /*if (!iDif && GetCrew(GetPlayerCount() - 1)) InitializePlayer2(0);
- if (!FindObject(DTHM)) relaunches[player] = 10;*/
+func UpdateScoreboard(int player)
+{
+ if (!GetPlayerID(player)) return;
- UpdateScoreboard();
+ if (!deathmatchEnabled)
+ {
+ var relaunchesLeft = numRelaunches - playerDeaths[GetPlayerID(player)];
+ SetScoreboardData(PlayerRow(player), 0, Format("%d", IIf(relaunchesLeft < 0, "{{SKUL}}", relaunchesLeft)));
+ }
+ else
+ {
+ SetScoreboardData(PlayerRow(player), 0, Format("%d", playerScore[GetPlayerID(player)]));
+ var team = GetPlayerTeam(player);
+ if (team) SetScoreboardData(TeamRow(team), 0, Format("%d", teamScore[team]));
+ }
}
-func RemovePlayer(int player, int team)
+func ShowLobby()
{
- playerScore[player] = 0;
- UpdateScoreboard();
+ LoadScenarioSection("Lobby");
+}
- // Player leaves and is still in setup?
- if (!setupDone && setupPlayer == player)
+func StartGame(object menu, string message)
+{
+ // Copy settings from menu
+ var sectionID = menu->LocalN("section");
+ mode = menu->LocalN("mode");
+ var extinguisherEnabled = menu->LocalN("extinguisherEnabled");
+ var friendlyPushingEnabled = menu->LocalN("friendlyPushingEnabled");
+ var rotateInJumpEnabled = menu->LocalN("rotateInJumpEnabled");
+ ambienceEnabled = menu->LocalN("ambienceEnabled");
+ numRelaunches = menu->LocalN("numRelaunches");
+ deathmatchEnabled = menu->LocalN("deathmatchEnabled");
+ deathmatchWinScore = menu->LocalN("deathmatchWinScore");
+ menu->RemoveObject();
+
+ // Change scenario section
+ loadingSection = true;
+ //Log("Before LoadScenarioSection()");
+ LoadScenarioSection(DefinitionCall(sectionID, "SectionName"));
+ //Log("After LoadScenarioSection()");
+ loadingSection = false;
+ section = CreateObject(sectionID, 0, 0, NO_OWNER);
+
+ // Create spawnpoints
+ if (mode != MODE_Apocalyptic)
{
- // Try to find any other player to continue setup
- for (var i = 0; i < GetPlayerCount(); ++i)
+ //Log("Creating spawnpoints");
+
+ var spawnPointSpawner = CreateObject(SPSR, 0, 0, NO_OWNER);
+ spawnPointSpawner->SetLocations(section->SpawnpointLocations());
+
+ if (mode != MODE_Magic)
{
- setupPlayer = GetPlayerByIndex(i);
- if (setupPlayer != player)
- {
- ShowSetup();
- return;
- }
+ spawnPointSpawner->SetDefinitions([[ROCK, 9], [SCRL, 9], [FLNT, 9], [SFLN, 9], [STFN, 4], [EFLN, 4], [FBMP, 4]]);
+ spawnPointSpawner->SetSpawnInterval(750);
+ }
+ else
+ {
+ spawnPointSpawner->SetDefinitions([[SCRL, 14], [GBLT, 1]]);
+ spawnPointSpawner->SetSpawnInterval(1000);
+ spawnPointSpawner->SetSpawnpointGamma(RGB(5, 5, 10), RGB(80, 80, 150), RGB(200, 200, 255));
}
+ spawnPointSpawner->CreateSpawnPoints();
}
- // No other players?
- setupPlayer = -1;
-}
+ // 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);
+ }
-func ShowSetup(int menuStage, int selection, bool back)
-{
- var clonk = GetCrew(setupPlayer);
-
- // Clonk already in setup menu?
- if (clonk->GetMenu()) return;
+ // Create melee goal
+ //Log("Creating melee goal");
+ CreateObject(MELE, 0, 0, NO_OWNER);
- //int CreateMenu (id idSymbol, object pMenuObject, object pCommandObject, int iExtra, string szCaption, int iExtraData, int iStyle, bool fPermanent, id idMenuID);
- //int AddMenuItem (string szCaption, string szCommand, id idItem, object pMenuObject, int iCount, int iParameter, string szInfoCaption, int iExtra, any XPar1, any XPar2);
+ // Create rules
+ //Log("Creating rules");
+ if (extinguisherEnabled) CreateObject(_ETG, 0, 0, NO_OWNER);
+ if (friendlyPushingEnabled) CreateObject(FYPG, 0, 0, NO_OWNER);
+ if (rotateInJumpEnabled) CreateObject(RIJP, 0, 0, NO_OWNER);
- CreateMenu(ROCK, clonk, 0, C4MN_Extra_None, 0, 0, C4MN_Style_Context);
+ //Log("Creating mode rules");
+ if (mode == MODE_SuddenDeath)
+ {
+ CreateObject(SDDT, 0, 0, NO_OWNER);
+ }
+ else if (mode == MODE_Magic)
+ {
+ CreateObject(MLPG, 0, 0, NO_OWNER);
+ }
+ else if (mode == MODE_Apocalyptic)
+ {
+ CreateObject(APCE, 0, 0, NO_OWNER);
+ }
- if (menuStage == MENU_Landscape)
+ // Deathmatch?
+ if (deathmatchEnabled)
{
- clonk->AddMenuItem("Default landscape", "ShowSetup(MENU_Mode, 0)", ROCK);
+ //Log("Creating deathmatch rule");
+ CreateObject(DTHM, 0, 0, NO_OWNER);
+ SetScoreboardData(SBRD_Caption, 0, "{{DTHM}}");
+ SetScoreboardData(0, SBRD_Caption, "$WinScore$");
+ SetScoreboardData(0, 0, Format("%d", deathmatchWinScore));
}
- else if (menuStage == MENU_Mode)
+ else
{
- if (!back) landscape = selection;
-
- // List modes
+ SetScoreboardData(SBRD_Caption, 0, "{{SKUL}}");
+ }
+
+ // Initialize players
+ //Log("Initializing players");
+ for (var i = 0; i < GetPlayerCount(); ++i)
+ {
+ InitializePlayer(GetPlayerByIndex(i));
+ }
+
+ //Log("Starting countdown");
+ gameStartMessage = message;
+ ShowCountdown();
+
+ //Log("StartGame() done");
+}
+
+func ShowCountdown()
+{
+ if (countdown == 0)
+ {
+ gameStartMessage = 0;
+ Message("");
+ Schedule("SetMaxPlayer(0)", 60 * 38);
- var modes = [
- ["Normal", MODE_Normal],
- ["Scrolls only", MODE_ScrollsOnly],
- ["Cancer", MODE_Cancer]];
-
- var itemIndex = 0;
- for (var mode in modes)
+ // Reenable crew
+ for (var i = 0; i < GetPlayerCount(); ++i)
{
- clonk->AddMenuItem(mode[0], Format("ShowSetup(MENU_Settings, %d)", mode[1]), ROCK);
- if (mode[1] == gameMode) clonk->SelectMenuItem(itemIndex);
- ++itemIndex;
+ var player = GetPlayerByIndex(i);
+ var clonk = GetCrew(player);
+ if (!clonk) continue; // Happens if player still in team choice menu
+
+ // Relaunch if clonk does not stand.
+ if (clonk->GetAction() != "Walk")
+ {
+ clonk->Kill();
+ clonk = GetCrew(player);
+ }
+
+ clonk->SetCrewEnabled(true);
+ SelectCrew(player, clonk, true);
+
+ // Make sure all clonks start with equal health
+ clonk->Extinguish();
+ ResetHealth(clonk);
}
- clonk->AddMenuItem("Back", "ShowSetup(MENU_Landscape, 0, true)", ROCK);
+ gameStarted = true;
}
- else if (menuStage == MENU_Settings)
+ else
{
- if (!back) gameMode = selection;
- clonk->AddMenuItem("Back", "ShowSetup(MENU_Mode, 0, true)", ROCK);
+ Message("@%d|%s", 0, countdown, gameStartMessage);
+ Schedule("GameCall(\"ShowCountdown\")", 38);
}
-}
-
-func Script2()
-{
- // Reopen setup menu if it was closed (by player or runtime join)
- if (!setupDone && setupPlayer != -1) ShowSetup();
-
- UpdateScoreboard();
- goto(1);
- return 1;
+ --countdown;
}
-func OnClonkDeath(object clonk, int killedBy)
+func LobbyActive() { return !section; }
+
+func HandleKill(int killed, int killer)
{
- var isDeathmatch = !!FindObject(DTHM);
- var player = clonk->GetOwner();
- var team = GetPlayerTeam(player);
- var teamKill = GetPlayerID(killedBy) == 0 || killedBy == player || team != 0 && team == GetPlayerTeam(killedBy);
+ // Assume suicide if killer cannot be determined
+ if (killer == NO_OWNER) killer = killed;
- // Killed by opponent?
+ var killedEliminated = false;
+ var killedID = GetPlayerID(killed), killerID = GetPlayerID(killer);
+ var killedTeam = GetPlayerTeam(killed), killerTeam = GetPlayerTeam(killer);
+ var teamKill = killer == killed || killedTeam != 0 && killedTeam == killerTeam;
+
+ ++playerDeaths[killedID];
+
+ // Update kill score
if (!teamKill)
{
- ++playerScore[killedBy];
- if (isDeathmatch) CheckDeathmatchKillCount();
+ ++playerScore[killerID];
+ if (killerTeam) ++teamScore[killerTeam];
}
- else
+ else // Decrement score on suicide or team kill
{
- // Deathmatch: Decrement score on suicide or team kill.
- if (isDeathmatch) --playerScore[killedBy];
+ if (playerScore[killerID] > 0)
+ {
+ --playerScore[killerID];
+ if (killerTeam) --teamScore[killerTeam];
+ }
}
-
- // Update relaunch counter
- if (!isDeathmatch)
+
+ // Show relaunch message or eliminate player if no relaunches left
+ var relaunchesLeft;
+ if (!deathmatchEnabled)
{
- // No relaunches left?
- if (relaunches[player] - 1 < 0)
+ relaunchesLeft = numRelaunches - playerDeaths[killedID];
+ if (relaunchesLeft < 0)
{
- EliminatePlayer(player);
- return;
+ EliminatePlayer(killed);
+ killedEliminated = true;
}
- else
+ else if (relaunchesLeft == 0)
{
- --relaunches[player];
+ PlayerMessage(killed, "$MsgLastRelaunch$");
}
+ else if (relaunchesLeft == 1)
+ {
+ PlayerMessage(killed, "$MsgOneRelaunch$");
+ }
+ else // More than one relaunch left
+ {
+ PlayerMessage(killed, "$MsgRelaunch$", 0, relaunchesLeft);
+ }
+ }
+
+ // Check for deathmatch winner
+ if (deathmatchEnabled)
+ {
+ // Teams enabled?
+ if (killerTeam)
+ {
+ // Winner?
+ if (teamScore[killerTeam] >= deathmatchWinScore)
+ {
+ // Eliminate all players of losing teams
+ for (var player in GetPlayers())
+ {
+ if (GetPlayerTeam(player) != killerTeam) EliminatePlayer(player);
+ }
+ gameOver = true;
+ killedEliminated = true;
+ }
+ }
+ else // No teams?
+ {
+ // Winner?
+ if (playerScore[killerID] >= deathmatchWinScore)
+ {
+ // Eliminate all losing players
+ for (var player in GetPlayers())
+ {
+ if (player != killer) EliminatePlayer(player);
+ }
+ gameOver = true;
+ killedEliminated = true;
+ }
+ }
+ }
+
+ UpdateScoreboard(killed);
+ UpdateScoreboard(killer);
+
+ return killedEliminated;
+}
+
+func GetPlayers()
+{
+ var players = CreateArray(GetPlayerCount());
+ for (var i = 0; i < GetPlayerCount(); ++i)
+ {
+ players[i] = GetPlayerByIndex(i);
+ }
+ return players;
+}
- // Show relaunch message. Warn player if it was his last relaunch.
- if (relaunches[player] == 0)
+func OnClonkDeath(object clonk, int killedBy)
+{
+ if (loadingSection) return;
+
+ var player = clonk->GetOwner();
+
+ // Do nothing if Clonk does not belong to a player
+ if (GetPlayerID(player) == 0) return;
+
+ // Handle kill and return if player got eliminated
+ if (gameStarted && HandleKill(player, killedBy)) return;
+
+ // Relaunch
+ if (GetPlayerID(player)) LaunchClonk(player, clonk, true);
+}
+
+func LaunchClonk(int player, object clonk, bool forceCreate)
+{
+ if (!clonk || forceCreate)
+ {
+ var newClonk = CreateObject(CLNK, 0, 0, player);
+ if (clonk)
{
- PlayerMessage(player, "$MsgLastRelaunch$");
+ newClonk->GrabObjectInfo(clonk);
}
else
{
- PlayerMessage(player, "$MsgRelaunch$", 0, relaunches[player]);
+ MakeCrewMember(newClonk, player);
}
+ clonk = newClonk;
+ }
+
+ ResetHealth(clonk);
+ SelectCrew(player, clonk, true);
+
+ // Move clonk to random position
+
+ var NumCheckPos = 10;
+ var positions = CreateArray(NumCheckPos);
+
+ for (var i = 0; i < NumCheckPos; ++i)
+ {
+ var wipf = PlaceAnimal(WIPF);
+ positions[i] = IIf(wipf, [wipf->GetX(), wipf->GetY()], [LandscapeWidth() / 2, LandscapeHeight() / 2]);
+ if (wipf) wipf->RemoveObject();
}
- // Create new clonk at random position
- var positions = [[168, 120], [301, 150], [914, 150], [1050, 120]];
- var position = positions[Random(GetLength(positions))];
- var newclonk = CreateObject(CLNK, position[0], position[1], player);
- newclonk->GrabObjectInfo(clonk);
+ // Prevent spawning too close to an enemy
- // Armageddon?
- if (FindObject(FRRN))
+ var bestPosition = positions[0], bestDistance = 0;
+ for (var pos in positions)
{
- AddEffect("DoTerra", newclonk, 200, 50);
- AddEffect("Bottom", newclonk, 200, 2);
+ var closestHostileClonk = FindObject2(Find_OCF(OCF_CrewMember | OCF_Alive), Find_Hostile(player), Sort_Distance(pos[0], pos[1]));
+ if (!closestHostileClonk) break;
+ var distance = Distance(pos[0], pos[1], closestHostileClonk->GetX(), closestHostileClonk->GetY());
+ if (distance > bestDistance)
+ {
+ bestPosition = pos;
+ bestDistance = distance;
+ }
}
- SelectCrew(player, newclonk, true);
+ clonk->SetPosition(bestPosition[0], bestPosition[1]);
+
+ // Still in countdown?
+ if (!LobbyActive() && !gameStarted)
+ {
+ clonk->SetCrewEnabled(false);
+ }
+
+ // No corpses in apocalopyse mode
+ if (mode == MODE_Apocalyptic) clonk->LocalN("removeOnDeath") = true;
+
+ if (FindObject(RIJP)) clonk->LocalN("rotateInJump") = true;
+
+ SetPlrView(player, clonk);
}
-func CheckDeathmatchKillCount()
+func ResetHealth(object clonk)
{
- var gameOver = false;
+ if (mode == MODE_SuddenDeath)
+ {
+ clonk->DoEnergy(1 - clonk->GetEnergy());
+ }
+ else
+ {
+ clonk->DoEnergy(100);
+ }
+}
+func CheckDeathmatchKillCount()
+{
if (GetTeamCount() == 0)
{
- var winner = -1;
-
+ var winner = NO_OWNER;
+
// Check if a player has reached the kill limit
for (var i = 0; i < GetPlayerCount(); ++i)
{
var plr = GetPlayerByIndex(i);
- if (playerScore[plr] >= deathmatchKillLimit)
+ if (playerScore[plr] >= deathmatchWinScore)
{
winner = plr;
- gameOver = true;
break;
}
}
@@ -236,10 +457,9 @@ func CheckDeathmatchKillCount()
{
var plr = GetPlayerByIndex(i), team = GetPlayerTeam(plr);
teamScore[team] += playerScore[plr];
- if (teamScore >= deathmatchKillLimit)
+ if (teamScore >= deathmatchWinScore)
{
winnerTeam = team;
- gameOver = true;
break;
}
}
@@ -254,215 +474,4 @@ func CheckDeathmatchKillCount()
}
}
}
-
- UpdateScoreboard();
-
- if (gameOver) GameOver(2014);
-}
-
-func UpdateScoreboard()
-{
- for (var plr; plr < GetPlayerCount(); ++plr)
- {
- SortScoreboard(0, true);
- plr = GetPlayerByIndex(plr);
- SetScoreboardData(plr, 0, GetTaggedPlayerName(plr), relaunches[plr]);
- SetScoreboardData(plr, 2, Format("%d", playerScore[plr]));
- if (relaunches[plr] < 0)
- {
- SetScoreboardData(plr, 1, Format("%s", "$Death$"));
- }
- else if (relaunches[plr] <= 1)
- {
- SetScoreboardData(plr, 1, Format("%d", relaunches[plr]));
- }
- else
- {
- SetScoreboardData(plr, 1, Format("%d", relaunches[plr]));
- }
- }
-}
-
-/*-----------------------Spielmodi-----------------------*/
-
-//Auswahl
-func InitializePlayer2(iPlr)
-{
- pChooser=GetHiRank(iPlr);
- CreateMenu(EFLN,pChooser,0,0,0,0,1);
- AddMenuItem("$Mode1$","SetDif",ROCK,pChooser,0,1);
- AddMenuItem("$Mode2$","SetDif",FLRN,pChooser,0,2);
- AddMenuItem("$Mode3$","SetDif",SMGC,pChooser,0,3);
- AddMenuItem("$Mode4$","SetDif",FXV1,pChooser,0,4);
- AddMenuItem("$Random$","SetDif",RMMG,pChooser,0,RandomX(1,4));
- return(1);
-}
-
-func SetDif(dummy,i)
-{
- if (i == 1) Message("$Mode1$");
- if (i == 2) Message("$Mode2$");
- if (i == 3) Message("$Mode3$");
- if (i == 4) Message("$Mode4$");
-
- if (i==1) CreateObject(SPWN);
- if (i==2)
- {
- Schedule("ChangeSection(\"SuddenDeath\")",10);
- Message("$Load$");
- }
- if (i==3)
- {
- CreateObject(MSPW);
- SetGamma(RGB(5,5,10),RGB(80,80,150),RGB(200,200,255));
- }
- if (i==4) UltimateExtreme();
-return(1);
-}
-
-func UltimateExtreme()
-{
- RemoveAll(SPNP);
- RemoveAll(MSPN);
- RemoveObject(FindObject(SPWN));
- CastObjects(RCKF,10);
- CreateObject(FRRN);
- MusicLevel(0);
- SoundLevel("ExtremeAmbiente",100);
- SoundLevel("Ambiente",0);
- for (var Plr;Plr < GetPlayerCount();Plr ++)
- {
- relaunches[Plr] = 5;
- AddEffect("DoTerra",GetHiRank(Plr),200,50);
- AddEffect("Bottom",GetHiRank(Plr),200,2);
- }
- var brick;
- for (var i;i0;i--)
- {
- CreateObject(BRK2,i*90,0);
- CreateObject(SPNP,Random(LandscapeWidth()),Random(LandscapeHeight()+500));
- }
- CastObjects(CANN,RandomX(10,20),Random(150),LandscapeWidth()/2);
- CreateObject(RAIN);
- CreateObject(FLRN);
- CreateObject(MELE);
- // Alles gespeicherte wieder herstellen
- if (g_iSaveSectIndex)
- while (g_iSaveSectIndex--)
- if (obj=Global(20+g_iSaveSectIndex))
- { obj->SetObjectStatus(1); Global(20+g_iSaveSectIndex)=0; }
- g_iSaveSectIndex=0;
- for (var iPlr;iPlrContentsCount();
- for (var i = 0; i < contentsCount; ++i)
- {
- SaveSectObj(obj->Contents(i));
- }
-
- // Save object
- Global(20 + g_iSaveSectIndex++) = obj;
- obj->SetObjectStatus(C4OS_INACTIVE);
-}
-
-/*-------------- Effects -----------------*/
-
-global func FxDoTerraTimer(object target)
-{
- if (target->ContentsCount() < 3) target->CreateContents(EFLN);
- ShakeViewPort(10);
- return 1;
-}
-
-global func FxBottomTimer(object target)
-{
- if (target->GetY() >= LandscapeHeight() - 20) target->SetPosition(target->GetX() + RandomX(-10, 10), 0);
- return 1;
-}
-
-global func FxWarStart(object target, int effectNumber)
-{
- EffectVar(0, 0, effectNumber) = 255;
- EffectVar(1, 0, effectNumber) = 1;
- return 1;
-}
-
-global func FxWarTimer(object target, int effectNumber)
-{
- // Remove corpses
- for (var obj in FindObjects(Find_OCF(OCF_CrewMember), Find_Not(Find_OCF(OCF_Alive))))
- {
- obj->RemoveObject();
- }
-
- if (EffectVar(1, 0, effectNumber) == 1)
- {
- --EffectVar(0, 0, effectNumber);
- }
- else
- {
- ++EffectVar(0, 0, effectNumber);
- }
-
- if (EffectVar(0, 0, effectNumber) < 0)
- {
- EffectVar(1, 0, effectNumber) = 0;
- }
- else if (EffectVar(0, 0, effectNumber) > 255)
- {
- EffectVar(1, 0, effectNumber) = 1;
- }
-
- var color = EffectVar(0, 0, effectNumber);
- SetSkyAdjust(RGB(255, color / 2, color / 4), RGB(128, color / 2, color / 4));
- SetGamma(RGB(2, 0, 0), RGB(128, color / 2, color / 4), RGB(180, color /2 , color / 4));
-
- return 1;
}
\ No newline at end of file
--
cgit v1.2.3-54-g00ecf