Change resource icons to sprites, clean up

This commit is contained in:
jsalmon3 2004-03-20 20:56:25 +00:00
parent daec42b68c
commit a209ec4a32
4 changed files with 249 additions and 251 deletions

View file

@ -5,12 +5,12 @@
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
/**@name ui.h - The user interface header file. */
/**@name ui.h - The user interface header file. */
//
// (c) Copyright 1999-2003 by Lutz Sammer and Jimmy Salmon
// (c) Copyright 1999-2004 by Lutz Sammer and Jimmy Salmon
//
// 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
@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
// $Id$
// $Id$
#ifndef __UI_H__
#define __UI_H__
@ -37,7 +37,7 @@
// FIXME: all user interface variables should go here and be configurable
/*----------------------------------------------------------------------------
-- Includes
-- Includes
----------------------------------------------------------------------------*/
#include "video.h"
@ -46,324 +46,329 @@
#include "interface.h"
/*----------------------------------------------------------------------------
-- Definitons
-- Definitons
----------------------------------------------------------------------------*/
/// buttons on screen themselves
typedef struct _button_ {
int X; /// x coordinate on the screen
int Y; /// y coordinate on the screen
int Width; /// width of the button on the screen
int Height; /// height of the button on the screen
int X; /// x coordinate on the screen
int Y; /// y coordinate on the screen
int Width; /// width of the button on the screen
int Height; /// height of the button on the screen
} Button;
#define MAX_NUM_VIEWPORTS 8 /// Number of supported viewports
#define MAX_NUM_VIEWPORTS 8 /// Number of supported viewports
#if !defined(__STRUCT_VIEWPORT__)
#define __STRUCT_VIEWPORT__ /// protect duplicate viewport typedef
typedef struct _viewport_ Viewport; /// Viewport typedef
#define __STRUCT_VIEWPORT__ /// protect duplicate viewport typedef
typedef struct _viewport_ Viewport; /// Viewport typedef
#endif
/**
** A map viewport.
** A map viewport.
**
** A part of the map displayed on sceen.
** A part of the map displayed on sceen.
**
** Viewport::X Viewport::Y
** Viewport::EndX Viewport::EndY
** Viewport::X Viewport::Y
** Viewport::EndX Viewport::EndY
**
** upper left corner of this viewport is located at pixel
** coordinates (X, Y) with respect to upper left corner of
** stratagus's window, similarly lower right corner of this
** viewport is (EndX, EndY) pixels away from the UL corner of
** stratagus's window.
** upper left corner of this viewport is located at pixel
** coordinates (X, Y) with respect to upper left corner of
** stratagus's window, similarly lower right corner of this
** viewport is (EndX, EndY) pixels away from the UL corner of
** stratagus's window.
**
** Viewport::MapX Viewport::MapY
** Viewport::MapWidth Viewport::MapHeight
** Viewport::MapX Viewport::MapY
** Viewport::MapWidth Viewport::MapHeight
**
** Tile coordinates of UL corner of this viewport with respect to
** UL corner of the whole map.
** Tile coordinates of UL corner of this viewport with respect to
** UL corner of the whole map.
**
** Viewport::Unit
** Viewport::Unit
**
** Viewport is bound to an unit. If the unit moves the viewport
** changes the position together with the unit.
** @todo binding to a group.
** Viewport is bound to an unit. If the unit moves the viewport
** changes the position together with the unit.
** @todo binding to a group.
*/
struct _viewport_ {
int X; /// Screen pixel left corner x coordinate
int Y; /// Screen pixel upper corner y coordinate
int EndX; /// Screen pixel right x coordinate
int EndY; /// Screen pixel bottom y coordinate
int X; /// Screen pixel left corner x coordinate
int Y; /// Screen pixel upper corner y coordinate
int EndX; /// Screen pixel right x coordinate
int EndY; /// Screen pixel bottom y coordinate
int MapX; /// Map tile left corner x coordinate
int MapY; /// Map tile upper corner y coordinate
int OffsetX; /// Map tile offset
int OffsetY; /// Map tile offset
int MapWidth; /// Width in map tiles
int MapHeight; /// Height in map tiles
int MapX; /// Map tile left corner x coordinate
int MapY; /// Map tile upper corner y coordinate
int OffsetX; /// Map tile offset
int OffsetY; /// Map tile offset
int MapWidth; /// Width in map tiles
int MapHeight; /// Height in map tiles
char MustRedrawTile[MAXMAP_W * MAXMAP_H];
char MustRedrawRow[MAXMAP_W];
char MustRedrawTile[MAXMAP_W * MAXMAP_H]; /// Must redraw tile
char MustRedrawRow[MAXMAP_W]; /// Must redraw row
Unit* Unit; /// Bound to this unit
Unit* Unit; /// Bound to this unit
};
/**
** Enumeration of the different predefined viewport configurations.
** Enumeration of the different predefined viewport configurations.
**
** @todo this should be later user configurable
** @todo this should be later user configurable
*/
typedef enum {
VIEWPORT_SINGLE, /// Old single viewport
VIEWPORT_SPLIT_HORIZ, /// Two viewports split horizontal
VIEWPORT_SPLIT_HORIZ3, /// Three viewports split horiontal
VIEWPORT_SPLIT_VERT, /// Two viewports split vertical
VIEWPORT_QUAD, /// Four viewports split symmetric
NUM_VIEWPORT_MODES /// Number of different viewports.
VIEWPORT_SINGLE, /// Old single viewport
VIEWPORT_SPLIT_HORIZ, /// Two viewports split horizontal
VIEWPORT_SPLIT_HORIZ3, /// Three viewports split horiontal
VIEWPORT_SPLIT_VERT, /// Two viewports split vertical
VIEWPORT_QUAD, /// Four viewports split symmetric
NUM_VIEWPORT_MODES, /// Number of different viewports.
} ViewportMode;
#define ScPanel "sc-panel" /// hack for transparency
#define ScPanel "sc-panel" /// hack for transparency
/**
** Menu panels
** Menu panels
*/
typedef struct _menu_panel_ {
char* Ident; /// Unique identifier
GraphicConfig Panel; /// Panel
struct _menu_panel_* Next; /// Next pointer
char* Ident; /// Unique identifier
GraphicConfig Panel; /// Panel
struct _menu_panel_* Next; /// Next pointer
} MenuPanel;
/**
** Defines the user interface.
** Defines the user interface.
*/
typedef struct _ui_ {
// to select the correct user interface.
char* Name; /// interface name to select
int Width; /// useable for this width
int Height; /// useable for this height
char* Name; /// interface name to select
int Width; /// useable for this width
int Height; /// useable for this height
int MouseScroll; /// Enable mouse scrolling
int KeyScroll; /// Enable keyboard scrolling
int MouseScroll; /// Enable mouse scrolling
int KeyScroll; /// Enable keyboard scrolling
/// Middle-Mouse Scroll Speed (screenpixels per mousepixel)
int MouseScrollSpeedDefault;
int MouseScrollSpeedDefault;
/// Middle-Mouse Scroll Speed with Control pressed
int MouseScrollSpeedControl;
int MouseScrollSpeedControl;
int MouseWarpX; /// Cursor warp X position
int MouseWarpY; /// Cursor warp Y position
int MouseWarpX; /// Cursor warp X position
int MouseWarpY; /// Cursor warp Y position
char* NormalFontColor; /// Color for normal text displayed
char* ReverseFontColor; /// Color for reverse text displayed
char* NormalFontColor; /// Color for normal text displayed
char* ReverseFontColor; /// Color for reverse text displayed
// Fillers
GraphicConfig* Filler; /// Filler graphics
int* FillerX; /// Filler X positions
int* FillerY; /// Filler Y positions
int NumFillers; /// Number of fillers
// Fillers
GraphicConfig* Filler; /// Filler graphics
int* FillerX; /// Filler X positions
int* FillerY; /// Filler Y positions
int NumFillers; /// Number of fillers
// Resource line
GraphicConfig Resource; /// Resource background
int ResourceX; /// Resource X position
int ResourceY; /// Resource Y position
// Resource line
GraphicConfig Resource; /// Resource background
int ResourceX; /// Resource X position
int ResourceY; /// Resource Y position
struct {
GraphicConfig Icon; /// icon image
int IconRow; /// icon image row (frame)
int IconX; /// icon X position
int IconY; /// icon Y position
int IconW; /// icon W position
int IconH; /// icon H position
int TextX; /// text X position
int TextY; /// text Y position
} Resources[MaxCosts+2]; /// Icon+Text of all resources
/// +2 for food and score
GraphicConfig Icon; /// icon image
int IconFrame; /// icon frame
int IconX; /// icon X position
int IconY; /// icon Y position
int IconW; /// icon W position
int IconH; /// icon H position
int TextX; /// text X position
int TextY; /// text Y position
} Resources[MaxCosts + 2]; /// Icon+Text of all resources
/// +2 for food and score
// Info panel
GraphicConfig InfoPanel; /// Info panel background
int InfoPanelX; /// Info panel screen X position
int InfoPanelY; /// Info panel screen Y position
int InfoPanelW; /// Info panel width
int InfoPanelH; /// Info panel height
GraphicConfig InfoPanel; /// Info panel background
int InfoPanelX; /// Info panel screen X position
int InfoPanelY; /// Info panel screen Y position
int InfoPanelW; /// Info panel width
int InfoPanelH; /// Info panel height
Button* SingleSelectedButton;
char* SingleSelectedText;
int SingleSelectedFont;
int SingleSelectedTextX;
int SingleSelectedTextY;
Button* SelectedButtons; /// Selected buttons
int NumSelectedButtons; /// Number of selected buttons
char* SelectedText;
int SelectedFont;
int SelectedTextX;
int SelectedTextY;
int MaxSelectedFont;
int MaxSelectedTextX; /// position to place '+#' text
int MaxSelectedTextY; /// if > maximum units selected
Button* SingleSelectedButton; /// FIXME: docu
char* SingleSelectedText; /// FIXME: docu
int SingleSelectedFont; /// FIXME: docu
int SingleSelectedTextX; /// FIXME: docu
int SingleSelectedTextY; /// FIXME: docu
Button* SelectedButtons; /// Selected buttons
int NumSelectedButtons; /// Number of selected buttons
char* SelectedText; /// FIXME: docu
int SelectedFont; /// FIXME: docu
int SelectedTextX; /// FIXME: docu
int SelectedTextY; /// FIXME: docu
int MaxSelectedFont; /// FIXME: docu
int MaxSelectedTextX; /// position to place '+#' text
int MaxSelectedTextY; /// if > maximum units selected
Button* SingleTrainingButton;
char* SingleTrainingText;
int SingleTrainingFont;
int SingleTrainingTextX;
int SingleTrainingTextY;
Button* TrainingButtons; /// Training buttons
int NumTrainingButtons; /// Number of training buttons
char* TrainingText;
int TrainingFont;
int TrainingTextX;
int TrainingTextY;
Button* SingleTrainingButton; /// FIXME: docu
char* SingleTrainingText; /// FIXME: docu
int SingleTrainingFont; /// FIXME: docu
int SingleTrainingTextX; /// FIXME: docu
int SingleTrainingTextY; /// FIXME: docu
Button* TrainingButtons; /// Training buttons
int NumTrainingButtons; /// Number of training buttons
char* TrainingText; /// FIXME: docu
int TrainingFont; /// FIXME: docu
int TrainingTextX; /// FIXME: docu
int TrainingTextY; /// FIXME: docu
Button* UpgradingButton;
char* UpgradingText;
int UpgradingFont;
int UpgradingTextX;
int UpgradingTextY;
Button* UpgradingButton;
char* UpgradingText;
int UpgradingFont;
int UpgradingTextX;
int UpgradingTextY;
Button* ResearchingButton;
char* ResearchingText;
int ResearchingFont;
int ResearchingTextX;
int ResearchingTextY;
Button* ResearchingButton;
char* ResearchingText;
int ResearchingFont;
int ResearchingTextX;
int ResearchingTextY;
Button* TransportingButtons;
int NumTransportingButtons; /// Number of transporting buttons
char* TransportingText;
int TransportingFont;
int TransportingTextX;
int TransportingTextY;
Button* TransportingButtons;
int NumTransportingButtons; /// Number of transporting buttons
char* TransportingText;
int TransportingFont;
int TransportingTextX;
int TransportingTextY;
// Completed bar
SDL_Color CompletedBarColorRGB; /// color for completed bar
Uint32 CompletedBarColor; /// color for completed bar
int CompletedBarShadow; /// should complete bar have shadow
int CompletedBarX; /// completed bar X position
int CompletedBarY; /// completed bar Y position
int CompletedBarW; /// completed bar width
int CompletedBarH; /// completed bar height
char* CompletedBarText; /// completed bar text
int CompletedBarFont; /// completed bar font
int CompletedBarTextX; /// completed bar text X position
int CompletedBarTextY; /// completed bar text Y position
SDL_Color CompletedBarColorRGB; /// color for completed bar
Uint32 CompletedBarColor; /// color for completed bar
int CompletedBarShadow; /// should complete bar have shadow
int CompletedBarX; /// completed bar X position
int CompletedBarY; /// completed bar Y position
int CompletedBarW; /// completed bar width
int CompletedBarH; /// completed bar height
char* CompletedBarText; /// completed bar text
int CompletedBarFont; /// completed bar font
int CompletedBarTextX; /// completed bar text X position
int CompletedBarTextY; /// completed bar text Y position
// Button panel
GraphicConfig ButtonPanel; /// Button panel background
Button* ButtonButtons; /// Button panel buttons
int NumButtonButtons; /// Number of button panel buttons
int ButtonPanelX; /// Button panel screen X position
int ButtonPanelY; /// Button panel screen Y position
GraphicConfig ButtonPanel; /// Button panel background
Button* ButtonButtons; /// Button panel buttons
int NumButtonButtons; /// Number of button panel buttons
int ButtonPanelX; /// Button panel screen X position
int ButtonPanelY; /// Button panel screen Y position
// Map area
ViewportMode ViewportMode; /// Current viewport mode
Viewport* MouseViewport; /// Viewport containing mouse
Viewport* SelectedViewport; /// Current selected active viewport
int NumViewports; /// # Viewports currently used
Viewport Viewports[MAX_NUM_VIEWPORTS]; /// Parameters of all viewports
ViewportMode ViewportMode; /// Current viewport mode
Viewport* MouseViewport; /// Viewport containing mouse
Viewport* SelectedViewport; /// Current selected active viewport
int NumViewports; /// # Viewports currently used
Viewport Viewports[MAX_NUM_VIEWPORTS]; /// Parameters of all viewports
// Map* attributes of Viewport are unused here:
Viewport MapArea; /// geometry of the whole map area
Viewport MapArea; /// geometry of the whole map area
// The menu panel
GraphicConfig MenuPanel; /// menu panel background
int MenuPanelX; /// menu panel screen X position
int MenuPanelY; /// menu panel screen Y position
GraphicConfig MenuPanel; /// menu panel background
int MenuPanelX; /// menu panel screen X position
int MenuPanelY; /// menu panel screen Y position
/// Menu buttons
struct {
int X; /// button screen X position
int Y; /// button screen Y position
char* Text; /// button caption
int Width; /// button width
int Height; /// button height
int Button; /// button style
} MenuButton,
NetworkMenuButton,
NetworkDiplomacyButton;
int X; /// button screen X position
int Y; /// button screen Y position
char* Text; /// button caption
int Width; /// button width
int Height; /// button height
int Button; /// button style
} MenuButton,
NetworkMenuButton,
NetworkDiplomacyButton;
// The minimap
GraphicConfig MinimapPanel; /// minimap panel background
int MinimapPanelX; /// minimap panel screen X position
int MinimapPanelY; /// minimap panel screen Y position
int MinimapW; /// minimap screen Width
int MinimapH; /// minimap screen Height
int MinimapPosX; /// minimap screen X position
int MinimapPosY; /// minimap screen Y position
int MinimapTransparent; /// unexplored areas are transparent
Uint32 ViewportCursorColor; /// minimap cursor color
GraphicConfig MinimapPanel; /// minimap panel background
int MinimapPanelX; /// minimap panel screen X position
int MinimapPanelY; /// minimap panel screen Y position
int MinimapW; /// minimap screen Width
int MinimapH; /// minimap screen Height
int MinimapPosX; /// minimap screen X position
int MinimapPosY; /// minimap screen Y position
int MinimapTransparent; /// unexplored areas are transparent
Uint32 ViewportCursorColor; /// minimap cursor color
// The status line
GraphicConfig StatusLine; /// Status line background
int StatusLineX; /// status line screen X position
int StatusLineY; /// status line screen Y position
int StatusLineTextX; /// status line screen text X position
int StatusLineTextY; /// status line screen text Y position
int StatusLineFont; /// Status line font
GraphicConfig StatusLine; /// Status line background
int StatusLineX; /// status line screen X position
int StatusLineY; /// status line screen Y position
int StatusLineTextX; /// status line screen text X position
int StatusLineTextY; /// status line screen text Y position
int StatusLineFont; /// Status line font
// Offsets for 640x480 center used by menus
int Offset640X; /// Offset for 640x480 X position
int Offset480Y; /// Offset for 640x480 Y position
int Offset640X; /// Offset for 640x480 X position
int Offset480Y; /// Offset for 640x480 Y position
//
// Cursors used.
// Cursors used.
//
CursorConfig Point; /// General pointing cursor
CursorConfig Glass; /// HourGlass, system is waiting
CursorConfig Cross; /// Multi-select cursor.
CursorConfig YellowHair; /// Yellow action,attack cursor.
CursorConfig GreenHair; /// Green action,attack cursor.
CursorConfig RedHair; /// Red action,attack cursor.
CursorConfig Scroll; /// Cursor for scrolling map around.
CursorConfig Point; /// General pointing cursor
CursorConfig Glass; /// HourGlass, system is waiting
CursorConfig Cross; /// Multi-select cursor.
CursorConfig YellowHair; /// Yellow action,attack cursor.
CursorConfig GreenHair; /// Green action,attack cursor.
CursorConfig RedHair; /// Red action,attack cursor.
CursorConfig Scroll; /// Cursor for scrolling map around.
CursorConfig ArrowE; /// Cursor pointing east
CursorConfig ArrowNE; /// Cursor pointing north east
CursorConfig ArrowN; /// Cursor pointing north
CursorConfig ArrowNW; /// Cursor pointing north west
CursorConfig ArrowW; /// Cursor pointing west
CursorConfig ArrowSW; /// Cursor pointing south west
CursorConfig ArrowS; /// Cursor pointing south
CursorConfig ArrowSE; /// Cursor pointing south east
CursorConfig ArrowE; /// Cursor pointing east
CursorConfig ArrowNE; /// Cursor pointing north east
CursorConfig ArrowN; /// Cursor pointing north
CursorConfig ArrowNW; /// Cursor pointing north west
CursorConfig ArrowW; /// Cursor pointing west
CursorConfig ArrowSW; /// Cursor pointing south west
CursorConfig ArrowS; /// Cursor pointing south
CursorConfig ArrowSE; /// Cursor pointing south east
// FIXME: could use different sounds/speach for the errors
// FIXME: could use different sounds/speech for the errors
// Is in gamesounds?
// SoundConfig PlacementError; /// played on placements errors
// SoundConfig PlacementSuccess; /// played on placements success
// SoundConfig Click; /// click noice used often
// SoundConfig PlacementError; /// played on placements errors
// SoundConfig PlacementSuccess; /// played on placements success
// SoundConfig Click; /// click noice used often
MenuPanel* MenuPanels; /// Menu panels
MenuPanel* MenuPanels; /// Menu panels
GraphicConfig VictoryBackground;
GraphicConfig DefeatBackground;
GraphicConfig VictoryBackground; /// FIXME: docu
GraphicConfig DefeatBackground; /// FIXME: docu
} UI;
/*----------------------------------------------------------------------------
-- Variables
-- Variables
----------------------------------------------------------------------------*/
extern UI TheUI; /// The user interface
extern UI** UI_Table; /// All available user interfaces
extern UI TheUI; /// The user interface
extern UI** UI_Table; /// All available user interfaces
extern char RightButtonAttacks; /// right button 0 move, 1 attack.
extern ButtonAction* CurrentButtons; /// Current Selected Buttons
extern char FancyBuildings; /// Mirror buildings 1 yes, 0 now.
extern char RightButtonAttacks; /// right button 0 move, 1 attack.
extern ButtonAction* CurrentButtons; /// Current Selected Buttons
extern char FancyBuildings; /// Mirror buildings 1 yes, 0 now.
extern int SpeedKeyScroll; /// Keyboard Scrolling Speed, in Frames
extern int SpeedMouseScroll; /// Mouse Scrolling Speed, in Frames
extern int SpeedKeyScroll; /// Keyboard Scrolling Speed, in Frames
extern int SpeedMouseScroll; /// Mouse Scrolling Speed, in Frames
extern char* UiGroupKeys; /// up to 11 keys used for group selection
extern char* UiGroupKeys; /// up to 11 keys used for group selection
// only exported to save them
/*----------------------------------------------------------------------------
-- Functions
-- Functions
----------------------------------------------------------------------------*/
extern void InitUserInterface(const char*); /// initialize the ui
extern void LoadUserInterface(void); /// load ui graphics
extern void SaveUserInterface(CLFile*); /// save the ui state
extern void CleanUI(UI*); /// clean up a ui
extern void CleanUserInterface(void); /// clean up the ui module
extern void UserInterfaceCclRegister(void); /// register ccl features
/// Initialize the ui
extern void InitUserInterface(const char* race_name);
/// Load ui graphics
extern void LoadUserInterface(void);
/// Save the ui state
extern void SaveUserInterface(CLFile* file);
/// Clean up a ui
extern void CleanUI(UI* ui);
/// Clean up the ui module
extern void CleanUserInterface(void);
/// Register ccl features
extern void UserInterfaceCclRegister(void);
/// Called if the mouse is moved in Normal interface state
extern void UIHandleMouseMove(int x,int y);
extern void UIHandleMouseMove(int x, int y);
/// Called if any mouse button is pressed down
extern void UIHandleButtonDown(unsigned button);
/// Called if any mouse button is released up
@ -375,7 +380,7 @@ extern void RestrictCursorToViewport(void);
extern void RestrictCursorToMinimap(void);
/// Get viewport for screen pixel position
extern Viewport* GetViewport(int, int);
extern Viewport* GetViewport(int x, int y);
/// Get viewport for tile map position
extern Viewport* MapTileGetViewport(int, int);
/// Cycle through all available viewport modes

View file

@ -598,9 +598,8 @@ global void DrawResources(void)
for (i = 0; i < MaxCosts; ++i) {
if (TheUI.Resources[i].Icon.Graphic) {
VideoDrawSubClip(TheUI.Resources[i].Icon.Graphic, 0,
TheUI.Resources[i].IconRow * TheUI.Resources[i].IconH,
TheUI.Resources[i].IconW, TheUI.Resources[i].IconH,
VideoDrawClip(TheUI.Resources[i].Icon.Graphic,
TheUI.Resources[i].IconFrame,
TheUI.Resources[i].IconX, TheUI.Resources[i].IconY);
}
if (TheUI.Resources[i].TextX != -1) {
@ -611,9 +610,8 @@ global void DrawResources(void)
}
}
if (TheUI.Resources[FoodCost].Icon.Graphic) {
VideoDrawSubClip(TheUI.Resources[FoodCost].Icon.Graphic, 0,
TheUI.Resources[FoodCost].IconRow * TheUI.Resources[FoodCost].IconH,
TheUI.Resources[FoodCost].IconW, TheUI.Resources[FoodCost].IconH,
VideoDrawClip(TheUI.Resources[FoodCost].Icon.Graphic,
TheUI.Resources[FoodCost].IconFrame,
TheUI.Resources[FoodCost].IconX, TheUI.Resources[FoodCost].IconY);
}
if (TheUI.Resources[FoodCost].TextX != -1) {
@ -628,9 +626,8 @@ global void DrawResources(void)
}
if (TheUI.Resources[ScoreCost].Icon.Graphic) {
VideoDrawSubClip(TheUI.Resources[ScoreCost].Icon.Graphic, 0,
TheUI.Resources[ScoreCost].IconRow * TheUI.Resources[ScoreCost].IconH,
TheUI.Resources[ScoreCost].IconW, TheUI.Resources[ScoreCost].IconH,
VideoDrawClip(TheUI.Resources[ScoreCost].Icon.Graphic,
TheUI.Resources[ScoreCost].IconFrame,
TheUI.Resources[ScoreCost].IconX, TheUI.Resources[ScoreCost].IconY);
}
if (TheUI.Resources[ScoreCost].TextX != -1) {
@ -1019,11 +1016,8 @@ global void DrawCosts(void)
x = TheUI.StatusLineX + 270;
if (CostsMana) {
// FIXME: hardcoded image!!!
VideoDrawSubClip(TheUI.Resources[GoldCost].Icon.Graphic,
/* 0, TheUI.Resources[GoldCost].IconRow *
TheUI.Resources[GoldCost].IconH */
0, 3 * TheUI.Resources[GoldCost].IconH,
TheUI.Resources[GoldCost].IconW, TheUI.Resources[GoldCost].IconH,
VideoDrawClip(TheUI.Resources[GoldCost].Icon.Graphic,
3,
x, TheUI.StatusLineTextY);
VideoDrawNumber(x + 15, TheUI.StatusLineTextY, GameFont, CostsMana);
@ -1033,9 +1027,8 @@ global void DrawCosts(void)
for (i = 1; i < MaxCosts; ++i) {
if (Costs[i]) {
if (TheUI.Resources[i].Icon.Graphic) {
VideoDrawSubClip(TheUI.Resources[i].Icon.Graphic, 0,
TheUI.Resources[i].IconRow * TheUI.Resources[i].IconH,
TheUI.Resources[i].IconW, TheUI.Resources[i].IconH,
VideoDrawClip(TheUI.Resources[i].Icon.Graphic,
TheUI.Resources[i].IconFrame,
x, TheUI.StatusLineTextY);
}
VideoDrawNumber(x + 15, TheUI.StatusLineTextY, GameFont,Costs[i]);
@ -1048,9 +1041,8 @@ global void DrawCosts(void)
if (CostsFood) {
// FIXME: hardcoded image!!!
VideoDrawSubClip(TheUI.Resources[FoodCost].Icon.Graphic, 0,
TheUI.Resources[FoodCost].IconRow * TheUI.Resources[FoodCost].IconH,
TheUI.Resources[FoodCost].IconW, TheUI.Resources[FoodCost].IconH,
VideoDrawClip(TheUI.Resources[FoodCost].Icon.Graphic,
TheUI.Resources[FoodCost].IconFrame,
x, TheUI.StatusLineTextY);
VideoDrawNumber(x + 15, TheUI.StatusLineTextY, GameFont, CostsFood);
x += 45;

View file

@ -1377,9 +1377,9 @@ local int CclDefineUI(lua_State* l)
lua_rawgeti(l, -1, subk + 1);
ui->Resources[res].Icon.File = strdup(LuaToString(l, -1));
lua_pop(l, 1);
} else if (!strcmp(value, "row")) {
} else if (!strcmp(value, "frame")) {
lua_rawgeti(l, -1, subk + 1);
ui->Resources[res].IconRow = LuaToNumber(l, -1);
ui->Resources[res].IconFrame = LuaToNumber(l, -1);
lua_pop(l, 1);
} else if (!strcmp(value, "size")) {
lua_rawgeti(l, -1, subk + 1);

View file

@ -203,7 +203,7 @@ global void LoadUserInterface(void)
MenuPanel* menupanel;
//
// Load graphics
// Load graphics
//
for (i = 0; i < TheUI.NumFillers; ++i) {
if (TheUI.Filler[i].File) {
@ -218,7 +218,8 @@ global void LoadUserInterface(void)
// FIXME: reuse same graphics?
if (TheUI.Resources[i].Icon.File) {
TheUI.Resources[i].Icon.Graphic =
LoadGraphic(TheUI.Resources[i].Icon.File);
LoadSprite(TheUI.Resources[i].Icon.File,
TheUI.Resources[i].IconW, TheUI.Resources[i].IconH);
}
}