Goes through our array and clears the slots out
| 487 | |
| 488 | // Goes through our array and clears the slots out |
| 489 | void InitVisEffects() { |
| 490 | static uint16_t old_max_vis = 0; |
| 491 | max_vis_effects = MAX_VIS_EFFECTS; // always peg to max on PC |
| 492 | |
| 493 | if (old_max_vis == max_vis_effects) |
| 494 | return; |
| 495 | |
| 496 | if (VisEffects != NULL) { |
| 497 | VisEffects = (vis_effect *)mem_realloc(VisEffects, sizeof(vis_effect) * max_vis_effects); |
| 498 | VisDeadList = (uint16_t *)mem_realloc(VisDeadList, sizeof(uint16_t) * max_vis_effects); |
| 499 | Vis_free_list = (int16_t *)mem_realloc(Vis_free_list, sizeof(int16_t) * max_vis_effects); |
| 500 | } else if (VisEffects == NULL) { |
| 501 | VisEffects = (vis_effect *)mem_malloc(sizeof(vis_effect) * max_vis_effects); |
| 502 | VisDeadList = (uint16_t *)mem_malloc(sizeof(uint16_t) * max_vis_effects); |
| 503 | Vis_free_list = (int16_t *)mem_malloc(sizeof(int16_t) * max_vis_effects); |
| 504 | } |
| 505 | for (int i = 0; i < max_vis_effects; i++) { |
| 506 | VisEffects[i].type = VIS_NONE; |
| 507 | VisEffects[i].roomnum = -1; |
| 508 | VisEffects[i].prev = -1; |
| 509 | VisEffects[i].next = -1; |
| 510 | Vis_free_list[i] = i; |
| 511 | } |
| 512 | old_max_vis = max_vis_effects; |
| 513 | Num_vis_effects = 0; |
| 514 | Highest_vis_effect_index = 0; |
| 515 | |
| 516 | atexit(ShutdownVisEffects); |
| 517 | } |
| 518 | |
| 519 | // Returns the next free viseffect |
| 520 | int VisEffectAllocate() { |