OpenTrespasser / JurassicParkTrespasser

A git-based fork of the Jurassic Park: Trespasser source code.
101 stars 25 forks source link

Deduplicate CDDSize and use it where applicable #124

Closed meekee7 closed 4 years ago

meekee7 commented 4 years ago

Certain DirectX structs have a dwSize member. When creating such a struct, you are supposed to assign dwSize to sizeof(ThatStruct). Trespasser has three wrappers to automate this: CDDSize, CDSSize (a copypaste of CDDSize) and InitDXStruct. They all do the same thing: memset the struct to 0 and then assign dwSize.

CDDSize is extracted into its own header file and augmented with a few compile-time safety checks. All usages of CDSSize and InitDXStruct are replaced with CDDSize. Furthermore, CDDSize is now used wherever applicable.