1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 20:20:02 +00:00

Merge branch 'lcs-dev' into lcs

This commit is contained in:
Nikolay Korolev 2021-01-09 17:35:57 +03:00
commit a38d0a0fbd
9 changed files with 1259 additions and 407 deletions

View file

@ -1494,9 +1494,9 @@ void CGarage::BuildRotatedDoorMatrix(CEntity * pDoor, float fPosition)
void CGarage::UpdateCrusherAngle() void CGarage::UpdateCrusherAngle()
{ {
RefreshDoorPointers(false); RefreshDoorPointers(false);
m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); //m_pDoor2->GetMatrix().SetRotateXOnly(TWOPI - m_fDoorPos); TODO
m_pDoor2->GetMatrix().UpdateRW(); //m_pDoor2->GetMatrix().UpdateRW();
m_pDoor2->UpdateRwFrame(); //m_pDoor2->UpdateRwFrame();
} }
void CGarage::UpdateCrusherShake(float X, float Y) void CGarage::UpdateCrusherShake(float X, float Y)

View file

@ -98,10 +98,6 @@ uint32 CTheScripts::LastMissionPassedTime;
uint16 CTheScripts::NumberOfExclusiveMissionScripts; uint16 CTheScripts::NumberOfExclusiveMissionScripts;
bool CTheScripts::bPlayerHasMetDebbieHarry; bool CTheScripts::bPlayerHasMetDebbieHarry;
bool CTheScripts::bPlayerIsInTheStatium; 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]; int CTheScripts::AllowedCollision[MAX_ALLOWED_COLLISIONS];
bool CTheScripts::FSDestroyedFlag; bool CTheScripts::FSDestroyedFlag;
short* CTheScripts::SavedVarIndices; short* CTheScripts::SavedVarIndices;
@ -110,6 +106,8 @@ int gScriptsFile = -1;
int CTheScripts::NextProcessId = 1; int CTheScripts::NextProcessId = 1;
bool CTheScripts::InTheScripts; bool CTheScripts::InTheScripts;
CRunningScript* pCurrent; CRunningScript* pCurrent;
uint16 CTheScripts::NumTrueGlobals;
uint16 CTheScripts::MostGlobals;
#ifdef MISSION_REPLAY #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_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_IS_AUSTRALIAN_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
REGISTER_COMMAND(COMMAND_DISARM_CAR_BOMB, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -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, ""), REGISTER_COMMAND(COMMAND_IS_JAPANESE_GAME, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""),
#elif (!defined GTA_PS2) REGISTER_COMMAND(COMMAND_1442, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1443, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#endif REGISTER_COMMAND(COMMAND_1444, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#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_1445, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_SHUFFLE_CARD_DECKS, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1446, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_FETCH_NEXT_CARD, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), REGISTER_COMMAND(COMMAND_1447, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), 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_1448, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_DEBUG_CAMERA_ON, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_1449, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -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_1450, INPUT_ARGUMENTS(), 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_1451, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_OBJECT_STATIC, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), true, -1, ""), REGISTER_COMMAND(COMMAND_1452, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -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_1453, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), 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_CALL, INPUT_ARGUMENTS(ARGTYPE_FUNCTION, ), OUTPUT_ARGUMENTS(), false, -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_NOTCALL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), 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_1456, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_GET_OBJECT_SPEED, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ), false, -1, ""), REGISTER_COMMAND(COMMAND_1457, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#endif REGISTER_COMMAND(COMMAND_1458, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT) REGISTER_COMMAND(COMMAND_1459, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1460, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1461, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1462, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) REGISTER_COMMAND(COMMAND_1463, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_MISSION_SKIP, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), REGISTER_COMMAND(COMMAND_1464, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_SET_IN_AMMUNATION, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1465, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_DO_SAVE_GAME, INPUT_ARGUMENTS(ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1466, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_IS_RETRY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_INT, ), false, -1, ""), REGISTER_COMMAND(COMMAND_1467, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_DUMMY, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1468, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_START, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1469, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_MARK_CUTSCENE_END, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1470, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
REGISTER_COMMAND(COMMAND_CUTSCENE_SCROLL, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""), REGISTER_COMMAND(COMMAND_1471, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
#endif 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 REGISTER_COMMAND
#undef INPUT_ARGUMENTS #undef INPUT_ARGUMENTS
@ -2261,18 +2442,14 @@ int CRunningScript::CollectParameterForDebug(char* buf, bool& var)
case ARGUMENT_INT32: case ARGUMENT_INT32:
case ARGUMENT_FLOAT: case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(&m_nIp); return CTheScripts::Read4BytesFromScript(&m_nIp);
break;
case ARGUMENT_INT8: case ARGUMENT_INT8:
return CTheScripts::Read1ByteFromScript(&m_nIp); return CTheScripts::Read1ByteFromScript(&m_nIp);
break;
case ARGUMENT_INT16: case ARGUMENT_INT16:
return CTheScripts::Read2BytesFromScript(&m_nIp); return CTheScripts::Read2BytesFromScript(&m_nIp);
break;
default: default:
var = true; var = true;
--m_nIp; --m_nIp;
GetPointerToScriptVariableForDebug(this, &m_nIp, buf); return *GetPointerToScriptVariableForDebug(this, &m_nIp, buf);
break;
} }
return 0; return 0;
} }
@ -2298,12 +2475,12 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
case ARGUMENT_FLOAT_ZERO: case ARGUMENT_FLOAT_ZERO:
return 0; return 0;
case ARGUMENT_FLOAT_1BYTE: case ARGUMENT_FLOAT_1BYTE:
return (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 24; return (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 24;
case ARGUMENT_FLOAT_2BYTES: case ARGUMENT_FLOAT_2BYTES:
return (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16; return (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
case ARGUMENT_FLOAT_3BYTES: case ARGUMENT_FLOAT_3BYTES:
tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(&m_nIp) << 8; tmp = (uint32)(uint8)CTheScripts::Read1ByteFromScript(pIp) << 8;
tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(&m_nIp) << 16; tmp |= (uint32)(uint16)CTheScripts::Read2BytesFromScript(pIp) << 16;
return tmp; return tmp;
case ARGUMENT_INT32: case ARGUMENT_INT32:
return CTheScripts::Read4BytesFromScript(pIp); return CTheScripts::Read4BytesFromScript(pIp);
@ -2314,7 +2491,7 @@ int32 CRunningScript::CollectNextParameterWithoutIncreasingPC(uint32 ip)
case ARGUMENT_FLOAT: case ARGUMENT_FLOAT:
return CTheScripts::Read4BytesFromScript(pIp); return CTheScripts::Read4BytesFromScript(pIp);
default: default:
pIp--; (*pIp)--;
return *GetPointerToScriptVariable(pIp, 0); return *GetPointerToScriptVariable(pIp, 0);
} }
return -1; return -1;
@ -2339,11 +2516,11 @@ int32* GetPointerToScriptVariable(CRunningScript* pScript, uint32* pIp)
script_assert(size > 0); script_assert(size > 0);
script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size); script_assert(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id] < size);
uint8 index = Min(pScript->m_anLocalVariables[pScript->m_nLocalsPointer + index_id], size - 1); 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) { else if (type >= ARGUMENT_GLOBAL) {
uint8 index_in_block = CTheScripts::Read1ByteFromScript(pIp); 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) { else if (type >= ARGUMENT_LOCAL_ARRAY) {
uint8 index_id = CTheScripts::Read1ByteFromScript(pIp); uint8 index_id = CTheScripts::Read1ByteFromScript(pIp);
@ -2488,7 +2665,6 @@ bool CTheScripts::Init(bool loaddata)
memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize); memset(ScriptSpace, 0, MainScriptSize + nLargestMissionSize);
CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize); CFileMgr::Read(mainf, (char*)ScriptSpace, MainScriptSize);
gScriptsFile = mainf; gScriptsFile = mainf;
CFileMgr::CloseFile(mainf);
CFileMgr::SetDir(""); CFileMgr::SetDir("");
ReadObjectNamesFromScript(); ReadObjectNamesFromScript();
UpdateObjectIndices(); UpdateObjectIndices();
@ -2598,6 +2774,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip)
return pNew; return pNew;
} }
// done(LCS)
void CTheScripts::Process() void CTheScripts::Process()
{ {
if (CReplay::IsPlayingBack()) if (CReplay::IsPlayingBack())
@ -2738,6 +2915,7 @@ void CRunningScript::Process()
CMessages::BriefMessages[0].m_nStartTime = 0; CMessages::BriefMessages[0].m_nStartTime = 0;
} }
// done(LCS)
int8 CRunningScript::ProcessOneCommand() int8 CRunningScript::ProcessOneCommand()
{ {
int8 retval = -1; int8 retval = -1;
@ -2748,13 +2926,37 @@ int8 CRunningScript::ProcessOneCommand()
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
char commandInfo[1024]; char commandInfo[1024];
uint32 ip = m_nIp; uint32 ip = m_nIp;
uint8 nInputParams;
uint8 nOutputParameters;
uint8 nLocalsOffset;
if (command < ARRAY_SIZE(commands)) { if (command < ARRAY_SIZE(commands)) {
script_assert(commands[command].id == command); 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) if (m_bNotFlag)
strcat(commandInfo, "NOT "); strcat(commandInfo, "NOT ");
if (commands[command].position == -1) if (commands[command].position == -1)
strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1); strcat(commandInfo, commands[command].name + sizeof("COMMAND_") - 1);
if (commands[command].input[0] == ARGTYPE_FUNCTION) {
char tmp[32];
bool var = false;
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);
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++) { for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
char tmp[32]; char tmp[32];
bool var = false; bool var = false;
@ -2775,6 +2977,7 @@ int8 CRunningScript::ProcessOneCommand()
if (commands[command].position == i) if (commands[command].position == i)
strcat(commandInfo, commands[command].name_override); strcat(commandInfo, commands[command].name_override);
} }
}
uint32 t = m_nIp; uint32 t = m_nIp;
m_nIp = ip; m_nIp = ip;
ip = t; ip = t;
@ -2810,10 +3013,10 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands1300To1399(command); retval = ProcessCommands1300To1399(command);
else if (command < 1497) else if (command < 1497)
retval = ProcessCommands1400To1499(command); retval = ProcessCommands1400To1499(command);
//else if (command < 1600) // TODO else if (command < 1600)
// retval = ProcessCommands1500To1599(command); retval = ProcessCommands1500To1599(command);
//else if (command < 1700) else if (command < 1700)
// retval = ProcessCommands1600To1699(command); retval = ProcessCommands1600To1699(command);
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
if (command < ARRAY_SIZE(commands)) { if (command < ARRAY_SIZE(commands)) {
if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) { if (commands[command].cond || commands[command].output[0] != ARGTYPE_NONE) {
@ -2823,6 +3026,7 @@ int8 CRunningScript::ProcessOneCommand()
uint32 t = m_nIp; uint32 t = m_nIp;
m_nIp = ip; m_nIp = ip;
ip = t; ip = t;
if (commands[command].input[0] != ARGTYPE_FUNCTION) {
for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) { for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
char tmp[32]; char tmp[32];
switch (commands[command].output[i]) { switch (commands[command].output[i]) {
@ -2834,6 +3038,7 @@ int8 CRunningScript::ProcessOneCommand()
default: script_assert(0 && "Script only returns INTs and FLOATs"); default: script_assert(0 && "Script only returns INTs and FLOATs");
} }
} }
}
m_nIp = ip; m_nIp = ip;
} }
PrintToLog("%s\n", commandInfo); PrintToLog("%s\n", commandInfo);
@ -2869,7 +3074,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
return 1; return 1;
case COMMAND_GOTO: case COMMAND_GOTO:
CollectParameters(&m_nIp, 1); 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 >= */ /* 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 */ /* 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 */ /* 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_VAR_NOT_EQUAL_TO_FLOAT_VAR:
//case COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR: //case COMMAND_IS_FLOAT_LVAR_NOT_EQUAL_TO_FLOAT_LVAR:
//case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR: //case COMMAND_IS_FLOAT_VAR_NOT_EQUAL_TO_FLOAT_LVAR:
/*
case COMMAND_GOTO_IF_TRUE: case COMMAND_GOTO_IF_TRUE:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
if (m_bCondResult) 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; return 0;
*/
case COMMAND_GOTO_IF_FALSE: case COMMAND_GOTO_IF_FALSE:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
if (!m_bCondResult) 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. */ /* Check COMMAND_GOTO note. */
return 0; return 0;
case COMMAND_TERMINATE_THIS_SCRIPT: case COMMAND_TERMINATE_THIS_SCRIPT:
@ -3362,45 +3565,17 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
script_assert(ScriptParams[0] >= 0); script_assert(ScriptParams[0] >= 0);
CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]); CRunningScript* pNew = CTheScripts::StartNewScript(ScriptParams[0]);
m_bIsActive = true; CollectParameters(&m_nIp, NUM_LOCAL_VARS, pNew->m_anLocalVariables);
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;
}
}
return 0; return 0;
} }
case COMMAND_GOSUB: case COMMAND_GOSUB:
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
script_assert(m_nStackPointer < MAX_STACK_DEPTH); script_assert(m_nStackPointer < MAX_STACK_DEPTH);
m_anStack[m_nStackPointer++] = m_nIp; 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; return 0;
case COMMAND_RETURN: case COMMAND_RETURN:
script_assert(m_nStackPointer > 0); /* No more SSU */ ReturnFromGosubOrFunction();
SetIP(m_anStack[--m_nStackPointer]);
return 0; return 0;
case COMMAND_LINE: case COMMAND_LINE:
CollectParameters(&m_nIp, 6); CollectParameters(&m_nIp, 6);
@ -3434,7 +3609,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
{ {
CVector pos; CVector pos;
CollectParameters(&m_nIp, 1); 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(); pos = CWorld::Players[ScriptParams[0]].m_pPed->m_pMyVehicle->GetPosition();
else else
pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition(); pos = CWorld::Players[ScriptParams[0]].m_pPed->GetPosition();
@ -3450,7 +3625,7 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CPlayerPed* ped = CWorld::Players[index].m_pPed; CPlayerPed* ped = CWorld::Players[index].m_pPed;
if (ped->bInVehicle) { if (ped->bInVehicle && ped->m_pMyVehicle) {
pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += ped->m_pMyVehicle->GetDistanceFromCentreOfMassToBaseOfModel();
ped->m_pMyVehicle->Teleport(pos); // removed dumb stuff that was present here ped->m_pMyVehicle->Teleport(pos); // removed dumb stuff that was present here
CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle); CTheScripts::ClearSpaceForMissionEntity(pos, ped->m_pMyVehicle);
@ -4441,14 +4616,14 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
case COMMAND_DEBUG_OFF: case COMMAND_DEBUG_OFF:
CTheScripts::DbgFlag = false; CTheScripts::DbgFlag = false;
return 0; return 0;
/*
case COMMAND_RETURN_TRUE: case COMMAND_RETURN_TRUE:
UpdateCompareFlag(true); UpdateCompareFlag(true);
ReturnFromGosubOrFunction();
return 0; return 0;
case COMMAND_RETURN_FALSE: case COMMAND_RETURN_FALSE:
UpdateCompareFlag(false); UpdateCompareFlag(false);
ReturnFromGosubOrFunction();
return 0; return 0;
*/
//case COMMAND_VAR_INT: //case COMMAND_VAR_INT:
default: default:
script_assert(0); script_assert(0);
@ -5022,6 +5197,24 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
return -1; 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 #ifdef MISSION_REPLAY
bool CRunningScript::CanAllowMissionReplay() bool CRunningScript::CanAllowMissionReplay()
@ -5102,9 +5295,9 @@ CTheScripts::SwitchToMission(int32 mission)
int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#endif #endif
CFileMgr::Seek(handle, offset, 0); 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); CFileMgr::CloseFile(handle);
CRunningScript* pMissionScript = CTheScripts::StartNewScript(SIZE_MAIN_SCRIPT); CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
CTimer::Resume(); CTimer::Resume();
pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true; pMissionScript->m_bMissionFlag = true;

View file

@ -271,16 +271,6 @@ enum {
VAR_GLOBAL = 2, VAR_GLOBAL = 2,
}; };
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 { enum {
MAX_NUM_SCRIPTS = 128, MAX_NUM_SCRIPTS = 128,
MAX_NUM_INTRO_TEXT_LINES = 48, MAX_NUM_INTRO_TEXT_LINES = 48,
@ -337,15 +327,6 @@ public:
static uint16 ScriptsUpdated; static uint16 ScriptsUpdated;
static uint32 LastMissionPassedTime; static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts; 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 bool bPlayerIsInTheStatium;
static uint8 RiotIntensity; static uint8 RiotIntensity;
@ -358,6 +339,8 @@ public:
static int NextProcessId; static int NextProcessId;
static bool InTheScripts; static bool InTheScripts;
static CRunningScript* pCurrent; static CRunningScript* pCurrent;
static uint16 NumTrueGlobals;
static uint16 MostGlobals;
static bool Init(bool loaddata = false); static bool Init(bool loaddata = false);
static void Process(); static void Process();
@ -476,6 +459,8 @@ public:
extern int ScriptParams[32]; extern int ScriptParams[32];
VALIDATE_SIZE(uStackReturnValue, 4);
class CRunningScript class CRunningScript
{ {
enum { enum {
@ -498,6 +483,15 @@ class CRunningScript
ORS_8 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: public:
CRunningScript* next; CRunningScript* next;
CRunningScript* prev; CRunningScript* prev;
@ -564,6 +558,8 @@ public:
int8 ProcessCommands1200To1299(int32); int8 ProcessCommands1200To1299(int32);
int8 ProcessCommands1300To1399(int32); int8 ProcessCommands1300To1399(int32);
int8 ProcessCommands1400To1499(int32); int8 ProcessCommands1400To1499(int32);
int8 ProcessCommands1500To1599(int32);
int8 ProcessCommands1600To1699(int32);
void LocatePlayerCommand(int32, uint32*); void LocatePlayerCommand(int32, uint32*);
void LocatePlayerCharCommand(int32, uint32*); void LocatePlayerCharCommand(int32, uint32*);
@ -601,11 +597,11 @@ public:
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal); 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); static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
void ReturnFromGosubOrFunction();
}; };
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER

View file

@ -1639,7 +1639,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius())); UpdateCompareFlag(TheCamera.IsSphereVisible(pObject->GetBoundCentre(), pObject->GetBoundRadius()));
return 0; return 0;
} }
/*
case COMMAND_GOSUB_FILE: case COMMAND_GOSUB_FILE:
{ {
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
@ -1649,7 +1648,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
// ScriptParams[1] == filename // ScriptParams[1] == filename
return 0; return 0;
} }
*/
case COMMAND_GET_GROUND_Z_FOR_3D_COORD: case COMMAND_GET_GROUND_Z_FOR_3D_COORD:
{ {
CollectParameters(&m_nIp, 3); CollectParameters(&m_nIp, 3);
@ -2126,7 +2124,6 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0); CGarages::ChangeGarageType(ScriptParams[0], ScriptParams[1], 0);
return 0; return 0;
/*
case COMMAND_ACTIVATE_CRUSHER_CRANE: case COMMAND_ACTIVATE_CRUSHER_CRANE:
{ {
CollectParameters(&m_nIp, 10); CollectParameters(&m_nIp, 10);
@ -2148,6 +2145,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
return 0; return 0;
} }
/*
case COMMAND_PRINT_WITH_2_NUMBERS: case COMMAND_PRINT_WITH_2_NUMBERS:
{ {
wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp); wchar* text = CTheScripts::GetTextByKeyFromScript(&m_nIp);

View file

@ -2740,6 +2740,9 @@ void CTheScripts::ReadObjectNamesFromScript()
{ {
int32 varSpace = GetSizeOfVariableSpace(); int32 varSpace = GetSizeOfVariableSpace();
uint32 ip = varSpace + 8; uint32 ip = varSpace + 8;
NumSaveVars = Read4BytesFromScript(&ip);
SavedVarIndices = (short*)&ScriptParams[ip];
ip += 2 * NumSaveVars;
NumberOfUsedObjects = Read2BytesFromScript(&ip); NumberOfUsedObjects = Read2BytesFromScript(&ip);
ip += 2; ip += 2;
for (uint16 i = 0; i < NumberOfUsedObjects; i++) { for (uint16 i = 0; i < NumberOfUsedObjects; i++) {
@ -2784,7 +2787,8 @@ void CTheScripts::ReadMultiScriptFileOffsetsFromScript()
uint32 ip = varSpace + 3; uint32 ip = varSpace + 3;
int32 objectSize = Read4BytesFromScript(&ip); int32 objectSize = Read4BytesFromScript(&ip);
ip = objectSize + 8; ip = objectSize + 8;
MainScriptSize = Read4BytesFromScript(&ip); NumTrueGlobals = Read2BytesFromScript(&ip);
MostGlobals = Read2BytesFromScript(&ip);
LargestMissionScriptSize = Read4BytesFromScript(&ip); LargestMissionScriptSize = Read4BytesFromScript(&ip);
NumberOfMissionScripts = Read2BytesFromScript(&ip); NumberOfMissionScripts = Read2BytesFromScript(&ip);
NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip); NumberOfExclusiveMissionScripts = Read2BytesFromScript(&ip);

View file

@ -374,32 +374,30 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{ {
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
if (CTheScripts::NumberOfExclusiveMissionScripts > 0 && ScriptParams[0] <= UINT16_MAX - 2) if (CTheScripts::NumberOfExclusiveMissionScripts > 0) {
if (ScriptParams[0] < UINT16_MAX - 1)
return 0; return 0;
ScriptParams[0] = UINT16_MAX - ScriptParams[0];
}
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
missionRetryScriptIndex = ScriptParams[0]; missionRetryScriptIndex = ScriptParams[0];
if (missionRetryScriptIndex == 19) if (missionRetryScriptIndex == 19)
CStats::LastMissionPassedName[0] = '\0'; CStats::LastMissionPassedName[0] = '\0';
#endif #endif
CTimer::Suspend(); CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; int offset = CTheScripts::MultiScriptArray[ScriptParams[0]] + 8;
#ifdef USE_DEBUG_SCRIPT_LOADER int size = CTheScripts::MultiScriptArray[ScriptParams[0] + 1] - CTheScripts::MultiScriptArray[ScriptParams[0]];
CFileMgr::ChangeDir("\\data\\"); if (size <= 0)
int handle = CFileMgr::OpenFile(scriptfile, "rb"); size = CTheScripts::LargestMissionScriptSize;
CFileMgr::ChangeDir("\\"); CFileMgr::Seek(gScriptsFile, offset, 0);
#else CFileMgr::Read(gScriptsFile, (const char*)&CTheScripts::ScriptSpace[CTheScripts::MainScriptSize], size); // TODO
CFileMgr::ChangeDir("\\"); CRunningScript* pMissionScript = CTheScripts::StartNewScript(CTheScripts::MainScriptSize);
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);
CTimer::Resume(); CTimer::Resume();
pMissionScript->m_bIsMissionScript = true; pMissionScript->m_bIsMissionScript = true;
pMissionScript->m_bMissionFlag = true; pMissionScript->m_bMissionFlag = true;
CTheScripts::bAlreadyRunningAMissionScript = true; CTheScripts::bAlreadyRunningAMissionScript = true;
CGameLogic::ClearShortCut(); memset(&CTheScripts::ScriptSpace[CTheScripts::NumTrueGlobals * 4 + 8], 0, CTheScripts::MostGlobals * 4);
pMissionScript->Process();
return 0; return 0;
} }
case COMMAND_SET_OBJECT_DRAW_LAST: case COMMAND_SET_OBJECT_DRAW_LAST:

View file

@ -384,7 +384,6 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
} }
return 0; return 0;
} }
#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
case COMMAND_IS_JAPANESE_GAME: case COMMAND_IS_JAPANESE_GAME:
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE); UpdateCompareFlag(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_JAPANESE);
@ -394,218 +393,697 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
UpdateCompareFlag(false); UpdateCompareFlag(false);
#endif #endif
return 0; return 0;
#elif (!defined GTA_PS2) case COMMAND_1442:
case COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED: script_assert(false);
script_assert(CTheScripts::ScriptSpace[m_nIp++] == ARGUMENT_GLOBALVAR); return 0;
uint16 var = CTheScripts::Read2BytesFromScript(&m_nIp); case COMMAND_1443:
CollectParameters(&m_nIp, 1); script_assert(false);
//CUserDisplay::OnscnTimer.SetCounterFlashWhenFirstDisplayed(var, ScriptParams[0]); return 0;
break; case COMMAND_1444:
#endif script_assert(false);
#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) return 0;
case COMMAND_SHUFFLE_CARD_DECKS: 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); CollectParameters(&m_nIp, 1);
script_assert(ScriptParams[0] >= 0 && ScriptParams[0] <= 6); if (nInputParams)
for (int i = 0; i < CARDS_IN_STACK; i++) CollectParameters(&m_nIp, nInputParams, &m_anLocalVariables[m_nLocalsPointer + nLocalsOffset]);
CTheScripts::CardStack[i] = 0; m_nLocalsPointer += nLocalsOffset;
int16 seq[CARDS_IN_STACK]; m_anStack[m_nStackPointer - 1] |= (m_nIp - nIPBeforeParameters) << STACKVALUE_IP_PARAMS_OFFSET;
for (int i = 0; i < MAX_DECKS * CARDS_IN_DECK; i++) if (ScriptParams[0] < 0)
seq[i] = i; m_nIp = CTheScripts::MainScriptSize - ScriptParams[0];
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 else
seq[l] = 0; m_nIp = ScriptParams[0];
}
--cards_left;
}
}
CTheScripts::CardStackPosition = 0;
return 0; return 0;
} }
case COMMAND_FETCH_NEXT_CARD: case COMMAND_1456:
{ script_assert(false);
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);
return 0; return 0;
} case COMMAND_1457:
case COMMAND_GET_OBJECT_VELOCITY: script_assert(false);
{
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);
return 0; return 0;
} case COMMAND_1458:
case COMMAND_IS_DEBUG_CAMERA_ON: script_assert(false);
UpdateCompareFlag(TheCamera.WorldViewerBeingUsed);
return 0; return 0;
case COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY: case COMMAND_1459:
{ script_assert(false);
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);
return 0; return 0;
} case COMMAND_1460:
case COMMAND_SET_OBJECT_ROTATION_VELOCITY: script_assert(false);
{
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);
return 0; return 0;
} case COMMAND_1461:
case COMMAND_IS_OBJECT_STATIC: script_assert(false);
{
CollectParameters(&m_nIp, 1);
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
UpdateCompareFlag(pObject->GetIsStatic());
return 0; return 0;
} case COMMAND_1462:
case COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS: script_assert(false);
{
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
return 0; return 0;
} case COMMAND_1463:
case COMMAND_DO_2D_RECTANGLES_COLLIDE: script_assert(false);
{
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);
return 0; return 0;
} case COMMAND_1464:
case COMMAND_GET_OBJECT_ROTATION_VELOCITY: script_assert(false);
{
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);
return 0; return 0;
} case COMMAND_1465:
case COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY: script_assert(false);
{
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);
}
}
return 0; return 0;
} case COMMAND_1466:
case COMMAND_GET_OBJECT_SPEED: script_assert(false);
{
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);
return 0; return 0;
} case COMMAND_1467:
#endif script_assert(false);
#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);
return 0; return 0;
case COMMAND_SET_IN_AMMUNATION: case COMMAND_1468:
CollectParameters(&m_nIp, 1); script_assert(false);
#ifdef MISSION_REPLAY
IsInAmmunation = ScriptParams[0];
#endif
return 0; return 0;
case COMMAND_DO_SAVE_GAME: case COMMAND_1469:
CollectParameters(&m_nIp, 1); script_assert(false);
#ifdef MISSION_REPLAY
SaveGameForPause(ScriptParams[0]);
#endif
return 0; return 0;
case COMMAND_IS_RETRY: case COMMAND_1470:
#ifdef MISSION_REPLAY script_assert(false);
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);
return 0; return 0;
case COMMAND_DUMMY: case COMMAND_1471:
script_assert(false);
return 0; return 0;
#endif case COMMAND_1472:
#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) script_assert(false);
// it is unknown what these commands do but they don't take parameters
case COMMAND_MARK_CUTSCENE_START:
return 0; return 0;
case COMMAND_MARK_CUTSCENE_END: case COMMAND_1473:
script_assert(false);
return 0; return 0;
case COMMAND_CUTSCENE_SCROLL: 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);
}
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);
// TODO (SET_NUMBER_USJ_FOUND?)
return 0;
case COMMAND_1520:
CollectParameters(&m_nIp, 1);
// TODO (SET_TOTAL_HIDDEN_PACKAGES?)
return 0;
case COMMAND_1521:
script_assert(false);
return 0;
case COMMAND_1522:
script_assert(false);
return 0;
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);
// TODO (SET_ONFOOT_CAMERA_MODE?)
return 0;
case COMMAND_1550:
script_assert(false);
return 0;
case COMMAND_1551:
script_assert(false);
return 0;
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);
// TODO (FREEZE_ONFOOT_CAMERA_MODE?)
return 0;
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);
}
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:
{
char tmp[12]; // TODO
CTheScripts::ReadTextLabelFromScript(&m_nIp, tmp);
m_nIp += KEY_LENGTH_IN_SCRIPT;
// TODO (CHANGE_STORED_PLAYER_OUTFIT?)
return 0;
}
case COMMAND_1636:
script_assert(false);
return 0;
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_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);
// TODO (DISABLE_PAUSE_MENU?)
return 0;
case COMMAND_1647:
script_assert(false);
return 0;
case COMMAND_1648:
CollectParameters(&m_nIp, 3);
// TODO (SET_CLOCK_EVENT_WARNING);
return 0;
case COMMAND_1649:
script_assert(false);
return 0;
case COMMAND_1650:
script_assert(false);
return 0;
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; return 0;
#endif
default: default:
script_assert(0); script_assert(0);
} }

View file

@ -1442,39 +1442,222 @@ enum {
COMMAND_REGISTER_FIRE_LEVEL, COMMAND_REGISTER_FIRE_LEVEL,
COMMAND_IS_AUSTRALIAN_GAME, COMMAND_IS_AUSTRALIAN_GAME,
COMMAND_DISARM_CAR_BOMB, COMMAND_DISARM_CAR_BOMB,
#if (defined GTAVC_JP_PATCH || defined SUPPORT_JAPANESE_SCRIPT)
COMMAND_IS_JAPANESE_GAME, COMMAND_IS_JAPANESE_GAME,
#elif (!defined GTA_PS2) COMMAND_1442,
COMMAND_SET_ONSCREEN_COUNTER_FLASH_WHEN_FIRST_DISPLAYED, COMMAND_1443,
#endif COMMAND_1444,
#if (defined GTA_PC && !defined GTAVC_JP_PATCH || defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT || defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) COMMAND_1445,
COMMAND_SHUFFLE_CARD_DECKS, COMMAND_1446,
COMMAND_FETCH_NEXT_CARD, COMMAND_1447,
COMMAND_GET_OBJECT_VELOCITY, COMMAND_1448,
COMMAND_IS_DEBUG_CAMERA_ON, COMMAND_1449,
COMMAND_ADD_TO_OBJECT_ROTATION_VELOCITY, COMMAND_1450,
COMMAND_SET_OBJECT_ROTATION_VELOCITY, COMMAND_1451,
COMMAND_IS_OBJECT_STATIC, COMMAND_1452,
COMMAND_GET_ANGLE_BETWEEN_2D_VECTORS, COMMAND_1453,
COMMAND_DO_2D_RECTANGLES_COLLIDE, COMMAND_CALL,
COMMAND_GET_OBJECT_ROTATION_VELOCITY, COMMAND_NOTCALL,
COMMAND_ADD_VELOCITY_RELATIVE_TO_OBJECT_VELOCITY, COMMAND_1456,
COMMAND_GET_OBJECT_SPEED, COMMAND_1457,
#endif COMMAND_1458,
#if (defined GTA_XBOX || defined SUPPORT_XBOX_SCRIPT) COMMAND_1459,
COMMAND_MARK_CUTSCENE_START, COMMAND_1460,
COMMAND_MARK_CUTSCENE_END, COMMAND_1461,
COMMAND_CUTSCENE_SCROLL, COMMAND_1462,
#elif (defined GTA_MOBILE || defined SUPPORT_MOBILE_SCRIPT) COMMAND_1463,
COMMAND_IS_MISSION_SKIP, COMMAND_1464,
COMMAND_SET_IN_AMMUNATION, COMMAND_1465,
COMMAND_DO_SAVE_GAME, COMMAND_1466,
COMMAND_IS_RETRY, COMMAND_1467,
COMMAND_DUMMY, COMMAND_1468,
COMMAND_MARK_CUTSCENE_START, COMMAND_1469,
COMMAND_MARK_CUTSCENE_END, COMMAND_1470,
COMMAND_CUTSCENE_SCROLL, COMMAND_1471,
#endif 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 #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND LAST_SCRIPT_COMMAND
#endif #endif
@ -1493,7 +1676,9 @@ enum eScriptArgument
ARGTYPE_PED_HANDLE, ARGTYPE_PED_HANDLE,
ARGTYPE_VEHICLE_HANDLE, ARGTYPE_VEHICLE_HANDLE,
ARGTYPE_OBJECT_HANDLE, ARGTYPE_OBJECT_HANDLE,
ARGTYPE_ANDOR ARGTYPE_ANDOR,
ARGTYPE_LIST,
ARGTYPE_FUNCTION
}; };
struct tScriptCommandData struct tScriptCommandData

View file

@ -97,7 +97,7 @@ enum Config {
NUMPACMANPICKUPS = 256, NUMPACMANPICKUPS = 256,
NUMEVENTS = 64, NUMEVENTS = 64,
NUM_CARGENS = 185, NUM_CARGENS = 500,
NUM_PATH_NODES_IN_AUTOPILOT = 8, NUM_PATH_NODES_IN_AUTOPILOT = 8,
@ -334,7 +334,7 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
#endif #endif
//#define SIMPLIER_MISSIONS // apply simplifications from mobile //#define SIMPLIER_MISSIONS // apply simplifications from mobile
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #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 #ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT #define USE_BASIC_SCRIPT_DEBUG_OUTPUT