FIXME: Logic is nearly perfect but there are some incorrect values used causing register mismatches inside the loop logic, as well as incorrect r1 local offsets throughout
| 227 | // FIXME: Logic is nearly perfect but there are some incorrect values used causing register mismatches |
| 228 | // inside the loop logic, as well as incorrect r1 local offsets throughout |
| 229 | zLightning* zLightningAdd(_tagLightningAdd* add) |
| 230 | { |
| 231 | zLightning* new_lightning; |
| 232 | if (!(new_lightning = FindFreeLightning())) |
| 233 | { |
| 234 | return NULL; |
| 235 | } |
| 236 | |
| 237 | new_lightning->type = add->type; |
| 238 | new_lightning->flags = add->flags | 0x41; |
| 239 | new_lightning->color = add->color; |
| 240 | |
| 241 | if (new_lightning->type != LYT_TYPE_FUNC) |
| 242 | { |
| 243 | new_lightning->legacy.total_points = add->total_points; |
| 244 | new_lightning->legacy.end_points = add->end_points; |
| 245 | new_lightning->legacy.arc_height = add->arc_height; |
| 246 | new_lightning->legacy.rand_radius = add->rand_radius; |
| 247 | |
| 248 | S32 zeusOnStraightPoint = TRUE; |
| 249 | F32 currot = 0.0f; |
| 250 | |
| 251 | switch (new_lightning->type) |
| 252 | { |
| 253 | case LYT_TYPE_LINE: |
| 254 | break; |
| 255 | case LYT_TYPE_ROTATING: |
| 256 | new_lightning->legacy.rot.degrees = add->move_degrees; |
| 257 | new_lightning->legacy.rot.height = add->rot_radius; |
| 258 | break; |
| 259 | case LYT_TYPE_ZEUS: |
| 260 | new_lightning->legacy.zeus.normal_offset = add->zeus_normal_offset; |
| 261 | new_lightning->legacy.zeus.back_offset = add->zeus_back_offset; |
| 262 | new_lightning->legacy.zeus.side_offset = add->zeus_side_offset; |
| 263 | break; |
| 264 | } |
| 265 | |
| 266 | xVec3 dir; |
| 267 | if (add->flags & 0x80) |
| 268 | { |
| 269 | if (add->end_points - 1 < 0) |
| 270 | { |
| 271 | xVec3Sub(&dir, &add->start[add->total_points - 1], add->start); |
| 272 | } |
| 273 | else |
| 274 | { |
| 275 | xVec3Sub(&dir, &add->end[add->end_points - 1], add->start); |
| 276 | } |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | xVec3Sub(&dir, add->end, add->start); |
| 281 | } |
| 282 | |
| 283 | xVec3Normalize(&dir, &dir); |
| 284 | |
| 285 | if (dir.y > 0.999f || dir.y < -0.999f) |
| 286 | { |
no test coverage detected