[bot] Match FUNC_3(...)

This commit is contained in:
RD42 2024-10-04 16:58:22 +08:00
parent b7b0237ebd
commit 3384a89aa3
2 changed files with 68 additions and 112 deletions

View File

@ -108,16 +108,20 @@ typedef struct _INCAR_SYNC_DATA
WORD wKeys; WORD wKeys;
QUATERNION quatRotation; QUATERNION quatRotation;
VECTOR vecPos; VECTOR vecPos;
VECTOR vecMoveSpeed;
char _gap24[16]; float fCarHealth;
BYTE bytePlayerHealth; BYTE bytePlayerHealth;
BYTE bytePlayerArmour; BYTE bytePlayerArmour;
BYTE byteCurrentWeapon : 6; BYTE byteCurrentWeapon : 6;
BYTE byteSpecialKey : 2; BYTE byteSpecialKey : 2;
BYTE byteSirenOn;
char _gap37[8]; BYTE byteLandingGearState;
VEHICLEID TrailerID;
union {
FLOAT fTrainSpeed;
FLOAT fBikeBankingAngle;
DWORD dwHydraThrustAngle;
};
} INCAR_SYNC_DATA; } INCAR_SYNC_DATA;
#pragma pack(1) #pragma pack(1)

View File

@ -4,23 +4,20 @@
struct struc_72 { struct struc_72 {
//char _gap0[71]; //char _gap0[71];
WORD field_0; VEHICLEID VehicleID;
WORD field_2; WORD lrAnalog;
WORD field_4; WORD udAnalog;
WORD field_6; WORD wKeys;
VECTOR field_8; VECTOR field_8; // vecRoll?
VECTOR field_14; VECTOR field_14; // vecDirection?
DWORD field_20; VECTOR vecPos;
DWORD field_24; VECTOR vecMoveSpeed;
DWORD field_28; float fCarHealth;
DWORD field_2C; BYTE bytePlayerHealth;
DWORD field_30; BYTE bytePlayerArmour;
DWORD field_34; BYTE byteCurrentWeapon : 6;
DWORD field_38; BYTE byteSpecialKey : 2;
BYTE field_3C; BYTE byteSirenOn;
BYTE field_3D;
BYTE field_3E;
BYTE field_3F;
char _gap40[3]; char _gap40[3];
@ -31,29 +28,6 @@ struct struc_73 {
char _gap0[52]; char _gap0[52];
}; };
struct struc_74 {
//char _gap0[63];
WORD field_0;
WORD field_2;
WORD field_4;
WORD field_6;
QUATERNION field_8;
DWORD field_18;
DWORD field_1C;
DWORD field_20;
DWORD field_24;
DWORD field_28;
DWORD field_2C;
DWORD field_30;
BYTE field_34;
BYTE field_35;
BYTE field_36;
BYTE field_37;
BYTE field_38;
WORD field_39;
DWORD field_3B;
};
DWORD *GLOBAL_3 = NULL; DWORD *GLOBAL_3 = NULL;
struc_73 *GLOBAL_4 = NULL; struc_73 *GLOBAL_4 = NULL;
struc_72 *GLOBAL_2 = NULL; struc_72 *GLOBAL_2 = NULL;
@ -112,82 +86,60 @@ int FUNC_2(FILE *a1, DWORD a2)
int FUNC_3(char *a1) int FUNC_3(char *a1)
{ {
FILE *fp = fopen(a1, "wb"); FILE *fp = fopen(a1, "wb");
if ( fp ) if(!fp) return 0;
{
DWORD v1 = 1000; DWORD v1 = 1000;
DWORD v2 = 1; DWORD v2 = 1;
fwrite(&v1, 1, sizeof(DWORD), fp); fwrite(&v1, 1, sizeof(DWORD), fp);
fwrite(&v2, 1, sizeof(DWORD), fp); fwrite(&v2, 1, sizeof(DWORD), fp);
struc_74 s; INCAR_SYNC_DATA icSync;
VECTOR v, vec1, vec2; VECTOR v, vec1, vec2;
MATRIX4X4 m; MATRIX4X4 m;
QUATERNION q; QUATERNION q;
memset(&s, 0, sizeof(struc_74)); memset(&icSync, 0, sizeof(INCAR_SYNC_DATA));
for(int i = 0; i != GLOBAL_1; i++) for(int i = 0; i != GLOBAL_1; i++)
{ {
s.field_0 = GLOBAL_2[i].field_0; icSync.VehicleID = GLOBAL_2[i].VehicleID;
s.field_2 = GLOBAL_2[i].field_2; icSync.lrAnalog = GLOBAL_2[i].lrAnalog;
s.field_4 = GLOBAL_2[i].field_4; icSync.udAnalog = GLOBAL_2[i].udAnalog;
s.field_6 = GLOBAL_2[i].field_6; icSync.wKeys = GLOBAL_2[i].wKeys;
s.field_36 = GLOBAL_2[i].field_3E & 0x3F | s.field_36 & 0xC0; icSync.byteCurrentWeapon = GLOBAL_2[i].byteCurrentWeapon;
s.field_38 = 0; icSync.byteLandingGearState = 0;
s.field_34 = GLOBAL_2[i].field_3C; icSync.bytePlayerHealth = GLOBAL_2[i].bytePlayerHealth;
s.field_35 = GLOBAL_2[i].field_3D; icSync.bytePlayerArmour = GLOBAL_2[i].bytePlayerArmour;
s.field_37 = GLOBAL_2[i].field_3F; icSync.byteSirenOn = GLOBAL_2[i].byteSirenOn;
s.field_30 = GLOBAL_2[i].field_38; icSync.fCarHealth = GLOBAL_2[i].fCarHealth;
s.field_3B = GLOBAL_2[i].field_43; icSync.dwHydraThrustAngle = GLOBAL_2[i].field_43;
s.field_18 = GLOBAL_2[i].field_20; icSync.vecPos = GLOBAL_2[i].vecPos;
s.field_1C = GLOBAL_2[i].field_24; icSync.vecMoveSpeed = GLOBAL_2[i].vecMoveSpeed;
s.field_20 = GLOBAL_2[i].field_28; icSync.TrailerID = 0;
s.field_24 = GLOBAL_2[i].field_2C;
s.field_28 = GLOBAL_2[i].field_30; vec2 = GLOBAL_2[i].field_8;
s.field_2C = GLOBAL_2[i].field_34; vec1 = GLOBAL_2[i].field_14;
s.field_39 = 0;
vec2.X = GLOBAL_2[i].field_8.X;
vec2.Y = GLOBAL_2[i].field_8.Y;
vec2.Z = GLOBAL_2[i].field_8.Z;
vec1.X = GLOBAL_2[i].field_14.X;
vec1.Y = GLOBAL_2[i].field_14.Y;
vec1.Z = GLOBAL_2[i].field_14.Z;
CrossProduct(&v, &vec1, &vec2); CrossProduct(&v, &vec1, &vec2);
v.X *= -1.0f; v.X *= -1.0f;
v.Y *= -1.0f; v.Y *= -1.0f;
v.Z *= -1.0f; v.Z *= -1.0f;
m.right.X = vec2.X; m.right = vec2;
m.right.Y = vec2.Y; m.up = vec1;
m.right.Z = vec2.Z; m.at = v;
m.up.X = vec1.X;
m.up.Y = vec1.Y;
m.up.Z = vec1.Z;
m.at.X = v.X;
m.at.Y = v.Y;
m.at.Z = v.Z;
MatrixToQuaternion(&m, &q); MatrixToQuaternion(&m, &q);
s.field_8.X = q.X; icSync.quatRotation = q;
s.field_8.Y = q.Y;
s.field_8.Z = q.Z;
s.field_8.W = q.W;
fwrite(&GLOBAL_3[i], 1, sizeof(DWORD), fp); fwrite(&GLOBAL_3[i], 1, sizeof(DWORD), fp);
fwrite(&s, 1, sizeof(struc_74), fp); fwrite(&icSync, 1, sizeof(INCAR_SYNC_DATA), fp);
} }
fclose(fp); fclose(fp);
return 1; return 1;
} }
else
{
return 0;
}
}
int FUNC_4(char *a1) int FUNC_4(char *a1)
{ {