MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / CheckRadiusSprites

Method CheckRadiusSprites

Source/Map/Random.cpp:103–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103bool cRandomMap::CheckRadiusSprites(cPosition* pPosition, int32 pRadius) {
104
105 int32 xLeft = pPosition->mX - pRadius;
106 int32 xRight = pPosition->mX + pRadius;
107
108 int32 yspan = (int32) (pRadius * sin(acos((pPosition->mX - pPosition->mX) / pRadius)));
109
110 int32 yTop = pPosition->mY - yspan;
111 int32 yBottom = pPosition->mY + yspan;
112
113
114 for (auto& Sprite : mSprites) {
115
116 if (Sprite.field_0 < 0 || Sprite.field_4 < 0)
117 continue;
118
119 if ((Sprite.field_0 >= xLeft && Sprite.field_0 <= xRight) &&
120 (Sprite.field_4 >= yTop && Sprite.field_4 <= yBottom))
121 return true;
122 }
123
124 return false;
125}
126
127float cRandomMap::getRandomFloat(float pMin, float pMax) {
128

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected