Index: client/tilespec.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v retrieving revision 1.110 diff -u -u -r1.110 tilespec.c --- client/tilespec.c 2003/02/05 07:19:43 1.110 +++ client/tilespec.c 2003/02/07 15:34:08 @@ -54,6 +54,7 @@ #define TILESPEC_SUFFIX ".tilespec" char *main_intro_filename; +char *main_myth_filename; char *minimap_intro_filename; struct named_sprites sprites; @@ -259,6 +260,10 @@ free(main_intro_filename); main_intro_filename = NULL; } + if (main_myth_filename) { + free(main_myth_filename); + main_myth_filename = NULL; + } if (minimap_intro_filename) { free(minimap_intro_filename); minimap_intro_filename = NULL; @@ -448,6 +453,10 @@ main_intro_filename = tilespec_gfx_filename(c); freelog(LOG_DEBUG, "intro file %s", main_intro_filename); + c = secfile_lookup_str(file, "tilespec.main_myth_file"); + main_myth_filename = tilespec_gfx_filename(c); + freelog(LOG_DEBUG, "myth file %s", main_myth_filename); + c = secfile_lookup_str(file, "tilespec.minimap_intro_file"); minimap_intro_filename = tilespec_gfx_filename(c); freelog(LOG_DEBUG, "radar file %s", minimap_intro_filename); Index: client/tilespec.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v retrieving revision 1.38 diff -u -u -r1.38 tilespec.h --- client/tilespec.h 2003/02/02 00:15:52 1.38 +++ client/tilespec.h 2003/02/07 15:34:08 @@ -212,6 +212,7 @@ /* full pathnames: */ extern char *main_intro_filename; +extern char *main_myth_filename; extern char *minimap_intro_filename; /* NOTE: The following comments are out of date and need to Index: client/gui-gtk/graphics.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.c,v retrieving revision 1.48 diff -u -u -r1.48 graphics.c --- client/gui-gtk/graphics.c 2003/01/29 05:10:49 1.48 +++ client/gui-gtk/graphics.c 2003/02/07 15:34:09 @@ -52,12 +52,18 @@ SPRITE * intro_gfx_sprite; SPRITE * radar_gfx_sprite; +SPRITE * myth_gfx_sprite; +SPRITE * scaled_intro_sprite; + GdkCursor * goto_cursor; GdkCursor * drop_cursor; GdkCursor * nuke_cursor; GdkCursor * patrol_cursor; +int scroll_counter = 0; /* counter for intro_scroll() */ + + /*************************************************************************** ... ***************************************************************************/ @@ -80,6 +86,9 @@ #define COLOR_MOTTO_FACE_R 0x2D #define COLOR_MOTTO_FACE_G 0x71 #define COLOR_MOTTO_FACE_B 0xE3 +#define COLOR_MYTH_FACE_R 0xED +#define COLOR_MYTH_FACE_G 0xED +#define COLOR_MYTH_FACE_B 0xFF /************************************************************************** ... @@ -159,6 +168,85 @@ tot / 2 - w / 2, y, word_version()); /* done */ + return; +} + + + + +/************************************************************************** +Intro: The Myth of Freeciv (scrolling) +It is called from gui_main every time the text is to be moved up +**************************************************************************/ +gint intro_scroll(gpointer data) +{ + if (scroll_counter < 61) { + gint height, width; + int tot, y, w; + GdkColor face; + GdkGC *face_gc; + SPRITE *scaled_myth_sprite; + + scroll_counter++; + + /* get colors */ + face.red = COLOR_MYTH_FACE_R << 8; + face.green = COLOR_MYTH_FACE_G << 8; + face.blue = COLOR_MYTH_FACE_B << 8; + gdk_imlib_best_color_get(&face); + + /* Load the background image */ + myth_gfx_sprite = load_gfxfile(main_myth_filename); + tot = myth_gfx_sprite->width; + face_gc = gdk_gc_new(root_window); + + y = myth_gfx_sprite->height - + (2 * gdk_string_height(main_fontset, freeciv_myth(2))); + w = gdk_string_width(main_fontset, freeciv_myth(2)); + gdk_gc_set_foreground(face_gc, &face); + gdk_window_get_size(map_canvas->window, &width, &height); + scaled_myth_sprite = + sprite_scale(myth_gfx_sprite, width + scroll_counter, + height + scroll_counter); + + int line = 0; + /* Draw each textline of the myth to scaled_myth_sprite */ + while (line < 16) { + gdk_draw_string(scaled_myth_sprite->pixmap, main_fontset, + face_gc, width * 0.50 - 210, + height * 0.8 - (18 * line), + freeciv_myth(13 - line + scroll_counter)); + line++; + } + + /* Draw scaled_myth_sprite to the screen */ + gdk_gc_destroy(face_gc); + gdk_draw_pixmap(map_canvas->window, civ_gc, + scaled_myth_sprite->pixmap, 0, 0, 0, 0, 1900, 1600); + + } else { + return FALSE; /* Timer is stopped when scroll_counter<61 */ + + } + + return TRUE; +} + + +/************************************************************************** +Remove the Myth text and repaint the regular intro +**************************************************************************/ +void intro_scroll_remove(int intro_timer_id) +{ + int height, width; + + scroll_counter = 100; + + gdk_window_get_size(map_canvas->window, &width, &height); + scaled_intro_sprite = sprite_scale(intro_gfx_sprite, width, height); + + gdk_draw_pixmap(map_canvas->window, civ_gc, + scaled_intro_sprite->pixmap, 0, 0, 0, 0, 1900, 1600); return; } Index: client/gui-gtk/graphics.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/graphics.h,v retrieving revision 1.11 diff -u -u -r1.11 graphics.h --- client/gui-gtk/graphics.h 2002/09/28 03:33:09 1.11 +++ client/gui-gtk/graphics.h 2003/02/07 15:34:10 @@ -32,11 +32,13 @@ extern SPRITE * intro_gfx_sprite; extern SPRITE * radar_gfx_sprite; +extern SPRITE * myth_gfx_sprite; extern GdkCursor * goto_cursor; extern GdkCursor * drop_cursor; extern GdkCursor * nuke_cursor; extern GdkCursor * patrol_cursor; + void gtk_draw_shadowed_string(GdkDrawable *drawable, GdkFont *fontset, GdkGC *black_gc, @@ -50,5 +52,7 @@ void sprite_get_bounding_box(SPRITE * sprite, int *start_x, int *start_y, int *end_x, int *end_y); SPRITE *crop_blankspace(SPRITE *s); +gint intro_scroll(gpointer data); +void intro_scroll_remove(int intro_timer_id); #endif /* FC__GRAPHICS_H */ Index: client/gui-gtk/gui_main.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/gui_main.c,v retrieving revision 1.127 diff -u -u -r1.127 gui_main.c --- client/gui-gtk/gui_main.c 2003/02/05 07:23:47 1.127 +++ client/gui-gtk/gui_main.c 2003/02/07 15:34:13 @@ -132,6 +132,7 @@ static enum Display_color_type display_color_type; /* practically unused */ static gint timer_id; /* ditto */ +static gint intro_timer_id; /* timer for intro */ static gint gdk_input_id; @@ -906,6 +907,7 @@ setup_widgets(); load_intro_gfx(); load_cursors(); + intro_scroll(NULL); genlist_init(&history_list); history_pos = -1; @@ -913,6 +915,7 @@ gtk_widget_show(toplevel); timer_id = gtk_timeout_add(TIMER_INTERVAL, timer_callback, NULL); + intro_timer_id = gtk_timeout_add(3400, intro_scroll, NULL); map_canvas_store = gdk_pixmap_new(root_window, map_canvas_store_twidth * NORMAL_TILE_WIDTH, @@ -1133,9 +1136,11 @@ **************************************************************************/ void add_net_input(int sock) { - gdk_input_id = gdk_input_add(sock, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, + gdk_input_id = gdk_input_add(sock, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, get_net_input, NULL); aconnection.notify_of_writable_data = set_wait_for_writable_socket; + + intro_scroll_remove(intro_timer_id); /* Stop the scrolling intro */ } /************************************************************************** Index: common/shared.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.c,v retrieving revision 1.98 diff -u -u -r1.98 shared.c --- common/shared.c 2002/12/18 17:36:19 1.98 +++ common/shared.c 2003/02/07 15:34:16 @@ -1222,6 +1222,85 @@ return _("'Cause civilization should be free!"); } + +/*************************************************************************** + Return the Freeciv Myth. + (The myth is common code) +***************************************************************************/ +char *freeciv_myth(int i) +{ + + char *myth[] = + { " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", +" ", + _(" The Freeciv Myth"), + _("In the beginning, before Earth came to be, there existed two"), + _("worlds: The first world was shrouded in a freezing mist. It"), + _("was called Niflheim, or House of the Mist. Near a well in the"), + _("House of the Mist lived a dragon by the name of Nidbug."), + _("Inside the well itself, there lived hordes of snakes which"), + _("let loose their venom into the water. The venomous water"), + _("overflowed the well and gushed out as a large river of icy"), + _("poison."), + " ", + _("In the second world there existed a sea of flames. This was"), + _("called Muspelheim, or House of the Flames. In Muspelheim there"), + _("ruled a creature, a genie named Surt. This creature possessed"), + _("a huge flaming sword from which a biting heat radiated."), + _("Besides Surt, Nidbug, and the snakes, there existed nothing"), + _("that could be considered life."), + " ", + _("Between the two worlds was a yawning void called Ginnungagab."), + _("Into this the freezing streams from Niflheim ran until the"), + _("void was filled with mountains of ice."), + " ", + _("Surt of Muspelheim swung his sword through the air, and the"), + _("flames licked at the mountains of ice in Ginnungagab."), + _("The desolated and absolutely silent void began to be covered"), + _("with a mysterious haze. At this exact place odd things began"), + _("to happen, and it was at this place that Earth came to be!"), + " ", + _("The first thing that ever moved in Ginnungagab was Ymer."), + _("Above Ymer's head stood a cow-like creature named Oedhumle."), + _("From the udder of this creature came a stream of milk which"), + _("flowed down over Ymer's head. Ymer had a drinking orgy and"), + _("then started to doze off. While asleep, Ymer started to sweat"), + _("Suddenly, his left arm gave birth to a female giant, and his"), + _("right arm gave birth to a male giant. Even his legs together"), + _("had a son!"), + " ", + _("Meanwhile, Oedhumle, the cow-like creature, stood calmly,"), + _("fully concentrated on licking the iceberg below. One day a"), + _("person was also brought to light. The giants were as ugly as"), + _("ugly could be, but this person was very handsome. His name was"), + _("Bor, and he married the female giant Bestle. Eventually, she"), + _("gave birth to three great, handsome sons: Odin, Ve and Vile."), + _("Odin, Ve and Vile grew up to be wise and strong men, and Odin"), + _("soon came to realize that their destiny was to do away with"), + _("Ymer. They killed him, and his blood flooded the world of"), + _("Ginnungagab leaving nothing but an ocean of blood around them."), + _("When they realized that everything was flooded they decided"), + _("to use Ymer's flesh as land. They tossed the huge bones onto"), + _("the fleshy land and mountains were created. Ymer's skull was"), + _("big enough to build a firmament above the land, and his brain"), + _("was torn apart and tossed into the sky where the pieces began"), + _("to orbit as huge clouds. The left-overs, teeth and small"), + _("fragments of bones, were sprinkled on the land as stones."), + " ", + _("Earth was created, and a kind of creature with a mixture of"), + _("giant and human genes was living this new earth with no"), + _("clothing and nothing on its mind but to survive. There was"), + _("a genuine need for some supernatural intervention, but above"), + _("all else what they really needed was one tough leader to"), + _("show them the way to a Freeciv-ilization.....") + }; + + assert(i>=0 && i '%s'",i,myth[i]); + return myth[i]; +} + + /*************************************************************************** Return whether two vectors: vec1 and vec2 have common bits. I.e. (vec1 & vec2) != 0. Index: common/shared.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/shared.h,v retrieving revision 1.110 diff -u -u -r1.110 shared.h --- common/shared.h 2002/12/18 19:05:22 1.110 +++ common/shared.h 2003/02/07 15:34:17 @@ -203,5 +203,6 @@ int *ind_result); const char *freeciv_motto(void); +char *freeciv_myth(int i); #endif /* FC__SHARED_H */ Index: data/isotrident.tilespec =================================================================== RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v retrieving revision 1.8 diff -u -u -r1.8 isotrident.tilespec --- data/isotrident.tilespec 2003/02/02 00:15:53 1.8 +++ data/isotrident.tilespec 2003/02/07 15:34:17 @@ -33,6 +33,7 @@ ; These are special because they get freed and reloaded ; as required: main_intro_file = "misc/intro" +main_myth_file = "misc/myth" minimap_intro_file = "misc/radar" ; Below, the graphics spec files; must be somewhere (anywhere) in