- pacmangamestruct *pp = *ps;
- Display *display = *dpy;
- static char *colors[]= {
- ". c #FF0000", /*Red*/
- ". c #00FFDE", /*Blue*/
- ". c #FFB847", /*Orange*/
- ". c #FFB8DE", /*Pink*/
- };
-
- static char **bits[] = {
- ghost_u1_xpm, ghost_u2_xpm, ghost_r1_xpm, ghost_r2_xpm,
- ghost_d1_xpm, ghost_d2_xpm, ghost_l1_xpm, ghost_l2_xpm
- };
- int i, j, k, m;
- int w = pp->spritexs;
- int h = pp->spriteys;
- GC gc = 0;
- Pixmap temp;
-
- for (i = 0; i < 4; i++){
- m = 0;
- for ( j = 0; j < MAXGDIR; j++){
- for ( k = 0; k < MAXGWAG; k++){
- bits[m][2] = colors[i];
- pp->ghostPixmap[i][j][k] = xpm_data_to_pixmap (display, window, bits[m],
- &w, &h, &pp->ghostMask);
-
- if (!pp->ghostPixmap[i][j][k]) pacman_fail("Cannot load ghost images");
-
- pp->ghostPixmap[i][j][k] = scale_pixmap(&display, pp->stippledGC,
- pp->ghostPixmap[i][j][k], pp->spritexs, pp->spriteys);
-
- if (!pp->ghostPixmap[i][j][k]) pacman_fail("Cannot scale ghost images");
- m++;
- }
- }
- }
- /* We really only need a single mask. This saves the headache of getting the bottom of the ghost
- * to clip just right. What we'll do is mask the top portion of the ghost, but the bottom of the
- * the ghost will be solid. I did this by setting the pixels between the fringe of their sheets
- * to black instead of none. -jeremy
- */
- temp = xpm_data_to_pixmap (display, window, ghost_mask_xpm,
- &w, &h, &pp->ghostMask);
-
- if (!temp) pacman_fail("Cannot load temporary ghost image");
-
- temp = scale_pixmap(&display, pp->stippledGC,
- temp, pp->spritexs, pp->spriteys);
-
- if (!temp) pacman_fail("Cannot scale temporary ghost image");
-
- gc = XCreateGC(display, pp->ghostMask, 0, 0);
-
- pp->ghostMask = scale_pixmap(&display, gc, pp->ghostMask,
- pp->spritexs, pp->spriteys);
- XFreePixmap(display, temp);
+ pacmangamestruct *pp = *ps;
+ Display *display = *dpy;
+ char *colors[] = {
+ ". c #FF0000", /*Red */
+ ". c #00FFDE", /*Blue */
+ ". c #FFB847", /*Orange */
+ ". c #FFB8DE", /*Pink */
+ };
+
+ char **bits[] = {
+ ghost_u1_xpm, ghost_u2_xpm, ghost_r1_xpm, ghost_r2_xpm,
+ ghost_d1_xpm, ghost_d2_xpm, ghost_l1_xpm, ghost_l2_xpm
+ };
+ char * const *s_bits[] = {
+ ghost_s1_xpm, ghost_s2_xpm,
+ ghost_sf1_xpm, ghost_sf2_xpm
+ };
+ char * const *e_bits[] = {
+ eyes_u_xpm, eyes_r_xpm, eyes_d_xpm, eyes_l_xpm
+ };
+
+ int i, j, k, m;
+ int w = pp->spritexs;
+ int h = pp->spriteys;
+ GC gc = 0;
+ Pixmap temp;
+
+ for (i = 0; i < 4; i++) {
+ m = 0;
+ for (j = 0; j < MAXGDIR; j++) {
+ for (k = 0; k < MAXGWAG; k++) {
+ bits[m][2] = colors[i];
+ pp->ghostPixmap[i][j][k] =
+ xpm_data_to_pixmap (display, window, bits[m], &w, &h,
+ &pp->ghostMask);
+
+ if (!pp->ghostPixmap[i][j][k])
+ pacman_fail ("Cannot load ghost images");
+
+ pp->ghostPixmap[i][j][k] =
+ scale_pixmap (&display, pp->stippledGC,
+ pp->ghostPixmap[i][j][k], pp->spritexs,
+ pp->spriteys);
+
+ if (!pp->ghostPixmap[i][j][k])
+ pacman_fail ("Cannot scale ghost images");
+ m++;
+ }
+ }
+ }
+ /* load the scared ghost */
+ m = 0;
+ for (i = 0; i < MAXGFLASH; i++) {
+ for (j = 0; j < MAXGWAG; j++) {
+ pp->s_ghostPixmap[i][j] =
+ xpm_data_to_pixmap (display, window, s_bits[m++], &w, &h,
+ &pp->ghostMask);
+
+ if (!pp->s_ghostPixmap[i][j])
+ pacman_fail ("Cannot Scare Ghost images");
+ pp->s_ghostPixmap[i][j] = scale_pixmap (&display, pp->stippledGC,
+ pp->s_ghostPixmap[i][j],
+ pp->spritexs,
+ pp->spriteys);
+
+ if (!pp->s_ghostPixmap[i][j])
+ pacman_fail ("Cannot scale Scared Ghost images");
+ }
+ }
+ /* load the ghost eyes */
+ for (i = 0; i < MAXGDIR; i++) {
+ pp->ghostEyes[i] =
+ xpm_data_to_pixmap (display, window, e_bits[i], &w, &h,
+ &pp->ghostMask);
+
+ if (!pp->ghostEyes[i])
+ pacman_fail ("Cannot open ghost eye images");
+
+ pp->ghostEyes[i] = scale_pixmap (&display, pp->stippledGC,
+ pp->ghostEyes[i],
+ pp->spritexs,
+ pp->spriteys);
+
+ if (!pp->ghostEyes[i])
+ pacman_fail ("Cannot open ghost eye images");
+ }
+
+
+
+ /* We really only need a single mask. This saves the headache of getting the
+ * bottom of the ghost to clip just right. What we'll do is mask
+ * the top portion of the ghost, but the bottom of the ghost will be solid.
+ * I did this by setting the pixels between the fringe of their sheets
+ * to black instead of none. -jeremy
+ */
+ temp = xpm_data_to_pixmap (display, window, ghost_mask_xpm,
+ &w, &h, &pp->ghostMask);
+
+ if (!temp)
+ pacman_fail ("Cannot load temporary ghost image");
+
+ temp = scale_pixmap (&display, pp->stippledGC,
+ temp, pp->spritexs, pp->spriteys);
+
+ if (!temp)
+ pacman_fail ("Cannot scale temporary ghost image");
+
+ gc = XCreateGC (display, pp->ghostMask, 0, 0);
+
+ pp->ghostMask = scale_pixmap (&display, gc, pp->ghostMask,
+ pp->spritexs, pp->spriteys);
+ XFreePixmap (display, temp);