Skip to content

Commit

Permalink
Set GF_ALL_STRINGS_TAGGED for bg2demo
Browse files Browse the repository at this point in the history
  * Add new GUIScript method GemRB.SetFeature()
  • Loading branch information
edheldil committed Jan 15, 2014
1 parent e61d555 commit 2295974
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gemrb/GUIScripts/GUIDefines.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@
GA_NO_NEUTRAL = 1024
GA_NO_SELF = 2048

# Game features, for Interface::SetFeatures()
# Defined in globals.h
GF_ALL_STRINGS_TAGGED = 1

# Shadow color for ShowModal()
# !!! Keep these synchronized with Interface.h !!!
MODAL_SHADOW_NONE = 0
Expand Down
3 changes: 3 additions & 0 deletions gemrb/GUIScripts/bg2/Start2.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def OnLoad():
CancelButton.SetEvent (IE_GUI_BUTTON_ON_PRESS, CancelTut)
PlayButton.SetFlags (IE_GUI_BUTTON_DEFAULT, OP_OR)
CancelButton.SetFlags (IE_GUI_BUTTON_CANCEL, OP_OR)
else:
GemRB.SetFeature (GF_ALL_STRINGS_TAGGED, True)

#quit subwindow
QuitWindow = GemRB.LoadWindow (3)
QuitTextArea = QuitWindow.GetControl (0)
Expand Down
16 changes: 16 additions & 0 deletions gemrb/docs/en/GUIScript/SetFeature.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Prototype: GemRB.SetFeature(feature, value)

Description: Set GameType flag FEATURE to VALUE, either True or False.

Parameters:
FEATURE - GF_xxx constant defined in GUIDefines.py and globals.h
VALUE - Value to set the feature to. Either True or False

Return value: N/A

Examples:
GemRB.SetFeature(GF_ALL_STRINGS_TAGGED, True)


MD5: 87139f1b1e0413d1e373c73af198217e

24 changes: 24 additions & 0 deletions gemrb/plugins/GUIScript/GUIScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10608,6 +10608,29 @@ static PyObject* GemRB_Log(PyObject* /*self*/, PyObject* args)
return Py_None;
}


PyDoc_STRVAR( GemRB_SetFeature__doc,
"GemRB.SetFeature(feature, value)\n\n"
"Set GameType flag FEATURE to VALUE, either True or False. \n"
"FEATURE is defined by GF_xxx defines.\n"
"Example:\n"
"GemRB.SetFeature(GF_ALL_STRINGS_TAGGED, True)\n");

static PyObject* GemRB_SetFeature(PyObject* /*self*/, PyObject* args)
{
unsigned int feature;
bool value;

if (!PyArg_ParseTuple(args, "ib", &feature, &value)) {
return NULL;
}

core->SetFeature(value, feature);
Py_INCREF(Py_None);
return Py_None;
}


static PyMethodDef GemRBMethods[] = {
METHOD(ActOnPC, METH_VARARGS),
METHOD(AddGameTypeHint, METH_VARARGS),
Expand Down Expand Up @@ -10775,6 +10798,7 @@ static PyMethodDef GemRBMethods[] = {
METHOD(SetDefaultActions, METH_VARARGS),
METHOD(SetEquippedQuickSlot, METH_VARARGS),
METHOD(SetFeat, METH_VARARGS),
METHOD(SetFeature, METH_VARARGS),
METHOD(SetFullScreen, METH_VARARGS),
METHOD(SetGamma, METH_VARARGS),
METHOD(SetGlobal, METH_VARARGS),
Expand Down

0 comments on commit 2295974

Please sign in to comment.