Permalink
Browse files

qtscript: Add more missing pieces for tutorial.

New events: eventDesignBody, eventDesignPropulsion,
eventDesignWeapon, eventDesignCommand, eventDesignSystem,
eventDesignQuit, eventMenuBuildSelected, eventMenuBuild,
eventMenuResearch, and eventMenuManufacture.
  • Loading branch information...
perim committed Dec 2, 2017
1 parent 2810c73 commit 629d43771b4ab621fcedb8403165f7557b235bdf
Showing with 96 additions and 1 deletion.
  1. +13 −0 src/design.cpp
  2. +20 −1 src/hci.cpp
  3. +53 −0 src/qtscript.cpp
  4. +10 −0 src/qtscript.h
View
@@ -3133,6 +3133,7 @@ void intProcessDesign(UDWORD id)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_WEAPON);
}
triggerEvent(TRIGGER_DESIGN_WEAPON);
break;
//Added cases for 2nd/3rd turret
case IDES_TURRET_A:
@@ -3166,6 +3167,7 @@ void intProcessDesign(UDWORD id)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_WEAPON);
}
triggerEvent(TRIGGER_DESIGN_WEAPON);
break;
case IDES_TURRET_B:
/* Calculate the index of the component */
@@ -3189,6 +3191,7 @@ void intProcessDesign(UDWORD id)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_WEAPON);
}
triggerEvent(TRIGGER_DESIGN_WEAPON);
break;
case IDES_BODY:
/* reveal propulsion button if hidden */
@@ -3251,6 +3254,7 @@ void intProcessDesign(UDWORD id)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_BODY);
}
triggerEvent(TRIGGER_DESIGN_BODY);
break;
case IDES_PROPULSION:
/* Calculate the index of the component */
@@ -3288,6 +3292,7 @@ void intProcessDesign(UDWORD id)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_PROPULSION);
}
triggerEvent(TRIGGER_DESIGN_PROPULSION);
break;
default:
break;
@@ -3458,6 +3463,14 @@ void intProcessDesign(UDWORD id)
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_SYSTEM);
}
}
if (apsExtraSysList[id - IDDES_EXTRASYSSTART]->compType == COMP_BRAIN)
{
triggerEvent(TRIGGER_DESIGN_COMMAND);
}
else
{
triggerEvent(TRIGGER_DESIGN_SYSTEM);
}
}
else
{
View
@@ -907,6 +907,7 @@ void intResetScreen(bool NoAnim)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DESIGN_QUIT);
}
triggerEvent(TRIGGER_DESIGN_QUIT);
break;
case INT_INTELMAP:
if (NoAnim)
@@ -2160,9 +2161,12 @@ static void intProcessStats(UDWORD id)
// call the tutorial callback if necessary
if (bInTutorial && objMode == IOBJ_BUILD)
{
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_BUILDGRID);
}
if (objMode == IOBJ_BUILD)
{
triggerEvent(TRIGGER_MENU_BUILD_SELECTED);
}
// Set the object stats
compIndex = id - IDSTAT_START;
@@ -3809,6 +3813,21 @@ static bool intAddStats(BASE_STATS **ppsStatsList, UDWORD numStats,
}
}
switch (objMode)
{
case IOBJ_BUILD:
triggerEvent(TRIGGER_MENU_BUILD_UP);
break;
case IOBJ_RESEARCH:
triggerEvent(TRIGGER_MENU_RESEARCH_UP);
break;
case IOBJ_MANUFACTURE:
triggerEvent(TRIGGER_MENU_MANUFACTURE_UP);
break;
default:
break;
}
return true;
}
View
@@ -986,6 +986,26 @@ void jsShowDebug()
//__ An event that is run when the mission transporter has no more reinforcements to deliver.
//__ \subsection{eventTransporterLanded(transport)}
//__ An event that is run when the mission transporter has landed with reinforcements.
//__ \subsection{eventDesignBody()}
//__An event that is run when current user picks a body in the design menu.
//__ \subsection{eventDesignPropulsion()}
//__An event that is run when current user picks a propulsion in the design menu.
//__ \subsection{eventDesignWeapon()}
//__An event that is run when current user picks a weapon in the design menu.
//__ \subsection{eventDesignCommand()}
//__An event that is run when current user picks a command turret in the design menu.
//__ \subsection{eventDesignSystem()}
//__An event that is run when current user picks a system other than command turret in the design menu.
//__ \subsection{eventDesignQuit()}
//__An event that is run when current user leaves the design menu.
//__ \subsection{eventMenuBuildSelected()}
//__An event that is run when current user picks something new in the build menu.
//__ \subsection{eventMenuBuild()}
//__An event that is run when current user opens the build menu.
//__ \subsection{eventMenuResearch()}
//__An event that is run when current user opens the research menu.
//__ \subsection{eventMenuManufacture()}
//__An event that is run when current user opens the manufacture menu.
bool triggerEvent(SCRIPT_TRIGGER_TYPE trigger, BASE_OBJECT *psObj)
{
// HACK: TRIGGER_VIDEO_QUIT is called before scripts for initial campaign video
@@ -1055,6 +1075,39 @@ bool triggerEvent(SCRIPT_TRIGGER_TYPE trigger, BASE_OBJECT *psObj)
case TRIGGER_GAME_SAVED:
callFunction(engine, "eventGameSaved", QScriptValueList());
break;
case TRIGGER_DESIGN_BODY:
callFunction(engine, "eventDesignBody", QScriptValueList());
break;
case TRIGGER_DESIGN_PROPULSION:
callFunction(engine, "eventDesignPropulsion", QScriptValueList());
break;
case TRIGGER_DESIGN_WEAPON:
callFunction(engine, "eventDesignWeapon", QScriptValueList());
break;
case TRIGGER_DESIGN_COMMAND:
callFunction(engine, "eventDesignCommand", QScriptValueList());
break;
case TRIGGER_DESIGN_SYSTEM:
callFunction(engine, "eventDesignSystem", QScriptValueList());
break;
case TRIGGER_DESIGN_QUIT:
callFunction(engine, "eventDesignQuit", QScriptValueList());
break;
case TRIGGER_MENU_BUILD_SELECTED:
callFunction(engine, "eventMenuBuildSelected", args);
break;
case TRIGGER_MENU_BUILD_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuBuild", args);
break;
case TRIGGER_MENU_RESEARCH_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuResearch", args);
break;
case TRIGGER_MENU_MANUFACTURE_UP:
args += QScriptValue(true);
callFunction(engine, "eventMenuManufacture", args);
break;
}
}
View
@@ -46,6 +46,16 @@ enum SCRIPT_TRIGGER_TYPE
TRIGGER_GAME_LOADED,
TRIGGER_GAME_SAVING,
TRIGGER_GAME_SAVED,
TRIGGER_DESIGN_BODY,
TRIGGER_DESIGN_WEAPON,
TRIGGER_DESIGN_COMMAND,
TRIGGER_DESIGN_SYSTEM,
TRIGGER_DESIGN_PROPULSION,
TRIGGER_DESIGN_QUIT,
TRIGGER_MENU_BUILD_UP,
TRIGGER_MENU_BUILD_SELECTED,
TRIGGER_MENU_MANUFACTURE_UP,
TRIGGER_MENU_RESEARCH_UP,
TRIGGER_OBJECT_RECYCLED
};

0 comments on commit 629d437

Please sign in to comment.