Merge pull request #532 from Nick007J/miami

script update
This commit is contained in:
aap 2020-05-10 17:41:31 +02:00 committed by GitHub
commit c07727eed0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 93 additions and 94 deletions

View File

@ -603,7 +603,7 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_
{ "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs }, { "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs },
{ "jogwoman", "ped", MI_COP, 4, aJoggerWomanAnimations, aStdAnimDescs }, { "jogwoman", "ped", MI_COP, 4, aJoggerWomanAnimations, aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, 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 }, { "playerback", "ped", MI_COP, 5, aPlayerStrafeBackAnimations, aStdAnimDescs },
{ "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide }, { "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide },
{ "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide }, { "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide },

View File

@ -36,7 +36,7 @@
#include "Zones.h" #include "Zones.h"
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f) #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 SAFE_DISTANCE_TO_PED (3.0f)
#define INFINITE_Z (1000000000.0f) #define INFINITE_Z (1000000000.0f)

View File

@ -197,17 +197,18 @@ void CGarages::Update(void)
aGarages[GarageToBeTidied].TidyUpGarage(); 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) { if (NumGarages >= NUM_GARAGES) {
assert(0); assert(0);
return NumGarages++; return NumGarages++;
} }
CGarage* pGarage = &aGarages[NumGarages]; CGarage* pGarage = &aGarages[NumGarages];
pGarage->m_fX1 = Min(X1, X2); // TODO(MIAMI): proper!
pGarage->m_fX2 = Max(X1, X2); pGarage->m_fX1 = Min(Min(X1, X2), X3);
pGarage->m_fY1 = Min(Y1, Y2); pGarage->m_fX2 = Max(Max(X1, X2), X3);
pGarage->m_fY2 = Max(Y1, Y2); pGarage->m_fY1 = Min(Min(Y1, Y2), Y3);
pGarage->m_fY2 = Max(Max(Y1, Y2), Y3);
pGarage->m_fZ1 = Min(Z1, Z2); pGarage->m_fZ1 = Min(Z1, Z2);
pGarage->m_fZ2 = Max(Z1, Z2); pGarage->m_fZ2 = Max(Z1, Z2);
pGarage->m_pDoor1 = nil; pGarage->m_pDoor1 = nil;
@ -2320,8 +2321,7 @@ void CGarages::Load(uint8* buf, uint32 size)
bool bool
CGarages::IsModelIndexADoor(uint32 id) CGarages::IsModelIndexADoor(uint32 id)
{ {
return id == MI_GARAGEDOOR1 || return id == MI_GARAGEDOOR2 ||
id == MI_GARAGEDOOR2 ||
id == MI_GARAGEDOOR3 || id == MI_GARAGEDOOR3 ||
id == MI_GARAGEDOOR4 || id == MI_GARAGEDOOR4 ||
id == MI_GARAGEDOOR5 || id == MI_GARAGEDOOR5 ||
@ -2335,7 +2335,6 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_GARAGEDOOR14 || id == MI_GARAGEDOOR14 ||
id == MI_GARAGEDOOR15 || id == MI_GARAGEDOOR15 ||
id == MI_GARAGEDOOR16 || id == MI_GARAGEDOOR16 ||
id == MI_GARAGEDOOR17 ||
id == MI_GARAGEDOOR18 || id == MI_GARAGEDOOR18 ||
id == MI_GARAGEDOOR19 || id == MI_GARAGEDOOR19 ||
id == MI_GARAGEDOOR20 || id == MI_GARAGEDOOR20 ||
@ -2344,13 +2343,5 @@ CGarages::IsModelIndexADoor(uint32 id)
id == MI_GARAGEDOOR23 || id == MI_GARAGEDOOR23 ||
id == MI_GARAGEDOOR24 || id == MI_GARAGEDOOR24 ||
id == MI_GARAGEDOOR25 || id == MI_GARAGEDOOR25 ||
id == MI_GARAGEDOOR26 || 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;
} }

View File

@ -42,6 +42,17 @@ enum eGarageType : int8
GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE, GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE,
GARAGE_KEEPS_OPENING_FOR_SPECIFIC_CAR, GARAGE_KEEPS_OPENING_FOR_SPECIFIC_CAR,
GARAGE_MISSION_KEEPCAR_REMAINCLOSED, 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 enum
@ -208,7 +219,7 @@ public:
#endif #endif
static void Update(void); 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 ChangeGarageType(int16, eGarageType, int32);
static void PrintMessages(void); static void PrintMessages(void);
static void TriggerMessage(const char* text, int16, uint16 time, int16); static void TriggerMessage(const char* text, int16, uint16 time, int16);

View File

@ -8,6 +8,7 @@ enum ePickupType : uint8
PICKUP_ON_STREET, PICKUP_ON_STREET,
PICKUP_ONCE, PICKUP_ONCE,
PICKUP_ONCE_TIMEOUT, PICKUP_ONCE_TIMEOUT,
PICKUP_ONCE_TIMEOUT_SLOW,
PICKUP_COLLECTABLE1, PICKUP_COLLECTABLE1,
PICKUP_IN_SHOP_OUT_OF_STOCK, PICKUP_IN_SHOP_OUT_OF_STOCK,
PICKUP_MONEY, PICKUP_MONEY,
@ -18,6 +19,9 @@ enum ePickupType : uint8
PICKUP_FLOATINGPACKAGE, PICKUP_FLOATINGPACKAGE,
PICKUP_FLOATINGPACKAGE_FLOATING, PICKUP_FLOATINGPACKAGE_FLOATING,
PICKUP_ON_STREET_SLOW, PICKUP_ON_STREET_SLOW,
PICKUP_ASSET_REVENUE,
PICKUP_PROPERTY_LOCKED,
PICKUP_PROPERTY_FORSALE,
PICKUP_NUMOFTYPES PICKUP_NUMOFTYPES
}; };

View File

@ -474,11 +474,11 @@ bool CStuckCarCheck::HasCarBeenStuckForAWhile(int32 id)
void CRunningScript::CollectParameters(uint32* pIp, int16 total) void CRunningScript::CollectParameters(uint32* pIp, int16 total)
{ {
for (int16 i = 0; i < total; i++){ for (int16 i = 0; i < total; i++){
float tmp;
uint16 varIndex; uint16 varIndex;
switch (CTheScripts::Read1ByteFromScript(pIp)) switch (CTheScripts::Read1ByteFromScript(pIp))
{ {
case ARGUMENT_INT32: case ARGUMENT_INT32:
case ARGUMENT_FLOAT:
ScriptParams[i] = CTheScripts::Read4BytesFromScript(pIp); ScriptParams[i] = CTheScripts::Read4BytesFromScript(pIp);
break; break;
case ARGUMENT_GLOBALVAR: case ARGUMENT_GLOBALVAR:
@ -497,10 +497,6 @@ void CRunningScript::CollectParameters(uint32* pIp, int16 total)
case ARGUMENT_INT16: case ARGUMENT_INT16:
ScriptParams[i] = CTheScripts::Read2BytesFromScript(pIp); ScriptParams[i] = CTheScripts::Read2BytesFromScript(pIp);
break; break;
case ARGUMENT_FLOAT:
tmp = CTheScripts::ReadFloatFromScript(pIp);
ScriptParams[i] = *(int32*)&tmp;
break;
default: default:
assert(0); assert(0);
break; break;
@ -587,6 +583,9 @@ void CRunningScript::Init()
} }
#ifdef USE_DEBUG_SCRIPT_LOADER #ifdef USE_DEBUG_SCRIPT_LOADER
const char* scriptfile = "main.scm";
int open_script() int open_script()
{ {
static int scriptToLoad = 1; static int scriptToLoad = 1;
@ -599,11 +598,11 @@ int open_script()
scriptToLoad = 2; scriptToLoad = 2;
switch (scriptToLoad) { switch (scriptToLoad) {
case 0: return CFileMgr::OpenFile("main.scm", "rb"); case 0: scriptfile = "main.scm"; break;
case 1: return CFileMgr::OpenFile("freeroam_miami.scm", "rb"); case 1: scriptfile = "freeroam_miami.scm"; break;
case 2: return CFileMgr::OpenFile("main_d.scm", "rb"); case 2: scriptfile = "main_d.scm"; break;
} }
return CFileMgr::OpenFile("main.scm", "rb"); return CFileMgr::OpenFile(scriptfile, "rb");
} }
#endif #endif
@ -4670,51 +4669,34 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
} }
case COMMAND_SET_GARAGE: case COMMAND_SET_GARAGE:
{ {
CollectParameters(&m_nIp, 7); CollectParameters(&m_nIp, 9);
float infX = *(float*)&ScriptParams[0]; float infX = *(float*)&ScriptParams[0];
float infY = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[1];
float infZ = *(float*)&ScriptParams[2]; float infZ = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3]; float X2 = *(float*)&ScriptParams[3];
float supY = *(float*)&ScriptParams[4]; float Y2 = *(float*)&ScriptParams[4];
float supZ = *(float*)&ScriptParams[5]; float supX = *(float*)&ScriptParams[5];
if (infX > supX) { float supY = *(float*)&ScriptParams[6];
infX = *(float*)&ScriptParams[3]; float supZ = *(float*)&ScriptParams[7];
supX = *(float*)&ScriptParams[0];
} // TODO(MIAMI): new 2 parameters, requires CGarage change
if (infY > supY) { ScriptParams[0] = CGarages::AddOne(infX, infY, infZ, X2, Y2, supX, supY, supZ, (eGarageType)ScriptParams[8], 0);
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);
StoreParameters(&m_nIp, 1); StoreParameters(&m_nIp, 1);
return 0; return 0;
} }
case COMMAND_SET_GARAGE_WITH_CAR_MODEL: case COMMAND_SET_GARAGE_WITH_CAR_MODEL:
{ {
CollectParameters(&m_nIp, 8); CollectParameters(&m_nIp, 10);
float infX = *(float*)&ScriptParams[0]; float infX = *(float*)&ScriptParams[0];
float infY = *(float*)&ScriptParams[1]; float infY = *(float*)&ScriptParams[1];
float infZ = *(float*)&ScriptParams[2]; float infZ = *(float*)&ScriptParams[2];
float supX = *(float*)&ScriptParams[3]; float X2 = *(float*)&ScriptParams[3];
float supY = *(float*)&ScriptParams[4]; float Y2 = *(float*)&ScriptParams[4];
float supZ = *(float*)&ScriptParams[5]; float supX = *(float*)&ScriptParams[5];
if (infX > supX) { float supY = *(float*)&ScriptParams[6];
infX = *(float*)&ScriptParams[3]; float supZ = *(float*)&ScriptParams[7];
supX = *(float*)&ScriptParams[0]; // 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]);
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]);
StoreParameters(&m_nIp, 1); StoreParameters(&m_nIp, 1);
return 0; return 0;
} }
@ -8703,8 +8685,13 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
CollectParameters(&m_nIp, 1); CollectParameters(&m_nIp, 1);
CTimer::Suspend(); CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]]; int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
#ifdef USE_DEBUG_SCRIPT_LOADER
CFileMgr::ChangeDir("\\data\\");
int handle = CFileMgr::OpenFile(scriptfile, "rb");
#else
CFileMgr::ChangeDir("\\"); CFileMgr::ChangeDir("\\");
int handle = CFileMgr::OpenFile("data\\main.scm", "rb"); int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
#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[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
CFileMgr::CloseFile(handle); CFileMgr::CloseFile(handle);
@ -9782,7 +9769,13 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_GET_CHAR_WEAPON_IN_SLOT: case COMMAND_GET_CHAR_WEAPON_IN_SLOT:
case COMMAND_GET_CLOSEST_STRAIGHT_ROAD: case COMMAND_GET_CLOSEST_STRAIGHT_ROAD:
case COMMAND_SET_CAR_FORWARD_SPEED: case COMMAND_SET_CAR_FORWARD_SPEED:
assert(0);
case COMMAND_SET_AREA_VISIBLE: 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: case COMMAND_SET_CUTSCENE_ANIM_TO_LOOP:
assert(0); assert(0);
case COMMAND_MARK_CAR_AS_CONVOY_CAR: case COMMAND_MARK_CAR_AS_CONVOY_CAR:

View File

@ -49,37 +49,37 @@
X("package1", MI_COLLECTABLE1, 0x5F5A04) \ X("package1", MI_COLLECTABLE1, 0x5F5A04) \
X("Money", MI_MONEY, 0x5F5A08) \ X("Money", MI_MONEY, 0x5F5A08) \
X("barrel1", MI_CARMINE, 0x5F5A0C) \ X("barrel1", MI_CARMINE, 0x5F5A0C) \
X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \ /*X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10)*/ \
X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \ X("dk_paynspraydoor", MI_GARAGEDOOR2, 0x5F5A14) \
X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \ X("dk_waretankdoor1", MI_GARAGEDOOR3, 0x5F5A18) \
X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \ X("hav_garagedoor1", MI_GARAGEDOOR4, 0x5F5A1C) \
X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \ X("hav_garagedoor02", MI_GARAGEDOOR5, 0x5F5A20) \
X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \ X("hav_garagedoor03", MI_GARAGEDOOR6, 0x5F5A24) \
X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \ X("hav_garagedoor04", MI_GARAGEDOOR7, 0x5F5A28) \
X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \ X("lh_showdoor03", MI_GARAGEDOOR9, 0x5F5A2C) \
X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \ X("lh_showdoor1", MI_GARAGEDOOR10, 0x5F5A30) \
X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \ X("lhtankdoor", MI_GARAGEDOOR11, 0x5F5A34) \
X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \ X("nbtgardoor", MI_GARAGEDOOR12, 0x5F5A38) \
X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \ X("dk_camjonesdoor", MI_GARAGEDOOR13, 0x5F5A3C) \
X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \ X("nbtgardoor02", MI_GARAGEDOOR14, 0x5F5A40) \
X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \ X("dt_savedra", MI_GARAGEDOOR15, 0x5F5A44) \
X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \ X("dt_savedrb", MI_GARAGEDOOR16, 0x5F5A48) \
X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \ /*X("dk_bombdoor", MI_GARAGEDOOR17, 0x5F5A4C)*/ \
X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \ X("dk_bombdoor", MI_GARAGEDOOR18, 0x5F5A50) \
X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \ X("haiwshpnsdoor", MI_GARAGEDOOR19, 0x5F5A54) \
X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \ X("wshpnsdoor", MI_GARAGEDOOR20, 0x5F5A58) \
X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \ X("nbecpnsdoor", MI_GARAGEDOOR21, 0x5F5A5C) \
X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \ X("nbtgardoor03", MI_GARAGEDOOR22, 0x5F5A60) \
X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \ X("dt_savedrc", MI_GARAGEDOOR23, 0x5F5A64) \
X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \ X("dt_savedrd", MI_GARAGEDOOR24, 0x5F5A68) \
X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \ X("man_frntstepGD", MI_GARAGEDOOR25, 0x5F5A6C) \
X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \ X("svegrgedoor", MI_GARAGEDOOR26, 0x5F5A70) \
X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \ /*X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74)*/ \
X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \ /*X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78)*/ \
X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \ /*X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C)*/ \
X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \ /*X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80)*/ \
X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \ /*X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84)*/ \
X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \ /*X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88)*/ \
X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \
X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \
X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ X("crushertop", MI_CRUSHERLID, 0x5F5A94) \