};
-int (*mapProcs[NMAPS])();
-
-int drawAll(SimView *view);
-int drawRes(SimView *view);
-int drawCom(SimView *view);
-int drawInd(SimView *view);
-int drawPower(SimView *view);
-int drawLilTransMap(SimView *view);
-int drawPopDensity(SimView *view);
-int drawRateOfGrowth(SimView *view);
-int drawTrafMap(SimView *view);
-int drawPolMap(SimView *view);
-int drawCrimeMap(SimView *view);
-int drawLandMap(SimView *view);
-int drawFireRadius(SimView *view);
-int drawPoliceRadius(SimView *view);
-int drawDynamic(SimView *view);
+void (*mapProcs[NMAPS])();
+
+void drawPopDensity(SimView *view);
+void drawRateOfGrowth(SimView *view);
+void drawTrafMap(SimView *view);
+void drawPolMap(SimView *view);
+void drawCrimeMap(SimView *view);
+void drawLandMap(SimView *view);
+void drawFireRadius(SimView *view);
+void drawPoliceRadius(SimView *view);
+void ditherMap(SimView *view);
+void drawRect(SimView *view, int pixel, int solid,
+ int x, int y, int w, int h);
+void maybeDrawRect(SimView *view, int val,
+ int x, int y, int w, int h);
short GetCI(short x)
}
+void
drawPopDensity(SimView *view)
{
short x, y;
}
+void
drawRateOfGrowth(SimView *view)
{
short x, y;
}
+void
drawTrafMap(SimView *view)
{
short x;
}
+void
drawPolMap(SimView *view)
{
short x, y;
}
+void
drawCrimeMap(SimView *view)
{
short x, y;
}
+void
drawLandMap(SimView *view)
{
short x, y;
}
+void
drawFireRadius(SimView *view)
{
short x, y;
drawAll(view);
- for (x = 0; x < SmY; x++) {
+ for (x = 0; x < SmX; x++) {
for (y = 0; y < SmY; y++) {
maybeDrawRect(view, GetCI(FireRate[x][y]),
x * 24, y * 24, 24, 24);
}
+void
drawPoliceRadius(SimView *view)
{
short x, y;
}
+void
setUpMapProcs(void)
{
mapProcs[ALMAP] = drawAll;
}
+void
MemDrawMap(SimView *view)
{
(*mapProcs[view->map_state])(view);
}
+void
ditherMap(SimView *view)
{
int i, x, y, width, height;
}
+void
maybeDrawRect(SimView *view, int val,
int x, int y, int w, int h)
{
}
+void
drawRect(SimView *view, int pixel, int solid,
int x, int y, int w, int h)
{
if (w && h) {
int i, j, stipple = (x ^ y) & 1;
+#if 0
unsigned char *data =
view->x->color ? view->data : view->data8;
+#endif
/* In the case of black and white, we use an 8 bit buffer and dither it. */
int pixelBytes =
QUAD line =
view->x->color ? view->line_bytes : view->line_bytes8;
+#if 0
unsigned char *image =
&(data[(line * y) + (x * pixelBytes)]);
+#endif
switch (pixelBytes) {
unsigned char *image =
&data[(line * y) + (x * pixelBytes)];
- if (solid) {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
+ for (i = h; i > 0; i--) {
+ for (j = w; j > 0; j--) {
+ if (solid || stipple++ & 1)
*image = pixel;
- image++;
- }
- image += line - w;
- }
- } else {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
- if (stipple++ & 1)
- *image = pixel;
- image++;
- }
- if (!(w & 1))
- stipple++;
- image += line - w;
+ image++;
}
+ if (!(w & 1))
+ stipple++;
+ image += line - w;
}
}
break;
image =
&data[(line * y) + x];
- if (solid) {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
- *image = pixel;
- image++;
- }
- image += line - w;
- }
- } else {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
- if (stipple++ & 1)
- *image = pixel;
- image++;
+ for (i = h; i > 0; i--) {
+ for (j = w; j > 0; j--) {
+ if (solid || stipple++ & 1) {
+ if (view->x->x_big_endian) {
+ *image = ((pixel & 0xff) << 8) | ((pixel & 0xff00) >> 8);
+ } else {
+ *image = pixel;
+ }
}
- if (!(w & 1))
- stipple++;
- image += line - w;
+ image++;
}
+ if (!(w & 1))
+ stipple++;
+ image += line - w;
}
+
}
break;
unsigned char *data =
(unsigned char *)view->data;
unsigned char *image;
- int bitmapPad = view->x->small_tile_image->bitmap_pad;
- int rowBytes = view->x->small_tile_image->bytes_per_line;
- line = rowBytes >> 1; /* Convert from byte offset to short offset */
image =
- &data[(line * y) + x];
+ &data[(line * y) + x * pixelBytes];
- if (solid) {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
- *(image++) = (pixel >> 0) & 0xff;
- *(image++) = (pixel >> 8) & 0xff;
- *(image++) = (pixel >> 16) & 0xff;
- if (bitmapPad == 32) {
+ for (i = h; i > 0; i--) {
+ for (j = w; j > 0; j--) {
+ if (view->x->x_big_endian) {
+ if (pixelBytes == 4) {
image++;
}
- }
- image += line - w;
- }
- } else {
- for (i = h; i > 0; i--) {
- for (j = w; j > 0; j--) {
- if (stipple++ & 1) {
- *(image++) = (pixel >> 0) & 0xff;
- *(image++) = (pixel >> 8) & 0xff;
- *(image++) = (pixel >> 16) & 0xff;
- if (bitmapPad == 32) {
- image++;
- }
+ if (solid || stipple++ & 1) {
+ *(image++) = (pixel >> 16) & 0xff;
+ *(image++) = (pixel >> 8) & 0xff;
+ *(image++) = (pixel >> 0) & 0xff;
+ } else {
+ image += 3;
+ }
+ } else {
+ if (solid || stipple++ & 1) {
+ *(image++) = (pixel >> 0) & 0xff;
+ *(image++) = (pixel >> 8) & 0xff;
+ *(image++) = (pixel >> 16) & 0xff;
+ } else {
+ image += 3;
+ }
+ if (pixelBytes == 4) {
+ image++;
}
}
- if (!(w & 1)) {
- stipple++;
- }
- image += line - w;
}
+ if (!(w & 1)) {
+ stipple++;
+ }
+ image += line - w * pixelBytes;
}
}
break;