Project

General

Profile

Feature #1057 ยป 0057-Add-animations-gui-property.patch

Marko Lindqvist, 11/03/2024 01:14 PM

View differences:

client/Makefile.am
global_worklist.h \
goto.c \
goto.h \
gui_properties.c \
gui_properties.h \
luaconsole_common.c \
luaconsole_common.h \
mapctrl_common.c \
client/client_main.c
#include "control.h"
#include "editor.h"
#include "global_worklist.h"
#include "gui_properties.h"
#include "helpdata.h" /* boot_help_texts() */
#include "mapview_common.h"
#include "music.h"
......
bind_textdomain_codeset("freeciv-nations", get_internal_encoding());
#endif
gui_properties_init();
i = 1;
announce = ANNOUNCE_DEFAULT;
client/gui-gtk-3.22/gui_main.c
#include "connectdlg_common.h"
#include "control.h"
#include "editor.h"
#include "gui_properties.h"
#include "options.h"
#include "text.h"
#include "tilespec.h"
......
}
}
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
}
client/gui-gtk-4.0/gui_main.c
#include "connectdlg_common.h"
#include "control.h"
#include "editor.h"
#include "gui_properties.h"
#include "options.h"
#include "text.h"
#include "tilespec.h"
......
{
return fc_app;
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void setup_gui_properties(void)
{
gui_properties.animations = TRUE;
}
client/gui-gtk-5.0/gui_main.c
#include "connectdlg_common.h"
#include "control.h"
#include "editor.h"
#include "gui_properties.h"
#include "options.h"
#include "text.h"
#include "tilespec.h"
......
{
return fc_app;
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void setup_gui_properties(void)
{
gui_properties.animations = TRUE;
}
client/gui-qt/gui_main.cpp
// client
#include "client_main.h"
#include "editgui_g.h"
#include "gui_properties.h"
#include "options.h"
#include "sprite.h"
#include "svgflag.h"
......
cat_snprintf(outbuf, outlen, _("\nBuilt in Qt6 mode."));
#endif // FC_QT5_MODE
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void qtg_setup_gui_properties()
{
gui_properties.animations = FALSE;
}
client/gui-qt/qtg_cxxside.cpp
funcs->endgame_report_dialog_player = qtg_endgame_report_dialog_player;
funcs->popup_image = qtg_popup_image;
funcs->setup_gui_properties = qtg_setup_gui_properties;
}
client/gui-qt/qtg_cxxside.h
void qtg_popup_image(const char *tag);
void qtg_setup_gui_properties();
#endif // FC__QTG_CXXSIDE_H
client/gui-sdl2/gui_main.c
#include "climisc.h"
#include "clinet.h"
#include "editgui_g.h"
#include "gui_properties.h"
#include "spaceshipdlg_g.h"
#include "tilespec.h"
#include "update_queue.h"
......
{
return SDL_PushEvent(flush_user_event) >= 0;
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
}
client/gui-sdl3/gui_main.c
#include "climisc.h"
#include "clinet.h"
#include "editgui_g.h"
#include "gui_properties.h"
#include "spaceshipdlg_g.h"
#include "tilespec.h"
#include "update_queue.h"
......
{
return SDL_PushEvent(flush_user_event);
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void setup_gui_properties(void)
{
gui_properties.animations = FALSE;
}
client/gui-stub/gui_main.c
{
/* PORTME */
}
/**********************************************************************//**
Define properties of this gui.
**************************************************************************/
void gui_setup_gui_properties(void)
{
/* PORTME */
}
client/gui_cbsetter.c
funcs->get_usable_themes_in_directory = gui_get_usable_themes_in_directory;
funcs->popup_image = gui_popup_image;
funcs->setup_gui_properties = gui_setup_gui_properties;
}
client/gui_interface.c
{
funcs.popup_image(tag);
}
/**********************************************************************//**
Call setup_gui_properties callback
**************************************************************************/
void setup_gui_properties(void)
{
funcs.setup_gui_properties();
}
client/gui_interface.h
void (*endgame_report_dialog_player)(const struct packet_endgame_player *packet);
void (*popup_image)(const char *tag);
void (*setup_gui_properties)(void);
};
struct gui_funcs *get_gui_funcs(void);
client/gui_properties.c
/***********************************************************************
Freeciv - Copyright (C) 2005 - The Freeciv Team
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif
#include <string.h>
/* utility */
#include "support.h"
/* client/include */
#include "gui_main_g.h"
#include "gui_properties.h"
struct client_properties gui_properties;
/**********************************************************************//**
Initialize gui_properties
**************************************************************************/
void gui_properties_init(void)
{
memset(&gui_properties, 0, sizeof(struct client_properties));
setup_gui_properties();
}
client/gui_properties.h
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef FC__GUI_PROPERTIES_H
#define FC__GUI_PROPERTIES_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
struct client_properties {
bool animations;
};
extern struct client_properties gui_properties;
void gui_properties_init(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* FC__GUI_PROPERTIES_H */
client/include/gui_main_g.h
GUI_FUNC_PROTO(void, gui_update_font, const char *font_name,
const char *font_value)
GUI_FUNC_PROTO(void, setup_gui_properties, void);
extern const char *client_string;
/* Actually defined in update_queue.c */
void conn_list_dialog_update(void);
#endif /* FC__GUI_MAIN_G_H */
#endif /* FC__GUI_MAIN_G_H */
client/tilespec.c
#include "control.h" /* For fill_xxx */
#include "editor.h"
#include "goto.h"
#include "gui_properties.h"
#include "helpdata.h"
#include "options.h" /* For fill_xxx */
#include "svgflag.h"
......
int time;
int time_per_frame;
struct sprite **sprites;
bool show_always;
};
struct drawing_data {
......
ret->time = 0;
ret->time_per_frame = time_per_frame;
ret->sprites = fc_malloc(frames * sizeof(struct sprite *));
ret->show_always = FALSE;
return ret;
}
......
****************************************************************************/
static struct sprite *anim_get_current_frame(struct anim *a)
{
if (!gui_properties.animations && !a->show_always) {
return a->sprites[0];
}
return a->sprites[(a->time / a->time_per_frame) % a->frames];
}
......
}
t->sprites.unit.select = anim_load(t, "unit.select", 1);
if (t->sprites.unit.select != nullptr) {
t->sprites.unit.select->show_always = TRUE;
}
SET_SPRITE(citybar.shields, "citybar.shields");
SET_SPRITE(citybar.food, "citybar.food");
meson.build
'client/editor.c',
'client/global_worklist.c',
'client/goto.c',
'client/gui_properties.c',
'client/helpdata.c',
'client/luaconsole_common.c',
'client/mapctrl_common.c',
    (1-1/1)