This is the doxygen documentation for gtkboard.

.
Main Page   Data Structures   File List   Data Fields   Globals  

pacman.c File Reference

#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <math.h>
#include <gdk/gdkkeysyms.h>
#include "game.h"
#include "aaball.h"

Go to the source code of this file.

Defines

#define PACMAN_CELL_SIZE   25
#define PACMAN_NUM_PIECES   48
#define PACMAN_BOARD_WID   26
#define PACMAN_BOARD_HEIT   25
#define PACMAN_FOOD   1
#define PACMAN_POWER   2
#define PACMAN_EMPTY   3
#define PACMAN_IS_EDIBLE(x)   (x>=1 && x<=3)
#define PACMAN_PAC_MIN   28
#define PACMAN_PAC_MAX   32
#define PACMAN_PAC_UP   28
#define PACMAN_PAC_DOWN   29
#define PACMAN_PAC_RIGHT   30
#define PACMAN_PAC_LEFT   31
#define PACMAN_IS_PAC(x)   ((x) >= PACMAN_PAC_MIN && (x) < PACMAN_PAC_MAX)
#define PACMAN_IS_GHOST(x)   ((x) >= 4 && x < 20)
#define PACMAN_GET_GHOST(x)   ((x)-(x)%4)
#define PACMAN_GET_GHOST_NUM(x)   (PACMAN_GET_GHOST(x)/4-1)
#define PACMAN_WALL_MASK   32
#define PACMAN_WALL_UP   8
#define PACMAN_WALL_DOWN   4
#define PACMAN_WALL_LEFT   2
#define PACMAN_WALL_RIGHT   1

Functions

void pacman_init ()
void pacman_set_init_pos (Pos *pos)
char** pacman_get_pixmap (int idx, int color)
int pacman_getmove_kb (Pos *cur_pos, int key, Player glob_to_play, byte **move, int **)
int pacman_animate (Pos *pos, byte **movp)
void pacman_get_cur_pos (byte *pos, int *x, int *y)
void pacman_recursive_dist (byte *pos, int x, int y, int val)
void pacman_set_dist (byte *pos)
float get_angle (float x, float y)
char** pacman_pixmap_ghost_gen (char *pixbuf)
char** pacman_pixmap_wall_gen (int idx, char *pixbuf)
char** pacman_pixmap_pac_gen (float dir, float gap, char *pixbuf)

Variables

char pacman_colors [6] = {100, 150, 200, 100, 150, 200}
int* pacman_init_pos = NULL
int pacman_maze [PACMAN_BOARD_HEIT][PACMAN_BOARD_WID]
char* brown_square_25_xpm []
Game Pacman
short dist [PACMAN_BOARD_WID][PACMAN_BOARD_HEIT]


Define Documentation

#define PACMAN_BOARD_HEIT   25
 

Definition at line 33 of file pacman.c.

#define PACMAN_BOARD_WID   26
 

Definition at line 32 of file pacman.c.

#define PACMAN_CELL_SIZE   25
 

Definition at line 29 of file pacman.c.

#define PACMAN_EMPTY   3
 

Definition at line 42 of file pacman.c.

#define PACMAN_FOOD   1
 

Definition at line 40 of file pacman.c.

#define PACMAN_GET_GHOST( x )   ((x)-(x)%4)
 

Definition at line 53 of file pacman.c.

Referenced by pacman_animate().

#define PACMAN_GET_GHOST_NUM( x )   (PACMAN_GET_GHOST(x)/4-1)
 

Definition at line 54 of file pacman.c.

Referenced by pacman_animate().

#define PACMAN_IS_EDIBLE( x )   (x>=1 && x<=3)
 

Definition at line 43 of file pacman.c.

Referenced by pacman_animate().

#define PACMAN_IS_GHOST( x )   ((x) >= 4 && x < 20)
 

Definition at line 52 of file pacman.c.

Referenced by pacman_animate(), and pacman_get_pixmap().

#define PACMAN_IS_PAC( x )   ((x) >= PACMAN_PAC_MIN && (x) < PACMAN_PAC_MAX)
 

Definition at line 50 of file pacman.c.

Referenced by pacman_get_cur_pos().

#define PACMAN_NUM_PIECES   48
 

Definition at line 30 of file pacman.c.

#define PACMAN_PAC_DOWN   29
 

Definition at line 47 of file pacman.c.

#define PACMAN_PAC_LEFT   31
 

Definition at line 49 of file pacman.c.

#define PACMAN_PAC_MAX   32
 

Definition at line 45 of file pacman.c.

#define PACMAN_PAC_MIN   28
 

Definition at line 44 of file pacman.c.

#define PACMAN_PAC_RIGHT   30
 

Definition at line 48 of file pacman.c.

#define PACMAN_PAC_UP   28
 

Definition at line 46 of file pacman.c.

#define PACMAN_POWER   2
 

Definition at line 41 of file pacman.c.

#define PACMAN_WALL_DOWN   4
 

Definition at line 63 of file pacman.c.

#define PACMAN_WALL_LEFT   2
 

Definition at line 64 of file pacman.c.

#define PACMAN_WALL_MASK   32
 

Definition at line 61 of file pacman.c.

#define PACMAN_WALL_RIGHT   1
 

Definition at line 65 of file pacman.c.

#define PACMAN_WALL_UP   8
 

Definition at line 62 of file pacman.c.


Function Documentation

float get_angle ( float x,
float y ) [static]
 

Definition at line 329 of file pacman.c.

int pacman_animate ( Pos * pos,
byte ** movp ) [static]
 

Definition at line 196 of file pacman.c.

void pacman_get_cur_pos ( byte * pos,
int * x,
int * y )
 

Definition at line 159 of file pacman.c.

Referenced by pacman_animate(), pacman_getmove_kb(), and pacman_set_dist().

char** pacman_get_pixmap ( int idx,
int color ) [static]
 

Definition at line 453 of file pacman.c.

int pacman_getmove_kb ( Pos * pos,
int key,
Player glob_to_play,
byte ** movp,
int ** rmovp ) [static]
 

Definition at line 278 of file pacman.c.

void pacman_init ( )
 

Definition at line 144 of file pacman.c.

char** pacman_pixmap_ghost_gen ( char * pixbuf ) [static]
 

Definition at line 340 of file pacman.c.

Referenced by pacman_get_pixmap().

char** pacman_pixmap_pac_gen ( float dir,
float gap,
char * pixbuf )
 

Definition at line 416 of file pacman.c.

Referenced by pacman_get_pixmap().

char** pacman_pixmap_wall_gen ( int idx,
char * pixbuf )
 

Definition at line 368 of file pacman.c.

Referenced by pacman_get_pixmap().

void pacman_recursive_dist ( byte * pos,
int x,
int y,
int val )
 

Definition at line 172 of file pacman.c.

Referenced by pacman_set_dist().

void pacman_set_dist ( byte * pos )
 

Definition at line 184 of file pacman.c.

Referenced by pacman_animate().

void pacman_set_init_pos ( Pos * pos ) [static]
 

Definition at line 300 of file pacman.c.


Variable Documentation

Game Pacman
 

Initial value:

 { PACMAN_CELL_SIZE, PACMAN_BOARD_WID, PACMAN_BOARD_HEIT, 
        PACMAN_NUM_PIECES,
        pacman_colors,  NULL, NULL, "Pacman", pacman_init}

Definition at line 132 of file pacman.c.

char* brown_square_25_xpm[] [static]
 

Definition at line 96 of file pacman.c.

short dist[PACMAN_BOARD_WID][PACMAN_BOARD_HEIT] [static]
 

Definition at line 169 of file pacman.c.

char pacman_colors[6] = {100, 150, 200, 100, 150, 200}
 

Definition at line 35 of file pacman.c.

int* pacman_init_pos = NULL
 

Definition at line 37 of file pacman.c.

int pacman_maze[PACMAN_BOARD_HEIT][PACMAN_BOARD_WID]
 

Initial value:

 
{
        {32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32},
        {32, 2, 1, 1, 1, 1, 1,32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,32, 1, 1, 1, 1, 1, 2,32},
        {32, 1,32,32,32,32, 1,32, 1,32,32,32,32,32,32,32,32, 1,32, 1,32,32,32,32, 1,32},
        {32, 1,32,32,32,32, 1,32, 1,32,32,32,32,32,32,32,32, 1,32, 1,32,32,32,32, 1,32},
        {32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,32},
        {32,32,32, 1,32,32, 1,32,32,32,32, 1,32,32, 1,32,32,32,32, 1,32,32, 1,32,32,32},
        {32,32,32, 1,32,32, 1, 1, 1, 1, 1, 1,32,32, 1, 1, 1, 1, 1, 1,32,32, 1,32,32,32},
        {32, 1, 1, 1,32,32,32,32, 1,32,32,32,32,32,32,32,32, 1,32,32,32,32, 1, 1, 1,32},
        {32, 1, 1, 1,32,32,32,32, 1,32,32,32,32,32,32,32,32, 1,32,32,32,32, 1, 1, 1,32},
        {32,32,32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,32,32,32},
        {32,32,32, 1,32,32,32,32, 1,32,32,32,32,32,32, 1,32, 1,32,32,32,32, 1,32,32,32},
        {32,32,32, 1,32,32,32,32, 1,32, 7, 3,15, 3, 3, 3,32, 1,32,32,32,32, 1,32,32,32},
        {32,32,32, 1,32,32, 1, 1, 1,32, 3,11, 3,19, 3, 3,32, 1, 1, 1,32,32, 1,32,32,32},
        {32,32,32, 1,32,32, 1,32, 1,32,32,32,32,32,32,32,32, 1,32, 1,32,32, 1,32,32,32},
        {32, 1, 1, 1, 1, 1, 1,32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,32, 1, 1, 1, 1, 1, 1,32},
        {32,32,32, 1,32,32,32,32,32,32,32, 1,32,32, 1,32,32,32,32,32,32,32, 1,32,32,32},
        {32,32,32, 1, 1, 1, 1, 1, 1, 1, 1, 1,32,32, 1, 1, 1, 1, 1, 1, 1, 1, 1,32,32,32},
        {32,32,32, 1,32,32,32,32, 1,32,32,32,32,32,32,32,32, 1,32,32,32,32, 1,32,32,32},
        {32,32,32, 1,32,32,32,32, 1,32,32,32,32,32,32,32,32, 1,32,32,32,32, 1,32,32,32},
        {32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,32},
        {32, 1,32,32,32, 1,32,32,32,32,32, 1,32,32, 1,32,32,32,32,32, 1,32,32,32, 1,32},
        {32, 1,32,32,32, 1,32,32, 1, 1, 1, 1,32,32, 1, 1, 1, 1,32,32, 1,32,32,32, 1,32},
        {32, 1,32,32,32, 1,32,32, 1,32,32,32,32,32,32,32,32, 1,32,32, 1,32,32,32, 1,32},
        {32, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,32},
        {32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32},
}

Definition at line 67 of file pacman.c.