[saco] Implement CEntity::TeleportTo(...)

Implements:
* `CEntity::GetModelIndex()`
* `CEntity::TeleportTo(...)`
This commit is contained in:
RD42 2024-02-27 21:25:04 +08:00
parent ff72a169a7
commit f5fd849bc3
4 changed files with 46 additions and 1 deletions

View File

@ -46,7 +46,11 @@ typedef struct _ENTITY_TYPE
MATRIX4X4 *mat; // 20-24
DWORD *pdwRenderWare; // 24-28
char _gap1C[40];
char _gap1C[6];
WORD nModelIndex; // 34-36
char _gap24[32];
VECTOR vecMoveSpeed; // 68-80
VECTOR vecTurnSpeed; // 80-92
@ -72,6 +76,12 @@ typedef struct _VEHICLE_TYPE
//-----------------------------------------------------------
#define TRAIN_PASSENGER_LOCO 537
#define TRAIN_FREIGHT_LOCO 538
#define TRAIN_PASSENGER 569
#define TRAIN_FREIGHT 570
#define TRAIN_TRAM 449
#define HYDRA 520
//-----------------------------------------------------------
// ---- weapon id defines ----

View File

@ -191,6 +191,36 @@ void CEntity::sub_1009EF20(int a2)
//-----------------------------------------------------------
UINT CEntity::GetModelIndex()
{
return m_pEntity->nModelIndex;
}
//-----------------------------------------------------------
void CEntity::TeleportTo(float x, float y, float z)
{
DWORD dwThisEntity = (DWORD)m_pEntity;
if(dwThisEntity && m_pEntity->vtable != 0x863C40) {
if( GetModelIndex() != TRAIN_PASSENGER_LOCO &&
GetModelIndex() != TRAIN_FREIGHT_LOCO &&
GetModelIndex() != TRAIN_TRAM) {
_asm mov ecx, dwThisEntity
_asm mov edx, [ecx] ; vtbl
_asm push 0
_asm push z
_asm push y
_asm push x
_asm call dword ptr [edx+56] ; method 14
} else {
ScriptCommand(&put_train_at,m_dwGTAId,x,y,z);
}
}
}
//-----------------------------------------------------------
BOOL CEntity::sub_1009FDE0()
{
return m_pEntity

View File

@ -23,6 +23,9 @@ public:
float sub_1009EEB0(); // unused
void sub_1009EEF0(PVECTOR Vector);
void sub_1009EF20(int a2); // unused
UINT GetModelIndex();
void TeleportTo(float x, float y, float z);
BOOL sub_1009FDE0();
VECTOR field_4[5];

View File

@ -43,6 +43,8 @@ const SCRIPT_COMMAND play_sound = { 0x018c, "fffi" };
const SCRIPT_COMMAND enable_train_traffic = { 0x06d7, "i" };
const SCRIPT_COMMAND put_train_at = { 0x07c7, "ifff" };
const SCRIPT_COMMAND refresh_streaming_at = { 0x04E4, "ff" };
const SCRIPT_COMMAND request_animation = { 0x04ED, "s" };