Permalink
Browse files

Improve upon gameOverMessage function.

No longer plays the mission end or win video in multiplayer. Now it can
play the game outro from within it.
  • Loading branch information...
KJeff01 committed Nov 29, 2017
1 parent 04f2ffe commit 652dde10bfdd0b8f476adc7f5041071b4e6d23c9
Showing with 32 additions and 14 deletions.
  1. +4 −6 data/base/script/campaign/cam3-4.js
  2. +5 −0 data/base/script/campaign/libcampaign.js
  3. +23 −8 src/qtscriptfuncs.cpp
@@ -91,11 +91,10 @@ function enableAllFactories()
function enableReinforcements()
{
camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, undefined, {
camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, "GAMMA_OUT", {
area: "RTLZ",
reinforcements: 60, // 1 min
annihilate: true,
victoryVideo: "MB3_4_OUTRO"
annihilate: true
});
}
@@ -124,11 +123,10 @@ function eventStartLevel()
var tpos = getObject("transportEntryExit");
var lz = getObject("landingZone");
camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, undefined, {
camSetStandardWinLossConditions(CAM_VICTORY_OFFWORLD, "GAMMA_OUT", {
area: "RTLZ",
reinforcements: -1,
annihilate: true,
victoryVideo: "MB3_4_OUTRO"
annihilate: true
});
centreView(startpos.x, startpos.y);
@@ -2475,6 +2475,11 @@ function __camGameWon()
if (camDef(__camNextLevel))
{
camTrace(__camNextLevel);
if (__camNextLevel === "GAMMA_OUT")
{
gameOverMessage(true, true);
return;
}
camNextLevel(__camNextLevel);
}
else
View
@@ -69,6 +69,7 @@
#include "warcam.h"
#include "projectile.h"
#include "component.h"
#include "seqdisp.h"
#define FAKE_REF_LASSAT 999
#define ALL_PLAYERS -1
@@ -2810,17 +2811,23 @@ static QScriptValue js_playSound(QScriptContext *context, QScriptEngine *engine)
return QScriptValue();
}
//-- \subsection{gameOverMessage(won)}
//-- \subsection{gameOverMessage(won, showOutro)}
//-- End game in victory or defeat.
static QScriptValue js_gameOverMessage(QScriptContext *context, QScriptEngine *engine)
{
int player = engine->globalObject().property("me").toInt32();
const MESSAGE_TYPE msgType = MSG_MISSION; // always
bool gameWon = context->argument(0).toBool();
bool showOutro = false;
if (context->argumentCount() > 1)
{
showOutro = context->argument(1).toBool();
}
VIEWDATA *psViewData;
if (gameWon)
{
psViewData = getViewData("WIN");
//Quick hack to stop assert when trying to play outro in campaign.
psViewData = !bMultiPlayer && showOutro ? getViewData("END") : getViewData("WIN");
addConsoleMessage(_("YOU ARE VICTORIOUS!"), DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
}
else
@@ -2830,15 +2837,23 @@ static QScriptValue js_gameOverMessage(QScriptContext *context, QScriptEngine *e
}
ASSERT(psViewData, "Viewdata not found");
MESSAGE *psMessage = addMessage(msgType, false, player);
if (psMessage)
if (!bMultiPlayer && psMessage)
{
//set the data
psMessage->pViewData = psViewData;
displayImmediateMessage(psMessage);
stopReticuleButtonFlash(IDRET_INTEL_MAP);
//we need to set this here so the VIDEO_QUIT callback is not called
setScriptWinLoseVideo(gameWon ? PLAY_WIN : PLAY_LOSE);
seq_ClearSeqList();
if (gameWon && showOutro)
{
seq_AddSeqToList("outro.ogg", nullptr, "outro.txa", false);
seq_StartNextFullScreenVideo();
}
else
{
//set the data
psMessage->pViewData = psViewData;
displayImmediateMessage(psMessage);
stopReticuleButtonFlash(IDRET_INTEL_MAP);
}
}
jsDebugMessageUpdate();
displayGameOver(gameWon);

0 comments on commit 652dde1

Please sign in to comment.