MCPcopy Create free account
hub / github.com/NetHack/NetHack / vga_DrawCursor

Function vga_DrawCursor

sys/msdos/vidvga.c:1348–1561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1346static struct planar_cell_struct cursor;
1347
1348void
1349vga_DrawCursor(void)
1350{
1351 int i, pixx, pixy, x, y, p;
1352 char __far *tmp1;
1353 char __far *tmp2;
1354 unsigned char first, second;
1355 /* char on[2] = {0xFF,0xFF}; */
1356 /* char off[2] = {0x00,0x00}; */
1357 boolean isrogue = Is_rogue_level(&u.uz);
1358 boolean singlebyte =
1359 (isrogue || iflags.over_view || iflags.traditional_view || !inmap);
1360 int curtyp;
1361
1362 if (!cursor_type && inmap)
1363 return; /* CURSOR_INVIS - nothing to do */
1364
1365 x = min(curcol, (CO - 1)); /* protection from callers */
1366 y = min(currow, (LI - 1)); /* protection from callers */
1367 if (!singlebyte && ((x < clipx) || (x > clipxmax)))
1368 return;
1369 pixy = row2y(y); /* convert to pixels */
1370 if (singlebyte)
1371 pixx = x;
1372 else
1373 pixx = col2x((x - clipx));
1374
1375 for (i = 0; i < ROWS_PER_CELL; ++i) {
1376 tmp1 = screentable[i + pixy];
1377 tmp1 += pixx;
1378 tmp2 = tmp1 + 1;
1379 egareadplane(3);
1380 /* memcpy(undercursor.plane[3].image[i],tmp1,BYTES_PER_CELL); */
1381 undercursor.plane[3].image[i][0] = READ_ABSOLUTE(tmp1);
1382 if (!singlebyte)
1383 undercursor.plane[3].image[i][1] = READ_ABSOLUTE(tmp2);
1384
1385 egareadplane(2);
1386 /* memcpy(undercursor.plane[2].image[i],tmp1,BYTES_PER_CELL); */
1387 undercursor.plane[2].image[i][0] = READ_ABSOLUTE(tmp1);
1388 if (!singlebyte)
1389 undercursor.plane[2].image[i][1] = READ_ABSOLUTE(tmp2);
1390
1391 egareadplane(1);
1392 /* memcpy(undercursor.plane[1].image[i],tmp1,BYTES_PER_CELL); */
1393 undercursor.plane[1].image[i][0] = READ_ABSOLUTE(tmp1);
1394 if (!singlebyte)
1395 undercursor.plane[1].image[i][1] = READ_ABSOLUTE(tmp2);
1396
1397 egareadplane(0);
1398 /* memcpy(undercursor.plane[0].image[i],tmp1,BYTES_PER_CELL); */
1399 undercursor.plane[0].image[i][0] = READ_ABSOLUTE(tmp1);
1400 if (!singlebyte)
1401 undercursor.plane[0].image[i][1] = READ_ABSOLUTE(tmp2);
1402 }
1403
1404 /*
1405 * Now we have a snapshot of the current cell.

Callers 4

vga_xputgFunction · 0.85
vga_userpanFunction · 0.85
vga_refreshFunction · 0.85
DrawCursorFunction · 0.85

Calls 1

positionbarFunction · 0.70

Tested by

no test coverage detected