Ported the $On Action and $On Action Stopped scripting hooks from zookeeper branch. Also bumps the char limit for conditions from 32 to 64.

git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@10254 387891d4-d844-0410-90c0-e4c51a9137d3
This commit is contained in:
zookeeper authored and niffiwan committed 2014-01-14 20:24:44 +10:00
1 parent 0115235de7
commit 61d9ce895b
9 files changed
+84 -16

No files matched your search

+15 -1
View File
@@ -38,6 +38,7 @@ flag_def_list Script_conditions[] =
{"Ship type", CHC_SHIPTYPE, 0},
{"Weapon class",CHC_WEAPONCLASS, 0},
{"KeyPress", CHC_KEYPRESS, 0},
{"Action", CHC_ACTION, 0},
{"Version", CHC_VERSION, 0},
{"Application", CHC_APPLICATION, 0}
};
@@ -50,6 +51,8 @@ flag_def_list Script_actions[] =
{"On Splash Screen", CHA_SPLASHSCREEN, 0},
{"On State Start", CHA_ONSTATESTART, 0},
{"On Frame", CHA_ONFRAME, 0},
{"On Action", CHA_ONACTION, 0},
{"On Action Stopped", CHA_ONACTIONSTOPPED,0},
{"On Key Pressed", CHA_KEYPRESSED, 0},
{"On Key Released", CHA_KEYRELEASED, 0},
{"On Mouse Moved", CHA_MOUSEMOVED, 0},
@@ -440,6 +443,17 @@ bool ConditionedHook::ConditionsValid(int action, object *objp, int more_data)
return false;
break;
}
case CHC_ACTION:
{
if(gameseq_get_depth() < 0)
return false;
int action_index = more_data;
if (action_index <= 0 || stricmp(scp->data.name, Control_config[action_index].text))
return false;
break;
}
case CHC_VERSION:
{
// Goober5000: I'm going to assume scripting doesn't care about SVN revision
@@ -1327,7 +1341,7 @@ bool script_state::ParseCondition(const char *filename)
case CHC_VERSION:
case CHC_APPLICATION:
default:
stuff_string(sct.data.name, F_NAME, NAME_LENGTH);
stuff_string(sct.data.name, F_NAME, CONDITION_LENGTH);
break;
}