[Freeciv-Dev] (PR#9082) patch to make gui-sdl compile
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9082 >
This patch causes gui-sdl to compile. However it won't get very far if
you try to run it. There are lots of hacks that just remove certain
pieces of code.
jason
? gmon.out
Index: client/gui-sdl/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/dialogs.c,v
retrieving revision 1.46
diff -u -r1.46 dialogs.c
--- client/gui-sdl/dialogs.c 23 Jun 2004 23:08:55 -0000 1.46
+++ client/gui-sdl/dialogs.c 24 Jun 2004 00:32:30 -0000
@@ -182,7 +182,6 @@
if (get_client_state() == CLIENT_PRE_GAME_STATE) {
draw_city_names = FALSE;
draw_city_productions = FALSE;
- SDL_FillRect(Main.text, NULL, 0x0);
SDL_FillRect(Main.gui, NULL, 0x0);
}
}
Index: client/gui-sdl/graphics.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/graphics.c,v
retrieving revision 1.30
diff -u -r1.30 graphics.c
--- client/gui-sdl/graphics.c 8 Mar 2004 07:20:49 -0000 1.30
+++ client/gui-sdl/graphics.c 24 Jun 2004 00:32:30 -0000
@@ -73,7 +73,7 @@
#include "patrol_cursor.xbm"
#include "patrol_cursor_mask.xbm"
-struct canvas Main;
+struct main Main;
static SDL_Surface *pIntro_gfx = NULL;
@@ -832,11 +832,11 @@
Main.guis = NULL;
Main.gui = NULL;
Main.map = NULL;
- Main.text = NULL;
Main.rects_count = 0;
Main.guis_count = 0;
-
- mapview_canvas.store = &Main;
+
+ Main.map_canvas.surf = Main.map;
+ mapview_canvas.store = &Main.map_canvas;
if (SDL_WasInit(SDL_INIT_AUDIO)) {
error = (SDL_InitSubSystem(iFlags) < 0);
@@ -868,7 +868,6 @@
{
FREESURFACE(Main.gui);
FREESURFACE(Main.map);
- FREESURFACE(Main.text);
}
/**************************************************************************
@@ -922,11 +921,6 @@
FREESURFACE(Main.map);
Main.map = SDL_DisplayFormat(Main.screen);
- FREESURFACE(Main.text);
- Main.text = SDL_DisplayFormatAlpha(Main.screen);
- SDL_FillRect(Main.text, NULL, 0x0);
- /*SDL_SetColorKey(Main.text , SDL_SRCCOLORKEY|SDL_RLEACCEL, 0x0);*/
-
FREESURFACE(Main.gui);
Main.gui = SDL_DisplayFormatAlpha(Main.screen);
SDL_FillRect(Main.gui, NULL, 0x0);
@@ -3611,13 +3605,28 @@
return result;
}
+void get_sprite_dimensions(struct Sprite *sprite, int *width, int *height)
+{
+ *width = GET_SURF(sprite)->w;
+ *height = GET_SURF(sprite)->h;
+}
+
+void gui_flush(void)
+{
+ /* Nothing */
+}
+
/**************************************************************************
Create a new sprite by cropping and taking only the given portion of
the image.
**************************************************************************/
struct Sprite *crop_sprite(struct Sprite *source,
- int x, int y, int width, int height)
+ int x, int y, int width, int height,
+ struct Sprite *mask,
+ int mask_offset_x, int mask_offset_y)
{
+ /* FIXME: this needs to be able to crop from a mask - equivalent to the
+ * code currently in gui_dither.c. */
SDL_Rect src_rect =
{ (Sint16) x, (Sint16) y, (Uint16) width, (Uint16) height };
SDL_Surface *pNew, *pTmp =
Index: client/gui-sdl/graphics.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/graphics.h,v
retrieving revision 1.17
diff -u -r1.17 graphics.h
--- client/gui-sdl/graphics.h 8 Mar 2004 07:20:49 -0000 1.17
+++ client/gui-sdl/graphics.h 24 Jun 2004 00:32:30 -0000
@@ -171,12 +171,16 @@
#define GET_SURF(m_sprite) (m_sprite->psurface)
struct canvas {
+ SDL_Surface *surf;
+};
+
+struct main {
int rects_count; /* update rect. array counter */
int guis_count; /* gui buffers array counter */
SDL_Rect rects[RECT_LIMIT]; /* update rect. list */
SDL_Surface *screen; /* main screen buffer */
SDL_Surface *map; /* map buffer */
- SDL_Surface *text; /* city descriptions buffer */
+ struct canvas map_canvas;
SDL_Surface *gui; /* gui buffer */
SDL_Surface **guis; /* gui buffers used by sdlclient widgets window
menager */
SDL_Event event; /* main event struct */
Index: client/gui-sdl/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.c,v
retrieving revision 1.44
diff -u -r1.44 gui_main.c
--- client/gui-sdl/gui_main.c 24 Jan 2004 02:58:55 -0000 1.44
+++ client/gui-sdl/gui_main.c 24 Jun 2004 00:32:49 -0000
@@ -825,7 +825,6 @@
__pMap_Scroll_User_Event.user.data2 = NULL;
pMap_Scroll_User_Event = &__pMap_Scroll_User_Event;
- smooth_move_unit_steps = 8;
update_city_text_in_refresh_tile = FALSE;
draw_city_names = FALSE;
draw_city_productions = FALSE;
Index: client/gui-sdl/gui_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_main.h,v
retrieving revision 1.22
diff -u -r1.22 gui_main.h
--- client/gui-sdl/gui_main.h 8 Mar 2004 07:20:49 -0000 1.22
+++ client/gui-sdl/gui_main.h 24 Jun 2004 00:32:49 -0000
@@ -53,7 +53,7 @@
#define CF_DRAW_PLAYERS_ALLIANCE_STATUS (1<<22)
#define CF_DRAW_PLAYERS_NEUTRAL_STATUS (1<<23)
-extern struct canvas Main;
+extern struct main Main;
extern struct GUI *pSellected_Widget;
extern Uint32 SDL_Client_Flags;
extern bool LSHIFT;
Index: client/gui-sdl/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/gui_stuff.c,v
retrieving revision 1.40
diff -u -r1.40 gui_stuff.c
--- client/gui-sdl/gui_stuff.c 5 Jan 2004 00:18:30 -0000 1.40
+++ client/gui-sdl/gui_stuff.c 24 Jun 2004 00:32:50 -0000
@@ -4508,7 +4508,7 @@
memcpy(pPixelArray, pPixel, (w - x) * sizeof(Uint8));
my_memset8(pPixel, (color & 0xFF), w - x);
- ((Uint8 *)pPixelArray) += (w - x);
+ (Uint8 *)pPixelArray += (w - x);
}
/*left */
@@ -5243,7 +5243,7 @@
for (; y > y0; y--) {
*pPixel = *(Uint32 *)pPixelArray;
- ((Uint32 *)pPixelArray)++;
+ pPixelArray = ADD_TO_POINTER(pPixelArray, sizeof(Uint32));
pPixel -= pitch;
}
Index: client/gui-sdl/mapctrl.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapctrl.c,v
retrieving revision 1.37
diff -u -r1.37 mapctrl.c
--- client/gui-sdl/mapctrl.c 16 Dec 2003 15:07:52 -0000 1.37
+++ client/gui-sdl/mapctrl.c 24 Jun 2004 00:32:50 -0000
@@ -442,7 +442,7 @@
pMap->size.w = MINI_MAP_W;
set_new_mini_map_window_pos();
- refresh_overview_viewrect();
+ refresh_overview(); /* Is a full refresh needed? */
sdl_dirty_rect(pMap->size);
} else {
SDL_BlitSurface(pTheme->R_ARROW_Icon, NULL, pMap_Button->theme, NULL);
@@ -469,8 +469,7 @@
set_wstate(pWidget, FC_WS_SELLECTED);
}
toggle_overview_mode();
- refresh_overview_canvas();
- refresh_overview_viewrect();
+ refresh_overview();
flush_dirty();
return -1;
}
@@ -528,9 +527,8 @@
Remake_MiniMap(w, h);
}
center_minimap_on_minimap_window();
- refresh_overview_canvas();
+ refresh_overview();
update_menus();
- refresh_overview_viewrect();
return 0;
}
@@ -542,7 +540,6 @@
if (((OVERVIEW_TILE_WIDTH + 1) * map.xsize + BLOCK_W + DOUBLE_FRAME_WH) <=
pUnits_Info_Window->size.x) {
char cBuf[4];
- OVERVIEW_TILE_WIDTH++;
my_snprintf(cBuf, sizeof(cBuf), "%d", OVERVIEW_TILE_WIDTH);
copy_chars_to_string16(pWidget->next->string16, cBuf);
redraw_label(pWidget->next);
@@ -561,7 +558,6 @@
if (OVERVIEW_TILE_WIDTH > 1) {
char cBuf[4];
- OVERVIEW_TILE_WIDTH--;
my_snprintf(cBuf, sizeof(cBuf), "%d", OVERVIEW_TILE_WIDTH);
copy_chars_to_string16(pWidget->prev->string16, cBuf);
redraw_label(pWidget->prev);
@@ -1994,7 +1990,7 @@
if ((LCTRL || RCTRL) && can_client_change_view()) {
draw_city_names ^= 1;
if(draw_city_names||draw_city_productions) {
- show_city_descriptions();
+ update_city_descriptions();
}
dirty_all();
}
@@ -2004,7 +2000,7 @@
if ((LCTRL || RCTRL) && can_client_change_view()) {
draw_city_productions ^= 1;
if(draw_city_names||draw_city_productions) {
- show_city_descriptions();
+ update_city_descriptions();
}
dirty_all();
}
Index: client/gui-sdl/mapview.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.c,v
retrieving revision 1.69
diff -u -r1.69 mapview.c
--- client/gui-sdl/mapview.c 17 May 2004 07:16:43 -0000 1.69
+++ client/gui-sdl/mapview.c 24 Jun 2004 00:32:51 -0000
@@ -77,10 +77,6 @@
extern SDL_Cursor **pAnimCursor;
extern bool do_cursor_animation;
-/* These values are stored in the mapview_canvas struct now. */
-#define map_view_x0 mapview_canvas.map_x0
-#define map_view_y0 mapview_canvas.map_y0
-
static Uint32 Amask;
static int HALF_NORMAL_TILE_HEIGHT, HALF_NORMAL_TILE_WIDTH;
@@ -110,12 +106,9 @@
static void init_dither_tiles(void);
static void free_dither_tiles(void);
-static void init_borders_tiles(void);
-static void free_borders_tiles(void);
static void fill_dither_buffers(SDL_Surface **pDitherBufs, int x, int y,
enum tile_terrain_type terrain);
-
static void draw_map_cell(SDL_Surface * pDest, Sint16 map_x, Sint16 map_y,
Uint16 map_col, Uint16 map_wier, int citymode);
@@ -125,29 +118,11 @@
/**************************************************************************
Draw some or all of a tile onto the mapview canvas.
**************************************************************************/
-void gui_map_put_tile_iso(int map_x, int map_y,
- int canvas_x, int canvas_y,
- int offset_x, int offset_y, int offset_y_unit,
- int width, int height, int height_unit,
- enum draw_type draw)
+void put_one_tile_iso(struct canvas *pcanvas, int map_x, int map_y,
+ int canvas_x, int canvas_y, bool citymode)
{
- if (draw == D_MB_LR || draw == D_FULL) {
- draw_map_cell(Main.map, canvas_x, canvas_y, (Uint16)map_x, (Uint16)map_y,
0);
- } else {
- static SDL_Rect dest;
-
- dest.x = canvas_x + offset_x;
- dest.y = canvas_y - HALF_NORMAL_TILE_HEIGHT + offset_y_unit;
- dest.w = width;
- dest.h = height_unit;
- SDL_SetClipRect(Main.map, &dest);
-
- draw_map_cell(Main.map, canvas_x, canvas_y, (Uint16)map_x, (Uint16)map_y,
0);
-
- /* clear ClipRect */
- SDL_SetClipRect(Main.map, NULL);
-
- }
+ draw_map_cell(pcanvas->surf, canvas_x, canvas_y,
+ (Uint16)map_x, (Uint16)map_y, citymode);
}
/**************************************************************************
@@ -160,7 +135,7 @@
{
SDL_Rect src = {offset_x, offset_y, width, height};
SDL_Rect dst = {canvas_x + offset_x, canvas_y + offset_y, 0, 0};
- SDL_BlitSurface(GET_SURF(sprite), &src, pcanvas->map, &dst);
+ SDL_BlitSurface(GET_SURF(sprite), &src, pcanvas->surf, &dst);
}
/**************************************************************************
@@ -171,7 +146,7 @@
struct Sprite *sprite)
{
SDL_Rect dst = {canvas_x, canvas_y, 0, 0};
- SDL_BlitSurface(GET_SURF(sprite), NULL, pcanvas->map, &dst);
+ SDL_BlitSurface(GET_SURF(sprite), NULL, pcanvas->surf, &dst);
}
/**************************************************************************
@@ -182,8 +157,8 @@
int canvas_x, int canvas_y, int width, int height)
{
SDL_Rect dst = {canvas_x, canvas_y, width, height};
- SDL_FillRect(pcanvas->map, &dst,
- get_game_color(color, pcanvas->map));
+ SDL_FillRect(pcanvas->surf, &dst,
+ get_game_color(color, pcanvas->surf));
}
/**************************************************************************
@@ -193,8 +168,35 @@
enum line_type ltype, int start_x, int start_y,
int dx, int dy)
{
- putline(pcanvas->map, start_x, start_y, start_x + dx, start_y + dy,
- get_game_color(color, pcanvas->map));
+ putline(pcanvas->surf, start_x, start_y, start_x + dx, start_y + dy,
+ get_game_color(color, pcanvas->surf));
+}
+
+void canvas_copy(struct canvas *dest, struct canvas *src,
+ int src_x, int src_y, int dest_x, int dest_y,
+ int width, int height)
+{
+
+}
+
+struct canvas *canvas_create(int width, int height)
+{
+ return NULL;
+}
+
+void canvas_free(struct canvas *store)
+{
+
+}
+
+void map_size_changed(void)
+{
+ /* Nothing */
+}
+
+void update_map_canvas_scrollbars_size()
+{
+ /* No scrollbars */
}
static bool is_flush_queued = FALSE;
@@ -215,10 +217,6 @@
src = dst;
SDL_BlitSurface(Main.map, &src, Main.screen, &dst);
dst = src;
- if(draw_city_names||draw_city_productions) {
- SDL_BlitSurface(Main.text, &src, Main.screen, &dst);
- dst = src;
- }
SDL_BlitSurface(Main.gui, &src, Main.screen, &dst);
while(Main.guis && Main.guis[i] && i < Main.guis_count) {
dst = src;
@@ -241,10 +239,6 @@
dst = rect;
SDL_BlitSurface(Main.map, &rect, Main.screen, &dst);
dst = rect;
- if(draw_city_names||draw_city_productions) {
- SDL_BlitSurface(Main.text, &rect, Main.screen, &dst);
- dst = rect;
- }
SDL_BlitSurface(Main.gui, &rect, Main.screen, &dst);
while(Main.guis && Main.guis[i] && i < Main.guis_count) {
dst = rect;
@@ -264,7 +258,7 @@
void unqueue_flush(void)
{
if(UPDATE_OVERVIEW_MAP) {
- refresh_overview_viewrect();
+ refresh_overview();
UPDATE_OVERVIEW_MAP = FALSE;
}
flush_dirty();
@@ -347,9 +341,6 @@
}
if(Main.rects_count >= RECT_LIMIT) {
SDL_BlitSurface(Main.map, NULL, Main.screen, NULL);
- if(draw_city_names||draw_city_productions) {
- SDL_BlitSurface(Main.text, NULL, Main.screen, NULL);
- }
SDL_BlitSurface(Main.gui, NULL, Main.screen, NULL);
while(Main.guis && Main.guis[j] && j < Main.guis_count) {
SDL_BlitSurface(Main.guis[j++], NULL, Main.screen, NULL);
@@ -364,10 +355,6 @@
dst = Main.rects[i];
SDL_BlitSurface(Main.map, &Main.rects[i], Main.screen, &dst);
dst = Main.rects[i];
- if(draw_city_names||draw_city_productions) {
- SDL_BlitSurface(Main.text, &Main.rects[i], Main.screen, &dst);
- dst = Main.rects[i];
- }
SDL_BlitSurface(Main.gui, &Main.rects[i], Main.screen, &dst);
while(Main.guis && Main.guis[j] && j < Main.guis_count) {
dst = Main.rects[i];
@@ -1045,7 +1032,7 @@
enable_focus_animation();
}
if (hover_unit != pUnit->id) {
- set_hover_state(NULL, HOVER_NONE);
+ set_hover_state(NULL, HOVER_NONE, ACTIVITY_LAST);
}
switch (hover_state) {
case HOVER_NONE:
@@ -1141,7 +1128,7 @@
void update_city_descriptions(void)
{
/* redraw buffer */
- show_city_descriptions();
+ show_city_descriptions(0, 0, mapview_canvas.store_width,
mapview_canvas.store_height);
dirty_all();
}
@@ -1150,7 +1137,7 @@
**************************************************************************/
void prepare_show_city_descriptions(void)
{
- SDL_FillRect(Main.text, NULL, 0x0);
+ /* Nothing */
}
/**************************************************************************
@@ -1158,7 +1145,8 @@
**************************************************************************/
static void put_city_desc_on_surface(SDL_Surface *pDest,
struct city *pCity,
- int canvas_x, int canvas_y)
+ int canvas_x, int canvas_y,
+ int *width, int *height)
{
static char buffer[128];
SDL_Surface *pCity_Size = NULL, *pCity_Name = NULL, *pCity_Prod = NULL;
@@ -1169,6 +1157,8 @@
player_color(get_player(pCity->owner))));
SDL_Color color_bg = {0, 0, 0, 80};
Uint32 frame_color;
+
+ *width = *height = 0; /* TODO */
color_size.unused = 128;
@@ -1427,10 +1417,11 @@
width and height of the text block (centered directly underneath the
city's tile).
****************************************************************************/
-void show_city_desc(struct city *pcity, int canvas_x, int canvas_y)
+void show_city_desc(struct canvas *pcanvas, int canvas_x, int canvas_y,
+ struct city *pcity, int *width, int *height)
{
- put_city_desc_on_surface(Main.text, pcity,
- canvas_x, canvas_y - NORMAL_TILE_HEIGHT / 6 );
+ put_city_desc_on_surface(Main.map, pcity,
+ canvas_x, canvas_y, width, height);
}
/* ===================================================================== */
@@ -1450,80 +1441,6 @@
OVERVIEW_TILE_HEIGHT * map.ysize) / 2;
}
-/**************************************************************************
- Set the dimensions for the map overview, in map units (tiles).
- Typically each tile will be a 2x2 rectangle, although this may vary.
-**************************************************************************/
-void set_overview_dimensions(int w, int h)
-{
- struct GUI *pMMap = get_minimap_window_widget();
- int width = pMMap->size.w - 30 - DOUBLE_FRAME_WH;
- int height = pMMap->size.h - DOUBLE_FRAME_WH;
-
- freelog(LOG_DEBUG,
- "MAPVIEW: 'set_overview_dimensions' call with x = %d y = %d", w, h);
-
- if(w > width || h > height) {
- Remake_MiniMap(w, h);
- width = pMMap->size.w - 30 - DOUBLE_FRAME_WH;
- height = pMMap->size.h - DOUBLE_FRAME_WH;
- }
-
- OVERVIEW_TILE_WIDTH = MAX(1, width / w);
- OVERVIEW_TILE_HEIGHT = MAX(1, height / h);
- center_minimap_on_minimap_window();
-
- enable(ID_TOGGLE_UNITS_WINDOW_BUTTON);
- enable(ID_REVOLUTION);
- enable(ID_ECONOMY);
- enable(ID_RESEARCH);
-
- /* New Turn */
- pMMap = pMMap->prev;
-
- /* enable PLAYERS BUTTON */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* enable ID_FIND_CITY */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* enable UNITS BUTTON */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* enable ID_CHATLINE_TOGGLE_LOG_WINDOW_BUTTON */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* enable toggle minimap mode */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* enable ID_TOGGLE_MAP_WINDOW_BUTTON */
- pMMap = pMMap->prev;
- set_wstate(pMMap, FC_WS_NORMAL);
-
- /* del init string */
- pMMap = get_widget_pointer_form_main_list(ID_WAITING_LABEL);
-
- if (pMMap) {
- del_widget_from_gui_list(pMMap);
- }
-
- /* this is here becouse I need function that is call after game start */
- if(is_isometric) {
- free_dither_tiles();
- init_dither_tiles();
- free_borders_tiles();
- init_borders_tiles();
- }
-
- draw_city_names = TRUE;
-
-}
-
void toggle_overview_mode(void)
{
if (overview_mode == BORDERS) {
@@ -1533,227 +1450,18 @@
}
}
-/**************************************************************************
-...
-**************************************************************************/
-static SDL_Color sdl_overview_tile_color(int x, int y)
-{
- SDL_Color color;
- struct tile *pTile=map_get_tile(x, y);
-
- if ((enum known_type)pTile->known == TILE_UNKNOWN) {
- return *(get_game_colorRGB(COLOR_STD_BLACK));
- } else {
- struct city *pCity = pTile->city;
- if (pCity) {
- if(pCity->owner == game.player_idx) {
- return *(get_game_colorRGB(COLOR_STD_WHITE));
- } else {
- return *(get_game_colorRGB(COLOR_STD_CYAN));
- }
- } else {
- struct unit *pUnit = find_visible_unit(pTile);
- if (pUnit) {
- if(pUnit->owner == game.player_idx) {
- return *(get_game_colorRGB(COLOR_STD_YELLOW));
- } else {
- return *(get_game_colorRGB(COLOR_STD_RED));
- }
- } else {
- switch (overview_mode) {
- case BORDERS:
- if (pTile->owner) {
- if (is_ocean(pTile->terrain)) {
- if ((enum known_type)pTile->known == TILE_KNOWN_FOGGED
- && draw_fog_of_war) {
- return *(get_game_colorRGB(COLOR_STD_RACE4));
- } else {
- SDL_Color color_fog = *(get_game_colorRGB(COLOR_STD_RACE0 +
- pTile->owner->player_no));
-
- color = *(get_game_colorRGB(COLOR_STD_OCEAN));
-
- ALPHA_BLEND(color_fog.r, color_fog.g, color_fog.b, 64,
- color.r, color.g, color.b);
- return color;
- }
- } else {
- if ((enum known_type)pTile->known == TILE_KNOWN_FOGGED
- && draw_fog_of_war) {
- color = *(get_game_colorRGB(COLOR_STD_RACE0 +
- pTile->owner->player_no));
-
- ALPHA_BLEND(0, 0, 0, 64,
- color.r, color.g, color.b);
- return color;
- } else {
- return *(get_game_colorRGB(COLOR_STD_RACE0 +
- pTile->owner->player_no));
- }
- }
- } else {
- goto STD;
- }
- break;
- case TEAMS:
- goto STD;
- break;
- default:
- {
-STD: if (is_ocean(pTile->terrain)) {
- if ((enum known_type)pTile->known == TILE_KNOWN_FOGGED
- && draw_fog_of_war) {
- return *(get_game_colorRGB(COLOR_STD_RACE4));
- } else {
- return *(get_game_colorRGB(COLOR_STD_OCEAN));
- }
- } else {
- if ((enum known_type)pTile->known == TILE_KNOWN_FOGGED
- && draw_fog_of_war) {
- return *(get_game_colorRGB(COLOR_STD_GROUND_FOGED));
- } else {
- return *(get_game_colorRGB(COLOR_STD_GROUND));
- }
- }
- }
- }
- }
- }
- }
-
- return color;
-}
-
-/**************************************************************************
- Update the tile for the given map position on the overview.
-**************************************************************************/
-void overview_update_tile(int x, int y)
+struct canvas *get_overview_window(void)
{
- struct GUI *pMMap = get_minimap_window_widget();
- SDL_Rect cell_size = {OVERVIEW_TILE_WIDTH * x + OVERVIEW_START_X,
- OVERVIEW_TILE_HEIGHT * y + OVERVIEW_START_Y,
- OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT};
- SDL_Color color = sdl_overview_tile_color(x, y);
-
- freelog(LOG_DEBUG, "MAPVIEW: overview_update_tile (x = %d y = %d )", x, y);
-
- SDL_FillRect(pMMap->theme, &cell_size,
- SDL_MapRGBA(pMMap->theme->format, color.r,color.g,
- color.b,color.unused));
- UPDATE_OVERVIEW_MAP = TRUE;
-}
-
-/**************************************************************************
- Refresh (update) the entire map overview.
-**************************************************************************/
-void refresh_overview_canvas(void)
-{
- struct GUI *pMMap = get_minimap_window_widget();
- SDL_Rect map_area = {FRAME_WH, FRAME_WH,
- pMMap->size.w - 30 - DOUBLE_FRAME_WH,
- pMMap->size.h - DOUBLE_FRAME_WH};
- SDL_Rect cell_size = {OVERVIEW_START_X, OVERVIEW_START_Y,
- OVERVIEW_TILE_WIDTH, OVERVIEW_TILE_HEIGHT};
- SDL_Color std_color;
- Uint16 col = 0, row = 0;
-
- /* clear map area */
- SDL_FillRect(pMMap->theme, &map_area,
- SDL_MapRGB(pMMap->theme->format, 0x0, 0x0, 0x0));
-
- while (TRUE) { /* mini map draw loop */
- std_color = sdl_overview_tile_color(col, row);
- SDL_FillRect(pMMap->theme, &cell_size,
- SDL_MapRGBA(pMMap->theme->format, std_color.r,std_color.g,
- std_color.b,std_color.unused));
-
- cell_size.x += OVERVIEW_TILE_WIDTH;
- col++;
-
- if (col == map.xsize) {
- cell_size.y += OVERVIEW_TILE_HEIGHT;
- cell_size.x = OVERVIEW_START_X;
- row++;
- if (row == map.ysize) {
- break;
- }
- col = 0;
- }
-
- } /* end mini map draw loop */
-}
-
-/**************************************************************************
- draw line on mini map.
- this algoritm is far from optim.
-**************************************************************************/
-static void putline_on_mini_map(SDL_Rect * pMapArea, Sint16 x0, Sint16 y0,
- Sint16 x1, Sint16 y1, Uint32 color, SDL_Surface *pDest)
-{
- register float m;
- register int x, y;
- int xloop, w = (x1 - x0);
-
-
- m = (float) (y1 - y0) / w;
-
- if (x0 < 0) {
- x0 += pMapArea->w;
- } else if (x0 >= pMapArea->w) {
- x0 -= pMapArea->w;
- }
-
- if (x1 < 0) {
- x1 += pMapArea->w;
- } else if (x1 >= pMapArea->w) {
- x1 -= pMapArea->w;
- }
-
- if (y0 < 0) {
- y0 += pMapArea->h;
- } else if (y0 >= pMapArea->h) {
- y0 -= pMapArea->h;
- }
-
- lock_surf(pDest);
-
- for (xloop = 0; xloop < w; xloop++) {
-
- x = x0 + xloop;
-
- y = m * (x - x0) + y0;
-
- if (x >= pMapArea->w) {
- x -= pMapArea->w;
- }
-
- if (y < 0) {
- y += pMapArea->h;
- } else if (y >= pMapArea->h) {
- y -= pMapArea->h;
- }
-
- x += pMapArea->x;
- y += pMapArea->y;
-
- putpixel(pDest, x, y, color);
-
- x -= pMapArea->x;
-
- }
-
- unlock_surf(pDest);
+ /* TODO */
+ return NULL;
}
/**************************************************************************
Refresh (update) the viewrect on the overview. This is the rectangle
showing the area covered by the mapview.
**************************************************************************/
-void refresh_overview_viewrect(void)
+void refresh_overview(void)
{
-
- int Nx, Ny, Ex, Ey, Wx, Wy, Sx, Sy, map_w, map_h;
- Uint32 color;
struct GUI *pMMap, *pBuf;
SDL_Rect map_area;
@@ -1785,40 +1493,7 @@
map_area.y + map_area.h + 1, 0xFFFFFFFF);
}
- /* The x's and y's are in overview coordinates. */
- map_w = mapview_canvas.tile_width;
- map_h = mapview_canvas.tile_height;
-
-#if 0
- /* take from Main Map */
- if (!canvas_to_map_pos(&Wx, &Wy, 0, 0)) {
- nearest_real_pos(&Wx, &Wy);
- }
-#endif
-
- Wx = OVERVIEW_TILE_WIDTH * map_view_x0;
- Wy = OVERVIEW_TILE_HEIGHT * map_view_y0;
-
- Nx = Wx + OVERVIEW_TILE_WIDTH * map_w;
- Ny = Wy - OVERVIEW_TILE_HEIGHT * map_w;
-
- Sx = Wx + OVERVIEW_TILE_WIDTH * map_h;
- Sy = Wy + OVERVIEW_TILE_HEIGHT * map_h;
- Ex = Nx + OVERVIEW_TILE_WIDTH * map_h;
- Ey = Ny + OVERVIEW_TILE_HEIGHT * map_h;
-
- color = 0xFFFFFFFF;
-
- putline_on_mini_map(&map_area, Nx, Ny, Ex, Ey, color, pMMap->dst);
-
- putline_on_mini_map(&map_area, Sx, Sy, Ex, Ey, color, pMMap->dst);
-
- putline_on_mini_map(&map_area, Wx, Wy, Sx, Sy, color, pMMap->dst);
-
- putline_on_mini_map(&map_area, Wx, Wy, Nx, Ny, color, pMMap->dst);
-
- freelog(LOG_DEBUG, "wx,wy: %d,%d nx,ny:%d,%x ex,ey:%d,%d, sx,sy:%d,%d",
- Wx, Wy, Nx, Ny, Ex, Ey, Sx, Sy);
+ refresh_overview_canvas();
/* ===== */
@@ -1957,47 +1632,7 @@
static void put_city_pixmap_draw(struct city *pCity, SDL_Surface *pDest,
Sint16 map_x, Sint16 map_y)
{
- static struct drawn_sprite pSprites[10];
- static SDL_Rect src, des;
- static int i, count;
-
- if(!pCity) {
- return;
- }
-
- count = fill_city_sprite_array_iso(pSprites, pCity);
-
- if (!(SDL_Client_Flags & CF_CIV3_CITY_TEXT_STYLE))
- {
- src = get_smaller_surface_rect(GET_SURF(pSprites[0].sprite));
- des.x = map_x + (NORMAL_TILE_WIDTH - src.w) / 2;
- des.y = map_y + NORMAL_TILE_HEIGHT / 4;
-
- /* blit flag/shield */
- SDL_BlitSurface(GET_SURF(pSprites[0].sprite), &src, pDest, &des);
- }
-
- if (pCity->owner == game.player_idx && cma_is_city_under_agent(pCity, NULL))
{
- draw_icon_from_theme(pTheme->CMA_Icon, 0, pDest,
- map_x + (NORMAL_TILE_WIDTH - pTheme->CMA_Icon->w / 2) / 4,
- map_y + NORMAL_TILE_HEIGHT - pTheme->CMA_Icon->h);
- }
-
- des.x = map_x;
- des.y = map_y;
- src = des;
- for (i = 1; i < count; i++) {
- if (pSprites[i].sprite) {
-#if 0
- if(GET_SURF(pSprites[i].sprite)->w - NORMAL_TILE_WIDTH > 0) {
- des.x -= ((GET_SURF(pSprites[i].sprite)->w - NORMAL_TILE_WIDTH) >> 1);
- }
-#endif
- SDL_BlitSurface(GET_SURF(pSprites[i].sprite), NULL, pDest, &des);
- des = src;
- }
- }
-
+ /* FIXME */
}
/**************************************************************************
@@ -2006,71 +1641,12 @@
void put_unit_pixmap_draw(struct unit *pUnit, SDL_Surface *pDest,
Sint16 map_x, Sint16 map_y)
{
- static struct drawn_sprite pSprites[10];
- static SDL_Rect copy, des;
- static SDL_Rect src_hp = {0,0,0,0};
- static SDL_Rect src_flag = {0,0,0,0};
- static int count, i;
- bool solid_bg;
-
- if(!pUnit) {
- return;
- }
-
- des.x = map_x;
- des.y = map_y;
-
- count = fill_unit_sprite_array(pSprites, pUnit, &solid_bg);
-
- des.x += NORMAL_TILE_WIDTH / 4;
-
- /* blit hp bar */
- if (!src_hp.x)
- {
- src_hp = get_smaller_surface_rect(GET_SURF(pSprites[count - 1].sprite));
- }
- copy = des;
- SDL_BlitSurface(GET_SURF(pSprites[count - 1].sprite), &src_hp, pDest, &des);
-
- des = copy;
- des.y += src_hp.h;
- des.x++;
-
- /* blit flag/shield */
- if (!src_flag.x)
- {
- src_flag = get_smaller_surface_rect(GET_SURF(pSprites[0].sprite));
- }
-
- SDL_BlitSurface(GET_SURF(pSprites[0].sprite), &src_flag, pDest, &des);
-
- des.x = map_x;
- des.y = map_y;
- copy = des;
- for (i = 1; i < count - 1; i++) {
- if (pSprites[i].sprite) {
- SDL_BlitSurface(GET_SURF(pSprites[i].sprite), NULL, pDest, &des);
- des = copy;
- }
- }
-
- /* draw current occupy status */
- if (pUnit->owner == game.player_idx && get_transporter_capacity(pUnit) > 0) {
-
- des.y += NORMAL_TILE_HEIGHT / 2;
- copy = des;
-
- if (pUnit->occupy >= 10) {
- SDL_BlitSurface(GET_SURF(sprites.city.size_tens[pUnit->occupy / 10]),
- NULL, pDest, &des);
- des = copy;
- }
-
- SDL_BlitSurface(GET_SURF(sprites.city.size[pUnit->occupy % 10]),
- NULL, pDest, &des);
+ if (pUnit) {
+ struct canvas canvas;
+ canvas.surf = pDest;
+ put_unit_full(pUnit, &canvas, map_x, map_y);
}
-
}
/**************************************************************************
@@ -2103,7 +1679,6 @@
Uint16 map_col, Uint16 map_row, int citymode)
{
static struct drawn_sprite pTile_sprs[80];
- static struct Sprite *pCoasts[4] = {NULL, NULL, NULL, NULL};
static SDL_Surface *pDitherBufs[4];
static SDL_Surface *pBufSurface = NULL;
static SDL_Rect dst, des;
@@ -2114,10 +1689,11 @@
static enum tile_terrain_type terrain;
static int count, i;
static bool fog, full_ocean, solid_bg;
+ enum color_std bg_color;
count =
- fill_tile_sprite_array_iso(pTile_sprs, pCoasts, NULL, map_col,
- map_row, citymode, &solid_bg);
+ fill_tile_sprite_array(pTile_sprs, &solid_bg, &bg_color,
+ map_col, map_row, citymode);
if (count == -1) { /* tile is unknown */
des.x = map_x;
@@ -2153,74 +1729,11 @@
dst = des;
- if (is_ocean(terrain)) {
- if (full_ocean) {
- if (fog) {
- SDL_BlitSurface(pOcean_Foged_Tile, NULL, pBufSurface, &des);
- } else {
- SDL_BlitSurface(pOcean_Tile, NULL, pBufSurface, &des);
- }
- } else { /* coasts */
- /* top */
- des.x += NORMAL_TILE_WIDTH / 4;
- SDL_BlitSurface(GET_SURF(pCoasts[0]), NULL, pBufSurface, &des);
- des = dst;
-
- /* bottom */
- des.x += NORMAL_TILE_WIDTH / 4;
- des.y += HALF_NORMAL_TILE_HEIGHT;
- SDL_BlitSurface(GET_SURF(pCoasts[1]), NULL, pBufSurface, &des);
- des = dst;
-
- /* left */
- des.y += NORMAL_TILE_HEIGHT / 4;
- SDL_BlitSurface(GET_SURF(pCoasts[2]), NULL, pBufSurface, &des);
- des = dst;
-
- /* right */
- des.y += NORMAL_TILE_HEIGHT / 4;
- des.x += HALF_NORMAL_TILE_WIDTH;
- SDL_BlitSurface(GET_SURF(pCoasts[3]), NULL, pBufSurface, &des);
- }
- } else {
- SDL_BlitSurface(GET_SURF(pTile_sprs[0].sprite), NULL, pBufSurface, &des);
- i++;
- }
-
des = dst;
- /*** Dither base terrain ***/
- if (!full_ocean && !is_ocean(terrain) && (SDL_Client_Flags &
CF_DRAW_MAP_DITHER))
- {
- /* north */
- if (pDitherBufs[0]) {
- des.x += HALF_NORMAL_TILE_WIDTH;
- SDL_BlitSurface(pDitherBufs[0], NULL, pBufSurface, &des);
- des = dst;
- }
- /* south */
- if (pDitherBufs[1]) {
- des.y += HALF_NORMAL_TILE_HEIGHT;
- SDL_BlitSurface(pDitherBufs[1], NULL, pBufSurface, &des);
- des = dst;
- }
- /* east */
- if (pDitherBufs[2]) {
- des.y += HALF_NORMAL_TILE_HEIGHT;
- des.x += HALF_NORMAL_TILE_WIDTH;
- SDL_BlitSurface(pDitherBufs[2], NULL, pBufSurface, &des);
- des = dst;
- }
- /* west */
- if (pDitherBufs[3]) {
- SDL_BlitSurface(pDitherBufs[3], NULL, pBufSurface, &des);
- des = dst;
- }
- }
-
- /*** Rest of terrain and specials ***/
+ /*** Rest of terrain and specials ***/
if (draw_terrain) {
- for (; i < count; i++) {
+ for (i = 0; i < count; i++) {
if (pTile_sprs[i].sprite) {
if (GET_SURF(pTile_sprs[i].sprite)->w - NORMAL_TILE_WIDTH > 0
|| GET_SURF(pTile_sprs[i].sprite)->h - NORMAL_TILE_HEIGHT > 0) {
@@ -2570,93 +2083,6 @@
}
/**************************************************************************
- This function is called to decrease a unit's HP smoothly in battle when
- combat_animation is turned on.
-**************************************************************************/
-void decrease_unit_hp_smooth(struct unit *punit0, int hp0,
- struct unit *punit1, int hp1)
-{
-
- static struct timer *anim_timer = NULL;
- struct unit *losing_unit = (hp0 == 0 ? punit0 : punit1);
- int i, canvas_x, canvas_y;
- SDL_Rect src =
- { 0, 0, NORMAL_TILE_WIDTH, 1.5 * NORMAL_TILE_HEIGHT }, dest;
-
- set_units_in_combat(punit0, punit1);
-
- do {
- anim_timer = renew_timer_start(anim_timer, TIMER_USER, TIMER_ACTIVE);
-
- if (punit0->hp > hp0
- && myrand((punit0->hp - hp0) + (punit1->hp - hp1)) <
- punit0->hp - hp0) {
- punit0->hp--;
- } else {
- if (punit1->hp > hp1) {
- punit1->hp--;
- } else {
- punit0->hp--;
- }
- }
-
- refresh_tile_mapcanvas(punit0->x, punit0->y, FALSE);
- refresh_tile_mapcanvas(punit1->x, punit1->y, FALSE);
-
- flush_dirty();
-
- usleep_since_timer_start(anim_timer, 10000);
-
- } while (punit0->hp > hp0 || punit1->hp > hp1);
-
-
- if (num_tiles_explode_unit &&
- map_to_canvas_pos(&canvas_x, &canvas_y, losing_unit->x, losing_unit->y))
{
- /* copy screen area */
- src.x = canvas_x;
- src.y = canvas_y;
- SDL_BlitSurface(Main.map, &src, pTmpSurface, NULL);
-
- dest.y = canvas_y;
- for (i = 0; i < num_tiles_explode_unit; i++) {
-
- anim_timer = renew_timer_start(anim_timer, TIMER_USER, TIMER_ACTIVE);
-
- /* blit explosion */
- dest.x = canvas_x + NORMAL_TILE_WIDTH / 4;
-
- SDL_BlitSurface(GET_SURF(sprites.explode.unit[i]),
- NULL, Main.map, &dest);
-
- flush_rect(dest);
-
- usleep_since_timer_start(anim_timer, 40000);
-
- /* clear explosion */
- dest.x = canvas_x;
- SDL_BlitSurface(pTmpSurface, NULL, Main.map, &dest);
- }
- }
-
- sdl_dirty_rect(dest);
-
- /* clear pTmpSurface */
- if ((pTmpSurface->format->BytesPerPixel == 4) &&
- (!pTmpSurface->format->Amask)) {
- SDL_FillRect(pTmpSurface, NULL, Amask);
- } else {
- SDL_FillRect(pTmpSurface, NULL, 0x0);
- }
-
- set_units_in_combat(NULL, NULL);
-
- refresh_tile_mapcanvas(punit0->x, punit0->y, FALSE);
- refresh_tile_mapcanvas(punit1->x, punit1->y, FALSE);
- rebuild_focus_anim_frames();
- flush_dirty();
-}
-
-/**************************************************************************
Update (refresh) the locations of the mapview scrollbars (if it uses
them).
**************************************************************************/
@@ -2677,122 +2103,14 @@
Draw in information about city workers on the mapview in the given
color.
**************************************************************************/
-void put_city_workers(struct city *pcity, int color)
+void put_city_worker(struct canvas *pcanvas,
+ enum color_std color, enum city_tile_type worker,
+ int canvas_x, int canvas_y)
{
freelog(LOG_DEBUG, "MAPVIEW: put_city_workers : PORT ME");
}
/**************************************************************************
- Draw a nuke mushroom cloud at the given tile.
-**************************************************************************/
-void put_nuke_mushroom_pixmaps(int x, int y)
-{
- int canvas_x, canvas_y;
-
- if (pAnim->num_tiles_explode_nuke &&
- map_to_canvas_pos(&canvas_x, &canvas_y, x, y)) {
- struct Sprite *pNuke;
- SDL_Surface *pStore;
- struct timer *anim_timer = NULL;
- SDL_Rect src, dst;
- char tag[32];
- int i;
-
- my_snprintf(tag , sizeof(tag), "explode.iso_nuke_0");
- pNuke = load_sprite(tag);
- assert(pNuke != NULL);
- /* copy screen area */
- src.w = GET_SURF(pNuke)->w;
- src.h = GET_SURF(pNuke)->h;
- src.x = canvas_x + (NORMAL_TILE_WIDTH - src.w) / 2;
- src.y = canvas_y + (NORMAL_TILE_HEIGHT - src.h) / 2 - 24;/* hard coded y
position !! */
- dst = src;
-
- pStore = create_surf(src.w, src.h, SDL_SWSURFACE);
- SDL_BlitSurface(Main.map, &src, pStore, NULL);
- src = dst;
-
- /* draw nuke explosion animations */
- for (i = 0; i < pAnim->num_tiles_explode_nuke; i++) {
-
- if(!pNuke) {
- my_snprintf(tag , sizeof(tag), "explode.iso_nuke_%d", i);
- pNuke = load_sprite(tag);
- }
- assert(pNuke != NULL);
-
- SDL_SetColorKey(GET_SURF(pNuke), SDL_SRCCOLORKEY,
- get_first_pixel(GET_SURF(pNuke)));
-
- anim_timer = renew_timer_start(anim_timer, TIMER_USER, TIMER_ACTIVE);
-
- /* blit explosion */
- SDL_BlitSurface(GET_SURF(pNuke), NULL, Main.map, &dst);
-
- flush_rect(dst);
- dst = src;
-
- usleep_since_timer_start(anim_timer, 40000);
-
- /* clear explosion */
- SDL_BlitSurface(pStore, NULL, Main.map, &dst);
- dst = src;
-
- unload_sprite(tag);
- pNuke = NULL;
- }
-
- FREESURFACE(pStore);
- finish_loading_sprites();
- }
-
-}
-
-/**************************************************************************
- Draw a segment (e.g., a goto line) from the given tile in the given
- direction.
-**************************************************************************/
-void draw_segment(int src_x, int src_y, int dir)
-{
- int dest_x, dest_y, is_real;
- int canvas_start_x, canvas_start_y;
- int canvas_end_x, canvas_end_y;
- Uint32 color = get_game_color(COLOR_STD_CYAN, Main.map);
-
- is_real = MAPSTEP(dest_x, dest_y, src_x, src_y, dir);
- assert(is_real);
-
- /* Find middle of tiles. y-1 to not undraw the the middle pixel of a
- horizontal line when we refresh the tile below-between. */
- map_to_canvas_pos(&canvas_start_x, &canvas_start_y, src_x, src_y);
- map_to_canvas_pos(&canvas_end_x, &canvas_end_y, dest_x, dest_y);
- canvas_start_x += HALF_NORMAL_TILE_WIDTH;
- canvas_start_y += HALF_NORMAL_TILE_HEIGHT - 1;
- canvas_end_x += HALF_NORMAL_TILE_WIDTH;
- canvas_end_y += HALF_NORMAL_TILE_HEIGHT - 1;
-
- dest_x = abs(canvas_end_x - canvas_start_x);
- dest_y = abs(canvas_end_y - canvas_start_y);
-
- /* somewhat hackish way of solving the problem where draw from a tile on
- one side of the screen out of the screen, and the tile we draw to is
- found to be on the other side of the screen. */
- if (dest_x > NORMAL_TILE_WIDTH || dest_y > NORMAL_TILE_HEIGHT) {
- return;
- }
-
- /* draw it! */
- putline(Main.map,
- canvas_start_x, canvas_start_y, canvas_end_x, canvas_end_y, color);
-
- dirty_rect(MIN(canvas_start_x, canvas_end_x),
- MIN(canvas_start_y, canvas_end_y),
- dest_x ? dest_x : 1, dest_y ? dest_y : 1);
-
-
-}
-
-/**************************************************************************
Area Selection
**************************************************************************/
void draw_selection_rectangle(int canvas_x, int canvas_y, int w, int h)
@@ -3059,7 +2377,7 @@
SDL_Surface *pDest = create_surf(get_citydlg_canvas_width(),
get_citydlg_canvas_height(), SDL_SWSURFACE);
- store.map = pDest;
+ store.surf = pDest;
/* turn off drawing units */
draw_units = 0;
@@ -3171,11 +2489,6 @@
SDL_Rect des = { 0 , 0 , 0, 0 };
SDL_Surface *pBuf[4];
- pBuf[0] = GET_SURF(sprites.tx.coast_cape_iso[0][0]);
- pBuf[1] = GET_SURF(sprites.tx.coast_cape_iso[0][1]);
- pBuf[2] = GET_SURF(sprites.tx.coast_cape_iso[0][2]);
- pBuf[3] = GET_SURF(sprites.tx.coast_cape_iso[0][3]);
-
/* top */
des.y = 0;
des.x = NORMAL_TILE_WIDTH / 4;
@@ -3214,11 +2527,6 @@
if (MAPSTEP(x1, y1, x, y, dir)) {
__ter[dir] = map_get_terrain(x1, y1);
-
- /* hacking away the river here... */
- if (is_isometric && __ter[dir] == T_RIVER) {
- __ter[dir] = T_GRASSLAND;
- }
} else {
/* We draw the edges of the map as if the same terrain just
* continued off the edge of the map. */
@@ -3257,7 +2565,7 @@
for (terrain = T_ARCTIC ; terrain < T_LAST ; terrain++)
{
- if (terrain == T_RIVER || is_ocean(terrain) || terrain == T_UNKNOWN)
+ if (is_ocean(terrain) || terrain == T_UNKNOWN)
{
for(i = 0; i < 4; i++)
{
@@ -3266,7 +2574,7 @@
continue;
}
- pTerrain_Surface = GET_SURF(get_tile_type(terrain)->sprite[0]);
+ pTerrain_Surface = GET_SURF(sprites.terrain[terrain]->layer[0].base);
for( i = 0; i < 4; i++ )
{
@@ -3355,66 +2663,6 @@
/**************************************************************************
...
**************************************************************************/
-static void init_borders_tiles(void)
-{
- int i;
- SDL_Color *color;
-
- pMapBorders = CALLOC(game.nplayers + 1, sizeof(SDL_Surface **));
- for(i=0; i<game.nplayers; i++) {
-
- color = get_game_colorRGB(COLOR_STD_RACE0 + i);
- color->unused = 192;
-
- pMapBorders[i] = CALLOC(4, sizeof(SDL_Surface *));
-
- pMapBorders[i][0] = SDL_DisplayFormat(pTheme->NWEST_BORDER_Icon);
- SDL_FillRectAlpha(pMapBorders[i][0], NULL, color);
- SDL_SetColorKey(pMapBorders[i][0], SDL_SRCCOLORKEY|SDL_RLEACCEL,
- get_first_pixel(pMapBorders[i][0]));
-
- pMapBorders[i][1] = SDL_DisplayFormat(pTheme->NNORTH_BORDER_Icon);
- SDL_FillRectAlpha(pMapBorders[i][1], NULL, color);
- SDL_SetColorKey(pMapBorders[i][1], SDL_SRCCOLORKEY|SDL_RLEACCEL,
- get_first_pixel(pMapBorders[i][1]));
-
- pMapBorders[i][2] = SDL_DisplayFormat(pTheme->NEAST_BORDER_Icon);
- SDL_FillRectAlpha(pMapBorders[i][2], NULL, color);
- SDL_SetColorKey(pMapBorders[i][2], SDL_SRCCOLORKEY|SDL_RLEACCEL,
- get_first_pixel(pMapBorders[i][2]));
-
- pMapBorders[i][3] = SDL_DisplayFormat(pTheme->NSOUTH_BORDER_Icon);
- SDL_FillRectAlpha(pMapBorders[i][3], NULL, color);
- SDL_SetColorKey(pMapBorders[i][3], SDL_SRCCOLORKEY|SDL_RLEACCEL,
- get_first_pixel(pMapBorders[i][3]));
-
- color->unused = 255;
- }
-
-}
-
-/**************************************************************************
- ...
-**************************************************************************/
-static void free_borders_tiles(void)
-{
- if(pMapBorders) {
- int i = 0;
- while(pMapBorders[i]) {
- FREESURFACE(pMapBorders[i][0]);
- FREESURFACE(pMapBorders[i][1]);
- FREESURFACE(pMapBorders[i][2]);
- FREESURFACE(pMapBorders[i][3]);
- FREE(pMapBorders[i]);
- i++;
- }
- FREE(pMapBorders);
- }
-}
-
-/**************************************************************************
- ...
-**************************************************************************/
void tmp_map_surfaces_init(void)
{
Index: client/gui-sdl/mapview.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/mapview.h,v
retrieving revision 1.14
diff -u -r1.14 mapview.h
--- client/gui-sdl/mapview.h 28 Aug 2003 16:02:04 -0000 1.14
+++ client/gui-sdl/mapview.h 24 Jun 2004 00:32:51 -0000
@@ -39,6 +39,7 @@
Sint16 map_x, Sint16 map_y);
void rebuild_focus_anim_frames(void);
void toggle_overview_mode(void);
+void refresh_overview(void);
void flush_rect(SDL_Rect rect);
void sdl_dirty_rect(SDL_Rect rect);
Index: client/gui-sdl/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/menu.c,v
retrieving revision 1.25
diff -u -r1.25 menu.c
--- client/gui-sdl/menu.c 1 Apr 2004 23:46:25 -0000 1.25
+++ client/gui-sdl/menu.c 24 Jun 2004 00:32:51 -0000
@@ -153,7 +153,10 @@
key_unit_auto_explore();
break;
case ID_UNIT_ORDER_CONNECT:
+#if 0
+ /* TODO: multiple connect types */
key_unit_connect();
+#endif
break;
case ID_UNIT_ORDER_PATROL:
key_unit_patrol();
Index: client/gui-sdl/optiondlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/optiondlg.c,v
retrieving revision 1.28
diff -u -r1.28 optiondlg.c
--- client/gui-sdl/optiondlg.c 2 Oct 2003 21:37:44 -0000 1.28
+++ client/gui-sdl/optiondlg.c 24 Jun 2004 00:32:51 -0000
@@ -768,31 +768,10 @@
/**************************************************************************
...
**************************************************************************/
-static int smooth_move_units_callback(struct GUI *pWidget)
-{
- redraw_icon(pWidget);
- flush_rect(pWidget->size);
- if (smooth_move_units) {
- smooth_move_units = FALSE;
- set_wstate(pWidget->prev->prev, FC_WS_DISABLED);
- redraw_edit(pWidget->prev->prev);
- flush_rect(pWidget->prev->prev->size);
- } else {
- smooth_move_units = TRUE;
- set_wstate(pWidget->prev->prev, FC_WS_NORMAL);
- redraw_edit(pWidget->prev->prev);
- flush_rect(pWidget->prev->prev->size);
- }
- return -1;
-}
-
-/**************************************************************************
- ...
-**************************************************************************/
-static int smooth_move_unit_steps_callback(struct GUI *pWidget)
+static int smooth_move_unit_msec_callback(struct GUI *pWidget)
{
char *tmp = convert_to_chars(pWidget->string16->text);
- sscanf(tmp, "%d", &smooth_move_unit_steps);
+ sscanf(tmp, "%d", &smooth_move_unit_msec);
FREE(tmp);
return -1;
}
@@ -939,44 +918,14 @@
pTmpGui->size.y = pTmpGui->next->size.y +
((pTmpGui->next->size.h - pTmpGui->size.h) / 2);
- /* 'smooth unit moves' */
- /* check box */
- pTmpGui = create_checkbox(pWindow->dst,
- smooth_move_units, WF_DRAW_THEME_TRANSPARENT);
-
- pTmpGui->action = smooth_move_units_callback;
- set_wstate(pTmpGui, FC_WS_NORMAL);
-
- pTmpGui->size.x = pWindow->size.x + 15;
-
- add_to_gui_list(ID_OPTIONS_LOCAL_MOVE_CHECKBOX, pTmpGui);
- pTmpGui->size.y = pTmpGui->next->next->size.y + pTmpGui->size.h + 4;
-
- /* label */
- pStr = create_str16_from_char(_("Smooth unit moves"), 10);
- pStr->style |= TTF_STYLE_BOLD;
- pStr->fgcol = text_color;
- pTmpGui = create_iconlabel(NULL, pWindow->dst, pStr, 0);
-
- pTmpGui->size.x = pWindow->size.x + 55;
-
- add_to_gui_list(ID_OPTIONS_LOCAL_MOVE_LABEL, pTmpGui);
-
- pTmpGui->size.y = pTmpGui->next->size.y +
- ((pTmpGui->next->size.h - pTmpGui->size.h) / 2);
-
- /* 'smooth unit move steps' */
+ /* 'smooth unit move msec' */
/* edit */
- my_snprintf(cBuf, sizeof(cBuf), "%d", smooth_move_unit_steps);
+ my_snprintf(cBuf, sizeof(cBuf), "%d", smooth_move_unit_msec);
pTmpGui = create_edit_from_chars(NULL, pWindow->dst, cBuf, 11, 25,
WF_DRAW_THEME_TRANSPARENT);
- pTmpGui->action = smooth_move_unit_steps_callback;
-
- if (smooth_move_units) {
- set_wstate(pTmpGui, FC_WS_NORMAL);
- }
+ pTmpGui->action = smooth_move_unit_msec_callback;
pTmpGui->size.x = pWindow->size.x + 12;
Index: client/gui-sdl/spaceshipdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/spaceshipdlg.c,v
retrieving revision 1.8
diff -u -r1.8 spaceshipdlg.c
--- client/gui-sdl/spaceshipdlg.c 8 May 2004 04:47:57 -0000 1.8
+++ client/gui-sdl/spaceshipdlg.c 24 Jun 2004 00:32:51 -0000
@@ -52,6 +52,7 @@
#include "spaceship.h"
#include "tilespec.h"
#include "climisc.h"
+#include "text.h"
#include "spaceshipdlg.h"
Index: client/gui-sdl/wldlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-sdl/wldlg.c,v
retrieving revision 1.14
diff -u -r1.14 wldlg.c
--- client/gui-sdl/wldlg.c 25 Feb 2004 20:09:51 -0000 1.14
+++ client/gui-sdl/wldlg.c 24 Jun 2004 00:32:51 -0000
@@ -342,8 +342,7 @@
}
} else {
pEditor->stock =
- city_change_production_penalty(pEditor->pCity,
- target, is_unit, FALSE);
+ city_change_production_penalty(pEditor->pCity, target, is_unit);
}
}
@@ -930,7 +929,7 @@
if(is_unit) {
struct unit_type *pType = get_unit_type(id);
- *cost = unig_build_value(id);
+ *cost = unit_build_shield_cost(id);
return pType->name;
} else {
*cost = impr_build_shield_cost(id);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#9082) patch to make gui-sdl compile,
Jason Short <=
|
|