2 * general header file for ypp-commodities
5 * This is part of ypp-sc-tools, a set of third-party tools for assisting
6 * players of Yohoho Puzzle Pirates.
8 * Copyright (C) 2009 Ian Jackson <ijackson@chiark.greenend.org.uk>
10 * This program 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 3 of the License, or
13 * (at your option) any later version.
15 * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
23 * Yohoho and Puzzle Pirates are probably trademarks of Three Rings and
24 * are used without permission. This program is not endorsed or
25 * sponsored by Three Rings.
41 /*----- from rgbimage.c -----*/
43 #define MAXIMGIDENT 100
45 typedef struct RgbImage {
48 /* red = data[ y*w*3 + x*3 + 0 ] = RI_PIXEL(ri,x,y)[0]
49 * green = data[ y*w*3 + x*3 + 1 ] = RI_PIXEL(ri,x,y)[1]
50 * blue = data[ y*w*3 + x*3 + 2 ] = RI_PIXEL(ri,x,y)[2]
54 typedef unsigned long Rgb;
56 void identify_rgbimage(const RgbImage *base, Rect portion,
57 char result[MAXIMGIDENT], const char *what);
58 RgbImage *alloc_rgb_image(int w, int h);
59 void fwrite_ppmraw(FILE *f, const RgbImage *ri);
61 #define RI_PIXEL(ri,x,y) ((ri)->data + ((y)*(ri)->w + (x)) * 3)
63 static inline Rgb ri_rgb(const RgbImage *ri, int x, int y) {
64 const unsigned char *rip= RI_PIXEL(ri,x,y);
65 return (rip[0] << 16) |
70 /*----- from structure.c -----*/
72 void find_structure(CanonImage *im, int *max_relevant_y_r,
73 Point *commod_focus_point_r);
74 Rect find_sunshine_widget(void);
76 void canon_colour_prepare(void);
77 void find_islandname(void);
78 void check_correct_commodities(void);
79 void read_screenshots(void);
80 void read_one_screenshot(void);
81 void analyse(FILE *tsv_output);
83 /*----- from convert.c -----*/
85 extern FILE *screenshot_file;
86 extern void fetch_with_rsync(const char *stem);
88 void vwarning(const char *fmt, va_list) FMT(1,0);
89 void warning(const char *fmt, ...) FMT(1,2);
91 void vprogress(const char *fmt, va_list) FMT(1,0);
92 void progress(const char *fmt, ...) FMT(1,2);
94 void vprogress_log(const char *fmt, va_list) FMT(1,0);
95 void progress_log(const char *fmt, ...) FMT(1,2);
97 void vprogress_spinner(const char *fmt, va_list) FMT(1,0);
98 void progress_spinner(const char *fmt, ...) FMT(1,2);
101 ff_singlepage= 000002,
102 ff_testservers= 000004,
104 ff_charset_edit= 000010,
105 ff_charset_allowedit= 000020,
106 ff_charset_havelocal= 000040,
109 ff_dict_fetch= 000100,
110 ff_dict_submit= 000200,
111 ff_dict_pirate= 000400,
114 ff_needisland= 001000,
115 ff_printisland= 002000,
117 ffs_printisland= 003000,
120 extern enum flags o_flags;
122 extern const char *o_ocean, *o_pirate;
125 /*----- from pages.c -----*/
127 void screenshot_startup(void);
128 void set_yppclient_window(unsigned long wul);
129 void find_yppclient_window(void);
130 void take_screenshots(void);
131 void take_one_screenshot(void);
133 #define MAX_PAGES 1000
134 extern CanonImage *page_images[MAX_PAGES];
137 extern const char *ocean, *pirate;
138 extern char *archipelago, *island;