Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.6 kB
6
Indexable
Never
So I have 3 different functions that only change a bool variable and I looked at the assembly code what really is happening and they change the value in different places and I do not understand why. The variable is getting set at the `mov byte ptr [eax+000004C0],01/00` instruction but eax has a different value at all of them. They should be the same, no?

Function
```
void CActorInstance::__InitializeCollisionData()
{
    m_canSkipCollision=false;
}
```
Assembly
```
- push ebp
- mov ebp,esp
- push ecx
- mov [ebp-04],CCCCCCCC { -858993460 }
- mov [ebp-04],ecx
- mov ecx,01076A82 { (1) }
- call 0043223B
- mov eax,[ebp-04]
- mov byte ptr [eax+000004C0],00 // eax = 13B3FCC4
- add esp,04 { 4 }
- cmp ebp,esp
- call 004238DA
- mov esp,ebp
- pop ebp
- ret```
---------------------------------------------
Function
```
void CActorInstance::EnableSkipCollision()
{
    m_canSkipCollision=true;
}
```
Assembly
```
- push ebp
- mov ebp,esp
- push ecx
- mov [ebp-04],CCCCCCCC { -858993460 }
- mov [ebp-04],ecx
- mov ecx,01076A82 { (1) }
- call 0043223B
- mov eax,[ebp-04]
- mov byte ptr [eax+000004C0],01 // eax = 27BC224C
- add esp,04 { 4 }
- cmp ebp,esp
- call 004238DA
- mov esp,ebp
- pop ebp
- ret
```
---------------------------------------------
Function
```void CActorInstance::DisableSkipCollision()
{
    m_canSkipCollision=false;
}```
Assembly
```
- push ebp
- mov ebp,esp
- push ecx
- mov [ebp-04],CCCCCCCC { -858993460 }
- mov [ebp-04],ecx
- mov ecx,01076A82 { (1) }
- call 0043223B
- mov eax,[ebp-04]
- mov byte ptr [eax+000004C0],00 // eax = 2776E3EC
- add esp,04 { 4 }
- cmp ebp,esp
- call 004238DA
- mov esp,ebp
- pop ebp
- ret
```