Checks to see if its time to respawn any powerups
| 1936 | |
| 1937 | // Checks to see if its time to respawn any powerups |
| 1938 | void MultiCheckToRespawnPowerups() { |
| 1939 | int i, t; |
| 1940 | |
| 1941 | for (i = 0; i < Num_powerup_timer; i++) { |
| 1942 | if (Powerup_timer[i].respawn_time < Gametime) { |
| 1943 | // This powerup needs to be respawned, so find a vacant spot |
| 1944 | int num_cand = 0; |
| 1945 | int candidates[MAX_RESPAWNS]; |
| 1946 | |
| 1947 | for (t = 0; t < Num_powerup_respawn; t++) { |
| 1948 | if (Powerup_respawn[t].used == 0) { |
| 1949 | if (Netgame.flags & NF_RANDOMIZE_RESPAWN) { |
| 1950 | // We found a spot! |
| 1951 | candidates[num_cand++] = t; |
| 1952 | } else { |
| 1953 | if (Powerup_timer[i].id == Powerup_respawn[t].original_id) |
| 1954 | candidates[num_cand++] = t; |
| 1955 | } |
| 1956 | } |
| 1957 | } |
| 1958 | |
| 1959 | if (num_cand == 0) { |
| 1960 | mprintf(0, "Couldn't find a good spot to respawn!!!\n"); |
| 1961 | return; |
| 1962 | } |
| 1963 | |
| 1964 | t = candidates[ps_rand() % num_cand]; |
| 1965 | |
| 1966 | mprintf(0, "Respawning powerup with id of %d.\n", Powerup_timer[i].id); |
| 1967 | Powerup_respawn[t].used = 1; |
| 1968 | int objnum = |
| 1969 | ObjCreate(OBJ_POWERUP, Powerup_timer[i].id, Powerup_respawn[t].roomnum, &Powerup_respawn[t].pos, NULL); |
| 1970 | if (objnum > -1) |
| 1971 | MultiSendObject(&Objects[objnum], 1); |
| 1972 | |
| 1973 | InitObjectScripts(&Objects[objnum]); |
| 1974 | Powerup_respawn[t].objnum = objnum; |
| 1975 | |
| 1976 | // Now erase this powerup from our timer info |
| 1977 | for (t = i; t < Num_powerup_timer - 1; t++) |
| 1978 | Powerup_timer[t] = Powerup_timer[t + 1]; |
| 1979 | |
| 1980 | Num_powerup_timer--; |
| 1981 | i--; |
| 1982 | } |
| 1983 | } |
| 1984 | } |
| 1985 | |
| 1986 | extern int Multi_occluded; |
| 1987 | // Sends out positional updates based on clients pps |
no test coverage detected