summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/control/Garages.cpp6
-rw-r--r--src/control/Script.cpp435
-rw-r--r--src/control/Script.h40
-rw-r--r--src/control/Script3.cpp4
-rw-r--r--src/control/Script5.cpp6
-rw-r--r--src/control/Script6.cpp30
-rw-r--r--src/control/Script8.cpp842
-rw-r--r--src/control/ScriptCommands.h251
-rw-r--r--src/core/config.h4
9 files changed, 1235 insertions, 383 deletions
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 89377db5..f083ecb5 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -1494,9 +1494,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition)
void CGarage::UpdateCrusherAngle()
{
RefreshDoorPointers(false);
- m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos);
- m_pDoor2->GetMatrix().UpdateRW();
- m_pDoor2->UpdateRwFrame();
+ //m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); TODO
+ //m_pDoor2->GetMatrix().UpdateRW();
+ //m_pDoor2->UpdateRwFrame();
}
void CGarage::UpdateCrusherShake(float X, float Y)
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 414e3f67..5ed4ebf5 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -98,10 +98,6 @@ uint32 CTheScripts::LastMissionPassedTime;
uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium;
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
-int16 CTheScripts::CardStack[CARDS_IN_DECK * MAX_DECKS];
-int16 CTheScripts::CardStackPosition;
-#endif
int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
bool CTheScripts::FSDestroyedFlag;
short* CTheScripts::SavedVarIndices;
@@ -110,6 +106,8 @@ int gScriptsFile = -1;
int CTheScripts::NextProcessId = 1;
bool CTheScripts::InTheScripts;
CRunningScript* pCurrent;
+uint16 CTheScripts::NumTrueGlobals;
+uint16 CTheScripts::MostGlobals;
#ifdef MISSION_REPLAY
@@ -1593,39 +1591,222 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_REGISTER_FIRE_LEVEL, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_AUSTRALIAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_DISARM_CAR_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
REGISTER_COMMAND(COMMAND_IS_JAPANESE_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
-#elif (!defined GTA_PS2)
- REGISTER_COMMAND(COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- REGISTER_COMMAND(COMMAND_SHUFFLE_CARD_DECKS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_FETCH_NEXT_CARD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_DEBUG_CAMERA_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_OBJECT_STATIC, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DO_2D_RECTANGLES_COLLIDE, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), true, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_ROTATION_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_GET_OBJECT_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""),
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT)
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
-#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- REGISTER_COMMAND(COMMAND_IS_MISSION_SKIP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_SET_IN_AMMUNATION, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DO_SAVE_GAME, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_IS_RETRY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""),
- REGISTER_COMMAND(COMMAND_DUMMY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
- REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
-#endif
+ REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1443, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1444, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1445, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1446, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1447, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1448, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1449, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1450, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1451, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1452, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1453, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_NOTCALL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1456, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1457, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1458, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1459, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1460, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1461, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1462, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1463, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1464, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1465, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1466, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1467, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1468, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1469, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1470, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1471, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1472, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1473, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1474, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1475, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1476, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1477, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1478, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1479, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1480, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1481, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1482, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1483, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1484, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1485, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1486, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1487, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1488, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1489, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1490, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1491, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1492, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1493, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1494, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1495, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1496, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1497, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1498, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1499, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1500, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1501, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1502, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1503, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1504, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1505, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1506, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1507, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1508, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1509, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1510, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1511, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1512, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1513, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1514, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1515, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1516, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1517, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1518, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1519, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1520, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1521, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1522, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1523, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1524, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1525, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1526, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1527, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1528, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1529, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1530, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1531, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1532, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1533, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1534, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1535, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1536, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1537, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1538, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1539, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1540, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1541, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1542, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1543, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1544, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1545, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1546, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1547, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1548, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1549, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1550, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1551, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1552, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1553, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1554, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1555, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1556, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1557, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1558, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1559, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1560, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_1561, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1562, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1563, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1564, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1565, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1566, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1567, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1568, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1569, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
+ REGISTER_COMMAND(COMMAND_1570, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1571, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1572, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1573, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1574, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1575, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1576, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1577, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1578, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1579, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1580, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1581, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1582, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1583, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1584, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1585, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1586, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1587, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1588, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1589, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1590, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1591, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1592, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1593, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1594, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1595, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1596, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1597, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1598, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1599, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1600, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1601, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1602, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1603, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1604, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1605, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1606, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1607, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1608, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1609, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1610, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1611, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1612, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1613, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1614, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1615, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1616, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1617, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1618, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1619, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1620, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1621, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1622, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1623, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1624, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1625, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1626, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1627, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1628, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1629, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1630, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1631, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1632, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1633, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1634, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1635, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1636, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1637, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1638, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1639, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1640, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1641, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1642, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1643, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1644, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1645, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1646, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1647, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1648, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1649, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1650, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1651, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1652, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1653, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1654, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1655, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
+ REGISTER_COMMAND(COMMAND_1656, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
};
#undef REGISTER_COMMAND
#undef INPUT_ARGUMENTS
@@ -2261,18 +2442,14 @@ int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
case ARGUMENT_INT32:
case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(&m_nIp);
- break;
case ARGUMENT_INT8:
return CTheScripts::Read1ByteFromScript(&m_nIp);
- break;
case ARGUMENT_INT16:
return CTheScripts::Read2BytesFromScript(&m_nIp);
- break;
default:
var = true;
--m_nIp;
- GetPointerToScriptVariableForDebug(this, &m_nIp, buf);
- break;
+ return *GetPointerToScriptVariableForDebug(this, &m_nIp, buf);
}
return 0;
}
@@ -2298,12 +2475,12 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
case ARGUMENT_FLOAT_ZERO:
return 0;
case ARGUMENT_FLOAT_1BYTE:
- return (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 24;
+ return (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24;
case ARGUMENT_FLOAT_2BYTES:
- return (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16;
+ return (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
case ARGUMENT_FLOAT_3BYTES:
- tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 8;
- tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16;
+ tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8;
+ tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
return tmp;
case ARGUMENT_INT32:
return CTheScripts::Read4BytesFromScript(pIp);
@@ -2314,7 +2491,7 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(pIp);
default:
- pIp--;
+ (*pIp)--;
return *GetPointerToScriptVariable(pIp, 0);
}
return -1;
@@ -2339,11 +2516,11 @@ int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp)
script_assert(size > 0);
script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1);
- return (int32*)&CTheScripts::ScriptSpace[((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block];
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL_ARRAY) << 8) + index + index_in_block)];
}
else if (type >= ARGUMENT_GLOBAL) {
uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp);
- return (int32*)&CTheScripts::ScriptSpace[((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block];
+ return (int32*)&CTheScripts::ScriptSpace[4 * (((int)(type - ARGUMENT_GLOBAL) << 8) + index_in_block)];
}
else if (type >= ARGUMENT_LOCAL_ARRAY) {
uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
@@ -2488,7 +2665,6 @@ bool CTheScripts::Init(bool loaddata)
memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
gScriptsFile = mainf;
- CFileMgr::CloseFile(mainf);
CFileMgr::SetDir("");
ReadObjectNamesFromScript();
UpdateObjectIndices();
@@ -2598,6 +2774,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip)
return pNew;
}
+// done(LCS)
void CTheScripts::Process()
{
if (CReplay::IsPlayingBack())
@@ -2738,6 +2915,7 @@ void CRunningScript::Process()
CMessages::BriefMessages[0].m_nStartTime = 0;
}
+// done(LCS)
int8 CRunningScript::ProcessOneCommand()
{
int8 retval = -1;
@@ -2748,32 +2926,57 @@ int8 CRunningScript::ProcessOneCommand()
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
char commandInfo[1024];
uint32 ip = m_nIp;
+ uint8 nInputParams;
+ uint8 nOutputParameters;
+ uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command);
- sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
+ sprintf(commandInfo, m_nIp >= CTheScripts::MainScriptSize ? "M<%5d> " : "<%6d> ", m_nIp >= CTheScripts::MainScriptSize ? m_nIp - CTheScripts::MainScriptSize : m_nIp);
if (m_bNotFlag)
strcat(commandInfo, "NOT ");
if (commands[command].position == -1)
strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1);
- for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ if (commands[command].input[0] == ARGTYPE_FUNCTION) {
char tmp[32];
bool var = false;
- int value;
- switch (commands[command].input[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
- case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
- case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
- case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
- case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
- case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break;
- default: script_assert(0);
- }
+ nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp);
+ nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ int value = CollectParameterForDebug(commandInfo, var);
+ sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value));
strcat(commandInfo, tmp);
- if (commands[command].position == i)
- strcat(commandInfo, commands[command].name_override);
+ strcat(commandInfo, "{");
+ for (int i = 0; i < nInputParams; i++) {
+ if (i != 0)
+ strcat(commandInfo, ", ");
+ value = CollectParameterForDebug(commandInfo, var);
+ sprintf(tmp, var ? "(%d)" : "%d", value);
+ strcat(commandInfo, tmp);
+
+ }
+ strcat(commandInfo, "}");
+ }
+ else {
+ for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ char tmp[32];
+ bool var = false;
+ int value;
+ switch (commands[command].input[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
+ case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
+ case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
+ case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
+ case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
+ case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value + 1) % 10, value / 10 == 0 ? "AND" : "OR"); break;
+ default: script_assert(0);
+ }
+ strcat(commandInfo, tmp);
+ if (commands[command].position == i)
+ strcat(commandInfo, commands[command].name_override);
+ }
}
uint32 t = m_nIp;
m_nIp = ip;
@@ -2810,10 +3013,10 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands1300To1399(command);
else if (command < 1497)
retval = ProcessCommands1400To1499(command);
- //else if (command < 1600) // TODO
- // retval = ProcessCommands1500To1599(command);
- //else if (command < 1700)
- // retval = ProcessCommands1600To1699(command);
+ else if (command < 1600)
+ retval = ProcessCommands1500To1599(command);
+ else if (command < 1700)
+ retval = ProcessCommands1600To1699(command);
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
if (command < ARRAY_SIZE(commands)) {
if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) {
@@ -2823,15 +3026,17 @@ int8 CRunningScript::ProcessOneCommand()
uint32 t = m_nIp;
m_nIp = ip;
ip = t;
- for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
- char tmp[32];
- switch (commands[command].output[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
- case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
- default: script_assert(0 && "Script only returns INTs and FLOATs");
+ if (commands[command].input[0] != ARGTYPE_FUNCTION) {
+ for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
+ char tmp[32];
+ switch (commands[command].output[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
+ case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
+ default: script_assert(0 && "Script only returns INTs and FLOATs");
+ }
}
}
m_nIp = ip;
@@ -2869,7 +3074,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
return 1;
case COMMAND_GOTO:
CollectParameters(&m_nIp, 1);
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::MainScriptSize - ScriptParams[0]);
/* Known issue: GOTO to 0. It might have been "better" to use > instead of >= */
/* simply because it never makes sense to jump to start of the script */
/* but jumping to start of a custom mission is an issue for simple mission-like scripts */
@@ -3324,17 +3529,15 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
//case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_VAR:
//case COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR:
//case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR:
- /*
case COMMAND_GOTO_IF_TRUE:
CollectParameters(&m_nIp, 1);
if (m_bCondResult)
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::MainScriptSize - ScriptParams[0]);
return 0;
- */
case COMMAND_GOTO_IF_FALSE:
CollectParameters(&m_nIp, 1);
if (!m_bCondResult)
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::MainScriptSize - ScriptParams[0]);
/* Check COMMAND_GOTO note. */
return 0;
case COMMAND_TERMINATE_THIS_SCRIPT:
@@ -3362,45 +3565,17 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
CollectParameters(&m_nIp, 1);
script_assert(ScriptParams[0] >= 0);
CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
- m_bIsActive = true;
- int8 type = CTheScripts::Read1ByteFromScript(&m_nIp);
- float tmp;
- for (int i = 0; type != ARGUMENT_END; type = CTheScripts::Read1ByteFromScript(&m_nIp), i++) {
- switch (type) {
- case ARGUMENT_INT32:
- pNew->m_anLocalVariables[i] = CTheScripts::Read4BytesFromScript(&m_nIp);
- break;
- //case ARGUMENT_GLOBALVAR:
- // pNew->m_anLocalVariables[i] = *(int32*)&CTheScripts::ScriptSpace[(uint16)CTheScripts::Read2BytesFromScript(&m_nIp)];
- // break;
- //case ARGUMENT_LOCALVAR:
- // pNew->m_anLocalVariables[i] = m_anLocalVariables[CTheScripts::Read2BytesFromScript(&m_nIp)];
- // break;
- case ARGUMENT_INT8:
- pNew->m_anLocalVariables[i] = CTheScripts::Read1ByteFromScript(&m_nIp);
- break;
- case ARGUMENT_INT16:
- pNew->m_anLocalVariables[i] = CTheScripts::Read2BytesFromScript(&m_nIp);
- break;
- case ARGUMENT_FLOAT:
- tmp = CTheScripts::ReadFloatFromScript(&m_nIp);
- pNew->m_anLocalVariables[i] = *(int32*)&tmp;
- break;
- default:
- break;
- }
- }
+ CollectParameters(&m_nIp, NUM_LOCAL_VARS, pNew->m_anLocalVariables);
return 0;
}
case COMMAND_GOSUB:
CollectParameters(&m_nIp, 1);
script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp;
- SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : SIZE_MAIN_SCRIPT - ScriptParams[0]);
+ SetIP(ScriptParams[0] >= 0 ? ScriptParams[0] : CTheScripts::MainScriptSize - ScriptParams[0]);
return 0;
case COMMAND_RETURN:
- script_assert(m_nStackPointer > 0); /* No more SSU */
- SetIP(m_anStack[--m_nStackPointer]);
+ ReturnFromGosubOrFunction();
return 0;
case COMMAND_LINE:
CollectParameters(&m_nIp, 6);
@@ -3434,7 +3609,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{
CVector pos;
CollectParameters(&m_nIp, 1);
- if (CWorld::Players[ScriptParams[0]].m_pPed->bInVehicle)
+ if (CWorld::Players[ScriptParams[0]].m_pPed->bInVehicle && CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle)
pos = CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle->GetPosition();
else
pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition();
@@ -3450,7 +3625,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CPlayerPed* ped = CWorld::Players[index].m_pPed;
- if (ped->bInVehicle) {
+ if (ped->bInVehicle && ped->m_pMyVehicle) {
pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
ped->m_pMyVehicle->Teleport(pos); // removed dumb stuff that was present here
CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle);
@@ -4441,14 +4616,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_DEBUG_OFF:
CTheScripts::DbgFlag = false;
return 0;
- /*
case COMMAND_RETURN_TRUE:
UpdateCompareFlag(true);
+ ReturnFromGosubOrFunction();
return 0;
case COMMAND_RETURN_FALSE:
UpdateCompareFlag(false);
+ ReturnFromGosubOrFunction();
return 0;
- */
//case COMMAND_VAR_INT:
default:
script_assert(0);
@@ -5022,6 +5197,24 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1;
}
+void CRunningScript::ReturnFromGosubOrFunction()
+{
+ uint32 val = m_nIp = m_anStack[--m_nStackPointer];
+ if (!(m_nIp & BIT(STACKVALUE_IS_FUNCTION_CALL_BIT)))
+ return;
+ if (m_nIp & BIT(STACKVALUE_INVERT_RETURN_BIT))
+ m_bCondResult = !m_bCondResult;
+ m_nIp = m_nIp & STACKVALUE_IP_MASK;
+ uint8 nInputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ for (int i = 0; i < nOutputParameters; i++)
+ ScriptParams[i] = m_anLocalVariables[m_nLocalsPointer + nInputParameters];
+ m_nIp += val >> STACKVALUE_IP_PARAMS_OFFSET;
+ m_nLocalsPointer -= nLocalsOffset;
+ StoreParameters(&m_nIp, nOutputParameters);
+}
+
#ifdef MISSION_REPLAY
bool CRunningScript::CanAllowMissionReplay()
@@ -5102,9 +5295,9 @@ CTheScripts::SwitchToMission(int32 mission)
int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif
CFileMgr::Seek(handle, offset, 0);
- CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
+ CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], CTheScripts::MainScriptSize);
CFileMgr::CloseFile(handle);
- CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT);
+ CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
diff --git a/src/control/Script.h b/src/control/Script.h
index 0a7f64bf..ae1838d7 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -272,16 +272,6 @@ enum {
};
enum {
-#ifdef PS2
- SIZE_MAIN_SCRIPT = 205512,
-#else
- SIZE_MAIN_SCRIPT = 225512,
-#endif
- SIZE_MISSION_SCRIPT = 35000,
- SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT
-};
-
-enum {
MAX_NUM_SCRIPTS = 128,
MAX_NUM_INTRO_TEXT_LINES = 48,
MAX_NUM_INTRO_RECTANGLES = 16,
@@ -337,15 +327,6 @@ public:
static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
-#define CARDS_IN_SUIT (13)
-#define NUM_SUITS (4)
-#define MAX_DECKS (6)
-#define CARDS_IN_DECK (CARDS_IN_SUIT * NUM_SUITS)
-#define CARDS_IN_STACK (CARDS_IN_DECK * MAX_DECKS)
- static int16 CardStack[CARDS_IN_STACK];
- static int16 CardStackPosition;
-#endif
static bool bPlayerIsInTheStatium;
static uint8 RiotIntensity;
@@ -358,6 +339,8 @@ public:
static int NextProcessId;
static bool InTheScripts;
static CRunningScript* pCurrent;
+ static uint16 NumTrueGlobals;
+ static uint16 MostGlobals;
static bool Init(bool loaddata = false);
static void Process();
@@ -476,6 +459,8 @@ public:
extern int ScriptParams[32];
+VALIDATE_SIZE(uStackReturnValue, 4);
+
class CRunningScript
{
enum {
@@ -498,6 +483,15 @@ class CRunningScript
ORS_8
};
+ enum {
+ STACKVALUE_IP_BITS = 22,
+ STACKVALUE_INVERT_RETURN_BIT = STACKVALUE_IP_BITS,
+ STACKVALUE_IS_FUNCTION_CALL_BIT,
+ STACKVALUE_IP_PARAMS_OFFSET,
+
+ STACKVALUE_IP_MASK = ((1 << STACKVALUE_IP_BITS) - 1)
+ };
+
public:
CRunningScript* next;
CRunningScript* prev;
@@ -564,6 +558,8 @@ public:
int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32);
+ int8 ProcessCommands1500To1599(int32);
+ int8 ProcessCommands1600To1699(int32);
void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*);
@@ -601,11 +597,11 @@ public:
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
-
- bool CheckDamagedWeaponType(int32 actual, int32 type);
-
+ bool CheckDamagedWeaponType(int32 actual, int32 type);
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
+ void ReturnFromGosubOrFunction();
+
};
#ifdef USE_DEBUG_SCRIPT_LOADER
diff --git a/src/control/Script3.cpp b/src/control/Script3.cpp
index 7476d8de..26e1187d 100644
--- a/src/control/Script3.cpp
+++ b/src/control/Script3.cpp
@@ -1639,7 +1639,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius()));
return 0;
}
- /*
case COMMAND_GOSUB_FILE:
{
CollectParameters(&m_nIp, 2);
@@ -1649,7 +1648,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
// ScriptParams[1] == filename
return 0;
}
- */
case COMMAND_GET_GROUND_Z_FOR_3D_COORD:
{
CollectParameters(&m_nIp, 3);
@@ -2126,7 +2124,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CollectParameters(&m_nIp, 2);
CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0);
return 0;
- /*
case COMMAND_ACTIVATE_CRUSHER_CRANE:
{
CollectParameters(&m_nIp, 10);
@@ -2148,6 +2145,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
return 0;
}
+ /*
case COMMAND_PRINT_WITH_2_NUMBERS:
{
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index c594b9c8..b49e1c79 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -2740,6 +2740,9 @@ void CTheScripts::ReadObjectNamesFromScript()
{
int32 varSpace = GetSizeOfVariableSpace();
uint32 ip = varSpace + 8;
+ NumSaveVars = Read4BytesFromScript(&ip);
+ SavedVarIndices = (short*)&ScriptParams[ip];
+ ip += 2 * NumSaveVars;
NumberOfUsedObjects = Read2BytesFromScript(&ip);
ip += 2;
for (uint16 i = 0; i < NumberOfUsedObjects; i++) {
@@ -2784,7 +2787,8 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript()
uint32 ip = varSpace + 3;
int32 objectSize = Read4BytesFromScript(&ip);
ip = objectSize + 8;
- MainScriptSize = Read4BytesFromScript(&ip);
+ NumTrueGlobals = Read2BytesFromScript(&ip);
+ MostGlobals = Read2BytesFromScript(&ip);
LargestMissionScriptSize = Read4BytesFromScript(&ip);
NumberOfMissionScripts = Read2BytesFromScript(&ip);
NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip);
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 76780941..8915a089 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -374,32 +374,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
CollectParameters(&m_nIp, 1);
- if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2)
- return 0;
+ if (CTheScripts::NumberOfExclusiveMissionScripts > 0) {
+ if (ScriptParams[0] < UINT16_MAX - 1)
+ return 0;
+ ScriptParams[0] = UINT16_MAX - ScriptParams[0];
+ }
#ifdef MISSION_REPLAY
missionRetryScriptIndex = ScriptParams[0];
if (missionRetryScriptIndex == 19)
CStats::LastMissionPassedName[0] = '\0';
#endif
CTimer::Suspend();
- int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
-#ifdef USE_DEBUG_SCRIPT_LOADER
- CFileMgr::ChangeDir("\\data\\");
- int handle = CFileMgr::OpenFile(scriptfile, "rb");
- CFileMgr::ChangeDir("\\");
-#else
- CFileMgr::ChangeDir("\\");
- int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
-#endif
- CFileMgr::Seek(handle, offset, 0);
- CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
- CFileMgr::CloseFile(handle);
- CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT);
+ int offset = CTheScripts::MultiScriptArray[ScriptParams[0]] + 8;
+ int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]];
+ if (size <= 0)
+ size = CTheScripts::LargestMissionScriptSize;
+ CFileMgr::Seek(gScriptsFile, offset, 0);
+ CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
+ CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume();
pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true;
CTheScripts::bAlreadyRunningAMissionScript = true;
- CGameLogic::ClearShortCut();
+ memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4);
+ pMissionScript->Process();
return 0;
}
case COMMAND_SET_OBJECT_DRAW_LAST:
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 74552b23..63102d24 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -384,7 +384,6 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
}
return 0;
}
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
case COMMAND_IS_JAPANESE_GAME:
#ifdef MORE_LANGUAGES
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
@@ -394,218 +393,697 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
UpdateCompareFlag(false);
#endif
return 0;
-#elif (!defined GTA_PS2)
- case COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED:
- script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR);
- uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp);
- CollectParameters(&m_nIp, 1);
- //CUserDisplay::OnscnTimer.SetCounterFlashWhenFirstDisplayed(var, ScriptParams[0]);
- break;
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- case COMMAND_SHUFFLE_CARD_DECKS:
+ case COMMAND_1442:
+ script_assert(false);
+ return 0;
+ case COMMAND_1443:
+ script_assert(false);
+ return 0;
+ case COMMAND_1444:
+ script_assert(false);
+ return 0;
+ case COMMAND_1445:
+ script_assert(false);
+ return 0;
+ case COMMAND_1446:
+ script_assert(false);
+ return 0;
+ case COMMAND_1447:
+ script_assert(false);
+ return 0;
+ case COMMAND_1448:
+ script_assert(false);
+ return 0;
+ case COMMAND_1449:
+ script_assert(false);
+ return 0;
+ case COMMAND_1450:
+ script_assert(false);
+ return 0;
+ case COMMAND_1451:
+ script_assert(false);
+ return 0;
+ case COMMAND_1452:
+ script_assert(false);
+ return 0;
+ case COMMAND_1453:
+ script_assert(false);
+ return 0;
+ case COMMAND_CALL:
+ case COMMAND_NOTCALL:
{
+ m_anStack[m_nStackPointer++] = m_nIp | BIT(STACKVALUE_IS_FUNCTION_CALL_BIT) | ((command == COMMAND_NOTCALL) ? BIT(STACKVALUE_INVERT_RETURN_BIT) : 0);
+ uint8 nInputParams = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nOutputParameters = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint8 nLocalsOffset = CTheScripts::Read1ByteFromScript(&m_nIp);
+ uint32 nIPBeforeParameters = m_nIp;
CollectParameters(&m_nIp, 1);
- script_assert(ScriptParams[0] >= 0 && ScriptParams[0] <= 6);
- for (int i = 0; i < CARDS_IN_STACK; i++)
- CTheScripts::CardStack[i] = 0;
- int16 seq[CARDS_IN_STACK];
- for (int i = 0; i < MAX_DECKS * CARDS_IN_DECK; i++)
- seq[i] = i;
- int cards_left = CARDS_IN_DECK * ScriptParams[0];
- for (int k = 1; k < CARDS_IN_DECK + 1; k++) {
- for (int deck = 0; deck < ScriptParams[0]; deck++) {
- int index = CGeneral::GetRandomNumberInRange(0, cards_left);
- CTheScripts::CardStack[seq[index]] = k;
- for (int l = index; l < cards_left; l++) {
- if (l + 1 < CARDS_IN_STACK)
- seq[l] = seq[l + 1];
- else
- seq[l] = 0;
- }
- --cards_left;
- }
- }
- CTheScripts::CardStackPosition = 0;
+ if (nInputParams)
+ CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]);
+ m_nLocalsPointer += nLocalsOffset;
+ m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET;
+ if (ScriptParams[0] < 0)
+ m_nIp = CTheScripts::MainScriptSize - ScriptParams[0];
+ else
+ m_nIp = ScriptParams[0];
return 0;
}
- case COMMAND_FETCH_NEXT_CARD:
- {
- if (CTheScripts::CardStack[CTheScripts::CardStackPosition] == 0)
- CTheScripts::CardStackPosition = 0;
- ScriptParams[0] = CTheScripts::CardStack[CTheScripts::CardStackPosition++];
- if (CTheScripts::CardStackPosition == CARDS_IN_DECK * MAX_DECKS)
- CTheScripts::CardStackPosition = 0;
- StoreParameters(&m_nIp, 1);
+ case COMMAND_1456:
+ script_assert(false);
+ return 0;
+ case COMMAND_1457:
+ script_assert(false);
+ return 0;
+ case COMMAND_1458:
+ script_assert(false);
+ return 0;
+ case COMMAND_1459:
+ script_assert(false);
+ return 0;
+ case COMMAND_1460:
+ script_assert(false);
+ return 0;
+ case COMMAND_1461:
+ script_assert(false);
+ return 0;
+ case COMMAND_1462:
+ script_assert(false);
+ return 0;
+ case COMMAND_1463:
+ script_assert(false);
+ return 0;
+ case COMMAND_1464:
+ script_assert(false);
+ return 0;
+ case COMMAND_1465:
+ script_assert(false);
+ return 0;
+ case COMMAND_1466:
+ script_assert(false);
+ return 0;
+ case COMMAND_1467:
+ script_assert(false);
+ return 0;
+ case COMMAND_1468:
+ script_assert(false);
+ return 0;
+ case COMMAND_1469:
+ script_assert(false);
+ return 0;
+ case COMMAND_1470:
+ script_assert(false);
return 0;
+ case COMMAND_1471:
+ script_assert(false);
+ return 0;
+ case COMMAND_1472:
+ script_assert(false);
+ return 0;
+ case COMMAND_1473:
+ script_assert(false);
+ return 0;
+ case COMMAND_1474:
+ script_assert(false);
+ return 0;
+ case COMMAND_1475:
+ script_assert(false);
+ return 0;
+ case COMMAND_1476:
+ script_assert(false);
+ return 0;
+ case COMMAND_1477:
+ script_assert(false);
+ return 0;
+ case COMMAND_1478:
+ script_assert(false);
+ return 0;
+ case COMMAND_1479:
+ script_assert(false);
+ return 0;
+ case COMMAND_1480:
+ script_assert(false);
+ return 0;
+ case COMMAND_1481:
+ script_assert(false);
+ return 0;
+ case COMMAND_1482:
+ script_assert(false);
+ return 0;
+ case COMMAND_1483:
+ script_assert(false);
+ return 0;
+ case COMMAND_1484:
+ script_assert(false);
+ return 0;
+ case COMMAND_1485:
+ script_assert(false);
+ return 0;
+ case COMMAND_1486:
+ script_assert(false);
+ return 0;
+ case COMMAND_1487:
+ script_assert(false);
+ return 0;
+ case COMMAND_1488:
+ script_assert(false);
+ return 0;
+ case COMMAND_1489:
+ script_assert(false);
+ return 0;
+ case COMMAND_1490:
+ script_assert(false);
+ return 0;
+ case COMMAND_1491:
+ script_assert(false);
+ return 0;
+ case COMMAND_1492:
+ script_assert(false);
+ return 0;
+ case COMMAND_1493:
+ script_assert(false);
+ return 0;
+ case COMMAND_1494:
+ script_assert(false);
+ return 0;
+ case COMMAND_1495:
+ script_assert(false);
+ return 0;
+ case COMMAND_1496:
+ script_assert(false);
+ return 0;
+ case COMMAND_1497:
+ script_assert(false);
+ return 0;
+ case COMMAND_1498:
+ script_assert(false);
+ return 0;
+ case COMMAND_1499:
+ script_assert(false);
+ return 0;
+ default:
+ script_assert(0);
}
- case COMMAND_GET_OBJECT_VELOCITY:
- {
+ return -1;
+}
+
+int8 CRunningScript::ProcessCommands1500To1599(int32 command)
+{
+ switch (command) {
+ case COMMAND_1500:
+ script_assert(false);
+ return 0;
+ case COMMAND_1501:
+ script_assert(false);
+ return 0;
+ case COMMAND_1502:
+ script_assert(false);
+ return 0;
+ case COMMAND_1503:
+ script_assert(false);
+ return 0;
+ case COMMAND_1504:
+ script_assert(false);
+ return 0;
+ case COMMAND_1505:
+ script_assert(false);
+ return 0;
+ case COMMAND_1506:
+ script_assert(false);
+ return 0;
+ case COMMAND_1507:
+ script_assert(false);
+ return 0;
+ case COMMAND_1508:
+ script_assert(false);
+ return 0;
+ case COMMAND_1509:
+ script_assert(false);
+ return 0;
+ case COMMAND_1510:
+ script_assert(false);
+ return 0;
+ case COMMAND_1511:
+ script_assert(false);
+ return 0;
+ case COMMAND_1512:
+ script_assert(false);
+ return 0;
+ case COMMAND_1513:
+ script_assert(false);
+ return 0;
+ case COMMAND_1514:
+ script_assert(false);
+ return 0;
+ case COMMAND_1515:
+ script_assert(false);
+ return 0;
+ case COMMAND_1516:
+ script_assert(false);
+ return 0;
+ case COMMAND_1517:
+ script_assert(false);
+ return 0;
+ case COMMAND_1518:
+ script_assert(false);
+ return 0;
+ case COMMAND_1519:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(CVector*)&ScriptParams[0] = GAME_SPEED_TO_METERS_PER_SECOND * pObject->GetMoveSpeed();
- StoreParameters(&m_nIp, 3);
+ // TODO (SET_NUMBER_USJ_FOUND?)
return 0;
- }
- case COMMAND_IS_DEBUG_CAMERA_ON:
- UpdateCompareFlag(TheCamera.WorldViewerBeingUsed);
+ case COMMAND_1520:
+ CollectParameters(&m_nIp, 1);
+ // TODO (SET_TOTAL_HIDDEN_PACKAGES?)
return 0;
- case COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY:
- {
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector newSpeed = pObject->GetTurnSpeed() + *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z);
+ case COMMAND_1521:
+ script_assert(false);
return 0;
- }
- case COMMAND_SET_OBJECT_ROTATION_VELOCITY:
- {
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector newSpeed = *(CVector*)&ScriptParams[1] / GAME_SPEED_TO_METERS_PER_SECOND;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetTurnSpeed(newSpeed.x, newSpeed.y, newSpeed.z);
+ case COMMAND_1522:
+ script_assert(false);
return 0;
- }
- case COMMAND_IS_OBJECT_STATIC:
- {
+ case COMMAND_1523:
+ script_assert(false);
+ return 0;
+ case COMMAND_1524:
+ script_assert(false);
+ return 0;
+ case COMMAND_1525:
+ script_assert(false);
+ return 0;
+ case COMMAND_1526:
+ script_assert(false);
+ return 0;
+ case COMMAND_1527:
+ script_assert(false);
+ return 0;
+ case COMMAND_1528:
+ script_assert(false);
+ return 0;
+ case COMMAND_1529:
+ script_assert(false);
+ return 0;
+ case COMMAND_1530:
+ script_assert(false);
+ return 0;
+ case COMMAND_1531:
+ script_assert(false);
+ return 0;
+ case COMMAND_1532:
+ script_assert(false);
+ return 0;
+ case COMMAND_1533:
+ script_assert(false);
+ return 0;
+ case COMMAND_1534:
+ script_assert(false);
+ return 0;
+ case COMMAND_1535:
+ script_assert(false);
+ return 0;
+ case COMMAND_1536:
+ script_assert(false);
+ return 0;
+ case COMMAND_1537:
+ script_assert(false);
+ return 0;
+ case COMMAND_1538:
+ script_assert(false);
+ return 0;
+ case COMMAND_1539:
+ script_assert(false);
+ return 0;
+ case COMMAND_1540:
+ script_assert(false);
+ return 0;
+ case COMMAND_1541:
+ script_assert(false);
+ return 0;
+ case COMMAND_1542:
+ script_assert(false);
+ return 0;
+ case COMMAND_1543:
+ script_assert(false);
+ return 0;
+ case COMMAND_1544:
+ script_assert(false);
+ return 0;
+ case COMMAND_1545:
+ script_assert(false);
+ return 0;
+ case COMMAND_1546:
+ script_assert(false);
+ return 0;
+ case COMMAND_1547:
+ script_assert(false);
+ return 0;
+ case COMMAND_1548:
+ script_assert(false);
+ return 0;
+ case COMMAND_1549:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- UpdateCompareFlag(pObject->GetIsStatic());
+ // TODO (SET_ONFOOT_CAMERA_MODE?)
return 0;
- }
- case COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS:
- {
- CollectParameters(&m_nIp, 4);
- CVector2D v1 = *(CVector2D*)&ScriptParams[0];
- CVector2D v2 = *(CVector2D*)&ScriptParams[2];
- float c = DotProduct2D(v1, v2) / (v1.Magnitude() * v2.Magnitude());
-#ifdef FIX_BUGS // command is a SA leftover where it was fixed to this
- *(float*)&ScriptParams[0] = RADTODEG(Acos(c));
-#else
- *(float*)&ScriptParams[0] = Acos(c);
-#endif
+ case COMMAND_1550:
+ script_assert(false);
return 0;
- }
- case COMMAND_DO_2D_RECTANGLES_COLLIDE:
- {
- CollectParameters(&m_nIp, 8);
- float infX1 = *(float*)&ScriptParams[0] - *(float*)&ScriptParams[2] * 0.5; // NB: not float
- float supX1 = *(float*)&ScriptParams[0] + *(float*)&ScriptParams[2] * 0.5;
- float infX2 = *(float*)&ScriptParams[4] - *(float*)&ScriptParams[6] * 0.5;
- float supX2 = *(float*)&ScriptParams[4] + *(float*)&ScriptParams[6] * 0.5;
- float infY1 = *(float*)&ScriptParams[1] - *(float*)&ScriptParams[3] * 0.5;
- float supY1 = *(float*)&ScriptParams[1] + *(float*)&ScriptParams[3] * 0.5;
- float infY2 = *(float*)&ScriptParams[5] - *(float*)&ScriptParams[7] * 0.5;
- float supY2 = *(float*)&ScriptParams[5] + *(float*)&ScriptParams[7] * 0.5;
- bool collide = true;
- if (infY2 > supY1)
- collide = false;
- if (infY1 > supY2)
- collide = false;
- if (infX2 > supX1)
- collide = false;
- if (infX1 > supX2)
- collide = false;
- UpdateCompareFlag(collide);
+ case COMMAND_1551:
+ script_assert(false);
return 0;
- }
- case COMMAND_GET_OBJECT_ROTATION_VELOCITY:
- {
+ case COMMAND_1552:
+ script_assert(false);
+ return 0;
+ case COMMAND_1553:
+ script_assert(false);
+ return 0;
+ case COMMAND_1554:
+ script_assert(false);
+ return 0;
+ case COMMAND_1555:
CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(CVector*)&ScriptParams[0] = pObject->GetTurnSpeed() * GAME_SPEED_TO_METERS_PER_SECOND;
- StoreParameters(&m_nIp, 3);
+ // TODO (FREEZE_ONFOOT_CAMERA_MODE?)
return 0;
- }
- case COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY:
- {
- CollectParameters(&m_nIp, 4);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- CVector vecAddition = *(CVector*)&ScriptParams[1] * CTimer::GetTimeStep() / GAME_SPEED_TO_METERS_PER_SECOND;
- if (!pObject->bIsStatic) {
- CVector vecCurrSpeed = pObject->GetSpeed();
- vecCurrSpeed.Normalise();
- if (vecCurrSpeed.z != 1.0) { // NB: not float!
- CVector vx = CrossProduct(vecCurrSpeed, CVector(0.0f, 0.0f, 1.0f));
- vx.Normalise();
- CVector vz = CrossProduct(vx, vecCurrSpeed);
- vz.Normalise();
- CVector vecNewSpeed = pObject->GetSpeed() + vecAddition.x * vx + vecAddition.y * vecCurrSpeed + vecAddition.z * vecCurrSpeed;
- if (pObject->bIsStatic) {
- pObject->SetIsStatic(false);
- pObject->AddToMovingList();
- }
- pObject->SetMoveSpeed(vecNewSpeed);
- }
- }
+ case COMMAND_1556:
+ script_assert(false);
+ return 0;
+ case COMMAND_1557:
+ script_assert(false);
+ return 0;
+ case COMMAND_1558:
+ script_assert(false);
+ return 0;
+ case COMMAND_1559:
+ script_assert(false);
+ return 0;
+ case COMMAND_1560:
+ // TODO (IS_E3_BUILD?)
+ UpdateCompareFlag(false);
+ return 0;
+ case COMMAND_1561:
+ script_assert(false);
+ return 0;
+ case COMMAND_1562:
+ script_assert(false);
+ return 0;
+ case COMMAND_1563:
+ script_assert(false);
+ return 0;
+ case COMMAND_1564:
+ script_assert(false);
+ return 0;
+ case COMMAND_1565:
+ script_assert(false);
+ return 0;
+ case COMMAND_1566:
+ script_assert(false);
+ return 0;
+ case COMMAND_1567:
+ script_assert(false);
+ return 0;
+ case COMMAND_1568:
+ script_assert(false);
+ return 0;
+ case COMMAND_1569:
+ // TODO (IS_MULTIPLAYER_ACTIVE?)
+ UpdateCompareFlag(false);
+ return 0;
+ case COMMAND_1570:
+ script_assert(false);
+ return 0;
+ case COMMAND_1571:
+ script_assert(false);
+ return 0;
+ case COMMAND_1572:
+ script_assert(false);
+ return 0;
+ case COMMAND_1573:
+ script_assert(false);
+ return 0;
+ case COMMAND_1574:
+ script_assert(false);
+ return 0;
+ case COMMAND_1575:
+ script_assert(false);
+ return 0;
+ case COMMAND_1576:
+ script_assert(false);
+ return 0;
+ case COMMAND_1577:
+ script_assert(false);
+ return 0;
+ case COMMAND_1578:
+ script_assert(false);
+ return 0;
+ case COMMAND_1579:
+ script_assert(false);
return 0;
+ case COMMAND_1580:
+ script_assert(false);
+ return 0;
+ case COMMAND_1581:
+ script_assert(false);
+ return 0;
+ case COMMAND_1582:
+ script_assert(false);
+ return 0;
+ case COMMAND_1583:
+ script_assert(false);
+ return 0;
+ case COMMAND_1584:
+ script_assert(false);
+ return 0;
+ case COMMAND_1585:
+ script_assert(false);
+ return 0;
+ case COMMAND_1586:
+ script_assert(false);
+ return 0;
+ case COMMAND_1587:
+ script_assert(false);
+ return 0;
+ case COMMAND_1588:
+ script_assert(false);
+ return 0;
+ case COMMAND_1589:
+ CollectParameters(&m_nIp, 2);
+ // TODO (SWAP_BUILDING?)
+ return 0;
+ case COMMAND_1590:
+ script_assert(false);
+ return 0;
+ case COMMAND_1591:
+ script_assert(false);
+ return 0;
+ case COMMAND_1592:
+ script_assert(false);
+ return 0;
+ case COMMAND_1593:
+ script_assert(false);
+ return 0;
+ case COMMAND_1594:
+ script_assert(false);
+ return 0;
+ case COMMAND_1595:
+ script_assert(false);
+ return 0;
+ case COMMAND_1596:
+ script_assert(false);
+ return 0;
+ case COMMAND_1597:
+ script_assert(false);
+ return 0;
+ case COMMAND_1598:
+ script_assert(false);
+ return 0;
+ case COMMAND_1599:
+ script_assert(false);
+ return 0;
+ default:
+ script_assert(0);
}
- case COMMAND_GET_OBJECT_SPEED:
+ return -1;
+}
+
+int8 CRunningScript::ProcessCommands1600To1699(int32 command)
+{
+ switch (command) {
+ case COMMAND_1600:
+ script_assert(false);
+ return 0;
+ case COMMAND_1601:
+ script_assert(false);
+ return 0;
+ case COMMAND_1602:
+ script_assert(false);
+ return 0;
+ case COMMAND_1603:
+ script_assert(false);
+ return 0;
+ case COMMAND_1604:
+ script_assert(false);
+ return 0;
+ case COMMAND_1605:
+ script_assert(false);
+ return 0;
+ case COMMAND_1606:
+ script_assert(false);
+ return 0;
+ case COMMAND_1607:
+ script_assert(false);
+ return 0;
+ case COMMAND_1608:
+ script_assert(false);
+ return 0;
+ case COMMAND_1609:
+ script_assert(false);
+ return 0;
+ case COMMAND_1610:
+ script_assert(false);
+ return 0;
+ case COMMAND_1611:
+ script_assert(false);
+ return 0;
+ case COMMAND_1612:
+ script_assert(false);
+ return 0;
+ case COMMAND_1613:
+ script_assert(false);
+ return 0;
+ case COMMAND_1614:
+ script_assert(false);
+ return 0;
+ case COMMAND_1615:
+ script_assert(false);
+ return 0;
+ case COMMAND_1616:
+ script_assert(false);
+ return 0;
+ case COMMAND_1617:
+ script_assert(false);
+ return 0;
+ case COMMAND_1618:
+ script_assert(false);
+ return 0;
+ case COMMAND_1619:
+ script_assert(false);
+ return 0;
+ case COMMAND_1620:
+ script_assert(false);
+ return 0;
+ case COMMAND_1621:
+ script_assert(false);
+ return 0;
+ case COMMAND_1622:
+ script_assert(false);
+ return 0;
+ case COMMAND_1623:
+ script_assert(false);
+ return 0;
+ case COMMAND_1624:
+ script_assert(false);
+ return 0;
+ case COMMAND_1625:
+ script_assert(false);
+ return 0;
+ case COMMAND_1626:
+ script_assert(false);
+ return 0;
+ case COMMAND_1627:
+ script_assert(false);
+ return 0;
+ case COMMAND_1628:
+ script_assert(false);
+ return 0;
+ case COMMAND_1629:
+ script_assert(false);
+ return 0;
+ case COMMAND_1630:
+ script_assert(false);
+ return 0;
+ case COMMAND_1631:
+ script_assert(false);
+ return 0;
+ case COMMAND_1632:
+ script_assert(false);
+ return 0;
+ case COMMAND_1633:
+ script_assert(false);
+ return 0;
+ case COMMAND_1634:
+ script_assert(false);
+ return 0;
+ case COMMAND_1635:
{
- CollectParameters(&m_nIp, 1);
- CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
- *(float*)&ScriptParams[0] = pObject->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_METERS_PER_SECOND;
- StoreParameters(&m_nIp, 1);
+ char tmp[12]; // TODO
+ CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
+ m_nIp += KEY_LENGTH_IN_SCRIPT;
+ // TODO (CHANGE_STORED_PLAYER_OUTFIT?)
return 0;
}
-#endif
-#if (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- case COMMAND_IS_MISSION_SKIP:
-#ifdef MISSION_REPLAY
- ScriptParams[0] = MissionSkipLevel;
-#else
- ScriptParams[0] = 0;
-#endif
- StoreParameters(&m_nIp, 1);
+ case COMMAND_1636:
+ script_assert(false);
return 0;
- case COMMAND_SET_IN_AMMUNATION:
- CollectParameters(&m_nIp, 1);
-#ifdef MISSION_REPLAY
- IsInAmmunation = ScriptParams[0];
-#endif
+ case COMMAND_1637:
+ script_assert(false);
+ return 0;
+ case COMMAND_1638:
+ script_assert(false);
+ return 0;
+ case COMMAND_1639:
+ script_assert(false);
return 0;
- case COMMAND_DO_SAVE_GAME:
+ case COMMAND_1640:
+ CollectParameters(&m_nIp, 2);
+ // TODO (LOCK_GARAGE?)
+ return 0;
+ case COMMAND_1641:
+ script_assert(false);
+ return 0;
+ case COMMAND_1642:
+ script_assert(false);
+ return 0;
+ case COMMAND_1643:
+ script_assert(false);
+ return 0;
+ case COMMAND_1644:
+ script_assert(false);
+ return 0;
+ case COMMAND_1645:
+ script_assert(false);
+ return 0;
+ case COMMAND_1646:
CollectParameters(&m_nIp, 1);
-#ifdef MISSION_REPLAY
- SaveGameForPause(ScriptParams[0]);
-#endif
+ // TODO (DISABLE_PAUSE_MENU?)
return 0;
- case COMMAND_IS_RETRY:
-#ifdef MISSION_REPLAY
- if (strcmp(m_abScriptName, "porno4") != 0)
- ScriptParams[0] = AllowMissionReplay;
-#ifdef FIX_BUGS
- else
- ScriptParams[0] = gbTryingPorn4Again;
-#else
- else if (gbTryingPorn4Again)
- ScriptParams[0] = 1;
-#endif
-#else
- ScriptParams[0] = 0;
-#endif
- StoreParameters(&m_nIp, 1);
+ case COMMAND_1647:
+ script_assert(false);
return 0;
- case COMMAND_DUMMY:
+ case COMMAND_1648:
+ CollectParameters(&m_nIp, 3);
+ // TODO (SET_CLOCK_EVENT_WARNING);
return 0;
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- // it is unknown what these commands do but they don't take parameters
- case COMMAND_MARK_CUTSCENE_START:
+ case COMMAND_1649:
+ script_assert(false);
return 0;
- case COMMAND_MARK_CUTSCENE_END:
+ case COMMAND_1650:
+ script_assert(false);
return 0;
- case COMMAND_CUTSCENE_SCROLL:
+ case COMMAND_1651:
+ script_assert(false);
+ return 0;
+ case COMMAND_1652:
+ script_assert(false);
+ return 0;
+ case COMMAND_1653:
+ script_assert(false);
+ return 0;
+ case COMMAND_1654:
+ script_assert(false);
+ return 0;
+ case COMMAND_1655:
+ script_assert(false);
+ return 0;
+ case COMMAND_1656:
+ script_assert(false);
return 0;
-#endif
default:
script_assert(0);
}
diff --git a/src/control/ScriptCommands.h b/src/control/ScriptCommands.h
index 8cf73abd..105fa82f 100644
--- a/src/control/ScriptCommands.h
+++ b/src/control/ScriptCommands.h
@@ -1442,39 +1442,222 @@ enum {
COMMAND_REGISTER_FIRE_LEVEL,
COMMAND_IS_AUSTRALIAN_GAME,
COMMAND_DISARM_CAR_BOMB,
-#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
COMMAND_IS_JAPANESE_GAME,
-#elif (!defined GTA_PS2)
- COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED,
-#endif
-#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- COMMAND_SHUFFLE_CARD_DECKS,
- COMMAND_FETCH_NEXT_CARD,
- COMMAND_GET_OBJECT_VELOCITY,
- COMMAND_IS_DEBUG_CAMERA_ON,
- COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY,
- COMMAND_SET_OBJECT_ROTATION_VELOCITY,
- COMMAND_IS_OBJECT_STATIC,
- COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS,
- COMMAND_DO_2D_RECTANGLES_COLLIDE,
- COMMAND_GET_OBJECT_ROTATION_VELOCITY,
- COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY,
- COMMAND_GET_OBJECT_SPEED,
-#endif
-#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT)
- COMMAND_MARK_CUTSCENE_START,
- COMMAND_MARK_CUTSCENE_END,
- COMMAND_CUTSCENE_SCROLL,
-#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT)
- COMMAND_IS_MISSION_SKIP,
- COMMAND_SET_IN_AMMUNATION,
- COMMAND_DO_SAVE_GAME,
- COMMAND_IS_RETRY,
- COMMAND_DUMMY,
- COMMAND_MARK_CUTSCENE_START,
- COMMAND_MARK_CUTSCENE_END,
- COMMAND_CUTSCENE_SCROLL,
-#endif
+ COMMAND_1442,
+ COMMAND_1443,
+ COMMAND_1444,
+ COMMAND_1445,
+ COMMAND_1446,
+ COMMAND_1447,
+ COMMAND_1448,
+ COMMAND_1449,
+ COMMAND_1450,
+ COMMAND_1451,
+ COMMAND_1452,
+ COMMAND_1453,
+ COMMAND_CALL,
+ COMMAND_NOTCALL,
+ COMMAND_1456,
+ COMMAND_1457,
+ COMMAND_1458,
+ COMMAND_1459,
+ COMMAND_1460,
+ COMMAND_1461,
+ COMMAND_1462,
+ COMMAND_1463,
+ COMMAND_1464,
+ COMMAND_1465,
+ COMMAND_1466,
+ COMMAND_1467,
+ COMMAND_1468,
+ COMMAND_1469,
+ COMMAND_1470,
+ COMMAND_1471,
+ COMMAND_1472,
+ COMMAND_1473,
+ COMMAND_1474,
+ COMMAND_1475,
+ COMMAND_1476,
+ COMMAND_1477,
+ COMMAND_1478,
+ COMMAND_1479,
+ COMMAND_1480,
+ COMMAND_1481,
+ COMMAND_1482,
+ COMMAND_1483,
+ COMMAND_1484,
+ COMMAND_1485,
+ COMMAND_1486,
+ COMMAND_1487,
+ COMMAND_1488,
+ COMMAND_1489,
+ COMMAND_1490,
+ COMMAND_1491,
+ COMMAND_1492,
+ COMMAND_1493,
+ COMMAND_1494,
+ COMMAND_1495,
+ COMMAND_1496,
+ COMMAND_1497,
+ COMMAND_1498,
+ COMMAND_1499,
+ COMMAND_1500,
+ COMMAND_1501,
+ COMMAND_1502,
+ COMMAND_1503,
+ COMMAND_1504,
+ COMMAND_1505,
+ COMMAND_1506,
+ COMMAND_1507,
+ COMMAND_1508,
+ COMMAND_1509,
+ COMMAND_1510,
+ COMMAND_1511,
+ COMMAND_1512,
+ COMMAND_1513,
+ COMMAND_1514,
+ COMMAND_1515,
+ COMMAND_1516,
+ COMMAND_1517,
+ COMMAND_1518,
+ COMMAND_1519,
+ COMMAND_1520,
+ COMMAND_1521,
+ COMMAND_1522,
+ COMMAND_1523,
+ COMMAND_1524,
+ COMMAND_1525,
+ COMMAND_1526,
+ COMMAND_1527,
+ COMMAND_1528,
+ COMMAND_1529,
+ COMMAND_1530,
+ COMMAND_1531,
+ COMMAND_1532,
+ COMMAND_1533,
+ COMMAND_1534,
+ COMMAND_1535,
+ COMMAND_1536,
+ COMMAND_1537,
+ COMMAND_1538,
+ COMMAND_1539,
+ COMMAND_1540,
+ COMMAND_1541,
+ COMMAND_1542,
+ COMMAND_1543,
+ COMMAND_1544,
+ COMMAND_1545,
+ COMMAND_1546,
+ COMMAND_1547,
+ COMMAND_1548,
+ COMMAND_1549,
+ COMMAND_1550,
+ COMMAND_1551,
+ COMMAND_1552,
+ COMMAND_1553,
+ COMMAND_1554,
+ COMMAND_1555,
+ COMMAND_1556,
+ COMMAND_1557,
+ COMMAND_1558,
+ COMMAND_1559,
+ COMMAND_1560,
+ COMMAND_1561,
+ COMMAND_1562,
+ COMMAND_1563,
+ COMMAND_1564,
+ COMMAND_1565,
+ COMMAND_1566,
+ COMMAND_1567,
+ COMMAND_1568,
+ COMMAND_1569,
+ COMMAND_1570,
+ COMMAND_1571,
+ COMMAND_1572,
+ COMMAND_1573,
+ COMMAND_1574,
+ COMMAND_1575,
+ COMMAND_1576,
+ COMMAND_1577,
+ COMMAND_1578,
+ COMMAND_1579,
+ COMMAND_1580,
+ COMMAND_1581,
+ COMMAND_1582,
+ COMMAND_1583,
+ COMMAND_1584,
+ COMMAND_1585,
+ COMMAND_1586,
+ COMMAND_1587,
+ COMMAND_1588,
+ COMMAND_1589,
+ COMMAND_1590,
+ COMMAND_1591,
+ COMMAND_1592,
+ COMMAND_1593,
+ COMMAND_1594,
+ COMMAND_1595,
+ COMMAND_1596,
+ COMMAND_1597,
+ COMMAND_1598,
+ COMMAND_1599,
+ COMMAND_1600,
+ COMMAND_1601,
+ COMMAND_1602,
+ COMMAND_1603,
+ COMMAND_1604,
+ COMMAND_1605,
+ COMMAND_1606,
+ COMMAND_1607,
+ COMMAND_1608,
+ COMMAND_1609,
+ COMMAND_1610,
+ COMMAND_1611,
+ COMMAND_1612,
+ COMMAND_1613,
+ COMMAND_1614,
+ COMMAND_1615,
+ COMMAND_1616,
+ COMMAND_1617,
+ COMMAND_1618,
+ COMMAND_1619,
+ COMMAND_1620,
+ COMMAND_1621,
+ COMMAND_1622,
+ COMMAND_1623,
+ COMMAND_1624,
+ COMMAND_1625,
+ COMMAND_1626,
+ COMMAND_1627,
+ COMMAND_1628,
+ COMMAND_1629,
+ COMMAND_1630,
+ COMMAND_1631,
+ COMMAND_1632,
+ COMMAND_1633,
+ COMMAND_1634,
+ COMMAND_1635,
+ COMMAND_1636,
+ COMMAND_1637,
+ COMMAND_1638,
+ COMMAND_1639,
+ COMMAND_1640,
+ COMMAND_1641,
+ COMMAND_1642,
+ COMMAND_1643,
+ COMMAND_1644,
+ COMMAND_1645,
+ COMMAND_1646,
+ COMMAND_1647,
+ COMMAND_1648,
+ COMMAND_1649,
+ COMMAND_1650,
+ COMMAND_1651,
+ COMMAND_1652,
+ COMMAND_1653,
+ COMMAND_1654,
+ COMMAND_1655,
+ COMMAND_1656,
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND
#endif
@@ -1493,7 +1676,9 @@ enum eScriptArgument
ARGTYPE_PED_HANDLE,
ARGTYPE_VEHICLE_HANDLE,
ARGTYPE_OBJECT_HANDLE,
- ARGTYPE_ANDOR
+ ARGTYPE_ANDOR,
+ ARGTYPE_LIST,
+ ARGTYPE_FUNCTION
};
struct tScriptCommandData
diff --git a/src/core/config.h b/src/core/config.h
index 4aaeb3c1..facbaacd 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -97,7 +97,7 @@ enum Config {
NUMPACMANPICKUPS = 256,
NUMEVENTS = 64,
- NUM_CARGENS = 185,
+ NUM_CARGENS = 500,
NUM_PATH_NODES_IN_AUTOPILOT = 8,
@@ -334,7 +334,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#endif
//#define SIMPLIER_MISSIONS // apply simplifications from mobile
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
-#define SCRIPT_LOG_FILE_LEVEL 0 // 0 == no log, 1 == overwrite every frame, 2 == full log
+#define SCRIPT_LOG_FILE_LEVEL 2 // 0 == no log, 1 == overwrite every frame, 2 == full log
#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT