qtscript: Add two new functions: showInterface() and hideInterface(). They currently

only serve to assist modifications of the reticule, but will eventually control
hide/show of the larger user interface widgets. Also fix alpha values on two reticule
images.
master
per 2013-08-02 21:50:11 +02:00
parent cd54d3880c
commit c0abe4efe3
8 changed files with 26 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 919 B

After

Width:  |  Height:  |  Size: 967 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 B

After

Width:  |  Height:  |  Size: 907 B

View File

@ -16,6 +16,7 @@ function eventGameInit()
setReticuleButton(4, _("Design (F4)"), "image_design_up.png", "image_design_down.png");
setReticuleButton(5, _("Intelligence Display (F5)"), "image_intelmap_up.png", "image_intelmap_down.png");
setReticuleButton(6, _("Commanders (F6)"), "image_commanddroid_up.png", "image_commanddroid_down.png");
showInterface();
}
function eventStartLevel()

View File

@ -20,6 +20,7 @@ function eventGameInit()
setReticuleButton(4, _("Design (F4)"), "image_design_up.png", "image_design_down.png");
setReticuleButton(5, _("Intelligence Display (F5)"), "image_intelmap_up.png", "image_intelmap_down.png");
setReticuleButton(6, _("Commanders (F6)"), "image_commanddroid_up.png", "image_commanddroid_down.png");
showInterface();
if (tilesetType != "ARIZONA")
{

View File

@ -797,7 +797,7 @@ static void intDoScreenRefresh(void)
//hides the power bar from the display
static void intHidePowerBar(void)
void intHidePowerBar()
{
//only hides the power bar if the player has requested no power bar
if (!powerBarUp)

View File

@ -333,10 +333,9 @@ extern void flashReticuleButton(UDWORD buttonID);
extern void stopReticuleButtonFlash(UDWORD buttonID);
//toggles the Power Bar display on and off
extern void togglePowerBar(void);
//displays the Power Bar
extern void intShowPowerBar(void);
void togglePowerBar();
void intShowPowerBar();
void intHidePowerBar();
//hides the power bar from the display - regardless of what player requested!
extern void forceHidePowerBar(void);

View File

@ -1221,7 +1221,6 @@ bool stageThreeInitialise(void)
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_GAMEINIT);
triggerEvent(TRIGGER_GAME_INIT);
}
intAddReticule();
intAddPower();
return true;

View File

@ -2718,7 +2718,8 @@ static QScriptValue js_enableTemplate(QScriptContext *context, QScriptEngine *en
//-- \subsection{setReticuleButton(id, filename, filenameHigh, tooltip, callback)} Add reticule button. id is which
//-- button to change, where zero is zero is the middle button, then going clockwise from the uppermost
//-- button. filename is button graphics and filenameHigh is for highlighting. The tooltip is the text you see when you
//-- mouse over the button. Finally, the callback is which scripting function to call
//-- mouse over the button. Finally, the callback is which scripting function to call. Hide and show the user interface
//-- for such changes to take effect.
static QScriptValue js_setReticuleButton(QScriptContext *context, QScriptEngine *engine)
{
int button = context->argument(0).toInt32();
@ -2730,6 +2731,22 @@ static QScriptValue js_setReticuleButton(QScriptContext *context, QScriptEngine
return QScriptValue();
}
//-- \subsection{showInterface()} Show user interface.
static QScriptValue js_showInterface(QScriptContext *context, QScriptEngine *engine)
{
intAddReticule();
intShowPowerBar();
return QScriptValue();
}
//-- \subsection{hideInterface(button type)} Hide user interface.
static QScriptValue js_hideInterface(QScriptContext *context, QScriptEngine *engine)
{
intRemoveReticule();
intHidePowerBar();
return QScriptValue();
}
//-- \subsection{removeReticuleButton(button type)} Remove reticule button. DO NOT USE FOR ANYTHING.
static QScriptValue js_removeReticuleButton(QScriptContext *context, QScriptEngine *engine)
{
@ -4487,6 +4504,8 @@ bool registerFunctions(QScriptEngine *engine, QString scriptName)
engine->globalObject().setProperty("enableTemplate", engine->newFunction(js_enableTemplate));
engine->globalObject().setProperty("setMiniMap", engine->newFunction(js_setMiniMap));
engine->globalObject().setProperty("setReticuleButton", engine->newFunction(js_setReticuleButton));
engine->globalObject().setProperty("showInterface", engine->newFunction(js_showInterface));
engine->globalObject().setProperty("hideInterface", engine->newFunction(js_hideInterface));
engine->globalObject().setProperty("addReticuleButton", engine->newFunction(js_removeReticuleButton)); // deprecated!!
engine->globalObject().setProperty("removeReticuleButton", engine->newFunction(js_removeReticuleButton));
engine->globalObject().setProperty("enableStructure", engine->newFunction(js_enableStructure));