Ok, I've searched the forums and have noticed a couple shortcomings with DarkBasic pro and using user-defined datatypes.
1) UDT cannot directly be passed as a parameter in a function, if they're also a part of an array
2) You cannot use a UDT as a return value from a function, without a workaround
3) UDT cannot contain arrays, without a workaround.
These three problems have definitely made me think outside of the box in regards to my programming. However, I cannot get past this shaking feeling that my code is becoming bloated, inefficient,
and just plain horrible
As quick rundown of my program....
a) Multiple people in the level
b) Each person casts four vectors for collision detection
c) Each vector consists of two points
d) Each point consists of three values (X,Y,Z)
I come from the world of object-oriented programming, and this screams using UDT's and arrays to store these data types. But, I cannot easily manipulate UDT's in functions, as there are limitations passing them in, and they cannot be returned without a hackjob. Which in itself could lead to buggy code. I could have duplicate code, which would solve that problem, but duplicate code leads to its own issues.
So, I'm confused. I'm relatively new to DarkBasic (hence all the newbie posts!) but I'm still extremely excited about using the product. In the week or so that I've been programming, I've exceeded what would take months to do in other SDK's that I have used.
But, for the sake of good design code, and not wanting to rewrite huge chunks later on - what good design tips are there for dealing with data situations like this?
EDIT: To show a small portion of what I have so far....
Type S4_Vector3
X as float
Y as float
Z as float
EndType
Type S4_Ray3D
pointA as S4_Vector3
pointB as S4_Vector3
EndType
`types for players
Type S4_Player
dbMeshID as Integer
dbTexID as Integer
pos as S4_Vector3
rot as S4_Vector3
scale as S4_Vector3
size as S4_Vector3
rayLegLeft as S4_Ray3D
rayLegRight as S4_Ray3D
rayBody as S4_Ray3D
rayHead as S4_Ray3D
EndType
Global Dim S4_PlayerList() as S4_Player
Clear Array S4_PlayerList()