Reputation: 71
I'm getting a error while calling this function "An unhandled exception of type 'System.OverflowException' occurred in"
Public Structure GlowStruct
Public r As Single
Public g As Single
Public b As Single
Public a As Single
Public rwo As Boolean
Public rwuo As Boolean
End Structure
Private Sub DrawGlow(ByVal pGlowIn As Int32, ByVal col As GlowStruct)
Dim pGlowObj = Mem.ReadInt(bClient + Offset.oGlowObject, 4)
Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H4), 4, col.r)
Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H8), 4, col.g)
Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &HC), 4, col.b)
Mem.WriteSingle(pGlowObj + ((pGlowIn * &H38) + &H10), 4, col.a)
Mem.WriteBool(pGlowObj + ((pGlowIn * &H38) + &H24), 1, col.rwo)
Mem.WriteBool(pGlowObj + ((pGlowIn * &H38) + &H25), 1, col.rwuo)
End Sub
Upvotes: 0
Views: 534
Reputation: 1441
When you multiply pGlowObj it is being treated as an integer still. Presumably pGlowObj * &H38 exceeds the maximum value for an integer.
Since you want a Single at the end anyway of the calculation anyway, just force pGlowObj to be a single to start with, and then it won't overflow:
Dim pGlowObj as Single = Mem.ReadInt(bClient + Offset.oGlowObject, 4)
Upvotes: 1