4 * The geeky little puzzle game with a big noodly crunch!
6 * gPlanarity copyright (C) 2005 Monty <monty@xiph.org>
7 * Original Flash game by John Tantalo <john.tantalo@case.edu>
8 * Original game concept by Mary Radcliffe
10 * gPlanarity is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
15 * gPlanarity is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Postfish; see the file COPYING. If not, write to the
22 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 #define V_RADIUS_SQ (V_RADIUS*V_RADIUS)
28 #define min(a,b) ((a)<(b)?(a):(b))
29 #define max(a,b) ((a)>(b)?(a):(b))
31 typedef struct vertex
{
39 int selected_volatile
;
42 int attached_to_grabbed
;
44 struct edge_list
*edges
;
48 typedef struct intersection
{
49 struct intersection
*prev
;
50 struct intersection
*next
;
51 struct intersection
*paired
;
62 intersection i
; // correct, not a pointer
66 typedef struct edge_list
{
68 struct edge_list
*next
;
71 typedef struct graph
{
75 long active_intersections
;
85 // scoring related metadata
86 long original_intersections
;
87 float intersection_mult
;
89 int objective_lessthan
;
94 typedef struct graphmeta
{
98 void (*gen
)(graph
*,int arg
);
105 extern vertex
*new_board(graph
*g
, int num_v
);
106 extern vertex
*find_vertex(graph
*g
, int x
, int y
);
108 extern edge_list
*add_edge_to_list(edge_list
*l
, edge
*e
);
109 extern void release_edge_list(edge_list
*el
);
110 extern edge
*new_edge(vertex
*A
, vertex
*B
);
111 extern void release_edge_list(edge_list
*el
);
112 extern void insert_edge(graph
*g
, edge
*e
);
113 extern int intersectsV(vertex
*L1
, vertex
*L2
, vertex
*M1
, vertex
*M2
,
114 double *xo
, double *yo
);
115 extern int intersects(int L1x
, int L1y
, int L2x
, int L2y
,
116 int M1x
, int M1y
, int M2x
, int M2y
,
117 double *xo
, double *yo
);
118 extern void move_vertex(graph
*g
, vertex
*v
, int x
, int y
);
119 extern void grab_vertex(graph
*g
, vertex
*v
);
120 extern void grab_selected(graph
*g
);
121 extern void ungrab_vertex(graph
*g
,vertex
*v
);
122 extern void ungrab_verticies(graph
*g
);
123 extern void activate_vertex(graph
*g
, vertex
*v
);
124 extern void deactivate_vertex(graph
*g
, vertex
*v
);
125 extern void select_verticies(graph
*g
, int x1
, int y1
, int x2
, int y2
);
126 extern void deselect_verticies(graph
*g
);
127 extern void move_selected_verticies(graph
*g
, int dx
, int dy
);
128 extern void scale_verticies(graph
*g
, float amount
);
129 extern void randomize_verticies(graph
*g
);
130 extern edge
*add_edge(graph
*g
,vertex
*A
, vertex
*B
);
131 extern int exists_edge(vertex
*a
, vertex
*b
);
132 extern int num_selected_verticies(graph
*g
);
133 extern void check_verticies(graph
*g
);
134 extern void impress_location(graph
*g
);
135 extern void commit_volatile_selection(graph
*g
);
136 extern void activate_verticies(graph
*g
);
137 extern int graph_write(graph
*g
, FILE *f
);
138 extern int graph_read(graph
*g
, FILE *f
);
139 extern void graph_release(graph
*g
);
141 extern int graphscore_get_score(graph
*g
);
142 extern int graphscore_get_raw_score(graph
*g
);
143 extern int graphscore_get_multiplier_percent(graph
*g
);
144 extern int graphscore_get_bonus(graph
*g
);
145 extern char *graphscore_objective_string(graph
*g
);
146 extern void graph_resize(graph
*g
, int width
, int height
);