Object respawning: Difference between revisions
m
→The revival map grid
imported>Leoetlino |
imported>Leoetlino |
||
Line 21: | Line 21: | ||
where the player column and row values are calculated as follows: | where the player column and row values are calculated as follows: | ||
<source lang="c++"> | <source lang="c++"> | ||
int col = std::clamp(((signed int)x + 5000) / 1000, 0, 9); | |||
int row = std::clamp(((signed int)z + 4000) / 1000, 0, 7); | |||
if ( (col + 0.5) * 1000.0 + -5000.0 >= x ) { | |||
*col1 = col - 1; | |||
*col2 = col; | |||
} else { | |||
*col1 = col; | |||
*col2 = col + 1; | |||
} | |||
if ( (row + 0.5) * 1000.0 + -4000.0 >= z ) { | |||
*row1 = row - 1; | |||
*row2 = row; | |||
} else { | |||
*row1 = row; | |||
*row2 = row + 1; | |||
} | |||
</source> | </source> | ||