| 161 | } |
| 162 | |
| 163 | void DrawAutomap() |
| 164 | { |
| 165 | int cells; |
| 166 | int sx, sy; |
| 167 | int i, j; |
| 168 | int mapx, mapy; |
| 169 | |
| 170 | if (leveltype == DTYPE_TOWN) { |
| 171 | DrawAutomapText(); |
| 172 | return; |
| 173 | } |
| 174 | |
| 175 | gpBufEnd = &gpBuffer[(PANEL_Y)*BUFFER_WIDTH]; |
| 176 | |
| 177 | AutoMapX = (ViewX - 16) >> 1; |
| 178 | while (AutoMapX + AutoMapXOfs < 0) |
| 179 | AutoMapXOfs++; |
| 180 | while (AutoMapX + AutoMapXOfs >= DMAXX) |
| 181 | AutoMapXOfs--; |
| 182 | AutoMapX += AutoMapXOfs; |
| 183 | |
| 184 | AutoMapY = (ViewY - 16) >> 1; |
| 185 | while (AutoMapY + AutoMapYOfs < 0) |
| 186 | AutoMapYOfs++; |
| 187 | while (AutoMapY + AutoMapYOfs >= DMAXY) |
| 188 | AutoMapYOfs--; |
| 189 | AutoMapY += AutoMapYOfs; |
| 190 | |
| 191 | cells = AmShiftTab[(AutoMapScale - 50) / 5]; |
| 192 | if (ScrollInfo._sxoff + ScrollInfo._syoff) |
| 193 | cells++; |
| 194 | mapx = AutoMapX - cells; |
| 195 | mapy = AutoMapY - 1; |
| 196 | |
| 197 | if (cells & 1) { |
| 198 | sx = 384 - AmLine64 * ((cells - 1) >> 1); |
| 199 | sy = 336 - AmLine32 * ((cells + 1) >> 1); |
| 200 | } else { |
| 201 | sx = 384 - AmLine64 * (cells >> 1) + AmLine32; |
| 202 | sy = 336 - AmLine32 * (cells >> 1) - AmLine16; |
| 203 | } |
| 204 | if (ViewX & 1) { |
| 205 | sx -= AmLine16; |
| 206 | sy -= AmLine8; |
| 207 | } |
| 208 | if (ViewY & 1) { |
| 209 | sx += AmLine16; |
| 210 | sy -= AmLine8; |
| 211 | } |
| 212 | |
| 213 | sx += AutoMapScale * ScrollInfo._sxoff / 100 >> 1; |
| 214 | sy += AutoMapScale * ScrollInfo._syoff / 100 >> 1; |
| 215 | if (invflag || sbookflag) { |
| 216 | sx -= 160; |
| 217 | } |
| 218 | if (chrflag || questlog) { |
| 219 | sx += 160; |
| 220 | } |
no test coverage detected