[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus data/ccl/human/ui.ccl data/ccl/orc/ui...
From: |
Jimmy Salmon |
Subject: |
[Stratagus-CVS] stratagus data/ccl/human/ui.ccl data/ccl/orc/ui... |
Date: |
Mon, 13 Oct 2003 00:43:19 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Jimmy Salmon <address@hidden> 03/10/13 00:43:18
Modified files:
data/ccl/human : ui.ccl
data/ccl/orc : ui.ccl
src/include : interface.h ui.h
src/ui : ccl_ui.c mainscr.c mouse.c ui.c
Log message:
Rewrote a lot of the info panel
Patches:
Index: stratagus/data/ccl/human/ui.ccl
diff -u stratagus/data/ccl/human/ui.ccl:1.40
stratagus/data/ccl/human/ui.ccl:1.41
--- stratagus/data/ccl/human/ui.ccl:1.40 Tue Oct 7 20:06:40 2003
+++ stratagus/data/ccl/human/ui.ccl Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: ui.ccl,v 1.40 2003/10/08 00:06:40 jsalmon3 Exp $
+;; $Id: ui.ccl,v 1.41 2003/10/13 04:43:18 jsalmon3 Exp $
(define-cursor 'cursor-point 'human
'image "ui/human/cursors/human_gauntlet.png"
@@ -46,6 +46,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (human_screen screen_width screen_height)
+ (define info_panel_x 0)
+ (define info_panel_y 160)
+ (define icon_size '(46 38))
(define-ui 'human screen_width screen_height
'normal-font-color 'white
@@ -75,15 +78,84 @@
'score (list 'file "graphics/ui/score.png" 'row 0
'pos (list (- screen_width 16 68) 0) 'size '(14 14) 'text-pos (list (+
(- screen_width 16 68) 18) 1)))
- 'info-panel (list "graphics/ui/human/infopanel.png" 0 160 176 176)
-
- 'completed-bar '(
- color (48 100 4)
- pos ( 12 313)
- size (152 14)
- text "% Complete"
- font game
- text-pos ( 50 313))
+ 'info-panel (list
+ 'panel (list
+ 'file "graphics/ui/human/infopanel.png"
+ 'pos (list info_panel_x info_panel_y)
+ 'size '(176 176)
+ )
+ 'selected (list
+ 'single (list
+ 'icon (list
+ 'pos '( 6 166) 'size icon_size))
+ 'multiple (list
+ 'icons (list
+ (list 'pos '( 6 166) 'size icon_size)
+ (list 'pos '( 62 166) 'size icon_size)
+ (list 'pos '(118 166) 'size icon_size)
+ (list 'pos '( 6 220) 'size icon_size)
+ (list 'pos '( 62 220) 'size icon_size)
+ (list 'pos '(118 220) 'size icon_size)
+ (list 'pos '( 6 274) 'size icon_size)
+ (list 'pos '( 62 274) 'size icon_size)
+ (list 'pos '(118 274) 'size icon_size)))
+ )
+ 'training (list
+ 'single (list
+ 'text (list
+ 'text "Training:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 37) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'multiple (list
+ 'icons (list
+ (list 'pos '( 6 216) 'size icon_size)
+ (list 'pos '( 62 216) 'size icon_size)
+ (list 'pos '(118 216) 'size icon_size)
+ (list 'pos '( 6 263) 'size icon_size)
+ (list 'pos '( 62 263) 'size icon_size)
+ (list 'pos '(118 263) 'size icon_size)))
+ )
+ 'upgrading (list
+ 'text (list
+ 'text "Upgrading:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 29) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'researching (list
+ 'text (list
+ 'text "Researching:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 16) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'transporting (list
+ 'icons (list
+ (list 'pos '( 6 220) 'size icon_size)
+ (list 'pos '( 62 220) 'size icon_size)
+ (list 'pos '(118 220) 'size icon_size)
+ (list 'pos '( 6 274) 'size icon_size)
+ (list 'pos '( 62 274) 'size icon_size)
+ (list 'pos '(118 274) 'size icon_size))
+ )
+ 'completed-bar (list
+ 'color '(48 100 4)
+ 'pos '( 12 313)
+ 'size '(152 14)
+ 'text (list
+ 'text "% Complete"
+ 'font 'game
+ 'pos '( 50 313))
+ )
+ )
'button-panel (list
(string-append "graphics/ui/human/"
@@ -129,33 +201,16 @@
caption "Diplomacy"
style network)
- 'info-buttons '(
- (pos ( 6 166) size (46 38))
- (pos ( 62 166) size (46 38))
- (pos (118 166) size (46 38))
- (pos ( 6 220) size (46 38))
- (pos ( 62 220) size (46 38))
- (pos (118 220) size (46 38))
- (pos ( 6 274) size (46 38))
- (pos ( 62 274) size (46 38))
- (pos (118 274) size (46 38)))
- 'training-buttons '(
- (pos ( 6 216) size (46 38))
- (pos ( 62 216) size (46 38))
- (pos (118 216) size (46 38))
- (pos ( 6 263) size (46 38))
- (pos ( 62 263) size (46 38))
- (pos (118 263) size (46 38)))
- 'button-buttons '(
- (pos ( 6 337) size (46 38))
- (pos ( 62 337) size (46 38))
- (pos (118 337) size (46 38))
- (pos ( 6 384) size (46 38))
- (pos ( 62 384) size (46 38))
- (pos (118 384) size (46 38))
- (pos ( 6 431) size (46 38))
- (pos ( 62 431) size (46 38))
- (pos (118 431) size (46 38)))
+ 'button-buttons (list
+ (list 'pos '( 6 337) 'size icon_size)
+ (list 'pos '( 62 337) 'size icon_size)
+ (list 'pos '(118 337) 'size icon_size)
+ (list 'pos '( 6 384) 'size icon_size)
+ (list 'pos '( 62 384) 'size icon_size)
+ (list 'pos '(118 384) 'size icon_size)
+ (list 'pos '( 6 431) 'size icon_size)
+ (list 'pos '( 62 431) 'size icon_size)
+ (list 'pos '(118 431) 'size icon_size))
'cursors '(
point cursor-point
Index: stratagus/data/ccl/orc/ui.ccl
diff -u stratagus/data/ccl/orc/ui.ccl:1.39 stratagus/data/ccl/orc/ui.ccl:1.40
--- stratagus/data/ccl/orc/ui.ccl:1.39 Tue Oct 7 20:06:40 2003
+++ stratagus/data/ccl/orc/ui.ccl Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
;;
-;; $Id: ui.ccl,v 1.39 2003/10/08 00:06:40 jsalmon3 Exp $
+;; $Id: ui.ccl,v 1.40 2003/10/13 04:43:18 jsalmon3 Exp $
(define-cursor 'cursor-point 'orc
'image "ui/orc/cursors/orcish_claw.png"
@@ -46,6 +46,9 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (orc_screen screen_width screen_height)
+ (define info_panel_x 0)
+ (define info_panel_y 160)
+ (define icon_size '(46 38))
(define-ui 'orc screen_width screen_height
'normal-font-color 'yellow
@@ -75,15 +78,85 @@
'score (list 'file "graphics/ui/score.png" 'row 0
'pos (list (- screen_width 16 68) 0) 'size '(14 14) 'text-pos (list (+
(- screen_width 16 68) 18) 1)))
- 'info-panel (list "graphics/ui/orc/infopanel.png" 0 160 176 176)
-
- 'completed-bar '(
- color (48 100 4)
- pos ( 12 313)
- size (152 14)
- text "% Complete"
- font game
- text-pos ( 50 313))
+ 'info-panel (list
+ 'panel (list
+ 'file "graphics/ui/orc/infopanel.png"
+ 'pos (list info_panel_x info_panel_y)
+ 'size '(176 176)
+ )
+ 'selected (list
+ 'single (list
+ 'icon (list
+ 'pos '( 6 166) 'size icon_size))
+ 'multiple (list
+ 'icons (list
+ (list 'pos '( 6 166) 'size icon_size)
+ (list 'pos '( 62 166) 'size icon_size)
+ (list 'pos '(118 166) 'size icon_size)
+ (list 'pos '( 6 220) 'size icon_size)
+ (list 'pos '( 62 220) 'size icon_size)
+ (list 'pos '(118 220) 'size icon_size)
+ (list 'pos '( 6 274) 'size icon_size)
+ (list 'pos '( 62 274) 'size icon_size)
+ (list 'pos '(118 274) 'size icon_size)))
+ )
+ 'training (list
+ 'single (list
+ 'text (list
+ 'text "Training:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 37) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'multiple (list
+ 'icons (list
+ (list 'pos '( 6 216) 'size icon_size)
+ (list 'pos '( 62 216) 'size icon_size)
+ (list 'pos '(118 216) 'size icon_size)
+ (list 'pos '( 6 263) 'size icon_size)
+ (list 'pos '( 62 263) 'size icon_size)
+ (list 'pos '(118 263) 'size icon_size))
+ )
+ )
+ 'upgrading (list
+ 'text (list
+ 'text "Upgrading:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 29) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'researching (list
+ 'text (list
+ 'text "Researching:"
+ 'font 'game
+ 'pos (list (+ info_panel_x 16) (+ info_panel_y 8 78)))
+ 'icon (list
+ 'pos (list (+ info_panel_x 107) (+ info_panel_y 8 70))
+ 'size icon_size)
+ )
+ 'transporting (list
+ 'icons (list
+ (list 'pos '( 6 220) 'size icon_size)
+ (list 'pos '( 62 220) 'size icon_size)
+ (list 'pos '(118 220) 'size icon_size)
+ (list 'pos '( 6 274) 'size icon_size)
+ (list 'pos '( 62 274) 'size icon_size)
+ (list 'pos '(118 274) 'size icon_size))
+ )
+ 'completed-bar (list
+ 'color '(48 100 4)
+ 'pos '( 12 313)
+ 'size '(152 14)
+ 'text (list
+ 'text "% Complete"
+ 'font 'game
+ 'pos '( 50 313))
+ )
+ )
'button-panel (list
(string-append "graphics/ui/orc/"
@@ -129,33 +202,16 @@
caption "Diplomacy"
style network)
- 'info-buttons '(
- (pos ( 6 166) size (46 38))
- (pos ( 62 166) size (46 38))
- (pos (118 166) size (46 38))
- (pos ( 6 220) size (46 38))
- (pos ( 62 220) size (46 38))
- (pos (118 220) size (46 38))
- (pos ( 6 274) size (46 38))
- (pos ( 62 274) size (46 38))
- (pos (118 274) size (46 38)))
- 'training-buttons '(
- (pos ( 6 216) size (46 38))
- (pos ( 62 216) size (46 38))
- (pos (118 216) size (46 38))
- (pos ( 6 263) size (46 38))
- (pos ( 62 263) size (46 38))
- (pos (118 263) size (46 38)))
- 'button-buttons '(
- (pos ( 6 337) size (46 38))
- (pos ( 62 337) size (46 38))
- (pos (118 337) size (46 38))
- (pos ( 6 384) size (46 38))
- (pos ( 62 384) size (46 38))
- (pos (118 384) size (46 38))
- (pos ( 6 431) size (46 38))
- (pos ( 62 431) size (46 38))
- (pos (118 431) size (46 38)))
+ 'button-buttons (list
+ (list 'pos '( 6 337) 'size icon_size)
+ (list 'pos '( 62 337) 'size icon_size)
+ (list 'pos '(118 337) 'size icon_size)
+ (list 'pos '( 6 384) 'size icon_size)
+ (list 'pos '( 62 384) 'size icon_size)
+ (list 'pos '(118 384) 'size icon_size)
+ (list 'pos '( 6 431) 'size icon_size)
+ (list 'pos '( 62 431) 'size icon_size)
+ (list 'pos '(118 431) 'size icon_size))
'cursors '(
point cursor-point
Index: stratagus/src/include/interface.h
diff -u stratagus/src/include/interface.h:1.83
stratagus/src/include/interface.h:1.84
--- stratagus/src/include/interface.h:1.83 Tue Oct 7 08:03:40 2003
+++ stratagus/src/include/interface.h Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.h,v 1.83 2003/10/07 12:03:40 martinxyz Exp $
+// $Id: interface.h,v 1.84 2003/10/13 04:43:18 jsalmon3 Exp $
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
@@ -92,8 +92,11 @@
/// Button area under cursor
enum _button_area_ {
- ButtonAreaInfo, /// Info panel button
+ ButtonAreaSelected, /// Selected button
ButtonAreaTraining, /// Training button
+ ButtonAreaUpgrading, /// Upgrading button
+ ButtonAreaResearching, /// Researching button
+ ButtonAreaTransporting, /// Transporting button
ButtonAreaButton, /// Button panel button
ButtonAreaMenu, /// Menu button
};
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.71 stratagus/src/include/ui.h:1.72
--- stratagus/src/include/ui.h:1.71 Tue Oct 7 20:06:42 2003
+++ stratagus/src/include/ui.h Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.71 2003/10/08 00:06:42 jsalmon3 Exp $
+// $Id: ui.h,v 1.72 2003/10/13 04:43:18 jsalmon3 Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -185,16 +185,6 @@
int ResourceY; /// Resource Y position
struct {
-#if 0
- int IconX; /// Icon X position
- int IconY; /// Icon Y position
- IconConfig Icon; /// Icon for resource
- int TextX; /// Text X position
- int TextX; /// Text Y position
- char* Text; /// Text for resource
- int AmountX; /// Amount X position
- int AmountY; /// Amount Y position
-#endif
GraphicConfig Icon; /// icon image
int IconRow; /// icon image row (frame)
int IconX; /// icon X position
@@ -213,17 +203,60 @@
int InfoPanelW; /// Info panel width
int InfoPanelH; /// Info panel height
- // Complete bar
- VMemType CompleteBarColorRGB; /// color for complete bar
- VMemType CompleteBarColor; /// color for complete bar
- int CompleteBarX; /// complete bar X position
- int CompleteBarY; /// complete bar Y position
- int CompleteBarW; /// complete bar width
- int CompleteBarH; /// complete bar height
- char* CompleteBarText; /// complete bar text
- unsigned CompleteBarFont; /// complete bar font
- int CompleteTextX; /// complete text X position
- int CompleteTextY; /// complete text Y position
+ 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;
+
+ 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* UpgradingButton;
+ char* UpgradingText;
+ int UpgradingFont;
+ int UpgradingTextX;
+ int UpgradingTextY;
+
+ 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;
+
+ // Completed bar
+ VMemType CompletedBarColorRGB; /// color for completed bar
+ VMemType CompletedBarColor; /// color for completed bar
+ 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
@@ -273,12 +306,8 @@
int StatusLineY; /// status line screen Y
position
int StatusLineTextX; /// status line screen text X
position
int StatusLineTextY; /// status line screen text Y
position
- unsigned StatusLineFont; /// Status line font
+ int StatusLineFont; /// Status line font
- Button* InfoButtons; /// Info buttons
- int NumInfoButtons; /// Number of info buttons
- Button* TrainingButtons; /// Training buttons
- int NumTrainingButtons; /// Number of training buttons
Button* ButtonButtons; /// Button panel buttons
int NumButtonButtons; /// Number of button panel
buttons
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.134 stratagus/src/ui/ccl_ui.c:1.135
--- stratagus/src/ui/ccl_ui.c:1.134 Tue Oct 7 20:06:43 2003
+++ stratagus/src/ui/ccl_ui.c Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.134 2003/10/08 00:06:43 jsalmon3 Exp $
+// $Id: ccl_ui.c,v 1.135 2003/10/13 04:43:18 jsalmon3 Exp $
//@{
@@ -55,6 +55,14 @@
global char* ClickMissile;
global char* DamageMissile;
+
+typedef struct _info_text_ {
+ char* Text;
+ int Font;
+ int X;
+ int Y;
+} InfoText;
+
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
@@ -691,6 +699,311 @@
}
/**
+** Parse info panel text
+*/
+local void CclParseInfoText(SCM list, InfoText* text)
+{
+ SCM value;
+
+ memset(text, 0, sizeof(*text));
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ text->Text = gh_scm2newstr(value, NULL);
+ } else if (gh_eq_p(value, gh_symbol2scm("font"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ text->Font = CclFontByIdentifier(value);
+ } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ text->X = gh_scm2int(gh_car(value));
+ text->Y = gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel icon
+*/
+local void CclParseInfoIcon(SCM list, Button* icon)
+{
+ SCM value;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ icon->X = gh_scm2int(gh_car(value));
+ icon->Y = gh_scm2int(gh_car(gh_cdr(value)));
+ } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ icon->Width = gh_scm2int(gh_car(value));
+ icon->Height = gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel selected section
+*/
+local void CclParseSelected(SCM list, UI* ui)
+{
+ SCM value;
+ SCM sublist;
+ InfoText text;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("single"))) {
+ sublist = gh_car(list);
+ list = gh_cdr(list);
+ while (!gh_null_p(sublist)) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ CclParseInfoText(value, &text);
+ ui->SingleSelectedText = text.Text;
+ ui->SingleSelectedFont = text.Font;
+ ui->SingleSelectedTextX = text.X;
+ ui->SingleSelectedTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ ui->SingleSelectedButton = calloc(1, sizeof(Button));
+ CclParseInfoIcon(value, ui->SingleSelectedButton);
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+ } else if (gh_eq_p(value, gh_symbol2scm("multiple"))) {
+ sublist = gh_car(list);
+ list = gh_cdr(list);
+ while (!gh_null_p(sublist)) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ CclParseInfoText(value, &text);
+ ui->SelectedText = text.Text;
+ ui->SelectedFont = text.Font;
+ ui->SelectedTextX = text.X;
+ ui->SelectedTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icons"))) {
+ SCM slist;
+ int i;
+
+ slist = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ ui->NumSelectedButtons = gh_length(slist);
+ ui->SelectedButtons = calloc(ui->NumSelectedButtons,
+ sizeof(Button));
+ i = 0;
+ while (!gh_null_p(slist)) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ CclParseInfoIcon(value, &ui->SelectedButtons[i++]);
+ }
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel training section
+*/
+local void CclParseTraining(SCM list, UI* ui)
+{
+ SCM value;
+ SCM sublist;
+ InfoText text;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("single"))) {
+ sublist = gh_car(list);
+ list = gh_cdr(list);
+ while (!gh_null_p(sublist)) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ CclParseInfoText(value, &text);
+ ui->SingleTrainingText = text.Text;
+ ui->SingleTrainingFont = text.Font;
+ ui->SingleTrainingTextX = text.X;
+ ui->SingleTrainingTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ ui->SingleTrainingButton = calloc(1, sizeof(Button));
+ CclParseInfoIcon(value, ui->SingleTrainingButton);
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+ } else if (gh_eq_p(value, gh_symbol2scm("multiple"))) {
+ sublist = gh_car(list);
+ list = gh_cdr(list);
+ while (!gh_null_p(sublist)) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ CclParseInfoText(value, &text);
+ ui->TrainingText = text.Text;
+ ui->TrainingFont = text.Font;
+ ui->TrainingTextX = text.X;
+ ui->TrainingTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icons"))) {
+ SCM slist;
+ int i;
+
+ slist = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ ui->NumTrainingButtons = gh_length(slist);
+ ui->TrainingButtons = calloc(ui->NumTrainingButtons,
+ sizeof(Button));
+ i = 0;
+ while (!gh_null_p(slist)) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ CclParseInfoIcon(value, &ui->TrainingButtons[i++]);
+ }
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel upgrading section
+*/
+local void CclParseUpgrading(SCM list, UI* ui)
+{
+ SCM value;
+ InfoText text;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ CclParseInfoText(value, &text);
+ ui->UpgradingText = text.Text;
+ ui->UpgradingFont = text.Font;
+ ui->UpgradingTextX = text.X;
+ ui->UpgradingTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ ui->UpgradingButton = calloc(1, sizeof(Button));
+ CclParseInfoIcon(value, ui->UpgradingButton);
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel researching section
+*/
+local void CclParseResearching(SCM list, UI* ui)
+{
+ SCM value;
+ InfoText text;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ CclParseInfoText(value, &text);
+ ui->ResearchingText = text.Text;
+ ui->ResearchingFont = text.Font;
+ ui->ResearchingTextX = text.X;
+ ui->ResearchingTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icon"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ ui->ResearchingButton = calloc(1, sizeof(Button));
+ CclParseInfoIcon(value, ui->ResearchingButton);
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
+** Parse info panel transporting section
+*/
+local void CclParseTransporting(SCM list, UI* ui)
+{
+ SCM value;
+ InfoText text;
+
+ while (!gh_null_p(list)) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ value = gh_car(list);
+ list = gh_cdr(list);
+ CclParseInfoText(value, &text);
+ ui->TransportingText = text.Text;
+ ui->TransportingFont = text.Font;
+ ui->TransportingTextX = text.X;
+ ui->TransportingTextY = text.Y;
+ } else if (gh_eq_p(value, gh_symbol2scm("icons"))) {
+ SCM sublist;
+ int i;
+
+ sublist = gh_car(list);
+ list = gh_cdr(list);
+ ui->NumTransportingButtons = gh_length(sublist);
+ ui->TransportingButtons = calloc(ui->NumTransportingButtons,
+ sizeof(Button));
+ i = 0;
+ while (!gh_null_p(sublist)) {
+ value = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ CclParseInfoIcon(value, &ui->TransportingButtons[i++]);
+ }
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+}
+
+/**
** Define the look+feel of the user interface.
**
** FIXME: need some general data structure to make this parsing easier.
@@ -902,46 +1215,93 @@
} else if (gh_eq_p(value, gh_symbol2scm("info-panel"))) {
sublist = gh_car(list);
list = gh_cdr(list);
- ui->InfoPanel.File = SCM_PopNewStr(&sublist);
- ui->InfoPanelX = SCM_PopInt(&sublist);
- ui->InfoPanelY = SCM_PopInt(&sublist);
- ui->InfoPanelW = SCM_PopInt(&sublist);
- ui->InfoPanelH = SCM_PopInt(&sublist);
- } else if (gh_eq_p(value, gh_symbol2scm("completed-bar"))) {
- sublist = gh_car(list);
- list = gh_cdr(list);
while (!gh_null_p(sublist)) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- if (gh_eq_p(value, gh_symbol2scm("color"))) {
- value = gh_car(sublist);
+ if (gh_eq_p(value, gh_symbol2scm("panel"))) {
+ SCM slist;
+
+ slist = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteBarColorRGB.D24.a = gh_scm2int(gh_car(value));
- ui->CompleteBarColorRGB.D24.b =
gh_scm2int(gh_car(gh_cdr(value)));
- ui->CompleteBarColorRGB.D24.c =
gh_scm2int(gh_car(gh_cdr(gh_cdr(value))));
- } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+ while (!gh_null_p(slist)) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ if (gh_eq_p(value, gh_symbol2scm("file"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->InfoPanel.File = gh_scm2newstr(value, NULL);
+ } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->InfoPanelX = gh_scm2int(gh_car(value));
+ ui->InfoPanelY = gh_scm2int(gh_car(gh_cdr(value)));
+ } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->InfoPanelW = gh_scm2int(gh_car(value));
+ ui->InfoPanelH = gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
+ } else if (gh_eq_p(value, gh_symbol2scm("selected"))) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteBarX = gh_scm2int(gh_car(value));
- ui->CompleteBarY = gh_scm2int(gh_car(gh_cdr(value)));
- } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+ CclParseSelected(value, ui);
+ } else if (gh_eq_p(value, gh_symbol2scm("training"))) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteBarW = gh_scm2int(gh_car(value));
- ui->CompleteBarH = gh_scm2int(gh_car(gh_cdr(value)));
- } else if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ CclParseTraining(value, ui);
+ } else if (gh_eq_p(value, gh_symbol2scm("upgrading"))) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteBarText = gh_scm2newstr(value, NULL);
- } else if (gh_eq_p(value, gh_symbol2scm("font"))) {
+ CclParseUpgrading(value, ui);
+ } else if (gh_eq_p(value, gh_symbol2scm("researching"))) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteBarFont = CclFontByIdentifier(value);
- } else if (gh_eq_p(value, gh_symbol2scm("text-pos"))) {
+ CclParseResearching(value, ui);
+ } else if (gh_eq_p(value, gh_symbol2scm("transporting"))) {
value = gh_car(sublist);
sublist = gh_cdr(sublist);
- ui->CompleteTextX = gh_scm2int(gh_car(value));
- ui->CompleteTextY = gh_scm2int(gh_car(gh_cdr(value)));
+ CclParseTransporting(value, ui);
+ } else if (gh_eq_p(value, gh_symbol2scm("completed-bar"))) {
+ SCM slist;
+
+ slist = gh_car(sublist);
+ sublist = gh_cdr(sublist);
+ while (!gh_null_p(slist)) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ if (gh_eq_p(value, gh_symbol2scm("color"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->CompletedBarColorRGB.D24.a =
gh_scm2int(gh_car(value));
+ ui->CompletedBarColorRGB.D24.b =
gh_scm2int(gh_car(gh_cdr(value)));
+ ui->CompletedBarColorRGB.D24.c =
gh_scm2int(gh_car(gh_cdr(gh_cdr(value))));
+ } else if (gh_eq_p(value, gh_symbol2scm("pos"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->CompletedBarX = gh_scm2int(gh_car(value));
+ ui->CompletedBarY =
gh_scm2int(gh_car(gh_cdr(value)));
+ } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ ui->CompletedBarW = gh_scm2int(gh_car(value));
+ ui->CompletedBarH =
gh_scm2int(gh_car(gh_cdr(value)));
+ } else if (gh_eq_p(value, gh_symbol2scm("text"))) {
+ InfoText text;
+
+ value = gh_car(slist);
+ slist = gh_cdr(slist);
+ CclParseInfoText(value, &text);
+ ui->CompletedBarText = text.Text;
+ ui->CompletedBarFont = text.Font;
+ ui->CompletedBarTextX = text.X;
+ ui->CompletedBarTextY = text.Y;
+ } else {
+ errl("Unsupported tag", value);
+ }
+ }
} else {
errl("Unsupported tag", value);
}
@@ -1126,71 +1486,6 @@
ui->NetworkDiplomacyButton.Button = scm2buttonid(value);
} else {
errl("Unsupported tag", value);
- }
- }
- } else if (gh_eq_p(value, gh_symbol2scm("info-buttons"))) {
- SCM slist;
- SCM sslist;
- Button* b;
-
- slist = gh_car(list);
- list = gh_cdr(list);
- while (!gh_null_p(slist)) {
- sslist = gh_car(slist);
- slist = gh_cdr(slist);
- ui->NumInfoButtons++;
- ui->InfoButtons = realloc(ui->InfoButtons,
- ui->NumInfoButtons*sizeof(*ui->InfoButtons));
- b = &ui->InfoButtons[ui->NumInfoButtons - 1];
- while (!gh_null_p(sslist)) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- if (gh_eq_p(value, gh_symbol2scm("pos"))) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- b->X = gh_scm2int(gh_car(value));
- b->Y = gh_scm2int(gh_car(gh_cdr(value)));
- } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- b->Width = gh_scm2int(gh_car(value));
- b->Height = gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag", value);
- }
- }
- }
- } else if (gh_eq_p(value, gh_symbol2scm("training-buttons"))) {
- SCM slist;
- SCM sslist;
- Button* b;
-
- slist = gh_car(list);
- list = gh_cdr(list);
- while (!gh_null_p(slist)) {
- sslist = gh_car(slist);
- slist = gh_cdr(slist);
- ui->NumTrainingButtons++;
- ui->TrainingButtons=realloc(ui->TrainingButtons,
- ui->NumTrainingButtons * sizeof(*ui->TrainingButtons));
- b=&ui->TrainingButtons[ui->NumTrainingButtons - 1];
- while (!gh_null_p(sslist)) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- if (gh_eq_p(value, gh_symbol2scm("pos"))) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- b->X = gh_scm2int(gh_car(value));
- b->Y = gh_scm2int(gh_car(gh_cdr(value)));
- } else if (gh_eq_p(value, gh_symbol2scm("size"))) {
- value = gh_car(sslist);
- sslist = gh_cdr(sslist);
- b->Width = gh_scm2int(gh_car(value));
- b->Height = gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag", value);
- }
-
}
}
} else if (gh_eq_p(value, gh_symbol2scm("button-buttons"))) {
Index: stratagus/src/ui/mainscr.c
diff -u stratagus/src/ui/mainscr.c:1.130 stratagus/src/ui/mainscr.c:1.131
--- stratagus/src/ui/mainscr.c:1.130 Tue Oct 7 20:06:43 2003
+++ stratagus/src/ui/mainscr.c Mon Oct 13 00:43:18 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainscr.c,v 1.130 2003/10/08 00:06:43 jsalmon3 Exp $
+// $Id: mainscr.c,v 1.131 2003/10/13 04:43:18 jsalmon3 Exp $
//@{
@@ -119,10 +119,10 @@
int f;
y += IconHeight + 7;
- VideoFillRectangleClip(ColorBlack, x, y + 3,IconWidth + 7, 4);
+ VideoFillRectangleClip(ColorBlack, x, y + 3, IconWidth + 7, 4);
if (unit->HP) {
- /* s0m3body: mana bar should represent proportional value of Mana with
respect to
- * MaxMana (unit->Type->_MaxMana) for the unit */
+ // s0m3body: mana bar should represent proportional value of Mana
+ // with respect to MaxMana (unit->Type->_MaxMana) for the unit
f = (100 * unit->Mana) / unit->Type->_MaxMana;
f = (f * (IconWidth + 5)) / 100;
VideoFillRectangleClip(ColorBlue, x + 1, y + 3 + 1, f, 2);
@@ -143,11 +143,11 @@
return;
}
f = (100 * ready) / full;
- f = (f * TheUI.CompleteBarW) / 100;
- VideoFillRectangleClip(TheUI.CompleteBarColor,
- TheUI.CompleteBarX, TheUI.CompleteBarY, f, TheUI.CompleteBarH);
- VideoDrawText(TheUI.CompleteTextX, TheUI.CompleteTextY,
- TheUI.CompleteBarFont, TheUI.CompleteBarText);
+ f = (f * TheUI.CompletedBarW) / 100;
+ VideoFillRectangleClip(TheUI.CompletedBarColor,
+ TheUI.CompletedBarX, TheUI.CompletedBarY, f, TheUI.CompletedBarH);
+ VideoDrawText(TheUI.CompletedBarTextX, TheUI.CompletedBarTextY,
+ TheUI.CompletedBarFont, TheUI.CompletedBarText);
}
/**
@@ -198,13 +198,19 @@
//
// Draw icon in upper left corner
//
- x = TheUI.InfoButtons[0].X;
- y = TheUI.InfoButtons[0].Y;
- DrawUnitIcon(unit->Player,type->Icon.Icon,
- (ButtonAreaUnderCursor == ButtonAreaInfo && ButtonUnderCursor == 0) ?
- (IconActive | (MouseButtons & LeftButton)) : 0,
- x, y);
- UiDrawLifeBar(unit, x, y);
+ if (TheUI.SingleSelectedText) {
+ VideoDrawText(TheUI.SingleSelectedTextX, TheUI.SingleSelectedTextY,
+ TheUI.SingleSelectedFont, TheUI.SingleSelectedText);
+ }
+ if (TheUI.SingleSelectedButton) {
+ x = TheUI.SingleSelectedButton->X;
+ y = TheUI.SingleSelectedButton->Y;
+ DrawUnitIcon(unit->Player, type->Icon.Icon,
+ (ButtonAreaUnderCursor == ButtonAreaSelected && ButtonUnderCursor
== 0) ?
+ (IconActive | (MouseButtons & LeftButton)) : 0,
+ x, y);
+ UiDrawLifeBar(unit, x, y);
+ }
if (unit->Player == ThisPlayer) { // Only for own units.
if (unit->HP && unit->HP < 10000) {
@@ -301,24 +307,36 @@
// Building training units.
//
if (unit->Orders[0].Action == UnitActionTrain) {
- if (OriginalTraining || unit->Data.Train.Count == 1) {
- VideoDrawText(x + 37, y + 8 + 78, GameFont, "Training:");
- DrawUnitIcon(unit->Player,unit->Data.Train.What[0]->Icon.Icon,
- 0, x + 107, y + 8 + 70);
+ if (unit->Data.Train.Count == 1) {
+ if (TheUI.SingleTrainingText) {
+ VideoDrawText(TheUI.SingleTrainingTextX,
TheUI.SingleTrainingTextY,
+ TheUI.SingleTrainingFont, TheUI.SingleTrainingText);
+ }
+ if (TheUI.SingleTrainingButton) {
+ DrawUnitIcon(unit->Player,
unit->Data.Train.What[0]->Icon.Icon,
+ (ButtonAreaUnderCursor == ButtonAreaTraining &&
+ ButtonUnderCursor == 0) ?
+ (IconActive | (MouseButtons & LeftButton)) : 0,
+ TheUI.SingleTrainingButton->X,
TheUI.SingleTrainingButton->Y);
+ }
UiDrawCompleted(unit->Data.Train.What[0]->Stats[
unit->Player->Player].Costs[TimeCost],
unit->Data.Train.Ticks);
} else {
- VideoDrawTextCentered(x + 114, y + 8 + 29, GameFont,
"Training...");
-
- for (i = 0; i < unit->Data.Train.Count; ++i) {
- DrawUnitIcon(unit->Player,
- unit->Data.Train.What[i]->Icon.Icon,
- (ButtonAreaUnderCursor == ButtonAreaTraining &&
- ButtonUnderCursor == i) ?
- (IconActive | (MouseButtons&LeftButton)) : 0,
- TheUI.TrainingButtons[i].X, TheUI.TrainingButtons[i].Y);
+ if (TheUI.TrainingText) {
+ VideoDrawTextCentered(TheUI.TrainingTextX,
TheUI.TrainingTextY,
+ TheUI.TrainingFont, TheUI.TrainingText);
+ }
+ if (TheUI.TrainingButtons) {
+ for (i = 0; i < unit->Data.Train.Count &&
+ i < TheUI.NumTrainingButtons; ++i) {
+ DrawUnitIcon(unit->Player,
unit->Data.Train.What[i]->Icon.Icon,
+ (ButtonAreaUnderCursor == ButtonAreaTraining &&
+ ButtonUnderCursor == i) ?
+ (IconActive | (MouseButtons & LeftButton)) : 0,
+ TheUI.TrainingButtons[i].X,
TheUI.TrainingButtons[i].Y);
+ }
}
UiDrawCompleted(unit->Data.Train.What[0]->Stats[
@@ -332,9 +350,17 @@
// Building upgrading to better type.
//
if (unit->Orders[0].Action == UnitActionUpgradeTo) {
- VideoDrawText(x + 29, y + 8 + 78, GameFont, "Upgrading:");
- DrawUnitIcon(unit->Player, unit->Orders[0].Type->Icon.Icon,
- 0, x + 107, y + 8 + 70);
+ if (TheUI.UpgradingText) {
+ VideoDrawText(TheUI.UpgradingTextX, TheUI.UpgradingTextY,
+ TheUI.UpgradingFont, TheUI.UpgradingText);
+ }
+ if (TheUI.UpgradingButton) {
+ DrawUnitIcon(unit->Player, unit->Orders[0].Type->Icon.Icon,
+ (ButtonAreaUnderCursor == ButtonAreaUpgrading &&
+ ButtonUnderCursor == 0) ?
+ (IconActive | (MouseButtons & LeftButton)) : 0,
+ TheUI.UpgradingButton->X, TheUI.UpgradingButton->Y);
+ }
UiDrawCompleted(unit->Orders[0].Type->Stats[
unit->Player->Player].Costs[TimeCost],
@@ -346,10 +372,17 @@
// Building research new technologie.
//
if (unit->Orders[0].Action == UnitActionResearch) {
- VideoDrawText(16, y + 8 + 78, GameFont, "Researching:");
- DrawUnitIcon(unit->Player,
- unit->Data.Research.Upgrade->Icon.Icon,
- 0, x + 107, y + 8 + 70);
+ if (TheUI.ResearchingText) {
+ VideoDrawText(TheUI.ResearchingTextX, TheUI.ResearchingTextY,
+ TheUI.ResearchingFont, TheUI.ResearchingText);
+ }
+ if (TheUI.ResearchingButton) {
+ DrawUnitIcon(unit->Player,
unit->Data.Research.Upgrade->Icon.Icon,
+ (ButtonAreaUnderCursor == ButtonAreaResearching &&
+ ButtonUnderCursor == 0) ?
+ (IconActive | (MouseButtons & LeftButton)) : 0,
+ TheUI.ResearchingButton->X, TheUI.ResearchingButton->Y);
+ }
UiDrawCompleted(unit->Data.Research.Upgrade->Costs[TimeCost],
unit->Player->UpgradeTimers.Upgrades[
@@ -383,19 +416,23 @@
// We displayed at least one resource
return;
}
-
+
if (type->Transporter && unit->InsideCount) {
+ if (TheUI.TransportingText) {
+ VideoDrawText(TheUI.TransportingTextX, TheUI.TransportingTextY,
+ TheUI.TransportingFont, TheUI.TransportingText);
+ }
uins = unit->UnitInside;
for (i = 0; i < unit->InsideCount; ++i, uins = uins->NextContained) {
DrawUnitIcon(unit->Player,uins->Type->Icon.Icon,
- (ButtonAreaUnderCursor == ButtonAreaInfo && ButtonUnderCursor
== i + 3) ?
+ (ButtonAreaUnderCursor == ButtonAreaSelected &&
ButtonUnderCursor == i) ?
(IconActive | (MouseButtons & LeftButton)) : 0,
- TheUI.InfoButtons[i + 3].X, TheUI.InfoButtons[i + 3].Y);
- UiDrawLifeBar(uins, TheUI.InfoButtons[i + 3].X, TheUI.InfoButtons[i
+ 3].Y);
+ TheUI.TransportingButtons[i].X, TheUI.TransportingButtons[i].Y);
+ UiDrawLifeBar(uins, TheUI.TransportingButtons[i].X,
TheUI.TransportingButtons[i].Y);
if (uins->Type->CanCastSpell) {
- UiDrawManaBar(uins, TheUI.InfoButtons[i + 3].X,
TheUI.InfoButtons[i + 3].Y);
+ UiDrawManaBar(uins, TheUI.TransportingButtons[i].X,
TheUI.TransportingButtons[i].Y);
}
- if (ButtonAreaUnderCursor == ButtonAreaInfo && ButtonUnderCursor ==
i + 3) {
+ if (ButtonAreaUnderCursor == ButtonAreaTransporting &&
ButtonUnderCursor == i) {
if (uins->Name) {
char buf[128];
sprintf(buf, "%s %s", uins->Type->Name, uins->Name);
@@ -441,13 +478,13 @@
if (stats->PiercingDamage < 30 && stats->BasicDamage < 30) {
sprintf(buf, "%d-%d~<+%d+%d~>",
(stats->PiercingDamage + 1) / 2, i,
- stats->BasicDamage-type->_BasicDamage +
+ stats->BasicDamage - type->_BasicDamage +
(int)isqrt(unit->XP / 100) * XpDamage,
stats->PiercingDamage-type->_PiercingDamage);
} else {
sprintf(buf, "%d-%d~<+%d+%d~>",
- (stats->PiercingDamage+stats->BasicDamage - 30) / 2, i,
- stats->BasicDamage-type->_BasicDamage +
+ (stats->PiercingDamage + stats->BasicDamage - 30) / 2,
i,
+ stats->BasicDamage - type->_BasicDamage +
(int)isqrt(unit->XP / 100) * XpDamage,
stats->PiercingDamage-type->_PiercingDamage);
}
@@ -1013,7 +1050,7 @@
}
if (costs) {
- for (i=0; i < MaxCosts; ++i) {
+ for (i = 0; i < MaxCosts; ++i) {
if (Costs[i] != costs[i]) {
Costs[i] = costs[i];
MustRedraw |= RedrawCosts;
@@ -1034,10 +1071,7 @@
*/
global void ClearCosts(void)
{
- int costs[MaxCosts];
-
- memset(costs, 0, sizeof(costs));
- SetCosts(0, 0, costs);
+ SetCosts(0, 0, NULL);
}
/*----------------------------------------------------------------------------
@@ -1082,13 +1116,13 @@
for (i = 0; i < NumSelected; ++i) {
DrawUnitIcon(ThisPlayer,
Selected[i]->Type->Icon.Icon,
- (ButtonAreaUnderCursor == ButtonAreaInfo &&
ButtonUnderCursor == i) ?
+ (ButtonAreaUnderCursor == ButtonAreaSelected &&
ButtonUnderCursor == i) ?
(IconActive | (MouseButtons & LeftButton)) : 0,
- TheUI.InfoButtons[i].X, TheUI.InfoButtons[i].Y);
+ TheUI.SelectedButtons[i].X, TheUI.SelectedButtons[i].Y);
UiDrawLifeBar(Selected[i],
- TheUI.InfoButtons[i].X, TheUI.InfoButtons[i].Y);
+ TheUI.SelectedButtons[i].X, TheUI.SelectedButtons[i].Y);
- if (ButtonAreaUnderCursor == ButtonAreaInfo &&
+ if (ButtonAreaUnderCursor == ButtonAreaSelected &&
ButtonUnderCursor == i) {
if (Selected[i]->Name) {
char buf[128];
@@ -1121,7 +1155,7 @@
}
DrawInfoPanelBackground(i);
DrawUnitInfo(Selected[0]);
- if (ButtonAreaUnderCursor == ButtonAreaInfo && ButtonUnderCursor ==
0) {
+ if (ButtonAreaUnderCursor == ButtonAreaSelected &&
ButtonUnderCursor == 0) {
if (Selected[0]->Name) {
char buf[128];
@@ -1225,9 +1259,9 @@
{
if (GameTimer.Running) {
if (GameTimer.Increasing) {
- GameTimer.Cycles += GameCycle-GameTimer.LastUpdate;
+ GameTimer.Cycles += GameCycle - GameTimer.LastUpdate;
} else {
- GameTimer.Cycles -= GameCycle-GameTimer.LastUpdate;
+ GameTimer.Cycles -= GameCycle - GameTimer.LastUpdate;
if (GameTimer.Cycles < 0) {
GameTimer.Cycles = 0;
}
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.153 stratagus/src/ui/mouse.c:1.154
--- stratagus/src/ui/mouse.c:1.153 Tue Oct 7 08:03:42 2003
+++ stratagus/src/ui/mouse.c Mon Oct 13 00:43:18 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.153 2003/10/07 12:03:42 martinxyz Exp $
+// $Id: mouse.c,v 1.154 2003/10/13 04:43:18 jsalmon3 Exp $
//@{
@@ -409,8 +409,8 @@
for (i = 0; i < TheUI.NumButtonButtons; ++i) {
if (x >= TheUI.ButtonButtons[i].X &&
x <= TheUI.ButtonButtons[i].X + TheUI.ButtonButtons[i].Width +
7 &&
- y>TheUI.ButtonButtons[i].Y &&
- y<=TheUI.ButtonButtons[i].Y + TheUI.ButtonButtons[i].Height +
7) {
+ y > TheUI.ButtonButtons[i].Y &&
+ y <= TheUI.ButtonButtons[i].Y + TheUI.ButtonButtons[i].Height +
7) {
ButtonAreaUnderCursor = ButtonAreaButton;
ButtonUnderCursor = i;
CursorOn = CursorOnButton;
@@ -418,28 +418,77 @@
return;
}
}
- if (NumSelected == 1 && Selected[0]->Type->Building &&
- Selected[0]->Orders[0].Action == UnitActionTrain &&
- Selected[0]->Data.Train.Count > 1) {
- for (i = 0; i < TheUI.NumTrainingButtons; ++i) {
- if (x >= TheUI.TrainingButtons[i].X &&
- x <= TheUI.TrainingButtons[i].X +
TheUI.TrainingButtons[i].Width + 7 &&
- y > TheUI.TrainingButtons[i].Y &&
- y <= TheUI.TrainingButtons[i].Y +
TheUI.TrainingButtons[i].Height + 7) {
- ButtonAreaUnderCursor = ButtonAreaTraining;
- ButtonUnderCursor = i;
+ if (NumSelected == 1 && Selected[0]->Type->Building) {
+ if (Selected[0]->Orders[0].Action == UnitActionTrain) {
+ if (Selected[0]->Data.Train.Count == 1) {
+ if (TheUI.SingleTrainingButton &&
+ x >= TheUI.SingleTrainingButton->X &&
+ x <= TheUI.SingleTrainingButton->X +
TheUI.SingleTrainingButton->Width + 7 &&
+ y > TheUI.SingleTrainingButton->Y &&
+ y <= TheUI.SingleTrainingButton->Y +
TheUI.SingleTrainingButton->Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaTraining;
+ ButtonUnderCursor = 0;
+ CursorOn = CursorOnButton;
+ MustRedraw |= RedrawButtonPanel;
+ return;
+ }
+ } else {
+ for (i = 0; i < TheUI.NumTrainingButtons; ++i) {
+ if (x >= TheUI.TrainingButtons[i].X &&
+ x <= TheUI.TrainingButtons[i].X +
TheUI.TrainingButtons[i].Width + 7 &&
+ y > TheUI.TrainingButtons[i].Y &&
+ y <= TheUI.TrainingButtons[i].Y +
TheUI.TrainingButtons[i].Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaTraining;
+ ButtonUnderCursor = i;
+ CursorOn = CursorOnButton;
+ MustRedraw |= RedrawButtonPanel;
+ return;
+ }
+ }
+ }
+ } else if (Selected[0]->Orders[0].Action == UnitActionUpgradeTo) {
+ if (x >= TheUI.UpgradingButton->X &&
+ x <= TheUI.UpgradingButton->X +
TheUI.UpgradingButton->Width + 7 &&
+ y > TheUI.UpgradingButton->Y &&
+ y <= TheUI.UpgradingButton->Y +
TheUI.UpgradingButton->Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaUpgrading;
+ ButtonUnderCursor = 0;
+ CursorOn = CursorOnButton;
+ MustRedraw |= RedrawButtonPanel;
+ return;
+ }
+ } else if (Selected[0]->Orders[0].Action == UnitActionResearch) {
+ if (x >= TheUI.ResearchingButton->X &&
+ x <= TheUI.ResearchingButton->X +
TheUI.ResearchingButton->Width + 7 &&
+ y > TheUI.ResearchingButton->Y &&
+ y <= TheUI.ResearchingButton->Y +
TheUI.ResearchingButton->Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaResearching;
+ ButtonUnderCursor = 0;
CursorOn = CursorOnButton;
MustRedraw |= RedrawButtonPanel;
return;
}
}
+ }
+ if (NumSelected == 1) {
+ if (TheUI.SingleSelectedButton &&
+ x >= TheUI.SingleSelectedButton->X &&
+ x <= TheUI.SingleSelectedButton->X +
TheUI.SingleSelectedButton->Width + 7 &&
+ y > TheUI.SingleSelectedButton->Y &&
+ y <= TheUI.SingleSelectedButton->Y +
TheUI.SingleSelectedButton->Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaSelected;
+ ButtonUnderCursor = 0;
+ CursorOn = CursorOnButton;
+ MustRedraw |= RedrawButtonPanel;
+ return;
+ }
} else {
- for (i = 0; i < TheUI.NumInfoButtons; ++i) {
- if (x >= TheUI.InfoButtons[i].X &&
- x <= TheUI.InfoButtons[i].X + TheUI.InfoButtons[i].Width +
7 &&
- y > TheUI.InfoButtons[i].Y &&
- y <= TheUI.InfoButtons[i].Y + TheUI.InfoButtons[i].Height +
7) {
- ButtonAreaUnderCursor = ButtonAreaInfo;
+ for (i = 0; i < TheUI.NumSelectedButtons; ++i) {
+ if (x >= TheUI.SelectedButtons[i].X &&
+ x <= TheUI.SelectedButtons[i].X +
TheUI.SelectedButtons[i].Width + 7 &&
+ y > TheUI.SelectedButtons[i].Y &&
+ y <= TheUI.SelectedButtons[i].Y +
TheUI.SelectedButtons[i].Height + 7) {
+ ButtonAreaUnderCursor = ButtonAreaSelected;
ButtonUnderCursor = i;
CursorOn = CursorOnButton;
MustRedraw |= RedrawButtonPanel;
@@ -451,7 +500,11 @@
if (ButtonUnderCursor != -1) { // remove old display
if (ButtonAreaUnderCursor == ButtonAreaMenu) {
MustRedraw |= RedrawMenuButton;
- } else if (ButtonAreaUnderCursor == ButtonAreaInfo) {
+ } else if (ButtonAreaUnderCursor == ButtonAreaSelected ||
+ ButtonAreaUnderCursor == ButtonAreaTraining ||
+ ButtonAreaUnderCursor == ButtonAreaUpgrading ||
+ ButtonAreaUnderCursor == ButtonAreaResearching ||
+ ButtonAreaUnderCursor == ButtonAreaTransporting) {
MustRedraw |= RedrawInfoPanel;
} else {
MustRedraw |= RedrawButtonPanel;
@@ -1410,7 +1463,7 @@
//
// clicked on info panel - selection shown
//
- if (NumSelected > 1 && ButtonAreaUnderCursor == ButtonAreaInfo) {
+ if (NumSelected > 1 && ButtonAreaUnderCursor == ButtonAreaSelected) {
if (!GameObserve && !GamePaused) {
DoSelectionButtons(ButtonUnderCursor, button);
}
@@ -1432,9 +1485,9 @@
MustRedraw |= RedrawMenuButton;
}
//
- // clicked on info panel
+ // clicked on selected button
//
- } else if (ButtonAreaUnderCursor == ButtonAreaInfo) {
+ } else if (ButtonAreaUnderCursor == ButtonAreaSelected) {
//
// clicked on single unit shown
//
@@ -1442,26 +1495,6 @@
PlayGameSound(GameSounds.Click.Sound, MaxSampleVolume);
ViewportCenterViewpoint(TheUI.SelectedViewport,
Selected[0]->X,
Selected[0]->Y);
- //
- // for transporter
- //
- } else if (ButtonUnderCursor > 2 && ButtonUnderCursor < 9) {
- if (NumSelected == 1 && Selected[0]->Type->Transporter) {
- if (!GameObserve && !GamePaused) {
- if (Selected[0]->InsideCount >= ButtonUnderCursor -
3) {
-
- // FIXME: should check if valid here.
- // n0b0dy: check WHAT?
- uins=Selected[0]->UnitInside;
- for (i = 0; i < ButtonUnderCursor - 3; ++i) {
- uins = uins->NextContained;
- }
- SendCommandUnload(Selected[0],
- Selected[0]->X, Selected[0]->Y, uins,
- !(KeyModifiers & ModifierShift));
- }
- }
- }
}
//
// clicked on training button
@@ -1478,18 +1511,57 @@
}
}
//
+ // clicked on upgrading button
+ //
+ } else if (ButtonAreaUnderCursor == ButtonAreaUpgrading) {
+ if (!GameObserve && !GamePaused) {
+ if (ButtonUnderCursor == 0 && NumSelected == 1) {
+ DebugLevel0Fn("Cancel upgrade %s\n" _C_
+ Selected[0]->Type->Ident);
+ SendCommandCancelUpgradeTo(Selected[0]);
+ }
+ }
+ //
+ // clicked on researching button
+ //
+ } else if (ButtonAreaUnderCursor == ButtonAreaResearching) {
+ if (!GameObserve && !GamePaused) {
+ if (ButtonUnderCursor == 0 && NumSelected == 1) {
+ DebugLevel0Fn("Cancel research %s\n" _C_
+ Selected[0]->Type->Ident);
+ SendCommandCancelResearch(Selected[0]);
+ }
+ }
+ //
// clicked on button panel
//
+ } else if (ButtonAreaUnderCursor == ButtonAreaTransporting) {
+ //
+ // for transporter
+ //
+ if (!GameObserve && !GamePaused) {
+ if (Selected[0]->InsideCount >= ButtonUnderCursor) {
+ // FIXME: should check if valid here.
+ // n0b0dy: check WHAT?
+ uins = Selected[0]->UnitInside;
+ for (i = 0; i < ButtonUnderCursor; ++i) {
+ uins = uins->NextContained;
+ }
+ SendCommandUnload(Selected[0],
+ Selected[0]->X, Selected[0]->Y, uins,
+ !(KeyModifiers & ModifierShift));
+ }
+ }
} else if (ButtonAreaUnderCursor == ButtonAreaButton) {
if (!GameObserve && !GamePaused) {
DoButtonButtonClicked(ButtonUnderCursor);
}
}
- } else if ((MouseButtons&MiddleButton)) {
+ } else if ((MouseButtons & MiddleButton)) {
//
// clicked on info panel - single unit shown
//
- if (ButtonAreaUnderCursor == ButtonAreaInfo &&
+ if (ButtonAreaUnderCursor == ButtonAreaSelected &&
ButtonUnderCursor == 0 && NumSelected == 1) {
PlayGameSound(GameSounds.Click.Sound, MaxSampleVolume);
if (TheUI.SelectedViewport->Unit == Selected[0]) {
@@ -1498,7 +1570,7 @@
TheUI.SelectedViewport->Unit = Selected[0];
}
}
- } else if ((MouseButtons&RightButton)) {
+ } else if ((MouseButtons & RightButton)) {
}
}
}
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.79 stratagus/src/ui/ui.c:1.80
--- stratagus/src/ui/ui.c:1.79 Tue Oct 7 22:49:37 2003
+++ stratagus/src/ui/ui.c Mon Oct 13 00:43:18 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.79 2003/10/08 02:49:37 jsalmon3 Exp $
+// $Id: ui.c,v 1.80 2003/10/13 04:43:18 jsalmon3 Exp $
//@{
@@ -154,8 +154,8 @@
SetViewportMode(VIEWPORT_SINGLE);
}
- TheUI.CompleteBarColor = VideoMapRGB(TheUI.CompleteBarColorRGB.D24.a,
- TheUI.CompleteBarColorRGB.D24.b, TheUI.CompleteBarColorRGB.D24.c);
+ TheUI.CompletedBarColor = VideoMapRGB(TheUI.CompletedBarColorRGB.D24.a,
+ TheUI.CompletedBarColorRGB.D24.b, TheUI.CompletedBarColorRGB.D24.c);
TheUI.ViewportCursorColor = ColorWhite;
}
@@ -343,23 +343,152 @@
}
CLprintf(file, ")\n");
- CLprintf(file, " 'info-panel (list \"%s\" %d %d %d %d)\n",
- ui->InfoPanel.File,
- ui->InfoPanelX, ui->InfoPanelY,
- ui->InfoPanelW, ui->InfoPanelH);
-
- CLprintf(file, "\n 'completed-bar '(");
- CLprintf(file, "\n color (%d %d %d)", ui->CompleteBarColorRGB.D24.a,
- ui->CompleteBarColorRGB.D24.b, ui->CompleteBarColorRGB.D24.c);
- CLprintf(file, "\n pos (%3d %3d)", ui->CompleteBarX, ui->CompleteBarY);
- CLprintf(file, "\n size (%d %d)", ui->CompleteBarW, ui->CompleteBarH);
- CLprintf(file, "\n text \"%s\"", ui->CompleteBarText);
- CLprintf(file, "\n font %s", FontNames[ui->CompleteBarFont]);
- CLprintf(file, "\n text-pos (%3d %3d)",
- ui->CompleteTextX, ui->CompleteTextY);
- CLprintf(file, ")\n\n");
+ CLprintf(file, "\n 'info-panel (list");
+ CLprintf(file, "\n 'panel (list");
+ CLprintf(file, "\n 'file \"%s\"", ui->InfoPanel.File);
+ CLprintf(file, "\n 'pos '(%d %d)", ui->InfoPanelX, ui->InfoPanelY);
+ CLprintf(file, "\n 'size '(%d %d))", ui->InfoPanelW, ui->InfoPanelH);
+
+ CLprintf(file, "\n 'selected (list");
+ CLprintf(file, "\n 'single (list");
+ if (ui->SingleSelectedText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->SingleSelectedText);
+ CLprintf(file, "\n 'font '%s",
FontNames[ui->SingleSelectedFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->SingleSelectedTextX, ui->SingleSelectedTextY);
+ }
+ if (ui->SingleSelectedButton) {
+ CLprintf(file, "\n 'icon (list");
+ CLprintf(file, "\n 'pos '(%d %d) 'size '(%d %d))",
+ ui->SingleSelectedButton->X, ui->SingleSelectedButton->Y,
+ ui->SingleSelectedButton->Width, ui->SingleSelectedButton->Height);
+ }
+ CLprintf(file, ")");
+ CLprintf(file, "\n 'multiple (list");
+ if (ui->SelectedText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->SelectedText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->SelectedFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->SelectedTextX, ui->SelectedTextY);
+ }
+ if (ui->SelectedButtons) {
+ CLprintf(file, "\n 'icons (list");
+ for (i = 0; i < ui->NumSelectedButtons; ++i) {
+ CLprintf(file, "\n (list 'pos '(%d %d) 'size '(%d %d))",
+ ui->SelectedButtons[i].X, ui->SelectedButtons[i].Y,
+ ui->SelectedButtons[i].Width, ui->SelectedButtons[i].Height);
+ }
+ CLprintf(file, ")");
+ }
+ CLprintf(file, ")");
+ CLprintf(file, ")");
+
+ CLprintf(file, "\n 'training (list");
+ CLprintf(file, "\n 'single (list");
+ if (ui->SingleTrainingText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->SingleTrainingText);
+ CLprintf(file, "\n 'font '%s",
FontNames[ui->SingleTrainingFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->SingleTrainingTextX, ui->SingleTrainingTextY);
+ }
+ if (ui->SingleTrainingButton) {
+ CLprintf(file, "\n 'icon (list");
+ CLprintf(file, "\n 'pos '(%d %d) 'size '(%d %d))",
+ ui->SingleTrainingButton->X, ui->SingleTrainingButton->Y,
+ ui->SingleTrainingButton->Width, ui->SingleTrainingButton->Height);
+ }
+ CLprintf(file, ")");
+ CLprintf(file, "\n 'multiple (list");
+ if (ui->TrainingText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->TrainingText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->TrainingFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->TrainingTextX, ui->TrainingTextY);
+ }
+ if (ui->TrainingButtons) {
+ CLprintf(file, "\n 'icons (list");
+ for (i = 0; i < ui->NumTrainingButtons; ++i) {
+ CLprintf(file, "\n (list 'pos '(%d %d) 'size '(%d %d))",
+ ui->TrainingButtons[i].X, ui->TrainingButtons[i].Y,
+ ui->TrainingButtons[i].Width, ui->TrainingButtons[i].Height);
+ }
+ CLprintf(file, ")");
+ }
+ CLprintf(file, ")");
+ CLprintf(file, ")");
+
+ CLprintf(file, "\n 'upgrading (list");
+ if (ui->UpgradingText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->UpgradingText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->UpgradingFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->UpgradingTextX, ui->UpgradingTextY);
+ }
+ if (ui->UpgradingButton) {
+ CLprintf(file, "\n 'icon (list");
+ CLprintf(file, "\n 'pos '(%d %d)",
+ ui->UpgradingButton->X, ui->UpgradingButton->Y);
+ CLprintf(file, "\n 'size '(%d %d))",
+ ui->UpgradingButton->Width, ui->UpgradingButton->Height);
+ }
+ CLprintf(file, ")");
+
+ CLprintf(file, "\n 'researching (list");
+ if (ui->ResearchingText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->ResearchingText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->ResearchingFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->ResearchingTextX, ui->ResearchingTextY);
+ }
+ if (ui->ResearchingButton) {
+ CLprintf(file, "\n 'icon (list");
+ CLprintf(file, "\n 'pos '(%d %d)",
+ ui->ResearchingButton->X, ui->ResearchingButton->Y);
+ CLprintf(file, "\n 'size '(%d %d))",
+ ui->ResearchingButton->Width, ui->ResearchingButton->Height);
+ }
+ CLprintf(file, ")");
+
+ CLprintf(file, "\n 'transporting (list");
+ if (ui->TransportingText) {
+ CLprintf(file, "\n 'text (list");
+ CLprintf(file, "\n 'text \"%s\"", ui->TransportingText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->TransportingFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->TransportingTextX, ui->TransportingTextY);
+ }
+ if (ui->TransportingButtons) {
+ CLprintf(file, "\n 'icons (list");
+ for (i = 0; i < ui->NumTransportingButtons; ++i) {
+ CLprintf(file, "\n (list 'pos '(%d %d) 'size '(%d %d))",
+ ui->TransportingButtons[i].X, ui->TransportingButtons[i].Y,
+ ui->TransportingButtons[i].Width,
ui->TransportingButtons[i].Height);
+ }
+ CLprintf(file, ")");
+ }
+ CLprintf(file, ")");
- CLprintf(file, " 'button-panel (list \"%s\" %d %d)\n",
+ CLprintf(file, "\n 'completed-bar (list");
+ CLprintf(file, "\n 'color '(%d %d %d)",
ui->CompletedBarColorRGB.D24.a,
+ ui->CompletedBarColorRGB.D24.b, ui->CompletedBarColorRGB.D24.c);
+ CLprintf(file, "\n 'pos '(%d %d)", ui->CompletedBarX,
ui->CompletedBarY);
+ CLprintf(file, "\n 'size '(%d %d)", ui->CompletedBarW,
ui->CompletedBarH);
+ CLprintf(file, "\n 'text (list", ui->CompletedBarText);
+ CLprintf(file, "\n 'text \"%s\"", ui->CompletedBarText);
+ CLprintf(file, "\n 'font '%s", FontNames[ui->CompletedBarFont]);
+ CLprintf(file, "\n 'pos '(%d %d))",
+ ui->CompletedBarTextX, ui->CompletedBarTextY);
+ CLprintf(file, ")");
+
+ CLprintf(file, ")\n"); // 'info-panel
+
+ CLprintf(file, "\n 'button-panel (list \"%s\" %d %d)",
ui->ButtonPanel.File, ui->ButtonPanelX, ui->ButtonPanelY);
CLprintf(file, "\n 'map-area (list");
@@ -426,22 +555,8 @@
ui->NetworkDiplomacyButton.Text);
CLprintf(file, "\n style %s",
MenuButtonStyle(ui->NetworkDiplomacyButton.Button));
- CLprintf(file, ")");
+ CLprintf(file, ")\n");
- CLprintf(file, "\n\n 'info-buttons '(");
- for (i = 0; i < ui->NumInfoButtons; ++i) {
- CLprintf(file, "\n (pos (%3d %3d) size (%d %d))",
- ui->InfoButtons[i].X, ui->InfoButtons[i].Y,
- ui->InfoButtons[i].Width, ui->InfoButtons[i].Height);
- }
- CLprintf(file, ")");
- CLprintf(file, "\n 'training-buttons '(");
- for (i = 0; i < ui->NumTrainingButtons; ++i) {
- CLprintf(file, "\n (pos (%3d %3d) size (%d %d))",
- ui->TrainingButtons[i].X, ui->TrainingButtons[i].Y,
- ui->TrainingButtons[i].Width, ui->TrainingButtons[i].Height);
- }
- CLprintf(file, ")");
CLprintf(file, "\n 'button-buttons '(");
for (i = 0; i < ui->NumButtonButtons; ++i) {
CLprintf(file, "\n (pos (%3d %3d) size (%d %d))",
@@ -515,7 +630,7 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.79 2003/10/08 02:49:37
jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: ui $Id: ui.c,v 1.80 2003/10/13 04:43:18
jsalmon3 Exp $\n\n");
// Contrast, Brightness, Saturation
CLprintf(file, "(set-contrast! %d)\n", TheUI.Contrast);
@@ -571,9 +686,21 @@
// Info Panel
free(ui->InfoPanel.File);
-
- // Completed Bar
- free(ui->CompleteBarText);
+ free(ui->SingleSelectedButton);
+ free(ui->SingleSelectedText);
+ free(ui->SelectedButtons);
+ free(ui->SelectedText);
+ free(ui->SingleTrainingButton);
+ free(ui->SingleTrainingText);
+ free(ui->TrainingButtons);
+ free(ui->TrainingText);
+ free(ui->UpgradingButton);
+ free(ui->UpgradingText);
+ free(ui->ResearchingButton);
+ free(ui->ResearchingText);
+ free(ui->TransportingButtons);
+ free(ui->TransportingText);
+ free(ui->CompletedBarText);
// Button Panel
free(ui->ButtonPanel.File);
@@ -591,8 +718,6 @@
free(ui->MenuButton.Text);
free(ui->NetworkMenuButton.Text);
free(ui->NetworkDiplomacyButton.Text);
- free(ui->InfoButtons);
- free(ui->TrainingButtons);
free(ui->ButtonButtons);
// Cursors