CGameMovement::Duck
0x0045c630 · 1765 bytes · __thiscall
_ZN13CGameMovement4DuckEv
Decompiled
undefined (1 param)
/* CGameMovement::Duck() */
void __thiscall CGameMovement::Duck(CGameMovement *this)
{
uint uVar1;
uint uVar2;
int iVar3;
bool bVar4;
bool bVar5;
char cVar6;
int iVar7;
int *piVar8;
uint uVar9;
int iVar10;
int iVar11;
CBaseEntity *this_00;
uint uVar12;
bool bVar13;
float fVar14;
CGameTrace local_70 [44];
float local_44;
uVar1 = *(uint *)(*(int *)(this + 8) + 0x28);
uVar2 = *(uint *)(*(int *)(this + 8) + 0x24);
iVar7 = CBaseEntity::GetGroundEntity(*(CBaseEntity **)(this + 4));
iVar10 = *(int *)(this + 4);
uVar12 = *(uint *)(iVar10 + 0x150);
iVar11 = *(int *)(iVar10 + 0x1a9c);
iVar10 = *(int *)(iVar10 + 0x1a98);
iVar3 = *(int *)(this + 8);
if ((*(byte *)(iVar3 + 0x24) & 4) == 0) {
*(uint *)(iVar3 + 0x28) = *(uint *)(iVar3 + 0x28) & 0xfffffffb;
}
else {
*(uint *)(iVar3 + 0x28) = *(uint *)(iVar3 + 0x28) | 4;
}
if (*(int *)(*(int *)(this + 4) + 0x100) < 1) {
return;
}
uVar9 = uVar2 ^ uVar1;
bVar13 = iVar7 != 0;
uVar12 = uVar12 >> 1;
bVar4 = 0 < iVar11;
bVar5 = 0 < iVar10;
(**(code **)(*(int *)this + 0xe4))(this);
piVar8 = *(int **)(this + 4);
if ((*(byte *)(*(int *)(this + 8) + 0x24) & 4) == 0) {
if ((*(char *)((int)piVar8 + 0x1a91) == '\0') && ((uVar12 & 1) == 0)) {
if (!bVar4) {
if (piVar8[0x40] < 1) {
return;
}
if ((*(byte *)(piVar8 + 0x748) & 8) != 0) {
return;
}
cVar6 = (**(code **)(*piVar8 + 0x4fc))(piVar8);
if (cVar6 != '\0') {
return;
}
piVar8 = *(int **)(this + 4);
if (piVar8[0x6a6] != 0) {
return;
}
iVar10 = (**(code **)(*piVar8 + 0x250))(piVar8);
fVar14 = *(float *)(iVar10 + 8);
iVar10 = (**(code **)(*(int *)this + 0x24))(this,0);
if (ABS(fVar14 - *(float *)(iVar10 + 8)) <= 0.1) {
return;
}
SetDuckedEyeOffset(this,0.0);
return;
}
}
else if (!bVar4) {
if (*(char *)((int)piVar8 + 0x1a92) != '\0') {
cVar6 = CanUnDuckJump(this,local_70);
if ((cVar6 != '\0') && (FinishUnDuckJump(this,local_70), local_44 < 1.0)) {
iVar10 = *(int *)(this + 4);
iVar11 = (int)((1.0 - local_44) * 200.0 + 800.0);
if (iVar11 != *(int *)(iVar10 + 0x1a98)) {
(**(code **)(*(int *)(iVar10 + 0x1a40) + 4))(iVar10 + 0x1a40,iVar10 + 0x1a98);
*(int *)(iVar10 + 0x1a98) = iVar11;
}
}
}
if (bVar5) {
return;
}
iVar10 = *(int *)(this + 4);
if (((*(char *)(iVar10 + 0x1ad0) == '\0') && (bVar13)) && (*(char *)(iVar10 + 0x1a91) == '\0')
) {
return;
}
if ((uVar9 & uVar1 & 4) != 0) {
if ((uVar12 & 1) == 0) {
if ((*(char *)(iVar10 + 0x1a91) != '\0') && (*(char *)(iVar10 + 0x1a90) == '\0')) {
fVar14 = (float)(1000 - *(int *)(iVar10 + 0x1a94)) * 0.0025;
if (fVar14 <= 0.0) {
fVar14 = 0.0;
}
if (1.0 <= fVar14) {
fVar14 = 1.0;
}
iVar11 = (int)(fVar14 * 200.0) + 800;
if (*(int *)(iVar10 + 0x1a94) != iVar11) {
(**(code **)(*(int *)(iVar10 + 0x1a40) + 4))(iVar10 + 0x1a40,iVar10 + 0x1a94);
*(int *)(iVar10 + 0x1a94) = iVar11;
}
}
}
else if (*(int *)(iVar10 + 0x1a94) != 1000) {
(**(code **)(*(int *)(iVar10 + 0x1a40) + 4))(iVar10 + 0x1a40,iVar10 + 0x1a94);
*(undefined4 *)(iVar10 + 0x1a94) = 1000;
}
}
cVar6 = (**(code **)(*(int *)this + 0xf0))(this);
iVar10 = *(int *)(this + 4);
if (cVar6 == '\0') {
if (*(int *)(iVar10 + 0x1a94) == 1000) {
return;
}
SetDuckedEyeOffset(this,1.0);
this_00 = *(CBaseEntity **)(this + 4);
if (*(int *)(this_00 + 0x1a94) != 1000) {
(**(code **)(*(int *)(this_00 + 0x1a40) + 4))(this_00 + 0x1a40,this_00 + 0x1a94);
*(undefined4 *)(this_00 + 0x1a94) = 1000;
this_00 = *(CBaseEntity **)(this + 4);
}
if (this_00[0x1a90] != (CBaseEntity)0x1) {
(**(code **)(*(int *)(this_00 + 0x1a40) + 4))(this_00 + 0x1a40,this_00 + 0x1a90);
this_00[0x1a90] = (CBaseEntity)0x1;
this_00 = *(CBaseEntity **)(this + 4);
}
if (this_00[0x1a91] != (CBaseEntity)0x0) {
(**(code **)(*(int *)(this_00 + 0x1a40) + 4))(this_00 + 0x1a40,this_00 + 0x1a91);
this_00[0x1a91] = (CBaseEntity)0x0;
this_00 = *(CBaseEntity **)(this + 4);
}
CBaseEntity::AddFlag(this_00,2);
return;
}
if ((*(char *)(iVar10 + 0x1a91) == '\0') && (*(char *)(iVar10 + 0x1a90) == '\0')) {
return;
}
iVar10 = 1000 - *(int *)(iVar10 + 0x1a94);
if (iVar10 < 0) {
iVar10 = 0;
}
else if (200 < iVar10) goto LAB_0045cd1f;
if (bVar13) {
fVar14 = (float)iVar10 * 0.005;
if (fVar14 <= 0.0) {
fVar14 = 0.0;
}
if (1.0 <= fVar14) {
fVar14 = 1.0;
}
fVar14 = 1.0 - fVar14;
SetDuckedEyeOffset(this,fVar14 * fVar14 * 3.0 - (fVar14 + fVar14) * fVar14 * fVar14);
iVar10 = *(int *)(this + 4);
if (*(char *)(iVar10 + 0x1a91) == '\x01') {
return;
}
(**(code **)(*(int *)(iVar10 + 0x1a40) + 4))(iVar10 + 0x1a40,iVar10 + 0x1a91);
*(undefined1 *)(iVar10 + 0x1a91) = 1;
return;
}
LAB_0045cd1f:
(**(code **)(*(int *)this + 0xe8))(this);
return;
}
}
if (((((uVar9 & uVar2 & 4) == 0) || ((uVar12 & 1) != 0)) || (bVar4)) || (bVar5)) {
LAB_0045c790:
if (*(char *)((int)piVar8 + 0x1a91) == '\0') goto LAB_0045c79f;
}
else {
if (piVar8[0x6a5] != 1000) {
(**(code **)(piVar8[0x690] + 4))(piVar8 + 0x690,piVar8 + 0x6a5);
piVar8[0x6a5] = 1000;
piVar8 = *(int **)(this + 4);
}
if (*(char *)((int)piVar8 + 0x1a91) != '\x01') {
(**(code **)(piVar8[0x690] + 4))(piVar8 + 0x690,(int)piVar8 + 0x1a91);
*(undefined1 *)((int)piVar8 + 0x1a91) = 1;
piVar8 = *(int **)(this + 4);
goto LAB_0045c790;
}
}
if ((!bVar4) && (!bVar5)) {
iVar10 = 0;
if (-1 < 1000 - piVar8[0x6a5]) {
iVar10 = 1000 - piVar8[0x6a5];
}
if (((iVar10 < 0x191) && ((uVar12 & 1) == 0)) && (bVar13)) {
fVar14 = (float)iVar10 * 0.0025;
if (fVar14 <= 0.0) {
fVar14 = 0.0;
}
if (1.0 <= fVar14) {
fVar14 = 1.0;
}
SetDuckedEyeOffset(this,fVar14 * fVar14 * 3.0 - (fVar14 + fVar14) * fVar14 * fVar14);
return;
}
(**(code **)(*(int *)this + 0xec))(this);
return;
}
LAB_0045c79f:
if (bVar4) {
if ((uVar12 & 1) == 0) {
StartUnDuckJump(this);
}
else if ((*(byte *)(*(int *)(this + 8) + 0x24) & 4) == 0) {
cVar6 = CanUnDuckJump(this,local_70);
if (cVar6 != '\0') {
FinishUnDuckJump(this,local_70);
iVar10 = *(int *)(this + 4);
iVar11 = (int)((1.0 - local_44) * 200.0 + 800.0);
if (iVar11 != *(int *)(iVar10 + 0x1a98)) {
(**(code **)(*(int *)(iVar10 + 0x1a40) + 4))(iVar10 + 0x1a40,iVar10 + 0x1a98);
*(int *)(iVar10 + 0x1a98) = iVar11;
}
}
}
}
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.