summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-06-07 15:07:36 +0300
committerNikolay Korolev <nickvnuk@gmail.com>2020-06-07 15:07:36 +0300
commitbe2291e44cd898a86fc2d0f1da56305e1f4143b2 (patch)
treedfaf1ef2497748dd6ff94fc3201844e480f1b215 /src
parent31569d512c708161b6c2afdf8a6e4356a7db15aa (diff)
fixed some arithmetic
Diffstat (limited to 'src')
-rw-r--r--src/control/Script.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 94590087..d90f2a0b 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -1552,11 +1552,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
+ case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_MULT_INT_VAR_BY_INT_LVAR:
+ case COMMAND_MULT_INT_LVAR_BY_INT_VAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*nScriptVar1 *= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1568,11 +1568,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
+ case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_MULT_FLOAT_VAR_BY_FLOAT_LVAR:
+ case COMMAND_MULT_FLOAT_LVAR_BY_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 *= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1584,11 +1584,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
+ case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_DIV_INT_VAR_BY_INT_LVAR:
+ case COMMAND_DIV_INT_LVAR_BY_INT_VAR:
nScriptVar1 = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*nScriptVar1 /= *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1600,11 +1600,11 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
- case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
+ case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
- case COMMAND_DIV_FLOAT_VAR_BY_FLOAT_LVAR:
+ case COMMAND_DIV_FLOAT_LVAR_BY_FLOAT_VAR:
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 /= *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1630,11 +1630,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
+#else
case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_ADD_TIMED_FLOAT_LVAR_TO_FLOAT_VAR:
+#else
case COMMAND_ADD_TIMED_FLOAT_VAR_TO_FLOAT_LVAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 += CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1660,11 +1668,19 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
+#ifdef FIX_BUGS // in SA it was fixed by reversing their order in enum
+ case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
+#else
case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
+#ifdef FIX_BUGS
+ case COMMAND_SUB_TIMED_FLOAT_LVAR_FROM_FLOAT_VAR:
+#else
case COMMAND_SUB_TIMED_FLOAT_VAR_FROM_FLOAT_LVAR:
+#endif
fScriptVar1 = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*fScriptVar1 -= CTimer::GetTimeStep() * *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
@@ -1678,13 +1694,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_SET_LVAR_INT_TO_VAR_INT:
+ case COMMAND_SET_VAR_INT_TO_LVAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_SET_VAR_INT_TO_LVAR_INT:
+ case COMMAND_SET_LVAR_INT_TO_VAR_INT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1702,13 +1718,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
+ case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_SET_VAR_FLOAT_TO_LVAR_FLOAT:
+ case COMMAND_SET_LVAR_FLOAT_TO_VAR_FLOAT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1726,13 +1742,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
+ case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT:
+ case COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *(float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
@@ -1750,13 +1766,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
return 0;
}
- case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
+ case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
return 0;
}
- case COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT:
+ case COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT:
{
float* ptr = (float*)GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
*ptr = *GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);