|
|
|
@ -2048,7 +2048,7 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total)
|
|
|
|
|
case ARGUMENT_GLOBALVAR:
|
|
|
|
|
varIndex = CTheScripts::Read2BytesFromScript(pIp);
|
|
|
|
|
script_assert(varIndex >= 8 && varIndex < CTheScripts::GetSizeOfVariableSpace());
|
|
|
|
|
ScriptParams[i] = BSWAP32(*((int32*)&CTheScripts::ScriptSpace[varIndex]));
|
|
|
|
|
ScriptParams[i] = BSWAP_I32(*((int32*)&CTheScripts::ScriptSpace[varIndex]));
|
|
|
|
|
break;
|
|
|
|
|
case ARGUMENT_LOCALVAR:
|
|
|
|
|
varIndex = CTheScripts::Read2BytesFromScript(pIp);
|
|
|
|
@ -2085,7 +2085,7 @@ int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
|
|
|
|
|
var = true;
|
|
|
|
|
sprintf(tmpstr, " $%d", varIndex / 4);
|
|
|
|
|
strcat(buf, tmpstr);
|
|
|
|
|
return BSWAP32(*((int32*)&CTheScripts::ScriptSpace[varIndex]));
|
|
|
|
|
return BSWAP_I32(*((int32*)&CTheScripts::ScriptSpace[varIndex]));
|
|
|
|
|
case ARGUMENT_LOCALVAR:
|
|
|
|
|
varIndex = CTheScripts::Read2BytesFromScript(&m_nIp);
|
|
|
|
|
script_assert(varIndex >= 0 && varIndex < ARRAY_SIZE(m_anLocalVariables));
|
|
|
|
@ -2135,7 +2135,7 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
|
|
|
|
|
case ARGUMENT_INT32:
|
|
|
|
|
return CTheScripts::Read4BytesFromScript(pIp);
|
|
|
|
|
case ARGUMENT_GLOBALVAR:
|
|
|
|
|
return BSWAP32(*((int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)]));
|
|
|
|
|
return BSWAP_I32(*((int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)]));
|
|
|
|
|
case ARGUMENT_LOCALVAR:
|
|
|
|
|
return m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)];
|
|
|
|
|
case ARGUMENT_INT8:
|
|
|
|
@ -2155,7 +2155,7 @@ void CRunningScript::StoreParameters(uint32* pIp, int16 number)
|
|
|
|
|
for (int16 i = 0; i < number; i++){
|
|
|
|
|
switch (CTheScripts::Read1ByteFromScript(pIp)) {
|
|
|
|
|
case ARGUMENT_GLOBALVAR:
|
|
|
|
|
*(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)] = BSWAP32(ScriptParams[i]);
|
|
|
|
|
*(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(pIp)] = BSWAP_I32(ScriptParams[i]);
|
|
|
|
|
break;
|
|
|
|
|
case ARGUMENT_LOCALVAR:
|
|
|
|
|
m_anLocalVariables[CTheScripts::Read2BytesFromScript(pIp)] = ScriptParams[i];
|
|
|
|
@ -2456,7 +2456,7 @@ CRunningScript* CTheScripts::StartTestScript()
|
|
|
|
|
|
|
|
|
|
bool CTheScripts::IsPlayerOnAMission()
|
|
|
|
|
{
|
|
|
|
|
return OnAMissionFlag && BSWAP32(*(int32*)&ScriptSpace[OnAMissionFlag]) == 1;
|
|
|
|
|
return OnAMissionFlag && BSWAP_I32(*(int32*)&ScriptSpace[OnAMissionFlag]) == 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CRunningScript::Process()
|
|
|
|
@ -2630,14 +2630,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
*ptr = BSWAP32(ScriptParams[0]);
|
|
|
|
|
*ptr = BSWAP_I32(ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_VAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(*(float*)&ScriptParams[0]);
|
|
|
|
|
*(float*)ptr = BSWAP_F32(*(float*)&ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_LVAR_INT:
|
|
|
|
@ -2661,7 +2661,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*ptr += ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*ptr = BSWAP32(BSWAP32(*ptr) + ScriptParams[0]);
|
|
|
|
|
*ptr = BSWAP_I32(BSWAP_I32(*ptr) + ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2672,7 +2672,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr += *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr ) + *(float*)&ScriptParams[0]);
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr ) + *(float*)&ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2697,7 +2697,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*ptr -= ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*ptr = BSWAP32(BSWAP32(*ptr) - ScriptParams[0]);
|
|
|
|
|
*ptr = BSWAP_I32(BSWAP_I32(*ptr) - ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2708,7 +2708,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr -= *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr ) - *(float*)&ScriptParams[0]);
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr ) - *(float*)&ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2733,7 +2733,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*ptr *= ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*ptr = BSWAP32(BSWAP32(*ptr) * ScriptParams[0]);
|
|
|
|
|
*ptr = BSWAP_I32(BSWAP_I32(*ptr) * ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2744,7 +2744,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr *= *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr ) * *(float*)&ScriptParams[0]);
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr ) * *(float*)&ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2769,7 +2769,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*ptr /= ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*ptr = BSWAP32(BSWAP32(*ptr) / ScriptParams[0]);
|
|
|
|
|
*ptr = BSWAP_I32(BSWAP_I32(*ptr) / ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2780,7 +2780,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr /= *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr ) / *(float*)&ScriptParams[0]);
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr ) / *(float*)&ScriptParams[0]);
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -2802,7 +2802,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr) > ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr) > ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_NUMBER:
|
|
|
|
@ -2816,7 +2816,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(ScriptParams[0] > BSWAP32(*ptr));
|
|
|
|
|
UpdateCompareFlag(ScriptParams[0] > BSWAP_I32(*ptr));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_NUMBER_GREATER_THAN_INT_LVAR:
|
|
|
|
@ -2830,21 +2830,21 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) > BSWAP32(*ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) > BSWAP_I32(*ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_INT_VAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*ptr1 > BSWAP32(*ptr2));
|
|
|
|
|
UpdateCompareFlag(*ptr1 > BSWAP_I32(*ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_VAR_GREATER_THAN_INT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) > *ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) > *ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_THAN_INT_LVAR:
|
|
|
|
@ -2858,7 +2858,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr) > *(float*)&ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr) > *(float*)&ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_NUMBER:
|
|
|
|
@ -2872,7 +2872,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*(float*)&ScriptParams[0] > FLOATSWAP32(*(float*)ptr));
|
|
|
|
|
UpdateCompareFlag(*(float*)&ScriptParams[0] > BSWAP_F32(*(float*)ptr));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_NUMBER_GREATER_THAN_FLOAT_LVAR:
|
|
|
|
@ -2886,21 +2886,21 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) > FLOATSWAP32(*(float*)ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) > BSWAP_F32(*(float*)ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_VAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*(float*)ptr1 > FLOATSWAP32(*(float*)ptr2));
|
|
|
|
|
UpdateCompareFlag(*(float*)ptr1 > BSWAP_F32(*(float*)ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_VAR_GREATER_THAN_FLOAT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) > *(float*)ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) > *(float*)ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_THAN_FLOAT_LVAR:
|
|
|
|
@ -2914,7 +2914,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr) >= ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr) >= ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
|
|
|
|
@ -2928,7 +2928,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(ScriptParams[0] >= BSWAP32(*ptr));
|
|
|
|
|
UpdateCompareFlag(ScriptParams[0] >= BSWAP_I32(*ptr));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_INT_LVAR:
|
|
|
|
@ -2942,21 +2942,21 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) >= BSWAP32(*ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) >= BSWAP_I32(*ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_VAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*ptr1 >= BSWAP32(*ptr2));
|
|
|
|
|
UpdateCompareFlag(*ptr1 >= BSWAP_I32(*ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_VAR_GREATER_OR_EQUAL_TO_INT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) >= *ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) >= *ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_GREATER_OR_EQUAL_TO_INT_LVAR:
|
|
|
|
@ -2970,7 +2970,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr) >= *(float*)&ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr) >= *(float*)&ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_NUMBER:
|
|
|
|
@ -2984,7 +2984,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*(float*)&ScriptParams[0] >= FLOATSWAP32(*(float*)ptr));
|
|
|
|
|
UpdateCompareFlag(*(float*)&ScriptParams[0] >= BSWAP_F32(*(float*)ptr));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_NUMBER_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
|
|
|
@ -2998,21 +2998,21 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) >= FLOATSWAP32(*(float*)ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) >= BSWAP_F32(*(float*)ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_VAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(*(float*)ptr1 >= FLOATSWAP32(*(float*)ptr2));
|
|
|
|
|
UpdateCompareFlag(*(float*)ptr1 >= BSWAP_F32(*(float*)ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_VAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) >= *(float*)ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) >= *(float*)ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_GREATER_OR_EQUAL_TO_FLOAT_LVAR:
|
|
|
|
@ -3026,7 +3026,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr) == ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr) == ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_EQUAL_TO_NUMBER:
|
|
|
|
@ -3040,14 +3040,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) == BSWAP32(*ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) == BSWAP_I32(*ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_VAR_EQUAL_TO_INT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(BSWAP32(*ptr1) == *ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_I32(*ptr1) == *ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_INT_LVAR_EQUAL_TO_INT_LVAR:
|
|
|
|
@ -3066,7 +3066,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
CollectParameters(&m_nIp, 1);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr) == *(float*)&ScriptParams[0]);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr) == *(float*)&ScriptParams[0]);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_NUMBER:
|
|
|
|
@ -3080,14 +3080,14 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) == FLOATSWAP32(*(float*)ptr2));
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) == BSWAP_F32(*(float*)ptr2));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_VAR_EQUAL_TO_FLOAT_LVAR:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
int32* ptr2 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
UpdateCompareFlag(FLOATSWAP32(*(float*)ptr1) == *(float*)ptr2);
|
|
|
|
|
UpdateCompareFlag(BSWAP_F32(*(float*)ptr1) == *(float*)ptr2);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_IS_FLOAT_LVAR_EQUAL_TO_FLOAT_LVAR:
|
|
|
|
@ -3152,7 +3152,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
pNew->m_anLocalVariables[i] = *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)];
|
|
|
|
|
#else
|
|
|
|
|
pNew->m_anLocalVariables[i] = BSWAP32(*(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)]);
|
|
|
|
|
pNew->m_anLocalVariables[i] = BSWAP_I32(*(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)]);
|
|
|
|
|
#endif
|
|
|
|
|
break;
|
|
|
|
|
case ARGUMENT_LOCALVAR:
|
|
|
|
@ -3320,7 +3320,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 += *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) + BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) + BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_INT_LVAR_TO_INT_VAR:
|
|
|
|
@ -3328,12 +3328,12 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 += *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) + *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) + *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_INT_VAR_TO_INT_LVAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*nScriptVar1 += BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*nScriptVar1 += BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_INT_LVAR_TO_INT_LVAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3344,7 +3344,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) + FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) + BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_VAR:
|
|
|
|
@ -3352,12 +3352,12 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 += *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) + *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) + *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_FLOAT_VAR_TO_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 += FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 += BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_FLOAT_LVAR_TO_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3368,7 +3368,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 -= GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) - BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) - BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_INT_LVAR_FROM_INT_LVAR:
|
|
|
|
@ -3380,7 +3380,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) - FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) - BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_LVAR:
|
|
|
|
@ -3404,31 +3404,31 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 -= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) - *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) - *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_INT_VAR_FROM_INT_LVAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*nScriptVar1 -= BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*nScriptVar1 -= BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_FLOAT_LVAR_FROM_FLOAT_VAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 -= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) - *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) - *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_FLOAT_VAR_FROM_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 -= FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 -= BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_INT_VAR_BY_INT_VAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) * BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) * BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
|
|
|
|
@ -3436,12 +3436,12 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) * *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) * *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*nScriptVar1 *= BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*nScriptVar1 *= BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_INT_LVAR_BY_INT_LVAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3452,7 +3452,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) * FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) * BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
|
|
|
|
@ -3460,12 +3460,12 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 *= FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 *= BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3476,7 +3476,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) / BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) / BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
|
|
|
|
@ -3484,12 +3484,12 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*nScriptVar1 = BSWAP32(BSWAP32(*nScriptVar1) / *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*nScriptVar1 = BSWAP_I32(BSWAP_I32(*nScriptVar1) / *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*nScriptVar1 /= BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*nScriptVar1 /= BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_INT_LVAR_BY_INT_LVAR:
|
|
|
|
|
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3500,7 +3500,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) / FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) / BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
|
|
|
|
@ -3508,12 +3508,12 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) / *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) / *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 /= FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 /= BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3526,7 +3526,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr += CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr) + (CTimer::GetTimeStep() * *(float*)&ScriptParams[0]));
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr) + (CTimer::GetTimeStep() * *(float*)&ScriptParams[0]));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -3542,7 +3542,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) + (CTimer::GetTimeStep() * FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL))));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) + (CTimer::GetTimeStep() * BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL))));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
@ -3554,7 +3554,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) + (CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) + (CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
@ -3563,7 +3563,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
|
|
|
|
|
#endif
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 += CTimer::GetTimeStep() * FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 += CTimer::GetTimeStep() * BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3576,7 +3576,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*(float*)ptr -= CTimer::GetTimeStep() * *(float*)&ScriptParams[0];
|
|
|
|
|
#else
|
|
|
|
|
*(float*)ptr = FLOATSWAP32(FLOATSWAP32(*(float*)ptr) - (CTimer::GetTimeStep() * *(float*)&ScriptParams[0]));
|
|
|
|
|
*(float*)ptr = BSWAP_F32(BSWAP_F32(*(float*)ptr) - (CTimer::GetTimeStep() * *(float*)&ScriptParams[0]));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -3592,7 +3592,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) - (CTimer::GetTimeStep() * FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL))));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) - (CTimer::GetTimeStep() * BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL))));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum
|
|
|
|
@ -3604,7 +3604,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
#ifndef BIGENDIAN
|
|
|
|
|
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
#else
|
|
|
|
|
*fScriptVar1 = FLOATSWAP32(FLOATSWAP32(*fScriptVar1) - (CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL)));
|
|
|
|
|
*fScriptVar1 = BSWAP_F32(BSWAP_F32(*fScriptVar1) - (CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL)));
|
|
|
|
|
#endif
|
|
|
|
|
return 0;
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
@ -3613,7 +3613,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
|
|
|
|
|
#endif
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*fScriptVar1 -= CTimer::GetTimeStep() * FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*fScriptVar1 -= CTimer::GetTimeStep() * BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_LVAR:
|
|
|
|
|
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
@ -3628,13 +3628,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_SET_VAR_INT_TO_LVAR_INT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*ptr = BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_LVAR_INT_TO_VAR_INT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_LVAR_INT_TO_LVAR_INT:
|
|
|
|
@ -3652,13 +3652,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
*ptr = BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_SET_LVAR_FLOAT_TO_LVAR_FLOAT:
|
|
|
|
@ -3670,21 +3670,21 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_CSET_VAR_INT_TO_VAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP32(*ptr);
|
|
|
|
|
*ptr = BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_I32(*ptr);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = BSWAP32(*ptr);
|
|
|
|
|
*ptr = BSWAP_I32(*ptr);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = FLOATSWAP32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_F32(*(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT:
|
|
|
|
@ -3696,21 +3696,21 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_CSET_VAR_FLOAT_TO_VAR_INT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = FLOATSWAP32(*ptr);
|
|
|
|
|
*ptr = BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_F32(*ptr);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = FLOATSWAP32(*ptr);
|
|
|
|
|
*ptr = BSWAP_F32(*ptr);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
|
|
|
|
|
*ptr = BSWAP32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
*ptr = BSWAP_I32(*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT:
|
|
|
|
@ -3722,7 +3722,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_ABS_VAR_INT:
|
|
|
|
|
{
|
|
|
|
|
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = BSWAP32(ABS(BSWAP32(*ptr)));
|
|
|
|
|
*ptr = BSWAP_I32(ABS(BSWAP_I32(*ptr)));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_ABS_LVAR_INT:
|
|
|
|
@ -3734,7 +3734,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
case COMMAND_ABS_VAR_FLOAT:
|
|
|
|
|
{
|
|
|
|
|
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
|
|
|
|
|
*ptr = FLOATSWAP32(ABS(FLOATSWAP32(*ptr)));
|
|
|
|
|
*ptr = BSWAP_F32(ABS(BSWAP_F32(*ptr)));
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_ABS_LVAR_FLOAT:
|
|
|
|
@ -3750,16 +3750,16 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|
|
|
|
CGeneral::GetRandomNumber();
|
|
|
|
|
CGeneral::GetRandomNumber(); /* To make it EXTRA random! */
|
|
|
|
|
#ifdef FIX_BUGS
|
|
|
|
|
*ptr = FLOATSWAP32(CGeneral::GetRandomNumberInRange(0.0f, 1.0f));
|
|
|
|
|
*ptr = BSWAP_F32(CGeneral::GetRandomNumberInRange(0.0f, 1.0f));
|
|
|
|
|
#else
|
|
|
|
|
*ptr = FLOATSWAP32(CGeneral::GetRandomNumber() / 65536.0f);
|
|
|
|
|
*ptr = BSWAP_F32(CGeneral::GetRandomNumber() / 65536.0f);
|
|
|
|
|
/* Between 0 and 0.5 on PC (oh well...), never used in original script. */
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
case COMMAND_GENERATE_RANDOM_INT:
|
|
|
|
|
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = BSWAP32(CGeneral::GetRandomNumber());
|
|
|
|
|
*GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL) = BSWAP_I32(CGeneral::GetRandomNumber());
|
|
|
|
|
return 0;
|
|
|
|
|
case COMMAND_CREATE_CHAR:
|
|
|
|
|
{
|
|
|
|
|