diff options
-rw-r--r-- | src/animation/AnimManager.cpp | 2 | ||||
-rw-r--r-- | src/control/CarCtrl.cpp | 2 | ||||
-rw-r--r-- | src/control/Garages.cpp | 25 | ||||
-rw-r--r-- | src/control/Garages.h | 13 | ||||
-rw-r--r-- | src/control/Pickups.h | 4 | ||||
-rw-r--r-- | src/control/Script.cpp | 79 | ||||
-rw-r--r-- | src/modelinfo/ModelIndices.h | 62 |
7 files changed, 93 insertions, 94 deletions
diff --git a/src/animation/AnimManager.cpp b/src/animation/AnimManager.cpp index 5857c29c..c6f84871 100644 --- a/src/animation/AnimManager.cpp +++ b/src/animation/AnimManager.cpp @@ -603,7 +603,7 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_ { "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs }, { "jogwoman", "ped", MI_COP, 4, aJoggerWomanAnimations, aStdAnimDescs }, { "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, aStdAnimDescs }, - { "skate", "skate", MI_COP, 4, aSkateAnimations, aStdAnimDescs }, + { "skate", "ped", MI_COP, 4, aSkateAnimations, aStdAnimDescs }, { "playerback", "ped", MI_COP, 5, aPlayerStrafeBackAnimations, aStdAnimDescs }, { "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide }, { "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide }, diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp index a1d926f8..bd53f0e5 100644 --- a/src/control/CarCtrl.cpp +++ b/src/control/CarCtrl.cpp @@ -36,7 +36,7 @@ #include "Zones.h" #define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) -#define DISTANCE_TO_SCAN_FOR_DANGER (11.0f) +#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f) #define SAFE_DISTANCE_TO_PED (3.0f) #define INFINITE_Z (1000000000.0f) diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp index 1b670dbe..d54d004a 100644 --- a/src/control/Garages.cpp +++ b/src/control/Garages.cpp @@ -197,17 +197,18 @@ void CGarages::Update(void) aGarages[GarageToBeTidied].TidyUpGarage(); } -int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float Z2, eGarageType type, int32 targetId) +int16 CGarages::AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, eGarageType type, int32 targetId) { if (NumGarages >= NUM_GARAGES) { assert(0); return NumGarages++; } CGarage* pGarage = &aGarages[NumGarages]; - pGarage->m_fX1 = Min(X1, X2); - pGarage->m_fX2 = Max(X1, X2); - pGarage->m_fY1 = Min(Y1, Y2); - pGarage->m_fY2 = Max(Y1, Y2); + // TODO(MIAMI): proper! + pGarage->m_fX1 = Min(Min(X1, X2), X3); + pGarage->m_fX2 = Max(Max(X1, X2), X3); + pGarage->m_fY1 = Min(Min(Y1, Y2), Y3); + pGarage->m_fY2 = Max(Max(Y1, Y2), Y3); pGarage->m_fZ1 = Min(Z1, Z2); pGarage->m_fZ2 = Max(Z1, Z2); pGarage->m_pDoor1 = nil; @@ -2320,8 +2321,7 @@ void CGarages::Load(uint8* buf, uint32 size) bool CGarages::IsModelIndexADoor(uint32 id) { - return id == MI_GARAGEDOOR1 || - id == MI_GARAGEDOOR2 || + return id == MI_GARAGEDOOR2 || id == MI_GARAGEDOOR3 || id == MI_GARAGEDOOR4 || id == MI_GARAGEDOOR5 || @@ -2335,7 +2335,6 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_GARAGEDOOR14 || id == MI_GARAGEDOOR15 || id == MI_GARAGEDOOR16 || - id == MI_GARAGEDOOR17 || id == MI_GARAGEDOOR18 || id == MI_GARAGEDOOR19 || id == MI_GARAGEDOOR20 || @@ -2344,13 +2343,5 @@ CGarages::IsModelIndexADoor(uint32 id) id == MI_GARAGEDOOR23 || id == MI_GARAGEDOOR24 || id == MI_GARAGEDOOR25 || - id == MI_GARAGEDOOR26 || - id == MI_GARAGEDOOR27 || - id == MI_GARAGEDOOR28 || - id == MI_GARAGEDOOR29 || - id == MI_GARAGEDOOR30 || - id == MI_GARAGEDOOR31 || - id == MI_GARAGEDOOR32 || - id == MI_CRUSHERBODY || - id == MI_CRUSHERLID; + id == MI_GARAGEDOOR26; } diff --git a/src/control/Garages.h b/src/control/Garages.h index 3105f72d..c54c41df 100644 --- a/src/control/Garages.h +++ b/src/control/Garages.h @@ -42,6 +42,17 @@ enum eGarageType : int8 GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE, GARAGE_KEEPS_OPENING_FOR_SPECIFIC_CAR, GARAGE_MISSION_KEEPCAR_REMAINCLOSED, + GARAGE_COLLECTCARS_4, + GARAGE_FOR_SCRIPT_TO_OPEN_FOR_CAR, + GARAGE_HIDEOUT_FOUR, + GARAGE_HIDEOUT_FIVE, + GARAGE_HIDEOUT_SIX, + GARAGE_HIDEOUT_SEVEN, + GARAGE_HIDEOUT_EIGHT, + GARAGE_HIDEOUT_NINE, + GARAGE_HIDEOUT_TEN, + GARAGE_HIDEOUT_ELEVEN, + GARAGE_HIDEOUT_TWELVE }; enum @@ -208,7 +219,7 @@ public: #endif static void Update(void); - static int16 AddOne(float X1, float Y1, float Z1, float X2, float Y2, float Z2, eGarageType type, int32 targetId); + static int16 AddOne(float X1, float Y1, float Z1, float X2, float Y2, float X3, float Y3, float Z2, eGarageType type, int32 targetId); static void ChangeGarageType(int16, eGarageType, int32); static void PrintMessages(void); static void TriggerMessage(const char* text, int16, uint16 time, int16); diff --git a/src/control/Pickups.h b/src/control/Pickups.h index 11da5f54..0c617f9e 100644 --- a/src/control/Pickups.h +++ b/src/control/Pickups.h @@ -8,6 +8,7 @@ enum ePickupType : uint8 PICKUP_ON_STREET, PICKUP_ONCE, PICKUP_ONCE_TIMEOUT, + PICKUP_ONCE_TIMEOUT_SLOW, PICKUP_COLLECTABLE1, PICKUP_IN_SHOP_OUT_OF_STOCK, PICKUP_MONEY, @@ -18,6 +19,9 @@ enum ePickupType : uint8 PICKUP_FLOATINGPACKAGE, PICKUP_FLOATINGPACKAGE_FLOATING, PICKUP_ON_STREET_SLOW, + PICKUP_ASSET_REVENUE, + PICKUP_PROPERTY_LOCKED, + PICKUP_PROPERTY_FORSALE, PICKUP_NUMOFTYPES }; diff --git a/src/control/Script.cpp b/src/control/Script.cpp index 90bde151..10dcda90 100644 --- a/src/control/Script.cpp +++ b/src/control/Script.cpp @@ -474,11 +474,11 @@ bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id) void CRunningScript::CollectParameters(uint32* pIp, int16 total) { for (int16 i = 0; i < total; i++){ - float tmp; uint16 varIndex; switch (CTheScripts::Read1ByteFromScript(pIp)) { case ARGUMENT_INT32: + case ARGUMENT_FLOAT: ScriptParams[i] = CTheScripts::Read4BytesFromScript(pIp); break; case ARGUMENT_GLOBALVAR: @@ -497,10 +497,6 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total) case ARGUMENT_INT16: ScriptParams[i] = CTheScripts::Read2BytesFromScript(pIp); break; - case ARGUMENT_FLOAT: - tmp = CTheScripts::ReadFloatFromScript(pIp); - ScriptParams[i] = *(int32*)&tmp; - break; default: assert(0); break; @@ -587,6 +583,9 @@ void CRunningScript::Init() } #ifdef USE_DEBUG_SCRIPT_LOADER + +const char* scriptfile = "main.scm"; + int open_script() { static int scriptToLoad = 1; @@ -599,11 +598,11 @@ int open_script() scriptToLoad = 2; switch (scriptToLoad) { - case 0: return CFileMgr::OpenFile("main.scm", "rb"); - case 1: return CFileMgr::OpenFile("freeroam_miami.scm", "rb"); - case 2: return CFileMgr::OpenFile("main_d.scm", "rb"); + case 0: scriptfile = "main.scm"; break; + case 1: scriptfile = "freeroam_miami.scm"; break; + case 2: scriptfile = "main_d.scm"; break; } - return CFileMgr::OpenFile("main.scm", "rb"); + return CFileMgr::OpenFile(scriptfile, "rb"); } #endif @@ -4670,51 +4669,34 @@ int8 CRunningScript::ProcessCommands500To599(int32 command) } case COMMAND_SET_GARAGE: { - CollectParameters(&m_nIp, 7); + CollectParameters(&m_nIp, 9); float infX = *(float*)&ScriptParams[0]; float infY = *(float*)&ScriptParams[1]; float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; - if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; - } - if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; - } - if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; - } - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, supX, supY, supZ, (eGarageType)ScriptParams[6], 0); + float X2 = *(float*)&ScriptParams[3]; + float Y2 = *(float*)&ScriptParams[4]; + float supX = *(float*)&ScriptParams[5]; + float supY = *(float*)&ScriptParams[6]; + float supZ = *(float*)&ScriptParams[7]; + + // TODO(MIAMI): new 2 parameters, requires CGarage change + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], 0); StoreParameters(&m_nIp, 1); return 0; } case COMMAND_SET_GARAGE_WITH_CAR_MODEL: { - CollectParameters(&m_nIp, 8); + CollectParameters(&m_nIp, 10); float infX = *(float*)&ScriptParams[0]; float infY = *(float*)&ScriptParams[1]; float infZ = *(float*)&ScriptParams[2]; - float supX = *(float*)&ScriptParams[3]; - float supY = *(float*)&ScriptParams[4]; - float supZ = *(float*)&ScriptParams[5]; - if (infX > supX) { - infX = *(float*)&ScriptParams[3]; - supX = *(float*)&ScriptParams[0]; - } - if (infY > supY) { - infY = *(float*)&ScriptParams[4]; - supY = *(float*)&ScriptParams[1]; - } - if (infZ > supZ) { - infZ = *(float*)&ScriptParams[5]; - supZ = *(float*)&ScriptParams[2]; - } - ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, supX, supY, supZ, (eGarageType)ScriptParams[6], ScriptParams[7]); + float X2 = *(float*)&ScriptParams[3]; + float Y2 = *(float*)&ScriptParams[4]; + float supX = *(float*)&ScriptParams[5]; + float supY = *(float*)&ScriptParams[6]; + float supZ = *(float*)&ScriptParams[7]; + // TODO(MIAMI): new 2 parameters, requires CGarage change + ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], ScriptParams[9]); StoreParameters(&m_nIp, 1); return 0; } @@ -8703,8 +8685,13 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command) CollectParameters(&m_nIp, 1); CTimer::Suspend(); int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; +#ifdef USE_DEBUG_SCRIPT_LOADER + CFileMgr::ChangeDir("\\data\\"); + int handle = CFileMgr::OpenFile(scriptfile, "rb"); +#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); @@ -9782,7 +9769,13 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command) case COMMAND_GET_CHAR_WEAPON_IN_SLOT: case COMMAND_GET_CLOSEST_STRAIGHT_ROAD: case COMMAND_SET_CAR_FORWARD_SPEED: + assert(0); case COMMAND_SET_AREA_VISIBLE: + CollectParameters(&m_nIp, 1); + CGame::currArea = ScriptParams[0]; + // TODO(MIAMI) !! + //CStreaming::RemoveBuildingsNotInArea(ScriptParams[0]); + return 0; case COMMAND_SET_CUTSCENE_ANIM_TO_LOOP: assert(0); case COMMAND_MARK_CAR_AS_CONVOY_CAR: diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h index f0db054d..21362c54 100644 --- a/src/modelinfo/ModelIndices.h +++ b/src/modelinfo/ModelIndices.h @@ -49,37 +49,37 @@ X("package1", MI_COLLECTABLE1, 0x5F5A04) \ X("Money", MI_MONEY, 0x5F5A08) \ X("barrel1", MI_CARMINE, 0x5F5A0C) \ - X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \ - X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \ - X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \ - X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \ - X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \ - X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \ - X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \ - X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \ - X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \ - X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \ - X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \ - X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \ - X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \ - X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \ - X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \ - X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \ - X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \ - X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \ - X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \ - X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \ - X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \ - X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \ - X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \ - X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \ - X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \ - X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \ - X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \ - X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \ - X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \ - X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \ - X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \ + /*X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10)*/ \ + X("dk_paynspraydoor", MI_GARAGEDOOR2, 0x5F5A14) \ + X("dk_waretankdoor1", MI_GARAGEDOOR3, 0x5F5A18) \ + X("hav_garagedoor1", MI_GARAGEDOOR4, 0x5F5A1C) \ + X("hav_garagedoor02", MI_GARAGEDOOR5, 0x5F5A20) \ + X("hav_garagedoor03", MI_GARAGEDOOR6, 0x5F5A24) \ + X("hav_garagedoor04", MI_GARAGEDOOR7, 0x5F5A28) \ + X("lh_showdoor03", MI_GARAGEDOOR9, 0x5F5A2C) \ + X("lh_showdoor1", MI_GARAGEDOOR10, 0x5F5A30) \ + X("lhtankdoor", MI_GARAGEDOOR11, 0x5F5A34) \ + X("nbtgardoor", MI_GARAGEDOOR12, 0x5F5A38) \ + X("dk_camjonesdoor", MI_GARAGEDOOR13, 0x5F5A3C) \ + X("nbtgardoor02", MI_GARAGEDOOR14, 0x5F5A40) \ + X("dt_savedra", MI_GARAGEDOOR15, 0x5F5A44) \ + X("dt_savedrb", MI_GARAGEDOOR16, 0x5F5A48) \ + /*X("dk_bombdoor", MI_GARAGEDOOR17, 0x5F5A4C)*/ \ + X("dk_bombdoor", MI_GARAGEDOOR18, 0x5F5A50) \ + X("haiwshpnsdoor", MI_GARAGEDOOR19, 0x5F5A54) \ + X("wshpnsdoor", MI_GARAGEDOOR20, 0x5F5A58) \ + X("nbecpnsdoor", MI_GARAGEDOOR21, 0x5F5A5C) \ + X("nbtgardoor03", MI_GARAGEDOOR22, 0x5F5A60) \ + X("dt_savedrc", MI_GARAGEDOOR23, 0x5F5A64) \ + X("dt_savedrd", MI_GARAGEDOOR24, 0x5F5A68) \ + X("man_frntstepGD", MI_GARAGEDOOR25, 0x5F5A6C) \ + X("svegrgedoor", MI_GARAGEDOOR26, 0x5F5A70) \ + /*X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74)*/ \ + /*X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78)*/ \ + /*X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C)*/ \ + /*X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80)*/ \ + /*X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84)*/ \ + /*X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88)*/ \ X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ |