CFourWheelVehiclePhysics::UpdateDriverControls
0x006aefe0 · 2606 bytes · __thiscall
_ZN24CFourWheelVehiclePhysics20UpdateDriverControlsEP8CUserCmdf
Decompiled
undefined (3 params)
/* CFourWheelVehiclePhysics::UpdateDriverControls(CUserCmd*, float) */
void __thiscall
CFourWheelVehiclePhysics::UpdateDriverControls
(CFourWheelVehiclePhysics *this,CUserCmd *param_1,float param_2)
{
undefined4 uVar1;
uint uVar2;
char cVar3;
char cVar4;
float *pfVar5;
vehicleparams_t *pvVar6;
int iVar7;
int *piVar8;
bool bVar9;
longdouble lVar10;
float fVar11;
float fVar12;
float fVar13;
float fVar14;
float fVar15;
float fVar16;
bool bVar17;
float local_50;
float local_44;
float local_40;
float local_30;
float local_2c;
float local_28;
char local_24;
undefined1 local_23;
undefined1 local_22;
undefined1 local_21;
undefined1 local_20;
uVar2 = *(uint *)(param_1 + 0x24);
pfVar5 = (float *)(**(code **)(**(int **)(this + 0x24) + 0xc))(*(int **)(this + 0x24));
pvVar6 = (vehicleparams_t *)(**(code **)(**(int **)(this + 0x24) + 0x10))(*(int **)(this + 0x24));
fVar11 = *pfVar5;
if (2.0 <= fVar11) {
local_50 = 1.0;
}
else if (-2.0 < fVar11) {
local_50 = 0.0;
}
else {
local_50 = -1.0;
}
local_40 = 0.0;
local_44 = 1.0;
fVar11 = ABS(fVar11 * 0.056818184);
if ((((*(int *)(xbox_autothrottle._28_4_ + 0x30) != 0) && (0.0 < *(float *)(param_1 + 0x18))) &&
(iVar7 = (**(code **)(**(int **)(this + 0x24) + 0x10))(*(int **)(this + 0x24)),
(float)(int)(*(float *)(iVar7 + 0x204) * 0.056818184) * 0.75 < fVar11)) &&
(*(float *)(param_1 + 0x18) <= ABS(*(float *)(param_1 + 0x1c)) &&
ABS(*(float *)(param_1 + 0x1c)) != *(float *)(param_1 + 0x18))) {
*(undefined4 *)(param_1 + 0x18) = 0x43c80000;
}
if ((uVar2 & 0x600) == 0) {
if (*(float *)(param_1 + 0x1c) == 0.0) {
SteeringRest(this,fVar11,pvVar6);
}
else {
SteeringTurnAnalog(this,fVar11,pvVar6,*(float *)(param_1 + 0x1c));
}
}
else {
bVar17 = (bool)((byte)(uVar2 >> 4) & 1);
bVar9 = false;
if ((uVar2 & 8) != 0) {
bVar9 = (bool)(bVar17 ^ 1);
}
SteeringTurn(this,fVar11,pvVar6,(bool)((byte)(uVar2 >> 9) & 1),bVar17,bVar9);
}
*(undefined4 *)(this + 0x18) = 0;
this[0x1c] = (CFourWheelVehiclePhysics)0x0;
this[0x1d] = (CFourWheelVehiclePhysics)0x0;
this[0x1e] = (CFourWheelVehiclePhysics)0x0;
this[0x1f] = (CFourWheelVehiclePhysics)0x0;
piVar8 = (int *)(**(code **)(**(int **)(this + 8) + 0xf0))(*(int **)(this + 8));
fVar14 = *(float *)(xbox_throttlebias._28_4_ + 0x2c);
if ((piVar8 == (int *)0x0) || (cVar3 = (**(code **)(*piVar8 + 0x16c))(piVar8), cVar3 == '\0')) {
LAB_006af1a3:
fVar12 = *(float *)(param_1 + 0x18);
joined_r0x006af4f6:
if (0.0 < fVar12) {
LAB_006af1b5:
fVar12 = fVar12 * 0.0025;
if (fVar12 <= 0.25) {
fVar12 = 0.25;
}
if (1.0 <= fVar12) {
fVar12 = local_44;
}
fVar14 = *(float *)(this + 0xc);
if (*(float *)(this + 0xc) < 0.0) {
*(undefined4 *)(this + 0xc) = 0;
fVar14 = local_40;
}
fVar13 = *(float *)(this + 0x40);
if (fVar13 <= 0.1) {
fVar13 = 0.1;
}
if (*(float *)(this + 0x10) != 0.0) {
fVar16 = *(float *)(pvVar6 + 0x274);
if (fVar11 < fVar16) {
fVar15 = *(float *)(pvVar6 + 0x27c);
if (fVar16 != 0.0) {
if (fVar11 / fVar16 <= 1.0) {
local_44 = fVar11 / fVar16;
}
if (local_44 <= 0.0) {
local_44 = local_40;
}
fVar15 = fVar15 * local_44;
}
}
else {
fVar15 = *(float *)(pvVar6 + 0x280);
if (fVar16 != *(float *)(pvVar6 + 0x278)) {
fVar11 = (fVar11 - fVar16) / (*(float *)(pvVar6 + 0x278) - fVar16);
if (1.0 <= fVar11) {
fVar11 = local_44;
}
if (fVar11 <= 0.0) {
fVar11 = local_40;
}
fVar15 = (fVar15 - *(float *)(pvVar6 + 0x27c)) * fVar11 + *(float *)(pvVar6 + 0x27c);
}
}
fVar11 = 1.0 - fVar15 * ABS(*(float *)(this + 0x10));
if (fVar11 <= 0.0) {
fVar11 = local_40;
}
if (fVar11 <= fVar13) {
fVar13 = fVar11;
}
}
lVar10 = (longdouble)Approach(fVar12 * fVar13,fVar14,param_2 * *(float *)(this + 0x120));
*(float *)(this + 0xc) = (float)lVar10;
joined_r0x006af5f8:
if ((0.0 <= local_50) || (this[0x20] == (CFourWheelVehiclePhysics)0x0)) goto LAB_006af247;
fVar11 = *(float *)(r_vehicleBrakeRate._28_4_ + 0x2c) +
*(float *)(r_vehicleBrakeRate._28_4_ + 0x2c);
}
else {
if (0.0 <= fVar12) goto LAB_006af50e;
LAB_006af8d0:
fVar11 = ABS(fVar12 * 0.0025);
if (fVar11 <= 0.25) {
fVar11 = 0.25;
}
if (1.0 <= fVar11) {
fVar11 = local_44;
}
fVar14 = *(float *)(this + 0xc);
if (0.0 < *(float *)(this + 0xc)) {
*(undefined4 *)(this + 0xc) = 0;
fVar14 = local_40;
}
fVar12 = *(float *)(this + 0x44);
if (-0.1 <= fVar12) {
fVar12 = -0.1;
}
lVar10 = (longdouble)Approach(fVar12 * fVar11,fVar14,param_2 * *(float *)(this + 0x120));
*(float *)(this + 0xc) = (float)lVar10;
joined_r0x006af95a:
if ((local_50 <= 0.0) || (this[0x20] == (CFourWheelVehiclePhysics)0x0)) {
LAB_006af247:
*(undefined4 *)(this + 0x14) = 0;
cVar3 = '\x01';
goto LAB_006af253;
}
fVar11 = *(float *)(r_vehicleBrakeRate._28_4_ + 0x2c);
}
lVar10 = (longdouble)Approach(1.0,*(float *)(this + 0x14),fVar11 * param_2);
this[0x1f] = (CFourWheelVehiclePhysics)0x1;
cVar3 = '\0';
*(undefined4 *)(this + 0xc) = 0;
*(float *)(this + 0x14) = (float)lVar10;
}
else {
iVar7 = __dynamic_cast(piVar8,&CBaseEntity::typeinfo,&CBasePlayer::typeinfo,0);
fVar12 = *(float *)(param_1 + 0x18);
if (fVar12 != 0.0) {
if (fVar12 <= 0.0) {
if (0.0 <= fVar12) goto LAB_006af50e;
if (*(int *)(iVar7 + 0x1d28) == 1) {
if (-fVar14 < fVar12) {
fVar12 = *(float *)(xbox_throttlespoof._28_4_ + 0x2c);
*(float *)(param_1 + 0x18) = fVar12;
goto joined_r0x006af4f6;
}
LAB_006af9b5:
*(undefined4 *)(iVar7 + 0x1d28) = 2;
goto LAB_006af1a3;
}
if (*(int *)(iVar7 + 0x1d28) == 0) goto LAB_006af9b5;
goto LAB_006af8d0;
}
if (*(int *)(iVar7 + 0x1d28) == 2) {
if (fVar12 < fVar14) {
fVar12 = -*(float *)(xbox_throttlespoof._28_4_ + 0x2c);
*(float *)(param_1 + 0x18) = fVar12;
goto joined_r0x006af4f6;
}
LAB_006af745:
*(undefined4 *)(iVar7 + 0x1d28) = 1;
fVar12 = *(float *)(param_1 + 0x18);
goto joined_r0x006af4f6;
}
if (*(int *)(iVar7 + 0x1d28) == 0) goto LAB_006af745;
goto LAB_006af1b5;
}
if (ABS(*(float *)(param_1 + 0x1c)) < 200.0) {
*(undefined4 *)(iVar7 + 0x1d28) = 0;
fVar12 = *(float *)(param_1 + 0x18);
goto joined_r0x006af4f6;
}
LAB_006af50e:
if ((uVar2 & 8) != 0) {
fVar14 = *(float *)(this + 0xc);
if (*(float *)(this + 0xc) < 0.0) {
*(undefined4 *)(this + 0xc) = 0;
fVar14 = local_40;
}
fVar12 = *(float *)(this + 0x40);
if (fVar12 <= 0.1) {
fVar12 = 0.1;
}
if (*(float *)(this + 0x10) != 0.0) {
fVar13 = *(float *)(pvVar6 + 0x274);
if (fVar13 <= fVar11) {
fVar16 = *(float *)(pvVar6 + 0x280);
if (fVar13 != *(float *)(pvVar6 + 0x278)) {
fVar11 = (fVar11 - fVar13) / (*(float *)(pvVar6 + 0x278) - fVar13);
if (1.0 <= fVar11) {
fVar11 = local_44;
}
if (fVar11 <= 0.0) {
fVar11 = local_40;
}
fVar16 = (fVar16 - *(float *)(pvVar6 + 0x27c)) * fVar11 + *(float *)(pvVar6 + 0x27c);
}
}
else {
fVar16 = *(float *)(pvVar6 + 0x27c);
if (fVar13 != 0.0) {
if (fVar11 / fVar13 <= 1.0) {
local_44 = fVar11 / fVar13;
}
if (local_44 <= 0.0) {
local_44 = local_40;
}
fVar16 = fVar16 * local_44;
}
}
fVar11 = 1.0 - fVar16 * ABS(*(float *)(this + 0x10));
if (fVar11 <= 0.0) {
fVar11 = local_40;
}
if (fVar11 <= fVar12) {
fVar12 = fVar11;
}
}
lVar10 = (longdouble)Approach(fVar12,fVar14,param_2 * *(float *)(this + 0x120));
*(float *)(this + 0xc) = (float)lVar10;
goto joined_r0x006af5f8;
}
if ((uVar2 & 0x10) != 0) {
fVar11 = *(float *)(this + 0xc);
if (0.0 < *(float *)(this + 0xc)) {
*(undefined4 *)(this + 0xc) = 0;
fVar11 = local_40;
}
fVar14 = *(float *)(this + 0x44);
if (-0.1 <= fVar14) {
fVar14 = -0.1;
}
lVar10 = (longdouble)Approach(fVar14,fVar11,param_2 * *(float *)(this + 0x120));
*(float *)(this + 0xc) = (float)lVar10;
goto joined_r0x006af95a;
}
*(undefined4 *)(this + 0xc) = 0;
cVar3 = '\0';
*(undefined4 *)(this + 0x14) = 0;
}
LAB_006af253:
if ((((uVar2 & 0x20000) != 0) &&
(cVar4 = (**(code **)(**(int **)(this + 0x24) + 0x3c))(*(int **)(this + 0x24)), cVar4 == '\0')
) && (cVar3 != '\0')) {
*(undefined4 *)(this + 0x18) = 0x3f800000;
}
if (((uVar2 & 2) == 0) || (this[0x20] == (CFourWheelVehiclePhysics)0x0)) {
cVar4 = (**(code **)(**(int **)(this + 0x24) + 0x3c))(*(int **)(this + 0x24));
if (cVar4 == '\0') {
if (cVar3 != '\0') {
if ((*(int *)(this + 0x28) < *(int *)(this + 0x2c)) &&
(10 < *(int *)(this + 0x2c) - *(int *)(this + 0x28))) {
this[0x135] = (CFourWheelVehiclePhysics)0x0;
}
}
goto LAB_006af362;
}
LAB_006af287:
*(undefined4 *)(this + 0xc) = 0;
this[0x1c] = (CFourWheelVehiclePhysics)0x1;
}
else {
this[0x1c] = (CFourWheelVehiclePhysics)0x1;
if (*(float *)(param_1 + 0x1c) < -100.0) {
this[0x1d] = (CFourWheelVehiclePhysics)0x1;
}
else if (100.0 < *(float *)(param_1 + 0x1c)) {
this[0x1e] = (CFourWheelVehiclePhysics)0x1;
}
cVar4 = (**(code **)(**(int **)(this + 0x24) + 0x3c))(*(int **)(this + 0x24));
cVar3 = '\0';
if (cVar4 != '\0') goto LAB_006af287;
LAB_006af362:
iVar7 = gpGlobals;
local_24 = cVar3;
if ((this[0x1c] == (CFourWheelVehiclePhysics)0x0) &&
(this[0x1f] == (CFourWheelVehiclePhysics)0x0)) {
if (cVar3 != '\0') {
if (this[0x135] == (CFourWheelVehiclePhysics)0x0) {
uVar1 = *(undefined4 *)(gpGlobals + 0xc);
this[0x135] = (CFourWheelVehiclePhysics)0x1;
*(undefined4 *)(this + 0x124) = uVar1;
}
goto LAB_006af2a6;
}
}
else if (cVar3 != '\0') goto LAB_006af2a6;
}
iVar7 = gpGlobals;
local_24 = '\0';
if (this[0x135] != (CFourWheelVehiclePhysics)0x0) {
cVar3 = (**(code **)(**(int **)(this + 0x24) + 0x3c))(*(int **)(this + 0x24));
iVar7 = gpGlobals;
local_24 = '\0';
if (cVar3 == '\0') {
fVar11 = *(float *)(gpGlobals + 0xc);
this[0x135] = (CFourWheelVehiclePhysics)0x0;
*(float *)(this + 0x128) = fVar11 - *(float *)(this + 0x124);
}
}
LAB_006af2a6:
local_2c = 0.0;
local_30 = *(float *)(iVar7 + 0x10);
local_28 = 0.0;
local_22 = 0;
fVar11 = (float)*(int *)(this + 0x28) / *(float *)(this + 0x48);
if ((float)*(int *)(this + 0x28) / *(float *)(this + 0x48) <= 0.0) {
fVar11 = local_40;
}
local_23 = *(float *)(this + 0xc) <= 0.0 && *(float *)(this + 0xc) != 0.0;
local_21 = 0;
local_20 = 0;
local_22 = IsBoosting(this);
local_21 = (**(code **)(**(int **)(this + 8) + 0xec))(*(int **)(this + 8));
local_2c = fVar11;
if (1.0 <= fVar11) {
local_2c = 1.0;
}
local_30 = param_2;
local_28 = *pfVar5;
(**(code **)(**(int **)(this + 8) + 0x10c))(*(int **)(this + 8),&local_30);
return;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.