| 1171 | } tgfirst; |
| 1172 | |
| 1173 | void |
| 1174 | tmp_at(coordxy x, coordxy y) |
| 1175 | { |
| 1176 | static struct tmp_glyph *tglyph = (struct tmp_glyph *) 0; |
| 1177 | struct tmp_glyph *tmp; |
| 1178 | |
| 1179 | switch (x) { |
| 1180 | case DISP_BEAM: |
| 1181 | case DISP_ALL: |
| 1182 | case DISP_TETHER: |
| 1183 | case DISP_FLASH: |
| 1184 | case DISP_ALWAYS: |
| 1185 | if (!tglyph) |
| 1186 | tmp = &tgfirst; |
| 1187 | else /* nested effect; we need dynamic memory */ |
| 1188 | tmp = (struct tmp_glyph *) alloc(sizeof *tmp); |
| 1189 | tmp->prev = tglyph; |
| 1190 | tglyph = tmp; |
| 1191 | tglyph->sidx = 0; |
| 1192 | tglyph->style = x; |
| 1193 | tglyph->glyph = y; |
| 1194 | flush_screen(0); /* flush buffered glyphs */ |
| 1195 | return; |
| 1196 | |
| 1197 | case DISP_FREEMEM: /* in case game ends with tmp_at() in progress */ |
| 1198 | while (tglyph) { |
| 1199 | tmp = tglyph->prev; |
| 1200 | if (tglyph != &tgfirst) |
| 1201 | free((genericptr_t) tglyph); |
| 1202 | tglyph = tmp; |
| 1203 | } |
| 1204 | return; |
| 1205 | |
| 1206 | default: |
| 1207 | break; |
| 1208 | } |
| 1209 | |
| 1210 | if (!tglyph) { |
| 1211 | panic("tmp_at: tglyph not initialized"); |
| 1212 | } else { |
| 1213 | switch (x) { |
| 1214 | case DISP_CHANGE: |
| 1215 | tglyph->glyph = y; |
| 1216 | break; |
| 1217 | |
| 1218 | case DISP_END: |
| 1219 | if (tglyph->style == DISP_BEAM || tglyph->style == DISP_ALL) { |
| 1220 | int i; |
| 1221 | |
| 1222 | /* Erase (reset) from source to end */ |
| 1223 | for (i = 0; i < tglyph->sidx; i++) |
| 1224 | newsym(tglyph->saved[i].x, tglyph->saved[i].y); |
| 1225 | } else if (tglyph->style == DISP_TETHER) { |
| 1226 | int i; |
| 1227 | |
| 1228 | if (y == BACKTRACK && tglyph->sidx > 1) { |
| 1229 | /* backtrack */ |
| 1230 | for (i = tglyph->sidx - 1; i > 0; i--) { |
no test coverage detected