|
Does allegro.cc have a Minecraft server anymore? |
Neil Black
Member #7,867
October 2006
|
Me too. I was like, "Oh crap, program Tetris and add it to the Depot!"
|
Slartibartfast
Member #8,789
June 2007
|
Just grab something you've made in a MinorHack and put it in the depot ---- |
bamccaig
Member #7,536
July 2006
|
/me adds al_hello_world to the depot. -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
LennyLen
Member #5,313
December 2004
|
If anyone else out there likes the maps that Minetographer makes (a la Tectonicus), but wants them as a single image file rather than as a collection of smaller images, I just wrote an Allegro program that stitches all the small images together into one large one. It supports all three image formats that Minetographer produces, care of jpgalleg, loadpng and algif, however saving the larger .png and .gif images is very slow unfortunately. I noticed that algif is also producing images where every pixel is black, which I'll start another thread about soon. The program uses a cutdown version of exgui.c for it's interface - simply just a list box for the worlds, and a quit button. It will automatically determine the location of the .Minetographer directory, and puts the images it creates in whatever directory it is run from. The source (pretty ugly, but meh) is as follows: 1#define _WIN32_IE 0x0400
2#include <allegro.h>
3#include <winalleg.h>
4#include <shlobj.h>
5#include <jpgalleg.h>
6#include <loadpng.h>
7#include <algif.h>
8#include <string>
9#include <sstream>
10#include <iostream>
11#include <fstream>
12#include <vector>
13
14
15void read_changed_txt(int world);
16void draw_maps(int world);
17char *listbox_getter(int index, int *list_size);
18int quit(void);
19int my_button_proc(int msg, DIALOG *d, int c);
20
21
22struct tile {
23
24 int zoom;
25 int x;
26 int y;
27
28};
29
30
31DIALOG the_dialog[] =
32{
33 { d_clear_proc, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, NULL, NULL, NULL },
34 { d_list_proc, 80, 50, 160, 50, 0, 0, 0, D_EXIT, 0, 0, (void *)listbox_getter, NULL, NULL },
35 { d_text_proc, 80, 20, 0, 0, 0, 0, 0, 0, 0, 0, (void *)"Select World to Map", NULL, NULL },
36 { my_button_proc, 130, 130, 60, 20, 0, 0, 'q', D_EXIT, 0, 0, (void *)"&Quit", NULL, (void *)quit },
37 { NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
38
39};
40
41
42char extension[4], appdata_dir[MAX_PATH];
43std::vector<tile> tiles;
44int max_zoom = 0, min_x[11], min_y[11], max_x[11], max_y[11];
45
46int main() {
47
48 allegro_init();
49 install_keyboard();
50 install_timer();
51 install_mouse();
52 jpgalleg_init();
53 loadpng_init();
54 algif_init();
55 set_color_depth(desktop_color_depth());
56 set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 160, 0, 0);
57 register_bitmap_file_type("jpg", load_jpg, save_jpg);
58 register_bitmap_file_type("png", load_png, save_png);
59 register_bitmap_file_type("gif", load_gif, save_gif);
60
61 for (int n = 0; n < 11; n++) {
62
63 min_x[n] = 0;
64 min_y[n] = 0;
65 max_x[n] = 0;
66 max_y[n] = 0;
67
68 }
69
70 int gui_fg_color = makecol(0, 0, 0);
71 int gui_bg_color = makecol(255, 255, 255);
72 set_dialog_color(the_dialog, gui_fg_color, gui_bg_color);
73 do_dialog(the_dialog, 1);
74
75 if (the_dialog[1].d1 < 0)
76 exit(EXIT_SUCCESS);
77
78 read_changed_txt(the_dialog[1].d1 + 1);
79 draw_maps(the_dialog[1].d1 + 1);
80
81 return 0;
82
83}
84END_OF_MAIN()
85
86
87void read_changed_txt(int world) {
88
89 SHGetSpecialFolderPath(0, appdata_dir, CSIDL_APPDATA, FALSE);
90 std::stringstream str;
91 str << appdata_dir << "\\Minetographer\\World" << world << "\\changed.txt";
92
93 std::ifstream listfile;
94 listfile.open((str.str()).c_str(), std::ifstream::in);
95 if (!listfile.good()) {
96
97 allegro_message("Error opening changed.txt!\n");
98 exit(EXIT_FAILURE);
99
100 }
101
102 char fileline[512], folder[2], filename[20];
103 tile cur_tile;
104 listfile.getline(fileline, 512);
105 if (!listfile.eof()) {
106
107 int end = strlen(fileline) - 1, nameend, folderend;
108
109 nameend = end;
110 for (;;) {
111
112 nameend--;
113 if (fileline[nameend] == '.') break;
114
115 }
116
117 folderend = nameend;
118 for (;;) {
119
120 folderend--;
121 if (fileline[folderend] == '\\') break;
122
123 }
124
125 memcpy(extension, fileline + nameend + 1, end - nameend);
126 extension[3] = '\0';
127
128 memcpy(filename, fileline + folderend + 1, nameend - folderend - 1);
129 filename[nameend - folderend - 1] = '\0';
130 sscanf(filename, "tile_%d_%d", &cur_tile.x, &cur_tile.y);
131
132 folder[0] = fileline[folderend - 1];
133 folder[1] = '\0';
134
135 cur_tile.zoom = atoi(folder);
136 tiles.push_back(cur_tile);
137
138 if (cur_tile.zoom > max_zoom)
139 max_zoom = cur_tile.zoom;
140 if (cur_tile.x < min_x[cur_tile.zoom])
141 min_x[cur_tile.zoom] = cur_tile.x;
142 if (cur_tile.x > max_x[cur_tile.zoom])
143 max_x[cur_tile.zoom] = cur_tile.x;
144 if (cur_tile.y < min_y[cur_tile.zoom])
145 min_y[cur_tile.zoom] = cur_tile.y;
146 if (cur_tile.y > max_y[cur_tile.zoom])
147 max_y[cur_tile.zoom] = cur_tile.y;
148
149 for(;;) {
150
151 listfile.getline(fileline, 512);
152 if (listfile.eof()) break;
153
154 nameend = end;
155 for (;;) {
156
157 nameend--;
158 if (fileline[nameend] == '.') break;
159
160 }
161
162 folderend = nameend;
163 for (;;) {
164
165 folderend--;
166 if (fileline[folderend] == '\\') break;
167
168 }
169
170 memcpy(filename, fileline + folderend + 1, nameend - folderend - 1);
171 filename[nameend - folderend - 1] = '\0';
172 sscanf(filename, "tile_%d_%d", &cur_tile.x, &cur_tile.y);
173
174 folder[0] = fileline[folderend - 1];
175 folder[1] = '\0';
176
177 cur_tile.zoom = atoi(folder);
178 tiles.push_back(cur_tile);
179
180 if (cur_tile.zoom > max_zoom)
181 max_zoom = cur_tile.zoom;
182 if (cur_tile.x < min_x[cur_tile.zoom])
183 min_x[cur_tile.zoom] = cur_tile.x;
184 if (cur_tile.x > max_x[cur_tile.zoom])
185 max_x[cur_tile.zoom] = cur_tile.x;
186 if (cur_tile.y < min_y[cur_tile.zoom])
187 min_y[cur_tile.zoom] = cur_tile.y;
188 if (cur_tile.y > max_y[cur_tile.zoom])
189 max_y[cur_tile.zoom] = cur_tile.y;
190
191 }
192
193 }
194
195}
196
197
198void draw_maps(int world) {
199
200 std::stringstream str;
201 str << appdata_dir << "\\Minetographer\\World" << world << "\\Zoom" << tiles[0].zoom << "\\tile_" << tiles[0].x << "_" << tiles[0].y << "." << extension;
202
203 BITMAP *need_for_size = load_bitmap((str.str()).c_str(), NULL);
204 if (!need_for_size) {
205
206 allegro_message("Error loading sample bitmap.\n");
207 exit(EXIT_FAILURE);
208
209 }
210 int tsize = need_for_size->w;
211 destroy_bitmap(need_for_size);
212
213 BITMAP *map[max_zoom + 1];
214 for (int n = 0; n <= max_zoom; n++) {
215
216 map[n] = create_bitmap((max_x[n] - min_x[n] + 1) * tsize, (max_y[n] - min_y[n] + 1) * tsize);
217 if(!map[n]) {
218
219 allegro_message("Error creating map bitmap.\n");
220 exit(EXIT_FAILURE);
221
222 }
223
224 clear_to_color(map[n], makecol(227, 226, 221));
225
226 }
227
228 for (std::vector<tile>::iterator it = tiles.begin(); it < tiles.end(); it++) {
229
230 str.str("");
231 str << appdata_dir << "\\Minetographer\\World" << world << "\\Zoom" << it->zoom << "\\tile_" << it->x << "_" << it->y << "." << extension;
232 BITMAP *tile = load_bitmap((str.str()).c_str(), NULL);
233 if (!tile) {
234
235 allegro_message("Error loading %s\n", (str.str()).c_str());
236 exit(EXIT_FAILURE);
237
238 }
239 std::cout << "Blitting " << str.str() << std::endl;
240 blit(tile, map[it->zoom], 0, 0, (it->x - min_x[it->zoom]) * tsize, (it->y - min_y[it->zoom]) * tsize, tsize, tsize);
241 destroy_bitmap(tile);
242
243 }
244
245 for (int n = 0; n <= max_zoom; n++){
246
247 str.str("");
248 str << "map_zoom_" << n << "." << extension;
249 std::cout << "Saving " << str.str() << std::endl;
250 save_bitmap((str.str()).c_str(), map[n], NULL);
251 std::cout <<str.str() << " saved" << std::endl;
252 destroy_bitmap(map[n]);
253
254 }
255
256}
257
258
259char *listbox_getter(int index, int *list_size)
260{
261 static char *strings[] =
262 {
263 "World1", "World2", "World3", "World4", "World5"
264 };
265
266 if (index < 0) {
267 *list_size = 5;
268 return NULL;
269 }
270 else {
271 return strings[index];
272 }
273}
274
275
276int quit(void)
277{
278 if (alert("Really Quit?", NULL, NULL, "&Yes", "&No", 'y', 'n') == 1)
279 exit(EXIT_SUCCESS);
280 else
281 return D_O_K;
282}
283
284
285int my_button_proc(int msg, DIALOG *d, int c)
286{
287 int ret = d_button_proc(msg, d, c);
288 if (ret == D_CLOSE && d->dp3)
289 return ((int (*)(void))d->dp3)();
290 return ret;
291}
|
Neil Black
Member #7,867
October 2006
|
Ooh, neat. I don't use the maps myself (laziness), but I can see how that would be useful to people who do.
|
23yrold3yrold
Member #1,134
March 2001
|
... because I know someone else will. {"name":"wisdom_teeth.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/f\/ff1a5cbb784afb7e1695d1d4be3789c2.png","w":740,"h":251,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/f\/ff1a5cbb784afb7e1695d1d4be3789c2"} -- |
LennyLen
Member #5,313
December 2004
|
You forgot the title text! {"name":"wisdom_teeth.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/f\/ff1a5cbb784afb7e1695d1d4be3789c2.png","w":740,"h":251,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/f\/f\/ff1a5cbb784afb7e1695d1d4be3789c2"}
|
Neil Black
Member #7,867
October 2006
|
I propose that we do this.
|
GameCreator
Member #2,541
July 2002
|
When do we take the medication?
|
CGamesPlay
Member #2,559
July 2002
|
-- Ryan Patterson - <http://cgamesplay.com/> |
BAF
Member #2,981
December 2002
|
|
Thomas Fjellstrom
Member #476
June 2000
|
Thats just creepy. -- |
23yrold3yrold
Member #1,134
March 2001
|
Minecraft 1.3 Beta is out. Server outdated. -- |
Neil Black
Member #7,867
October 2006
|
Has anyone tried beds yet?
|
Dario ff
Member #10,065
August 2008
|
I hope the new map file format somehow reduces the load on the server. EDIT: The new launcher keeps failing that it can't connect to minecraft.net. :/ TranslatorHack 2010, a human translation chain in a.cc. |
23yrold3yrold
Member #1,134
March 2001
|
Shame; I updated a bit ago. I'm glad they implemented that lighting mod as a standard feature; looks much better. -- |
MiquelFire
Member #3,110
January 2003
|
, I just got the DesertBus auction tagline. And ouch, this new monitor needs to have it's colors adjusted badly, the background looks black. I always have this issue with a new driver anyway. --- |
CursedTyrant
Member #7,080
April 2006
|
The bed is a nice touch, especially for single player. I got ambushed by a mob while sleeping (woke up, a zombie standing next to me), so sleep can be interrupted. Pretty nice. --------- |
CGamesPlay
Member #2,559
July 2002
|
Server updated. The maps won't work with the new format, but the new format's filenames are significantly more sensible. -- Ryan Patterson - <http://cgamesplay.com/> |
bamccaig
Member #7,536
July 2006
|
Does that mean that we've started all over again? -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Thomas Fjellstrom
Member #476
June 2000
|
bamccaig said: Does that mean that we've started all over again? No, he meant mcmap wont work. -- |
Dario ff
Member #10,065
August 2008
|
Works smooth here. At least from what I've noticed. I'm surprised you guys didn't lit up my wooden mansion while I was away. Specially after trolling you with my "treasure". EDIT: Tomasu entered and my game black screened... And I don't see Tomasu any more. TranslatorHack 2010, a human translation chain in a.cc. |
Thomas Fjellstrom
Member #476
June 2000
|
You dropped off, then java crashed. Not the game. Java. Quote: # java.lang.OutOfMemoryError: requested 32744 bytes for ChunkPool::allocate. Out of swap space? Now I can't even start the game. It immediately dies with the same error, but for less memory (2k or less). And I'm not only not out of swap, I'm not even close to being out of memory. -- |
MiquelFire
Member #3,110
January 2003
|
I wonder if this new format will prevent my computer from hanging? It's annoying to be playing and all of a sudden, the whole computer locks up, and I can't see why it did so. --- |
Dario ff
Member #10,065
August 2008
|
MiquelFire said: I wonder if this new format will prevent my computer from hanging? It's annoying to be playing and all of a sudden, the whole computer locks up, and I can't see why it did so. I tried out SP and the framerate and loading seems to have improved for me. It might be a bit laggy the first time you convert tho. TranslatorHack 2010, a human translation chain in a.cc. |
|
|