[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus ./Rules.make.in ./configure.in data/c...
From: |
Martin Renold |
Subject: |
[Stratagus-CVS] stratagus ./Rules.make.in ./configure.in data/c... |
Date: |
Fri, 08 Aug 2003 06:16:46 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Martin Renold <address@hidden> 03/08/08 06:16:44
Modified files:
. : Rules.make.in configure.in
data/ccl/human : ui.ccl
data/ccl/orc : ui.ccl
doc : ChangeLog.html
src/action : action_attack.c action_board.c action_build.c
action_follow.c action_harvest.c
action_minegold.c action_move.c action_repair.c
action_research.c action_resource.c
action_train.c action_unload.c
action_upgradeto.c actions.c command.c
src/clone : ccl_player.c construct.c mainloop.c player.c
unit.c unit_draw.c
src/editor : editloop.c
src/game : loadgame.c savegame.c
src/include : cursor.h depend.h icons.h interface.h missile.h
stratagus.h tileset.h ui.h unit.h unittype.h
src/map : minimap.c tileset.c
src/missile : missile.c
src/ui : botpanel.c button_checks.c ccl_ui.c icons.c
interface.c mainscr.c menu_proc.c mouse.c ui.c
src/unit : ccl_unittype.c depend.c unittype.c upgrade.c
src/video : cursor.c
Log message:
- NEW_UI compile-time option (applying my patch)
- fewer things are saved
- minimap may have different palette and position is configurable
Patches:
Index: stratagus/Rules.make.in
diff -u stratagus/Rules.make.in:1.12 stratagus/Rules.make.in:1.13
--- stratagus/Rules.make.in:1.12 Sat Aug 2 09:43:46 2003
+++ stratagus/Rules.make.in Fri Aug 8 06:16:43 2003
@@ -54,7 +54,7 @@
-DUNIT_ON_MAP -DNEW_AI -DUSE_LIBMODPLUG -DUSE_HP_FOR_XP \
@PROFILE_CFLAGS@ @DEBUG_CFLAGS@ @VIDEO_CFLAGS@ @BZ2_CFLAGS@ \
@OGG_CFLAGS@ @MAD_CFLAGS@ @FLAC_CFLAGS@ @CDAUDIO_CFLAGS@ @GUILE_CFLAGS@ \
- $(CCL) $(VERSION) $(COMP_CFLAGS) @SOUND_CFLAGS@ @PLATFORM@ \
+ $(CCL) $(VERSION) $(COMP_CFLAGS) @NEWUI_CFLAGS@ @SOUND_CFLAGS@ @PLATFORM@ \
-I/usr/local/include $(ARTSC)
CTAGSFLAGS=-i defptvS -a -f
Index: stratagus/configure.in
diff -u stratagus/configure.in:1.21 stratagus/configure.in:1.22
--- stratagus/configure.in:1.21 Sat Aug 2 09:38:45 2003
+++ stratagus/configure.in Fri Aug 8 06:16:43 2003
@@ -45,6 +45,17 @@
fi
dnl -----------------------
+dnl --- NEW_UI ---
+AC_ARG_WITH([new-ui],
+ AC_HELP_STRING([--with-new-ui], [Enable New User Interface (default:
no)]),,
+ with_new_ui="no")
+NEWUI_CFLAGS=
+if test "x$with_new_ui" = "xyes"; then
+ NEWUI_CFLAGS="-DNEW_UI"
+fi
+AC_SUBST(NEWUI_CFLAGS)
+dnl -----------------------
+
dnl --- CHECK FOR WITH SOUND ---
AC_ARG_ENABLE(sound,
[ --enable-sound [Use sound (default: yes)]], SOUND="$with_sound")
Index: stratagus/data/ccl/human/ui.ccl
diff -u stratagus/data/ccl/human/ui.ccl:1.35
stratagus/data/ccl/human/ui.ccl:1.36
--- stratagus/data/ccl/human/ui.ccl:1.35 Fri Jul 11 14:27:05 2003
+++ stratagus/data/ccl/human/ui.ccl Fri Aug 8 06:16:43 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.35 2003/07/11 18:27:05 grumbel Exp $
+;; $Id: ui.ccl,v 1.36 2003/08/08 10:16:43 martinxyz Exp $
;;=============================================================================
;; Define a cursor.
@@ -72,8 +72,7 @@
"/filler-right.png")
'pos (list (- screen_width 16) 0))
- ; Resource line
- (list
+ 'ressource-line (list
(string-append "graphics/ui/human/"
(number->string screen_width) "x" (number->string screen_height)
"/resource.png")
@@ -91,8 +90,7 @@
'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)
+ 'info-panel (list "graphics/ui/human/infopanel.png" 0 160 176 176)
'completed-bar '(
color 149
@@ -103,7 +101,7 @@
text-pos ( 50 313))
; Command button panel
- (list
+ 'button-panel (list
(string-append "graphics/ui/human/"
(number->string screen_width) "x" (number->string screen_height)
"/buttonpanel.png")
@@ -116,10 +114,10 @@
(* 32 (trunc (/ (- screen_height 16 16) 32)))))
; Menu button
- (list "graphics/ui/human/menubutton.png" 0 0)
+ 'menu-panel (list "graphics/ui/human/menubutton.png" 0 0)
- ; Minimap
- (list "graphics/ui/human/minimap.png" 0 24)
+ 'minimap-panel (list "graphics/ui/human/minimap.png" 0 24)
+ 'minimap-pos (list (+ 0 24) (+ 24 2))
'status-line (list
'file (string-append "graphics/ui/human/"
Index: stratagus/data/ccl/orc/ui.ccl
diff -u stratagus/data/ccl/orc/ui.ccl:1.34 stratagus/data/ccl/orc/ui.ccl:1.35
--- stratagus/data/ccl/orc/ui.ccl:1.34 Fri Jul 11 14:27:05 2003
+++ stratagus/data/ccl/orc/ui.ccl Fri Aug 8 06:16:43 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.34 2003/07/11 18:27:05 grumbel Exp $
+;; $Id: ui.ccl,v 1.35 2003/08/08 10:16:43 martinxyz Exp $
;;=============================================================================
;; Define a cursor.
@@ -72,8 +72,7 @@
"/filler-right.png")
'pos (list (- screen_width 16) 0))
- ; Resource line
- (list
+ 'ressource-line (list
(string-append "graphics/ui/orc/"
(number->string screen_width) "x" (number->string screen_height)
"/resource.png")
@@ -91,8 +90,7 @@
'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)
+ 'info-panel (list "graphics/ui/orc/infopanel.png" 0 160 176 176)
; Completed bar
'completed-bar '(
@@ -104,7 +102,7 @@
text-pos ( 50 313))
; Command button panel
- (list
+ 'button-panel (list
(string-append "graphics/ui/orc/"
(number->string screen_width) "x" (number->string screen_height)
"/buttonpanel.png")
@@ -117,10 +115,11 @@
(* 32 (trunc (/ (- screen_height 16 16) 32)))))
; Menu button
- (list "graphics/ui/orc/menubutton.png" 0 0)
+ 'menu-panel (list "graphics/ui/orc/menubutton.png" 0 0)
; Minimap
- (list "graphics/ui/orc/minimap.png" 0 24)
+ 'minimap-panel (list "graphics/ui/orc/minimap.png" 0 24)
+ 'minimap-pos (list (+ 0 24) (+ 24 2))
'status-line (list
'file (string-append "graphics/ui/orc/"
Index: stratagus/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.506 stratagus/doc/ChangeLog.html:1.507
--- stratagus/doc/ChangeLog.html:1.506 Sat Jul 12 11:03:13 2003
+++ stratagus/doc/ChangeLog.html Fri Aug 8 06:16:43 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.506 2003/07/12 15:03:13 n0body Exp $
+---- $Id: ChangeLog.html,v 1.507 2003/08/08 10:16:43 martinxyz Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,12 @@
<li>Future 1.19 Release<p>
<ul>
<li>+++
+ <li>Minimap panel can have its own palette now (from Martin Renold).
+ <li>Simplified save/load, fewer things are now saved (from Martin Renold).
+ <li>NEW_UI: Dropped of displaying the current unit action with the buttons
(from Martin Renold).
+ <li>NEW_UI: Dropped Alt-Buttons support (did anybody use this?) (from
Martin Renold).
+ <li>NEW_UI: Button actions are now custom scheme scripts (from Martin
Renold).
+ <li>NEW_UI: Added as compile time option (from Martin Renold).
<li>Fixed loading games saved with different resolutions (from Martin
Renold).
<li>Removed spaces from data files (from Martin Renold).
<li>Changed the handling of contained units to a circular linked list
(from Crestez Dan Leonard).
Index: stratagus/src/action/action_attack.c
diff -u stratagus/src/action/action_attack.c:1.76
stratagus/src/action/action_attack.c:1.77
--- stratagus/src/action/action_attack.c:1.76 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_attack.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_attack.c,v 1.76 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_attack.c,v 1.77 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -51,6 +51,9 @@
#include "sound.h"
#include "map.h"
#include "pathfinder.h"
+#ifdef NEW_UI
+#include "interface.h"
+#endif
/*----------------------------------------------------------------------------
-- Defines
@@ -161,7 +164,13 @@
unit->SavedOrder.Goal=NoUnitP;
if( unit->Selected && unit->Player==ThisPlayer ) {
+#ifndef NEW_UI
MustRedraw|=RedrawButtonPanel;
+#else
+ // FIXME: not really used because actions
+ // cannot yet be shown with NEW_UI
+ SelectedUnitChanged();
+#endif
}
goal=unit->Orders[0].Goal;
}
@@ -371,7 +380,11 @@
unit->SavedOrder.Goal=NoUnitP;
if( unit->Selected && unit->Player==ThisPlayer ) {
+#ifndef NEW_UI
MustRedraw|=RedrawButtonPanel;
+#else
+ SelectedUnitChanged();
+#endif
}
return;
}
@@ -445,7 +458,11 @@
DebugCheck( unit->SavedOrder.Goal!=NoUnitP );
if( unit->Selected && unit->Player==ThisPlayer ) {
+#ifndef NEW_UI
MustRedraw|=RedrawButtonPanel;
+#else
+ SelectedUnitChanged();
+#endif
}
}
return;
Index: stratagus/src/action/action_board.c
diff -u stratagus/src/action/action_board.c:1.38
stratagus/src/action/action_board.c:1.39
--- stratagus/src/action/action_board.c:1.38 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_board.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_board.c,v 1.38 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_board.c,v 1.39 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -184,8 +184,8 @@
unit->OrderCount=1;
unit->Orders[0].Action=UnitActionStill;
if( IsOnlySelected(transporter) ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
}
return;
}
Index: stratagus/src/action/action_build.c
diff -u stratagus/src/action/action_build.c:1.84
stratagus/src/action/action_build.c:1.85
--- stratagus/src/action/action_build.c:1.84 Tue Jul 22 10:32:21 2003
+++ stratagus/src/action/action_build.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_build.c,v 1.84 2003/07/22 14:32:21 n0body Exp $
+// $Id: action_build.c,v 1.85 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -121,7 +121,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->SubAction=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
@@ -166,7 +166,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->SubAction=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
@@ -195,7 +195,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->SubAction=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
@@ -213,7 +213,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->SubAction=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
@@ -414,10 +414,10 @@
UpdateForNewUnit(unit,0);
if( IsOnlySelected(unit) ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
} else if( unit->Player==ThisPlayer ) {
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
unit->CurrentSightRange=unit->Stats->SightRange;
MapMarkSight(unit->Player,unit->X+unit->Type->TileWidth/2,
Index: stratagus/src/action/action_follow.c
diff -u stratagus/src/action/action_follow.c:1.26
stratagus/src/action/action_follow.c:1.27
--- stratagus/src/action/action_follow.c:1.26 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_follow.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_follow.c,v 1.26 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_follow.c,v 1.27 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -84,7 +84,7 @@
unit->SubAction=0;
unit->Orders[0].Action=UnitActionStill;
if( IsOnlySelected(unit) ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
@@ -195,7 +195,7 @@
unit->SubAction=0;
unit->Orders[0].Action=UnitActionStill;
if( IsOnlySelected(unit) ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
Index: stratagus/src/action/action_harvest.c
diff -u stratagus/src/action/action_harvest.c:1.73
stratagus/src/action/action_harvest.c:1.74
--- stratagus/src/action/action_harvest.c:1.73 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_harvest.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_harvest.c,v 1.73 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_harvest.c,v 1.74 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -218,7 +218,11 @@
//
CheckUnitToBeDrawn(unit);
if( IsOnlySelected(unit) ) { // update display
+#ifndef NEW_UI
UpdateButtonPanel();
+#else
+ SelectedUnitChanged();
+#endif
}
//
Index: stratagus/src/action/action_minegold.c
diff -u stratagus/src/action/action_minegold.c:1.75
stratagus/src/action/action_minegold.c:1.76
--- stratagus/src/action/action_minegold.c:1.75 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_minegold.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_minegold.c,v 1.75 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_minegold.c,v 1.76 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -323,7 +323,7 @@
unit->Player->UnitTypesCount[unit->Type->Type]++;
CheckUnitToBeDrawn(unit);
if( unit->Selected ) {
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
unit->Wait=1;
return unit->SubAction;
Index: stratagus/src/action/action_move.c
diff -u stratagus/src/action/action_move.c:1.60
stratagus/src/action/action_move.c:1.61
--- stratagus/src/action/action_move.c:1.60 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_move.c Fri Aug 8 06:16:43 2003
@@ -21,7 +21,7 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
-// $Id: action_move.c,v 1.60 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_move.c,v 1.61 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -146,12 +146,13 @@
MapMarkNewSight(unit->Player,x,y,unit->CurrentSightRange,xd,yd);
// Remove unit from the current selection
if( unit->Selected && !IsMapFieldVisible(ThisPlayer,unit->X,unit->Y)) {
+#ifndef NEW_UI
if( NumSelected==1 ) { // Remove building cursor
CancelBuildingMode();
}
+#endif
UnSelectUnit(unit);
- MustRedraw|=RedrawPanels;
- UpdateButtonPanel();
+ SelectionChanged();
}
// Remark sight for units inside too.
@@ -308,7 +309,7 @@
}
unit->Orders[0].Action=UnitActionStill;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
Index: stratagus/src/action/action_repair.c
diff -u stratagus/src/action/action_repair.c:1.47
stratagus/src/action/action_repair.c:1.48
--- stratagus/src/action/action_repair.c:1.47 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_repair.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_repair.c,v 1.47 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_repair.c,v 1.48 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -130,7 +130,7 @@
unit->Orders[0].Action = UnitActionStill;
unit->State = unit->SubAction = 0;
if (unit->Selected) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
}
// FIXME: We shouldn't animate if no resources are available.
@@ -279,7 +279,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->State=unit->SubAction=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
@@ -341,7 +341,7 @@
unit->Orders[0].Action=UnitActionStill;
unit->SubAction=unit->State=0;
if( unit->Selected ) { // update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
}
return;
}
Index: stratagus/src/action/action_research.c
diff -u stratagus/src/action/action_research.c:1.31
stratagus/src/action/action_research.c:1.32
--- stratagus/src/action/action_research.c:1.31 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_research.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_research.c,v 1.31 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_research.c,v 1.32 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -106,13 +106,14 @@
unit->SubAction=0;
// Upgrade can change all
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
return;
}
if( IsOnlySelected(unit) ) {
+ // refresh info panel (to show progress, I think)
MustRedraw|=RedrawInfoPanel;
}
Index: stratagus/src/action/action_resource.c
diff -u stratagus/src/action/action_resource.c:1.41
stratagus/src/action/action_resource.c:1.42
--- stratagus/src/action/action_resource.c:1.41 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_resource.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_resource.c,v 1.41 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_resource.c,v 1.42 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -305,7 +305,8 @@
CheckUnitToBeDrawn(unit);
if( IsOnlySelected(unit) ) {
- UpdateButtonPanel();
+ SelectedUnitChanged();
+ // FIXME: redundant?
MustRedraw|=RedrawButtonPanel;
}
unit->Wait=1;
Index: stratagus/src/action/action_train.c
diff -u stratagus/src/action/action_train.c:1.52
stratagus/src/action/action_train.c:1.53
--- stratagus/src/action/action_train.c:1.52 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_train.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_train.c,v 1.52 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_train.c,v 1.53 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -199,8 +199,13 @@
}
if( IsOnlySelected(unit) ) {
+#ifndef NEW_UI
UpdateButtonPanel();
MustRedraw|=RedrawPanels;
+#else
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
+#endif
}
return;
Index: stratagus/src/action/action_unload.c
diff -u stratagus/src/action/action_unload.c:1.38
stratagus/src/action/action_unload.c:1.39
--- stratagus/src/action/action_unload.c:1.38 Fri Jul 18 16:26:19 2003
+++ stratagus/src/action/action_unload.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_unload.c,v 1.38 2003/07/18 20:26:19 grumbel Exp $
+// $Id: action_unload.c,v 1.39 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -288,8 +288,8 @@
}
}
if( IsOnlySelected(unit) ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
}
// We still have some units to unload, find a piece of free coast.
Index: stratagus/src/action/action_upgradeto.c
diff -u stratagus/src/action/action_upgradeto.c:1.37
stratagus/src/action/action_upgradeto.c:1.38
--- stratagus/src/action/action_upgradeto.c:1.37 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/action_upgradeto.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_upgradeto.c,v 1.37 2003/07/11 14:35:29 n0body Exp $
+// $Id: action_upgradeto.c,v 1.38 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -96,11 +96,9 @@
//
// Update possible changed buttons.
//
- if( IsOnlySelected(unit) ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
- } else if( player==ThisPlayer ) {
- UpdateButtonPanel();
+ if( IsOnlySelected(unit) || player==ThisPlayer ) {
+ // could affect the buttons of any selected unit
+ SelectedUnitChanged();
MustRedraw|=RedrawInfoPanel;
}
Index: stratagus/src/action/actions.c
diff -u stratagus/src/action/actions.c:1.82 stratagus/src/action/actions.c:1.83
--- stratagus/src/action/actions.c:1.82 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/actions.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: actions.c,v 1.82 2003/07/11 14:35:29 n0body Exp $
+// $Id: actions.c,v 1.83 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -320,7 +320,7 @@
unit->Wait=1;
if( IsOnlySelected(unit) ) {// update display for new action
- UpdateButtonPanel();
+ SelectedUnitChanged();
MustRedraw|=RedrawInfoPanel;
}
}
Index: stratagus/src/action/command.c
diff -u stratagus/src/action/command.c:1.94 stratagus/src/action/command.c:1.95
--- stratagus/src/action/command.c:1.94 Fri Jul 11 10:35:29 2003
+++ stratagus/src/action/command.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: command.c,v 1.94 2003/07/11 14:35:29 n0body Exp $
+// $Id: command.c,v 1.95 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -1021,8 +1021,8 @@
// Update interface.
//
if (unit->Player == ThisPlayer && unit->Selected) {
- UpdateButtonPanel();
- MustRedraw |= RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw |= RedrawInfoPanel;
}
}
}
@@ -1098,8 +1098,8 @@
// Update interface.
//
if( unit->Player==ThisPlayer && unit->Selected ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
}
unit->Wait=unit->Reset=1; // immediately start next command.
@@ -1194,8 +1194,8 @@
// Update interface.
//
if( unit->Player==ThisPlayer && unit->Selected ) {
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+ SelectedUnitChanged();
+ MustRedraw|=RedrawInfoPanel;
}
unit->Wait=unit->Reset=1; // immediately start next command.
Index: stratagus/src/clone/ccl_player.c
diff -u stratagus/src/clone/ccl_player.c:1.37
stratagus/src/clone/ccl_player.c:1.38
--- stratagus/src/clone/ccl_player.c:1.37 Fri Aug 1 15:30:36 2003
+++ stratagus/src/clone/ccl_player.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_player.c,v 1.37 2003/08/01 19:30:36 grumbel Exp $
+// $Id: ccl_player.c,v 1.38 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -134,7 +134,7 @@
free(str);
if( i==PlayerRaces.Count ) {
// FIXME: this leaves a half initialized player
- errl("Unsupported tag",gh_car(list));
+ errl("Unsupported race",gh_car(list));
}
list=gh_cdr(list);
} else if( gh_eq_p(value,gh_symbol2scm("ai")) ) {
Index: stratagus/src/clone/construct.c
diff -u stratagus/src/clone/construct.c:1.31
stratagus/src/clone/construct.c:1.32
--- stratagus/src/clone/construct.c:1.31 Fri Jul 11 10:35:30 2003
+++ stratagus/src/clone/construct.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: construct.c,v 1.31 2003/07/11 14:35:30 n0body Exp $
+// $Id: construct.c,v 1.32 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -140,31 +140,15 @@
*/
global void SaveConstructions(FILE* file)
{
- int i;
int j;
- char** cp;
Construction** cop;
ConstructionFrame* cframe;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: constructions $Id: construct.c,v 1.31 2003/07/11
14:35:30 n0body Exp $\n\n");
-
- //
- // Dump table wc2 construction numbers -> internal symbol.
- //
- if( (cp=ConstructionWcNames) ) {
- fprintf(file,"(define-construction-wc-names");
-
- i=90;
- while( *cp ) {
- if( i+strlen(*cp)>79 ) {
- i=fprintf(file,"\n ");
- }
- i+=fprintf(file," '%s",*cp++);
- }
- fprintf(file,")\n\n");
- }
+ fprintf(file,";;; MODULE: constructions $Id: construct.c,v 1.32 2003/08/08
10:16:43 martinxyz Exp $\n\n");
+ // FIXME: needed?
+
//
// Dump table of all constructions
//
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.139
stratagus/src/clone/mainloop.c:1.140
--- stratagus/src/clone/mainloop.c:1.139 Sat Aug 2 09:34:24 2003
+++ stratagus/src/clone/mainloop.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.139 2003/08/02 13:34:24 grumbel Exp $
+// $Id: mainloop.c,v 1.140 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -564,9 +564,9 @@
DrawMenuButtonArea();
}
if( MustRedraw&RedrawMinimapBorder ) {
- VideoDrawSub(TheUI.Minimap.Graphic,0,0
- ,TheUI.Minimap.Graphic->Width,TheUI.Minimap.Graphic->Height
- ,TheUI.MinimapX,TheUI.MinimapY);
+ VideoDrawSub(TheUI.MinimapPanel.Graphic,0,0
+
,TheUI.MinimapPanel.Graphic->Width,TheUI.MinimapPanel.Graphic->Height
+ ,TheUI.MinimapPanelX,TheUI.MinimapPanelY);
}
PlayerPixels(Players); // Reset to default colors
@@ -596,11 +596,15 @@
}
if( MustRedraw&RedrawStatusLine ) {
DrawStatusLine();
+#ifndef NEW_UI
MustRedraw|=RedrawCosts;
+#endif
}
+#ifndef NEW_UI
if( MustRedraw&RedrawCosts ) {
DrawCosts();
}
+#endif
if( MustRedraw&RedrawTimer ) {
DrawTimer();
}
@@ -664,13 +668,13 @@
}
if( MustRedraw&RedrawMinimapBorder ) {
InvalidateAreaAndCheckCursor(
- TheUI.MinimapX,TheUI.MinimapY
- ,TheUI.Minimap.Graphic->Width,TheUI.Minimap.Graphic->Height);
+ TheUI.MinimapPanelX,TheUI.MinimapPanelY
+
,TheUI.MinimapPanel.Graphic->Width,TheUI.MinimapPanel.Graphic->Height);
} else if( (MustRedraw&RedrawMinimap)
|| (MustRedraw&RedrawMinimapCursor) ) {
// FIXME: Redraws too much of the minimap
InvalidateAreaAndCheckCursor(
- TheUI.MinimapX+24,TheUI.MinimapY+2
+ TheUI.MinimapPosX,TheUI.MinimapPosY
,MINIMAP_W,MINIMAP_H);
}
if( MustRedraw&RedrawInfoPanel ) {
@@ -690,7 +694,11 @@
,TheUI.Resource.Graphic->Width
,TheUI.Resource.Graphic->Height);
}
+#ifndef NEW_UI
if( (MustRedraw&RedrawStatusLine || MustRedraw&RedrawCosts) &&
TheUI.StatusLine.Graphic ) {
+#else
+ if( MustRedraw&RedrawStatusLine && TheUI.StatusLine.Graphic ) {
+#endif
InvalidateAreaAndCheckCursor(
TheUI.StatusLineX,TheUI.StatusLineY
,TheUI.StatusLine.Graphic->Width
Index: stratagus/src/clone/player.c
diff -u stratagus/src/clone/player.c:1.86 stratagus/src/clone/player.c:1.87
--- stratagus/src/clone/player.c:1.86 Fri Jul 11 10:35:30 2003
+++ stratagus/src/clone/player.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: player.c,v 1.86 2003/07/11 14:35:30 n0body Exp $
+// $Id: player.c,v 1.87 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -189,8 +189,9 @@
int j;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: players $Id: player.c,v 1.86 2003/07/11 14:35:30
n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: players $Id: player.c,v 1.87 2003/08/08 10:16:43
martinxyz Exp $\n\n");
+#ifndef NEW_UI
//
// Dump table wc2 race numbers -> internal symbol.
//
@@ -208,6 +209,7 @@
}
fprintf(file,")\n\n");
}
+#endif
//
// Dump all players
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.281 stratagus/src/clone/unit.c:1.282
--- stratagus/src/clone/unit.c:1.281 Sat Aug 2 09:34:24 2003
+++ stratagus/src/clone/unit.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.281 2003/08/02 13:34:24 grumbel Exp $
+// $Id: unit.c,v 1.282 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -692,12 +692,14 @@
unit->Removed=1;
// Remove unit from the current selection
if( unit->Selected ) {
+#ifndef NEW_UI
if( NumSelected==1 ) { // Remove building cursor
CancelBuildingMode();
}
- UnSelectUnit(unit);
MustRedraw|=RedrawPanels;
- UpdateButtonPanel();
+#endif
+ UnSelectUnit(unit);
+ SelectionChanged();
}
// Unit is seen as under cursor
@@ -4273,11 +4275,14 @@
int InRun, RunStart;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: units $Id: unit.c,v 1.281 2003/08/02 13:34:24
grumbel Exp $\n\n");
+ fprintf(file,";;; MODULE: units $Id: unit.c,v 1.282 2003/08/08 10:16:43
martinxyz Exp $\n\n");
//
// Local variables
//
+
+ // FIXME: is this map specifig or global for the game?
+ // if it is global, don't save it
fprintf(file,"(set-hitpoint-regeneration! #%s)\n",
HitPointRegeneration ? "t" : "f");
fprintf(file,"(set-xp-damage! #%s)\n",
@@ -4338,6 +4343,7 @@
*/
global void InitUnits(void)
{
+ // probably call CleanUnits() here?
}
/**
Index: stratagus/src/clone/unit_draw.c
diff -u stratagus/src/clone/unit_draw.c:1.146
stratagus/src/clone/unit_draw.c:1.147
--- stratagus/src/clone/unit_draw.c:1.146 Thu Jul 24 15:27:32 2003
+++ stratagus/src/clone/unit_draw.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit_draw.c,v 1.146 2003/07/24 19:27:32 n0body Exp $
+// $Id: unit_draw.c,v 1.147 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -640,69 +640,6 @@
ShowLoadProgress("\tDecorations `%s'\n",SpellSprite.File);
SpellSprite.Sprite=LoadSprite(SpellSprite.File
,SpellSprite.Width,SpellSprite.Height);
- }
-}
-
-/**
-** Save decorations.
-*/
-global void SaveDecorations(FILE* file)
-{
- fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: decorations $Id: unit_draw.c,v 1.146 2003/07/24
19:27:32 n0body Exp $\n\n");
-
- fprintf(file,"(mana-sprite \"%s\" %d %d %d %d)\n",
- ManaSprite.File,ManaSprite.HotX,ManaSprite.HotY,
- ManaSprite.Width,ManaSprite.Height);
- fprintf(file,"(health-sprite \"%s\" %d %d %d %d)\n",
- HealthSprite.File,HealthSprite.HotX,HealthSprite.HotY,
- HealthSprite.Width,HealthSprite.Height);
- fprintf(file,"(shadow-sprite \"%s\" %d %d %d %d)\n",
- ShadowSprite.File,ShadowSprite.HotX,ShadowSprite.HotY,
- ShadowSprite.Width,ShadowSprite.Height);
- fprintf(file,"(spell-sprite \"%s\" %d %d %d %d)\n",
- SpellSprite.File,SpellSprite.HotX,SpellSprite.HotY,
- SpellSprite.Width,SpellSprite.Height);
-
- // This belongs to the config and not save file
- if( ShowHealthBar ) {
- fprintf(file,";(show-health-bar)\n");
- }
- if( ShowHealthDot ) {
- fprintf(file,";(show-health-dot)\n");
- }
- if( ShowHealthHorizontal ) {
- fprintf(file,";(show-health-horizontal)\n");
- } else {
- fprintf(file,";(show-health-vertical)\n");
- }
- if( ShowHealthBackgroundLong ) {
- fprintf(file,";(show-health-blackground-long)\n");
- }
- if( ShowManaBar ) {
- fprintf(file,";(show-mana-bar)\n");
- }
- if( ShowManaDot ) {
- fprintf(file,";(show-mana-dot)\n");
- }
- if( ShowManaHorizontal ) {
- fprintf(file,";(show-mana-horizontal)\n");
- } else {
- fprintf(file,";(show-mana-vertical)\n");
- }
- if( ShowManaBackgroundLong ) {
- fprintf(file,";(show-mana-blackground-long)\n");
- }
- if( ShowEnergySelectedOnly ) {
- fprintf(file,";(show-energy-selected-only)\n");
- }
- if( ShowNoFull ) {
- fprintf(file,";(show-no-full)\n");
- } else {
- fprintf(file,";(show-full)\n");
- }
- if( DecorationOnTop ) {
- fprintf(file,";(decoration-on-top)\n");
}
}
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.124
stratagus/src/editor/editloop.c:1.125
--- stratagus/src/editor/editloop.c:1.124 Sat Aug 2 09:34:24 2003
+++ stratagus/src/editor/editloop.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.124 2003/08/02 13:34:24 grumbel Exp $
+// $Id: editloop.c,v 1.125 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -922,9 +922,9 @@
//
// Minimap border
//
- if (TheUI.Minimap.Graphic) {
- VideoDrawSub(TheUI.Minimap.Graphic, 0, 0, TheUI.Minimap.Graphic->Width,
- TheUI.Minimap.Graphic->Height, TheUI.MinimapX, TheUI.MinimapY);
+ if (TheUI.MinimapPanel.Graphic) {
+ VideoDrawSub(TheUI.MinimapPanel.Graphic, 0, 0,
TheUI.MinimapPanel.Graphic->Width,
+ TheUI.MinimapPanel.Graphic->Height, TheUI.MinimapPanelX,
TheUI.MinimapPanelY);
}
//
// Minimap
@@ -1580,8 +1580,8 @@
//
// Minimap
//
- if (x >= TheUI.MinimapX+24 && x < TheUI.MinimapX+24+MINIMAP_W
- && y >= TheUI.MinimapY+2 && y < TheUI.MinimapY+2+MINIMAP_H) {
+ if (x >= TheUI.MinimapPosX && x < TheUI.MinimapPosX+MINIMAP_W
+ && y >= TheUI.MinimapPosY && y < TheUI.MinimapPosY+MINIMAP_H) {
CursorOn = CursorOnMinimap;
}
@@ -1733,8 +1733,8 @@
//
// Minimap
//
- if (x >= TheUI.MinimapX + 24 && x < TheUI.MinimapX + 24 + MINIMAP_W
- && y >= TheUI.MinimapY + 2 && y < TheUI.MinimapY + 2 + MINIMAP_H) {
+ if (x >= TheUI.MinimapPosX && x < TheUI.MinimapPosX + MINIMAP_W
+ && y >= TheUI.MinimapPosY && y < TheUI.MinimapPosY + MINIMAP_H) {
CursorOn = CursorOnMinimap;
return;
}
Index: stratagus/src/game/loadgame.c
diff -u stratagus/src/game/loadgame.c:1.55 stratagus/src/game/loadgame.c:1.56
--- stratagus/src/game/loadgame.c:1.55 Sat Aug 2 09:34:25 2003
+++ stratagus/src/game/loadgame.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: loadgame.c,v 1.55 2003/08/02 13:34:25 grumbel Exp $
+// $Id: loadgame.c,v 1.56 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -121,7 +121,7 @@
/**
** Initialize all modules.
**
-** Call each module to initialize.
+** Call each module to initialize (for LoadGame).
*/
global void InitModules(void)
{
@@ -217,8 +217,57 @@
int old_siod_verbose_level;
unsigned long game_cycle;
- CleanModules();
+ // protect from hooks
+
+ //LoadCcl(); // Reload the main config file
+ { // maxy: added instead of CleanModules(); untested
+ // FIXME: those things should be somehow either in InitModules
+ // or be cleaned implicitely when things get overriden from
+ // the savegame
+
+ EndReplayLog();
+ CleanMessages();
+
+ DestroyCursorBackground();
+ CursorBuilding=0;
+ GameCursor=0;
+ UnitUnderCursor=NoUnitP;
+ CleanAi();
+ { //CleanPlayers(); //?
+ int p;
+
+ for( p=0; p<PlayerMax; ++p ) {
+ if( Players[p].Name ) {
+ free(Players[p].Name);
+ }
+ if( Players[p].Units ) {
+ free(Players[p].Units);
+ }
+ }
+ ThisPlayer=NULL;
+ memset(Players,0,sizeof(Players));
+ NumPlayers=0;
+ // ? NoRescueCheck=0;
+ }
+
+ CleanUnits();
+ CleanSelections();
+ CleanGroups();
+ // CleanUpgrades() ?
+ // CleanDependencies() ?
+ // should not be necessary: CleanButtons()
+ CleanMissiles();
+ CleanMap();
+ CleanReplayLog();
+#ifdef HIERARCHIC_PATHFINDER
+ PfHierClean ();
+#endif
+ if (AStarOn) {
+ FreeAStar();
+ }
+ }
+ // collect garbage, then eval the savegame
old_siod_verbose_level=siod_verbose_level;
siod_verbose_level=4;
user_gc(SCM_BOOL_F);
@@ -236,8 +285,8 @@
GameCycle=game_cycle;
//GameCursor=TheUI.Point.Cursor; // FIXME: just a default.
GameCursor=CursorTypeByIdent("cursor-point"); // TheUI not cleaned
- UpdateButtonPanel();
- MustRedraw=RedrawEverything; // redraw everything
+ SelectionChanged();
+ MustRedraw=RedrawEverything;
}
/**
Index: stratagus/src/game/savegame.c
diff -u stratagus/src/game/savegame.c:1.28 stratagus/src/game/savegame.c:1.29
--- stratagus/src/game/savegame.c:1.28 Sat Aug 2 09:34:25 2003
+++ stratagus/src/game/savegame.c Fri Aug 8 06:16:43 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: savegame.c,v 1.28 2003/08/02 13:34:25 grumbel Exp $
+// $Id: savegame.c,v 1.29 2003/08/08 10:16:43 martinxyz Exp $
//@{
@@ -101,7 +101,7 @@
fprintf(file,";;;(save-game\n");
fprintf(file,";;; 'comment\t\"Generated by Stratagus Version " VERSION
"\"\n");
fprintf(file,";;; 'comment\t\"Visit http://Stratagus.Org for more
informations\"\n");
- fprintf(file,";;; 'comment\t\"$Id: savegame.c,v 1.28 2003/08/02 13:34:25
grumbel Exp $\"\n");
+ fprintf(file,";;; 'comment\t\"$Id: savegame.c,v 1.29 2003/08/08 10:16:43
martinxyz Exp $\"\n");
fprintf(file,";;; 'type\t\"%s\"\n","single-player");
fprintf(file,";;; 'date\t\"%s\"\n",s);
fprintf(file,";;; 'map\t\"%s\"\n",TheMap.Description);
@@ -127,17 +127,11 @@
fprintf(file,"(set-game-cycle! %lu)\n",GameCycle);
SaveCcl(file);
- SaveIcons(file);
- SaveCursors(file);
SaveUserInterface(file);
- SaveTilesets(file);
SaveConstructions(file);
- SaveDecorations(file);
SaveUnitTypes(file);
SaveUpgrades(file);
- SaveDependencies(file);
SaveButtons(file);
- SaveMissileTypes(file);
SavePlayers(file);
SaveMap(file);
SaveUnits(file);
Index: stratagus/src/include/cursor.h
diff -u stratagus/src/include/cursor.h:1.32 stratagus/src/include/cursor.h:1.33
--- stratagus/src/include/cursor.h:1.32 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/cursor.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.h,v 1.32 2003/07/11 14:35:30 n0body Exp $
+// $Id: cursor.h,v 1.33 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __CURSOR_H__
#define __CURSOR_H__
@@ -179,7 +179,11 @@
extern CursorStates CursorState; /// current cursor state (point,...)
extern int CursorAction; /// action for selection
+#ifndef NEW_UI
extern int CursorValue; /// value for action (spell
type f.e.)
+#else
+extern int CursorSpell; /// spell type for target selection
+#endif
extern UnitType* CursorBuilding; /// building cursor
extern CursorType* GameCursor; /// cursor-type
Index: stratagus/src/include/depend.h
diff -u stratagus/src/include/depend.h:1.14 stratagus/src/include/depend.h:1.15
--- stratagus/src/include/depend.h:1.14 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/depend.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: depend.h,v 1.14 2003/07/11 14:35:30 n0body Exp $
+// $Id: depend.h,v 1.15 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __DEPEND_H__
#define __DEPEND_H__
@@ -137,8 +137,6 @@
extern void InitDependencies(void);
/// Load the dependencies
extern void LoadDependencies(FILE* file);
- /// Save the dependencies
-extern void SaveDependencies(FILE* file);
/// Cleanup dependencies module
extern void CleanDependencies();
Index: stratagus/src/include/icons.h
diff -u stratagus/src/include/icons.h:1.35 stratagus/src/include/icons.h:1.36
--- stratagus/src/include/icons.h:1.35 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/icons.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: icons.h,v 1.35 2003/07/11 14:35:30 n0body Exp $
+// $Id: icons.h,v 1.36 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __ICONS_H__
#define __ICONS_H__
@@ -219,7 +219,6 @@
/// Draw icon of an unit
extern void DrawUnitIcon(const Player*,Icon*,unsigned,int,int);
-extern void SaveIcons(FILE*); /// Save icons
extern void IconCclRegister(void); /// Register CCL features
//@}
Index: stratagus/src/include/interface.h
diff -u stratagus/src/include/interface.h:1.79
stratagus/src/include/interface.h:1.80
--- stratagus/src/include/interface.h:1.79 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/interface.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.h,v 1.79 2003/07/11 14:35:30 n0body Exp $
+// $Id: interface.h,v 1.80 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
@@ -40,54 +40,65 @@
#include "player.h"
#include "unit.h"
#include "icons.h"
+#ifdef NEW_UI
+#include "ccl.h"
+#endif
/*----------------------------------------------------------------------------
-- Definitons
----------------------------------------------------------------------------*/
- /// Button Commands
+ /// Button Commands that need target selection
enum _button_cmd_ {
- ButtonMove, /// order move
+ ButtonMove, /// order move
+ ButtonAttack, /// order attack
+ ButtonRepair, /// order repair
+ ButtonHarvest, /// order harvest
+ ButtonBuild, /// order build
+ ButtonPatrol, /// order patrol
+ ButtonAttackGround, /// order attack ground
+ ButtonSpellCast, /// order cast spell
+ ButtonUnload, /// order unload unit
+ ButtonDemolish, /// order demolish/explode
+#ifndef NEW_UI
ButtonStop, /// order stop
- ButtonAttack, /// order attack
- ButtonRepair, /// order repair
- ButtonHarvest, /// order harvest
ButtonButton, /// choose other button set
- ButtonBuild, /// order build
ButtonTrain, /// order train
- ButtonPatrol, /// order patrol
ButtonStandGround, /// order stand ground
- ButtonAttackGround, /// order attack ground
ButtonReturn, /// order return goods
- ButtonDemolish, /// order demolish/explode
- ButtonSpellCast, /// order cast spell
ButtonResearch, /// order reseach
ButtonUpgradeTo, /// order upgrade
- ButtonUnload, /// order unload unit
ButtonCancel, /// cancel
ButtonCancelUpgrade, /// cancel upgrade
ButtonCancelTrain, /// cancel training
ButtonCancelBuild, /// cancel building
+#endif
};
/// typedef for action of button
typedef struct _button_action_ ButtonAction;
+#ifndef NEW_UI
typedef int (*ButtonCheckFunc)(const Unit*,const ButtonAction*);
+#endif
/// Action of button
struct _button_action_ {
+#ifndef NEW_UI
int Pos; /// button position in the grid
int Level; /// requires button level
- IconConfig Icon; /// icon to display
enum _button_cmd_ Action; /// command on button press
int Value; /// extra value for command
char* ValueStr; /// keep original value string
/// Check if this button is allowed
ButtonCheckFunc Allowed;
char* AllowStr; /// argument for allowed
+ char* UnitMask; /// for which units is it available
+#else
+ SCM Action; /// script on button press
+#endif
+ IconConfig Icon; /// icon to display
int Key; /// alternative on keyboard
char* Hint; /// tip text
- char* UnitMask; /// for which units is it available
};
/// Button area under cursor
@@ -297,11 +308,18 @@
extern void InitButtons(void);
/// Free memory for buttons
extern void CleanButtons(void);
+#ifndef NEW_UI
/// Make a new button
extern int AddButton(int pos,int level,const char* IconIdent,
enum _button_cmd_ action,const char* value,
const ButtonCheckFunc func,const void* arg,
int key,const char* hint,const char* umask);
+#else
+ /// Add a new button to the command panel
+extern void AddButton(int pos, char *icon_ident, SCM action, int key, char
*hint);
+ /// Remove a single button from the panel
+global void RemoveButton(int pos);
+#endif
/// Save all buttons
extern void SaveButtons(FILE* file);
@@ -388,11 +406,13 @@
/// Draw status line
extern void DrawStatusLine(void);
/// Draw costs in status line
+#ifndef NEW_UI
extern void DrawCosts(void);
/// Set costs to be displayed in status line
extern void SetCosts(int,int,const int* costs);
/// Clear the costs displayed in status line (undisplay!)
extern void ClearCosts(void);
+#endif
/// Draw the unit info panel
extern void DrawInfoPanel(void);
@@ -405,13 +425,18 @@
/// Update the content of the unit button panel
extern void UpdateButtonPanel(void);
/// Handle button click in button panel area
+#ifndef NEW_UI
extern void DoButtonButtonClicked(int button);
+#else
+extern void DoButtonButtonClicked(int pos);
+#endif
/// Lookup key for bottom panel buttons
extern int DoButtonPanelKey(int key);
/// Handle the mouse in scroll area
extern int HandleMouseScrollArea(int,int);
+#ifndef NEW_UI
//
// in button_checks.c
//
@@ -433,7 +458,6 @@
extern int ButtonCheckNoWork(const Unit*,const ButtonAction*);
/// Check if unit isn't researching or upgrading
extern int ButtonCheckNoResearch(const Unit*,const ButtonAction*);
-
/// Check if all requirements for an attack to are meet
extern int ButtonCheckAttack(const Unit*,const ButtonAction*);
/// Check if all requirements for an upgrade to are meet
@@ -442,6 +466,21 @@
extern int ButtonCheckResearch(const Unit*,const ButtonAction*);
/// Check if all requirements for a single research are meet
extern int ButtonCheckSingleResearch(const Unit*,const ButtonAction*);
+#endif
+
+//
+// in ccl_ui.c
+//
+ /// Called whenever the units selection is altered
+extern void SelectionChanged(void);
+ /// Called whenever the selected unit was updated
+extern void SelectedUnitChanged(void);
+#ifdef NEW_UI
+ /// Enter target selection mode
+extern void ChooseTargetBegin(int action);
+ /// Clean up when leaving target selection mode
+extern void ChooseTargetFinish(void);
+#endif
//@}
Index: stratagus/src/include/missile.h
diff -u stratagus/src/include/missile.h:1.59
stratagus/src/include/missile.h:1.60
--- stratagus/src/include/missile.h:1.59 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/missile.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.h,v 1.59 2003/07/11 14:35:30 n0body Exp $
+// $Id: missile.h,v 1.60 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __MISSILE_H__
#define __MISSILE_H__
@@ -529,8 +529,6 @@
/// distance from view point to missile
extern int ViewPointDistanceToMissile(const Missile*);
- /// Save missile-types
-extern void SaveMissileTypes(FILE*);
/// Save missiles
extern void SaveMissiles(FILE*);
Index: stratagus/src/include/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.8
stratagus/src/include/stratagus.h:1.9
--- stratagus/src/include/stratagus.h:1.8 Tue Jul 22 10:32:21 2003
+++ stratagus/src/include/stratagus.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: stratagus.h,v 1.8 2003/07/22 14:32:21 n0body Exp $
+// $Id: stratagus.h,v 1.9 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __STRATAGUS_H__
#define __STRATAGUS_H__
@@ -404,7 +404,10 @@
RedrawButtonPanel = 1<<16, /// Unit buttons
RedrawFillers = 1<<17, /// Fillers
RedrawMinimapBorder = 1<<18, /// Area around minimap
+
+#ifndef NEW_UI
RedrawCosts = 1<<19, /// Costs in status line
+#endif
RedrawMenuButton = 1<<20, /// Area above minimap
RedrawMinimapCursor = 1<<21, /// Minimap cursor changed
RedrawMenu = 1<<22, /// Menu
Index: stratagus/src/include/tileset.h
diff -u stratagus/src/include/tileset.h:1.42
stratagus/src/include/tileset.h:1.43
--- stratagus/src/include/tileset.h:1.42 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/tileset.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: tileset.h,v 1.42 2003/07/11 14:35:30 n0body Exp $
+// $Id: tileset.h,v 1.43 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __TILESET_H__
#define __TILESET_H__
@@ -334,7 +334,6 @@
----------------------------------------------------------------------------*/
extern void LoadTileset(void); /// Load tileset definition
-extern void SaveTilesets(FILE*); /// Save the tileset configuration
extern void CleanTilesets(void); /// Cleanup the tileset module
extern void TilesetCclRegister(void); /// Register CCL features for tileset
Index: stratagus/src/include/ui.h
diff -u stratagus/src/include/ui.h:1.62 stratagus/src/include/ui.h:1.63
--- stratagus/src/include/ui.h:1.62 Fri Jul 11 10:35:30 2003
+++ stratagus/src/include/ui.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.62 2003/07/11 14:35:30 n0body Exp $
+// $Id: ui.h,v 1.63 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -256,9 +256,11 @@
NetworkDiplomacyButton;
// The minimap
- GraphicConfig Minimap; /// minimap panel background
- int MinimapX; /// minimap screen X position
- int MinimapY; /// minimap screen Y position
+ GraphicConfig MinimapPanel; /// minimap panel background
+ int MinimapPanelX; /// minimap panel screen X
position
+ int MinimapPanelY; /// minimap panel screen Y
position
+ int MinimapPosX; /// minimap screen X position
+ int MinimapPosY; /// minimap screen Y position
int ViewportCursorColor; /// minimap cursor color
// The status line
Index: stratagus/src/include/unit.h
diff -u stratagus/src/include/unit.h:1.199 stratagus/src/include/unit.h:1.200
--- stratagus/src/include/unit.h:1.199 Thu Jul 24 15:27:32 2003
+++ stratagus/src/include/unit.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.h,v 1.199 2003/07/24 19:27:32 n0body Exp $
+// $Id: unit.h,v 1.200 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __UNIT_H__
#define __UNIT_H__
@@ -948,8 +948,6 @@
extern void DecorationCclRegister(void);
/// Load the decorations (health,mana) of units
extern void LoadDecorations(void);
- /// Save the decorations (health,mana) of units
-extern void SaveDecorations(FILE* file);
/// Clean the decorations (health,mana) of units
extern void CleanDecorations(void);
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.91
stratagus/src/include/unittype.h:1.92
--- stratagus/src/include/unittype.h:1.91 Thu Jul 24 15:27:32 2003
+++ stratagus/src/include/unittype.h Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.91 2003/07/24 19:27:32 n0body Exp $
+// $Id: unittype.h,v 1.92 2003/08/08 10:16:44 martinxyz Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -443,6 +443,9 @@
#include "upgrade_structs.h"
#include "construct.h"
#include "etlib/hash.h"
+#ifdef NEW_UI
+#include "ccl.h"
+#endif
/*----------------------------------------------------------------------------
-- Declarations
@@ -628,6 +631,10 @@
Graphic* ShadowSprite; /// Shadow sprite image
#ifdef USE_OPENGL
Graphic* PlayerColorSprite[PlayerMax]; /// Sprites with player colors
+#endif
+#ifdef NEW_UI
+
+ SCM AddButtonsHook; /// Script called to add UI
buttons
#endif
};
Index: stratagus/src/map/minimap.c
diff -u stratagus/src/map/minimap.c:1.59 stratagus/src/map/minimap.c:1.60
--- stratagus/src/map/minimap.c:1.59 Tue Jul 22 10:32:22 2003
+++ stratagus/src/map/minimap.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: minimap.c,v 1.59 2003/07/22 14:32:22 n0body Exp $
+// $Id: minimap.c,v 1.60 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -101,7 +101,8 @@
int y;
int scale;
- if( !(scale=(MinimapScale/MINIMAP_FAC)) ) {
+ scale=MinimapScale/MINIMAP_FAC;
+ if( scale == 0 ) {
scale=1;
}
//
@@ -257,14 +258,12 @@
}
//
- // Draw the mini-map background. Note draws a little too much.
+ // Set the pixels on the minimap background to transparent (0).
//
- // FIXME: position of the minimap in the graphic is hardcoded (24x2)
- for( h=0; h<MINIMAP_H; ++h ) {
- memcpy(&((unsigned char*)MinimapGraphic->Frames)[h*MINIMAP_W],
- &((unsigned
char*)TheUI.Minimap.Graphic->Frames)[24+(h+2)*TheUI.Minimap.Graphic->Width],
- TheUI.Minimap.Graphic->Width);
- }
+ // FIXME: make the image really use colorkey
+ // FIXME: I think this is only necessary on each map size change?
+ // Or maybe if you disable displaying terrain, too?
+ memset(MinimapGraphic->Frames, 0, MINIMAP_W*MINIMAP_H);
//
// Draw the terrain
@@ -405,9 +404,13 @@
global void DrawMinimap(int vx __attribute__((unused)),
int vy __attribute__((unused)))
{
+ // draw background
+ VideoDrawSub(TheUI.MinimapPanel.Graphic,0,0
+
,TheUI.MinimapPanel.Graphic->Width,TheUI.MinimapPanel.Graphic->Height
+ ,TheUI.MinimapPanelX,TheUI.MinimapPanelY);
VideoDrawSub(MinimapGraphic,0,0
,MinimapGraphic->Width,MinimapGraphic->Height
- ,TheUI.MinimapX+24,TheUI.MinimapY+2);
+ ,TheUI.MinimapPosX,TheUI.MinimapPosY);
}
/**
@@ -440,9 +443,9 @@
// Determine and save region below minimap cursor
// FIXME: position of the minimap in the graphic is hardcoded (24x2)
OldMinimapCursorX=x=
- TheUI.MinimapX+24+MinimapX+(vx*MinimapScale)/MINIMAP_FAC;
+ TheUI.MinimapPosX+MinimapX+(vx*MinimapScale)/MINIMAP_FAC;
OldMinimapCursorY=y=
- TheUI.MinimapY+2+MinimapY+(vy*MinimapScale)/MINIMAP_FAC;
+ TheUI.MinimapPosY+MinimapY+(vy*MinimapScale)/MINIMAP_FAC;
OldMinimapCursorW=w=
(TheUI.SelectedViewport->MapWidth*MinimapScale)/MINIMAP_FAC;
OldMinimapCursorH=h=
@@ -473,7 +476,7 @@
{
int tx;
- tx=((((x)-TheUI.MinimapX-24-MinimapX)*MINIMAP_FAC)/MinimapScale);
+ tx=((((x)-TheUI.MinimapPosX-MinimapX)*MINIMAP_FAC)/MinimapScale);
if( tx<0 ) {
return 0;
}
@@ -490,7 +493,7 @@
{
int ty;
- ty=((((y)-TheUI.MinimapY-2-MinimapY)*MINIMAP_FAC)/MinimapScale);
+ ty=((((y)-TheUI.MinimapPosY-MinimapY)*MINIMAP_FAC)/MinimapScale);
if( ty<0 ) {
return 0;
}
Index: stratagus/src/map/tileset.c
diff -u stratagus/src/map/tileset.c:1.47 stratagus/src/map/tileset.c:1.48
--- stratagus/src/map/tileset.c:1.47 Sat Aug 2 09:34:25 2003
+++ stratagus/src/map/tileset.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: tileset.c,v 1.47 2003/08/02 13:34:25 grumbel Exp $
+// $Id: tileset.c,v 1.48 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -517,233 +517,6 @@
}
}
};
-
-/**
-** Save flag part of tileset.
-**
-** @param file File handle for the saved flags.
-** @param flags Bit field of the flags.
-*/
-local void SaveTilesetFlags(FILE* file, unsigned flags)
-{
- if (flags & MapFieldWaterAllowed) {
- fprintf(file, " 'water");
- }
- if (flags & MapFieldLandAllowed) {
- fprintf(file, " 'land");
- }
- if (flags & MapFieldCoastAllowed) {
- fprintf(file, " 'coast");
- }
- if (flags & MapFieldNoBuilding) {
- fprintf(file, " 'no-building");
- }
- if (flags & MapFieldUnpassable) {
- fprintf(file, " 'unpassable");
- }
- if (flags & MapFieldWall) {
- fprintf(file, " 'wall");
- }
- if (flags & MapFieldRocks) {
- fprintf(file, " 'rock");
- }
- if (flags & MapFieldForest) {
- fprintf(file, " 'forest");
- }
- if (flags & MapFieldLandUnit) {
- fprintf(file, " 'land-unit");
- }
- if (flags & MapFieldAirUnit) {
- fprintf(file, " 'air-unit");
- }
- if (flags & MapFieldSeaUnit) {
- fprintf(file, " 'sea-unit");
- }
- if (flags & MapFieldBuilding) {
- fprintf(file, " 'building");
- }
- if (flags & MapFieldHuman) {
- fprintf(file, " 'human");
- }
-}
-
-/**
-** Save solid part of tileset.
-**
-** @param file File handle to save the solid part.
-** @param table Tile numbers.
-** @param name Ascii name of solid tile
-** @param flags Tile attributes.
-** @param start Start index into table.
-*/
-local void SaveTilesetSolid(FILE* file, const unsigned short* table,
- const char* name, unsigned flags, int start)
-{
- int i;
- int j;
- int n;
-
- fprintf(file, " 'solid (list \"%s\"", name);
- SaveTilesetFlags(file, flags);
- // Remove empty tiles at end of block
- for (n = 15; n >= 0 && !table[start + n]; n--) {
- }
- i = fprintf(file, "\n #(");
- for (j = 0; j <= n; ++j) {
- i += fprintf(file, " %3d", table[start + j]);
- }
- i += fprintf(file, "))");
-
- while ((i += 8) < 80) {
- fprintf(file, "\t");
- }
- fprintf(file, "; %03X\n", start);
-}
-
-/**
-** Save mixed part of tileset.
-**
-** @param file File handle to save the mixed part.
-** @param table Tile numbers.
-** @param name1 First ascii name of mixed tiles.
-** @param name2 Second Ascii name of mixed tiles.
-** @param flags Tile attributes.
-** @param start Start index into table.
-** @param end End of tiles.
-*/
-local void SaveTilesetMixed(FILE* file, const unsigned short* table,
- const char* name1, const char* name2, unsigned flags, int start, int end)
-{
- int x;
- int i;
- int j;
- int n;
-
- fprintf(file, " 'mixed (list \"%s\" \"%s\"", name1, name2);
- SaveTilesetFlags(file, flags);
- fprintf(file,"\n");
- for (x = 0; x < 0x100; x += 0x10) {
- if (start + x >= end) { // Check end must be 0x10 aligned
- break;
- }
- fprintf(file, " #(");
- // Remove empty slots at end of table
- for (n = 15; n >= 0 && !table[start + x + n]; n--) {
- }
- i = 6;
- for (j = 0; j <= n; ++j) {
- i += fprintf(file, " %3d", table[start + x + j]);
- }
- if (x == 0xF0 ) {
- i += fprintf(file, "))");
- } else {
- i += fprintf(file, ")");
- }
-
- while ((i += 8) < 80) {
- fprintf(file, "\t");
- }
- fprintf(file, "; %03X\n", start + x);
- }
-}
-
-/**
-** Save the tileset.
-**
-** @param file Output file.
-** @param tileset Save the content of this tileset.
-*/
-local void SaveTileset(FILE* file, const Tileset* tileset)
-{
- const unsigned short* table;
- int i;
- int n;
-
- fprintf(file, "\n(define-tileset\n '%s 'class '%s", tileset->Ident,
- tileset->Class);
- fprintf(file, "\n 'name \"%s\"", tileset->Name);
- fprintf(file, "\n 'image \"%s\"", tileset->ImageFile);
- fprintf(file, "\n 'palette \"%s\"", tileset->PaletteFile);
- fprintf(file, "\n ;; Slots descriptions");
- fprintf(file,
- "\n 'slots (list\n 'special (list\t\t;; Can't be in pud\n");
- fprintf(file, " 'extra-trees #( %d %d %d %d %d %d )\n",
- tileset->ExtraTrees[0], tileset->ExtraTrees[1]
- , tileset->ExtraTrees[2], tileset->ExtraTrees[3]
- , tileset->ExtraTrees[4], tileset->ExtraTrees[5]);
- fprintf(file, " 'top-one-tree %d 'mid-one-tree %d 'bot-one-tree %d\n",
- tileset->TopOneTree, tileset->MidOneTree, tileset->BotOneTree);
- fprintf(file, " 'removed-tree %d\n", tileset->RemovedTree);
- fprintf(file, " 'growing-tree #( %d %d )\n", tileset->GrowingTree[0],
- tileset->GrowingTree[1]);
- fprintf(file, " 'extra-rocks #( %d %d %d %d %d %d )\n",
- tileset->ExtraRocks[0], tileset->ExtraRocks[1]
- , tileset->ExtraRocks[2], tileset->ExtraRocks[3]
- , tileset->ExtraRocks[4], tileset->ExtraRocks[5]);
- fprintf(file, " 'top-one-rock %d 'mid-one-rock %d 'bot-one-rock %d\n",
- tileset->TopOneRock, tileset->MidOneRock, tileset->BotOneRock);
- fprintf(file, " 'removed-rock %d )\n", tileset->RemovedRock);
-
- table = tileset->Table;
- n = tileset->NumTiles;
-
- for (i = 0; i < n;) {
- //
- // Mixeds
- //
- if (tileset->BasicNameTable[i] && tileset->MixedNameTable[i]) {
- SaveTilesetMixed(file, table,
- tileset->TileNames[tileset->BasicNameTable[i]],
- tileset->TileNames[tileset->MixedNameTable[i]],
- tileset->FlagsTable[i], i, n);
- i += 256;
- //
- // Solids
- //
- } else {
- SaveTilesetSolid(file, table,
- tileset->TileNames[tileset->BasicNameTable[i]],
- tileset->FlagsTable[i], i);
- i += 16;
- }
- }
- fprintf(file, " )\n");
- fprintf(file, " ;; Animated tiles\n");
- fprintf(file, " 'animations (list #( ) )\n");
- fprintf(file, " 'objects (list #( ) ))\n");
-}
-
-/**
-** Save the current tileset module.
-**
-** @param file Output file.
-*/
-global void SaveTilesets(FILE* file)
-{
- int i;
- char** sp;
-
- fprintf(file, "\n;;; -----------------------------------------\n");
- fprintf(file,
- ";;; MODULE: tileset $Id: tileset.c,v 1.47 2003/08/02 13:34:25 grumbel
Exp $\n\n");
-
- // Original number to internal tileset name
-
- i = fprintf(file, "(define-tileset-wc-names");
- for (sp = TilesetWcNames; *sp; ++sp) {
- if (i + strlen(*sp) > 79) {
- i = fprintf(file, "\n ");
- }
- i += fprintf(file, " '%s", *sp);
- }
- fprintf(file, ")\n");
-
- // Save all loaded tilesets
-
- for (i = 0; i < NumTilesets; ++i) {
- SaveTileset(file, Tilesets[i]);
- }
-}
/**
** Cleanup the tileset module.
Index: stratagus/src/missile/missile.c
diff -u stratagus/src/missile/missile.c:1.73
stratagus/src/missile/missile.c:1.74
--- stratagus/src/missile/missile.c:1.73 Fri Jul 18 16:26:20 2003
+++ stratagus/src/missile/missile.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: missile.c,v 1.73 2003/07/18 20:26:20 grumbel Exp $
+// $Id: missile.c,v 1.74 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -1511,75 +1511,6 @@
}
/**
-** Save the missile-types to file.
-**
-** @param file Output file.
-**
-** @todo FIXME: CanHitOwner and FriendlyFire not supported!
-*/
-global void SaveMissileTypes(FILE* file)
-{
- MissileType* mtype;
- char** sp;
- int i;
-
- fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: missile-types $Id: missile.c,v 1.73 2003/07/18
20:26:20 grumbel Exp $\n\n");
-
- //
- // Original number to internal missile-type name.
- //
- i=fprintf(file,"(define-missiletype-wc-names");
- for( sp=MissileTypeWcNames; *sp; ++sp ) {
- if( i+strlen(*sp)>79 ) {
- i=fprintf(file,"\n ");
- }
- i+=fprintf(file," '%s",*sp);
- }
- fprintf(file,")\n\n");
-
- //
- // Missile types
- //
- for( mtype=MissileTypes; mtype<&MissileTypes[NumMissileTypes]; ++mtype ) {
- fprintf(file,"(define-missile-type '%s\n ",mtype->Ident);
- if( mtype->File ) {
- fprintf(file," 'file \"%s\"",mtype->File);
- }
- fprintf(file," 'size '(%d %d)",mtype->Width,mtype->Height);
- if( mtype->Sprite ) {
- fprintf(file," 'frames %d",mtype->SpriteFrames);
- }
- fprintf(file,"\n 'num-directions %d",mtype->NumDirections);
- fprintf(file,"\n ");
- if( mtype->FiredSound.Name ) {
- fprintf(file," 'fired-sound \"%s\"",mtype->FiredSound.Name);
- }
- if( mtype->ImpactSound.Name ) {
- fprintf(file," 'impact-sound \"%s\"",mtype->ImpactSound.Name);
- }
- if( mtype->FiredSound.Name || mtype->ImpactSound.Name ) {
- fprintf(file,"\n ");
- }
- fprintf(file," 'class '%s",MissileClassNames[mtype->Class]);
- fprintf(file," 'draw-level %d ",mtype->DrawLevel);
- if( mtype->StartDelay ) {
- fprintf(file," 'delay %d",mtype->StartDelay);
- }
- fprintf(file," 'sleep %d",mtype->Sleep);
- fprintf(file," 'speed %d",mtype->Speed);
- fprintf(file," 'range %d",mtype->Range);
- if( mtype->ImpactMissile ) {
- fprintf(file,"\n 'impact-missile '%s",mtype->ImpactMissile->Ident);
- }
- fprintf(file,"\n ");
- fprintf(file," 'can-hit-owner #%c",mtype->CanHitOwner ? 't' : 'f');
- fprintf(file," 'friendly-fire #%c",mtype->FriendlyFire ? 't' : 'f');
- fprintf(file,")\n");
- }
-}
-
-/**
** Save the state of a missile to file.
*/
local void SaveMissile(const Missile* missile,FILE* file)
@@ -1619,7 +1550,7 @@
Missile* const* missiles;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.73 2003/07/18
20:26:20 grumbel Exp $\n\n");
+ fprintf(file,";;; MODULE: missiles $Id: missile.c,v 1.74 2003/08/08
10:16:44 martinxyz Exp $\n\n");
for( missiles=GlobalMissiles; *missiles; ++missiles ) {
SaveMissile(*missiles,file);
Index: stratagus/src/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.80 stratagus/src/ui/botpanel.c:1.81
--- stratagus/src/ui/botpanel.c:1.80 Tue Jul 22 10:32:22 2003
+++ stratagus/src/ui/botpanel.c Fri Aug 8 06:16:44 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: botpanel.c,v 1.80 2003/07/22 14:32:22 n0body Exp $
+// $Id: botpanel.c,v 1.81 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -56,23 +56,26 @@
-- Defines
----------------------------------------------------------------------------*/
+#ifndef NEW_UI
/// How many different buttons are allowed
#define MAX_BUTTONS 2048
+#endif
/*----------------------------------------------------------------------------
-- Variables
----------------------------------------------------------------------------*/
- /// for unit buttons sub-menus etc.
-global int CurrentButtonLevel;
-
/// Display the command key in the buttons.
global char ShowCommandKey;
+#ifndef NEW_UI
+ /// for unit buttons sub-menus etc.
+global int CurrentButtonLevel;
/// All buttons for units
local ButtonAction *UnitButtonTable[MAX_BUTTONS];
/// buttons in UnitButtonTable
local int NumUnitButtons;
+#endif
/*----------------------------------------------------------------------------
-- Functions
@@ -83,6 +86,7 @@
*/
global void InitButtons(void)
{
+#ifndef NEW_UI
int z;
//
@@ -92,6 +96,10 @@
UnitButtonTable[z]->Icon.Icon
= IconByIdent(UnitButtonTable[z]->Icon.Name);
}
+#else
+ // FIXME: proabably not necessary
+ //CleanButtons();
+#endif
}
/**
@@ -99,148 +107,11 @@
*/
global void SaveButtons(FILE* file)
{
- int i;
- int n;
- char* cp;
-
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: buttons $Id: botpanel.c,v 1.80 2003/07/22
14:32:22 n0body Exp $\n\n");
-
- for( i=0; i<NumUnitButtons; ++i ) {
- fprintf(file,"(define-button 'pos %d 'level %d 'icon '%s\n",
- UnitButtonTable[i]->Pos,
- UnitButtonTable[i]->Level,
- IdentOfIcon(UnitButtonTable[i]->Icon.Icon));
- fprintf(file," 'action ");
- switch( UnitButtonTable[i]->Action ) {
- case ButtonMove:
- fprintf(file,"'move"); break;
- case ButtonStop:
- fprintf(file,"'stop"); break;
- case ButtonAttack:
- fprintf(file,"'attack"); break;
- case ButtonRepair:
- fprintf(file,"'repair"); break;
- case ButtonHarvest:
- fprintf(file,"'harvest"); break;
- case ButtonButton:
- fprintf(file,"'button"); break;
- case ButtonBuild:
- fprintf(file,"'build"); break;
- case ButtonTrain:
- fprintf(file,"'train-unit"); break;
- case ButtonPatrol:
- fprintf(file,"'patrol"); break;
- case ButtonStandGround:
- fprintf(file,"'stand-ground"); break;
- case ButtonAttackGround:
- fprintf(file,"'attack-ground"); break;
- case ButtonReturn:
- fprintf(file,"'return-goods"); break;
- case ButtonDemolish:
- fprintf(file,"'demolish"); break;
- case ButtonSpellCast:
- fprintf(file,"'cast-spell"); break;
- case ButtonResearch:
- fprintf(file,"'research"); break;
- case ButtonUpgradeTo:
- fprintf(file,"'upgrade-to"); break;
- case ButtonUnload:
- fprintf(file,"'unload"); break;
- case ButtonCancel:
- fprintf(file,"'cancel"); break;
- case ButtonCancelUpgrade:
- fprintf(file,"'cancel-upgrade"); break;
- case ButtonCancelTrain:
- fprintf(file,"'cancel-train-unit"); break;
- case ButtonCancelBuild:
- fprintf(file,"'cancel-build"); break;
- }
- if( UnitButtonTable[i]->ValueStr ) {
- if( isdigit(UnitButtonTable[i]->ValueStr[0]) ) {
- fprintf(file," 'value %s\n",UnitButtonTable[i]->ValueStr);
- } else {
- fprintf(file," 'value '%s\n",UnitButtonTable[i]->ValueStr);
- }
- } else {
- fprintf(file,"\n");
- }
- if( UnitButtonTable[i]->Allowed ) {
- fprintf(file," 'allowed ");
- if( UnitButtonTable[i]->Allowed == ButtonCheckTrue ) {
- fprintf(file,"'check-true");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckFalse ) {
- fprintf(file,"'check-false");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckUpgrade ) {
- fprintf(file,"'check-upgrade");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckUnitsOr ) {
- fprintf(file,"'check-units-or");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckUnitsAnd ) {
- fprintf(file,"'check-units-and");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckNetwork ) {
- fprintf(file,"'check-network");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckNoNetwork ) {
- fprintf(file,"'check-no-network");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckNoWork ) {
- fprintf(file,"'check-no-work");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckNoResearch ) {
- fprintf(file,"'check-no-research");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckAttack ) {
- fprintf(file,"'check-attack");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckUpgradeTo ) {
- fprintf(file,"'check-upgrade-to");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckResearch ) {
- fprintf(file,"'check-research");
- } else if( UnitButtonTable[i]->Allowed == ButtonCheckSingleResearch
) {
- fprintf(file,"'check-single-research");
- } else {
- DebugLevel0Fn("Unsupported check function %p\n" _C_
- UnitButtonTable[i]->Allowed);
- fprintf(file,"%p",UnitButtonTable[i]->Allowed);
- }
- if( UnitButtonTable[i]->AllowStr ) {
- fprintf(file," 'allow-arg '(");
- cp=alloca(strlen(UnitButtonTable[i]->AllowStr));
- strcpy(cp,UnitButtonTable[i]->AllowStr);
- cp=strtok(cp,",");
- while( cp ) {
- fprintf(file,"%s",cp);
- cp=strtok(NULL,",");
- if( cp ) {
- fprintf(file," ");
- }
- }
- fprintf(file,")");
- }
- fprintf(file,"\n");
- }
- fprintf(file," 'key \"");
- switch( UnitButtonTable[i]->Key ) {
- case '\033':
- fprintf(file,"\\%03o",UnitButtonTable[i]->Key);
- break;
- default:
- fprintf(file,"%c",UnitButtonTable[i]->Key);
- break;
- }
- fprintf(file,"\" 'hint \"%s\"\n",UnitButtonTable[i]->Hint);
- n=fprintf(file," 'for-unit '(");
- cp=alloca(strlen(UnitButtonTable[i]->UnitMask));
- strcpy(cp,UnitButtonTable[i]->UnitMask);
- cp=strtok(cp,",");
- while( cp ) {
- if( n+strlen(cp)>78 ) {
- n=fprintf(file,"\n ");
- }
- n+=fprintf(file,"%s",cp);
- cp=strtok(NULL,",");
- if( cp ) {
- n+=fprintf(file," ");
- }
- }
- fprintf(file,"))\n\n");
- }
+ fprintf(file,";;; MODULE: buttons $Id: botpanel.c,v 1.81 2003/08/08
10:16:44 martinxyz Exp $\n\n");
+ // Hmm, is this needed? maybe it is set in a tutorial level which
+ // might be saved?
fprintf(file,"(set-show-command-key! %s)\n\n",
ShowCommandKey ? "#t" : "#f");
}
@@ -263,17 +134,41 @@
-- Buttons structures
----------------------------------------------------------------------------*/
+#ifndef NEW_UI
global ButtonAction* CurrentButtons; /// Pointer to current buttons
local ButtonAction _current_buttons[9]; /// FIXME: this is just for test
+#else
+global ButtonAction CurrentButtons[9]; /// Pointer to current buttons
+#endif
+
+#ifdef NEW_UI
+local void CleanButton(ButtonAction * ba)
+{
+ if( !ba->Icon.Name ) {
+ return;
+ }
+ free(ba->Icon.Name);
+ CclGcUnprotect(ba->Action);
+ memset(ba, 0, sizeof(*ba));
+ MustRedraw|=RedrawButtonPanel;
+}
+#endif
/// FIXME: docu
+#ifndef NEW_UI
int AddButton(int pos, int level, const char *icon_ident,
enum _button_cmd_ action, const char *value, const ButtonCheckFunc func,
const void *allow, int key, const char *hint, const char *umask)
+#else
+global void AddButton(int pos, char *icon_ident, SCM action, int key, char
*hint)
+#endif
{
+#ifndef NEW_UI
char buf[2048];
+#endif
ButtonAction *ba;
+#ifndef NEW_UI
ba = (ButtonAction *) malloc(sizeof(ButtonAction));
DebugCheck(!ba); //FIXME: perhaps should return error?
@@ -316,7 +211,6 @@
} else {
ba->AllowStr = NULL;
}
-
ba->Key = key;
ba->Hint = strdup(hint);
//FIXME: here should be added costs to the hint
@@ -328,17 +222,57 @@
}
ba->UnitMask = strdup(buf);
UnitButtonTable[NumUnitButtons++] = ba;
-
// FIXME: check if already initited
//DebugCheck(ba->Icon.Icon == NoIcon);// just checks, that's why at the end
return 1;
+#else
+ if( pos<1 || pos>9 ) {
+ DebugLevel0Fn("Bad button positon %d (Icon.Name=%s)\n" _C_ pos _C_
icon_ident);
+ // FIXME: better way to kill the program?
+ DebugCheck(1);
+ }
+ ba = CurrentButtons + (pos-1);
+ CleanButton(ba);
+
+ // maxy: the caller does not free this pointer
+ ba->Icon.Name = icon_ident;
+ ba->Icon.Icon = IconByIdent(ba->Icon.Name);
+ if( ba->Icon.Icon == NoIcon ) {
+ ba->Icon.Icon = IconByIdent(ba->Icon.Name);
+ DebugLevel0Fn("Icon not found: Icon.Name = %s\n" _C_ ba->Icon.Name);
+ // FIXME: better way to kill the program? or draw a
+ // Unknown-Icon and add a hint so the user can test the rest of the ccl?
+ DebugCheck(1);
+ }
+
+ // maxy: the caller protected this from the GC
+ ba->Action = action;
+
+ // maxy: the caller does not free this pointer
+ ba->Hint = hint;
+ MustRedraw|=RedrawButtonPanel;
+ ba->Key = key;
+#endif
}
+#ifdef NEW_UI
+global void RemoveButton(int pos)
+{
+ if( pos<1 || pos>9 ) {
+ DebugLevel0Fn("Bad button positon %d\n" _C_ pos);
+ // FIXME: better way to kill the program?
+ DebugCheck(1);
+ }
+ CleanButton(CurrentButtons + (pos-1));
+}
+#endif
+
/**
** Cleanup buttons.
*/
global void CleanButtons(void)
{
+#ifndef NEW_UI
int z;
//
@@ -367,6 +301,13 @@
CurrentButtonLevel = 0;
CurrentButtons = NULL;
+#else
+ int i;
+ DebugLevel0Fn("CleanButtons()\n");
+ for (i=0; i<9; i++) {
+ CleanButton(CurrentButtons + i);
+ }
+#endif
}
/**
@@ -376,9 +317,15 @@
{
int i;
int v;
+#ifndef NEW_UI
const UnitStats* stats;
const ButtonAction* buttons;
char buf[8];
+#else
+ //const UnitStats* stats;
+ const ButtonAction* ba;
+ //char buf[8];
+#endif
//
// Draw background
@@ -389,17 +336,28 @@
,TheUI.ButtonPanelX,TheUI.ButtonPanelY);
}
+#ifndef NEW_UI
if( !(buttons=CurrentButtons) ) { // no buttons
return;
}
+#endif
// FIXME: this is unneeded DrawUnitIcon does it self
PlayerPixels(ThisPlayer); // could only select own units.
+#ifndef NEW_UI
for( i=0; i<TheUI.NumButtonButtons; ++i ) {
if( buttons[i].Pos!=-1 ) {
int j;
int action;
+#else
+ //for( i=0; i<TheUI.NumButtonButtons; ++i ) {
+ for( i=0; i<9; ++i ) {
+ ba = CurrentButtons + i;
+ if( ba->Icon.Icon != NoIcon ) {
+ //int j;
+ //int action;
+#endif
// cursor is on that button
if( ButtonAreaUnderCursor==ButtonAreaButton
@@ -418,6 +376,12 @@
// FIXME: Should show the rally action of buildings.
//
+ // NEW_UI:
+ /* FIXME: maxy: had to disable this feature :(
+ should be re-enabled from ccl as a boolean button option,
+ together with something like (selected-action-is 'patrol) */
+
+#ifndef NEW_UI
action=UnitActionNone;
switch( buttons[i].Action ) {
case ButtonStop:
@@ -500,15 +464,22 @@
break;
}
}
+#endif
+#ifndef NEW_UI
DrawUnitIcon(ThisPlayer,buttons[i].Icon.Icon
,v,TheUI.ButtonButtons[i].X,TheUI.ButtonButtons[i].Y);
+#else
+ DrawUnitIcon(ThisPlayer,ba->Icon.Icon
+ ,v,TheUI.ButtonButtons[i].X,TheUI.ButtonButtons[i].Y);
+#endif
//
// Update status line for this button
//
if( ButtonAreaUnderCursor==ButtonAreaButton
&& ButtonUnderCursor==i && KeyState!=KeyStateInput ) {
+#ifndef NEW_UI
SetStatusLine(buttons[i].Hint);
// FIXME: Draw costs
v=buttons[i].Value;
@@ -541,6 +512,9 @@
ClearCosts();
break;
}
+#else
+ SetStatusLine(ba->Hint);
+#endif
}
//
@@ -548,15 +522,26 @@
//
if( ShowCommandKey ) {
Button* b;
+#ifdef NEW_UI
+ char buf[4];
+#endif
b=&TheUI.ButtonButtons[i];
+#ifndef NEW_UI
if( CurrentButtons[i].Key==27 ) {
+#else
+ if( ba->Key==27 ) {
+#endif
strcpy(buf,"ESC");
VideoDrawText(b->X+4+b->Width-VideoTextLength(GameFont,buf),
b->Y+5+b->Height-VideoTextHeight(GameFont),GameFont,buf);
} else {
// FIXME: real DrawChar would be useful
+#ifndef NEW_UI
buf[0]=toupper(CurrentButtons[i].Key);
+#else
+ buf[0]=toupper(ba->Key);
+#endif
buf[1]='\0';
VideoDrawText(b->X+4+b->Width-VideoTextLength(GameFont,buf),
b->Y+5+b->Height-VideoTextHeight(GameFont),GameFont,buf);
@@ -570,6 +555,7 @@
-- Functions
----------------------------------------------------------------------------*/
+#ifndef NEW_UI
/**
** Update bottom panel for multiple units.
*/
@@ -860,13 +846,11 @@
{
int i;
UnitType* type;
-
DebugLevel3Fn("Button clicked %d\n" _C_ button);
if( !CurrentButtons ) { // no buttons
return;
}
-
//
// Button not available.
//
@@ -879,6 +863,7 @@
//
// Handle action on button.
//
+
DebugLevel3Fn("Button clicked %d=%d\n" _C_ button _C_
CurrentButtons[button].Action);
switch( CurrentButtons[button].Action ) {
@@ -905,7 +890,6 @@
&& (KeyModifiers&ModifierControl) ) {
int autocast;
SpellType *spell;
-
spell=SpellTypeById(CurrentButtons[button].Value);
if( !CanAutoCastSpell(spell) ) {
PlayGameSound(GameSounds.PlacementError.Sound
@@ -1065,6 +1049,38 @@
break;
}
}
+#endif
+
+#ifdef NEW_UI
+global void DoButtonButtonClicked(int pos)
+{
+ ButtonAction * ba;
+ ba = CurrentButtons + pos;
+ //
+ // Handle action on button.
+ //
+ //FIXME DebugLevel3Fn("Button clicked (button hint: %s).", ba->Hint);
+
+ if( !gh_null_p(ba->Action) ) {
+ PlayGameSound(GameSounds.Click.Sound,MaxSampleVolume);
+
+ /*
+ if( [ccl debugging] ) { // display executed command
+ gh_display(...);
+ gh_newline();
+ }
+ */
+ gh_apply(ba->Action,NIL);
+ } else {
+ if( ba->Hint ) {
+ DebugLevel0Fn("Missing button action (button hint: %s)." _C_
ba->Hint);
+ } else {
+ // FIXME: remove this after testing
+ DebugLevel0Fn("You are clicking on empty space, aren't you ;)");
+ }
+ }
+}
+#endif
/**
** Lookup key for bottom panel buttons.
@@ -1077,6 +1093,7 @@
{
int i;
+#ifndef NEW_UI
if( CurrentButtons ) { // buttons
// cade: this is required for action queues SHIFT+M should be `m'
@@ -1091,7 +1108,22 @@
}
}
}
+#else
+ ButtonAction * ba;
+
+ // cade: this is required for action queues SHIFT+M should be `m'
+ if ( key >= 'A' && key <= 'Z' ) {
+ key = tolower(key);
+ }
+ for( i=0; i<9; i++ ) {
+ ba = CurrentButtons + i;
+ if( key==CurrentButtons[i].Key ) {
+ DoButtonButtonClicked(i);
+ return 1;
+ }
+ }
+#endif
return 0;
}
Index: stratagus/src/ui/button_checks.c
diff -u stratagus/src/ui/button_checks.c:1.9
stratagus/src/ui/button_checks.c:1.10
--- stratagus/src/ui/button_checks.c:1.9 Fri Jul 11 10:35:33 2003
+++ stratagus/src/ui/button_checks.c Fri Aug 8 06:16:44 2003
@@ -26,10 +26,11 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: button_checks.c,v 1.9 2003/07/11 14:35:33 n0body Exp $
+// $Id: button_checks.c,v 1.10 2003/08/08 10:16:44 martinxyz Exp $
//@{
+#ifndef NEW_UI
/*----------------------------------------------------------------------------
-- Includes
----------------------------------------------------------------------------*/
@@ -278,3 +279,6 @@
}
//@}
+#else
+// FIXME: maxy: remove this file.
+#endif
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.117 stratagus/src/ui/ccl_ui.c:1.118
--- stratagus/src/ui/ccl_ui.c:1.117 Sat Aug 2 09:34:25 2003
+++ stratagus/src/ui/ccl_ui.c Fri Aug 8 06:16:44 2003
@@ -10,7 +10,7 @@
//
/address@hidden ccl_ui.c - The ui ccl functions. */
//
-// (c) Copyright 1999-2003 by Lutz Sammer and Jimmy Salmon
+// (c) Copyright 1999-2003 by Lutz Sammer, Jimmy Salmon, Martin Renold
//
// 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: ccl_ui.c,v 1.117 2003/08/02 13:34:25 grumbel Exp $
+// $Id: ccl_ui.c,v 1.118 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -47,11 +47,566 @@
#include "menus.h"
#include "font.h"
#include "etlib/hash.h"
+#ifdef NEW_UI
+#include "commands.h"
+#include "spells.h"
+#include "depend.h"
+#endif
+
+/*----------------------------------------------------------------------------
+-- Variables
+----------------------------------------------------------------------------*/
+
+#ifdef NEW_UI
+local SCM SelectionChangedHook; /// Script to add/remove buttons
+local SCM SelectedUnitChangedHook; /// Script to refresh buttons
+local SCM ChooseTargetBeginHook; /// Script to draw target selection buttons
+local SCM ChooseTargetFinishHook; /// Script to draw target selection buttons
+#endif
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
+#ifdef NEW_UI
+// Note, the commands all operate on the selected unit(s) and are
+// called from ccl hooks during the game when a button is pressed.
+
+// helper functions used for actions that need target selection
+global void ChooseTargetBegin(int action)
+{
+ CursorState=CursorStateSelect;
+ GameCursor=TheUI.YellowHair.Cursor;
+ CursorAction=action;
+ MustRedraw|=RedrawCursor;
+
+ if( ChooseTargetBeginHook == NIL ) {
+ DebugLevel0Fn("Hook is NIL!\n");
+ } else {
+ gh_apply(ChooseTargetBeginHook,NIL);
+ }
+ // FIXME: maybe write this from ccl?
+ SetStatusLine("Select Target");
+}
+
+global void ChooseTargetFinish(void)
+{
+ if( CursorState!=CursorStateSelect ) {
+ return;
+ }
+ ClearStatusLine();
+ CursorState=CursorStatePoint;
+ GameCursor=TheUI.Point.Cursor;
+ MustRedraw|=RedrawCursor;
+ CursorBuilding=0;
+
+ if( ChooseTargetFinishHook == NIL ) {
+ DebugLevel0Fn("Hook is NIL!\n");
+ } else {
+ gh_apply(ChooseTargetFinishHook,NIL);
+ }
+}
+
+/**
+** FIXME: docu for command-patrol
+*/
+local SCM CclCommandPatrol(void)
+{
+ ChooseTargetBegin(ButtonPatrol);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-harvest
+*/
+local SCM CclCommandHarvest(void)
+{
+ ChooseTargetBegin(ButtonHarvest);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-attack
+*/
+local SCM CclCommandAttack(void)
+{
+ ChooseTargetBegin(ButtonAttack);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-cancel-upgrade
+*/
+local SCM CclCommandCancelUpgrade(void)
+{
+ if( Selected[0]->Orders[0].Action==UnitActionUpgradeTo ) {
+ SendCommandCancelUpgradeTo(Selected[0]);
+ } else if( Selected[0]->Orders[0].Action==UnitActionResearch ) {
+ SendCommandCancelResearch(Selected[0]);
+ }
+ // FIXME: must call SelectedUnitChanged() here?
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Build the given unit type (a building).
+*/
+local SCM CclCommandBuild(SCM arg)
+{
+ char * ident;
+ ident = gh_scm2newstr(arg, NULL);
+ UnitType * type;
+ type=UnitTypeByIdent(ident);
+ free(ident);
+
+ if( !PlayerCheckUnitType(ThisPlayer,type) ) {
+ ChooseTargetBegin(ButtonBuild);
+ GameCursor=TheUI.Point.Cursor;
+ CursorBuilding=type;
+ MustRedraw|=RedrawCursor;
+ }
+
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Train an unit with given type
+*/
+local SCM CclCommandTrainUnit(SCM arg)
+{
+ char * ident;
+ ident = gh_scm2newstr(arg, NULL);
+ UnitType * type;
+ type=UnitTypeByIdent(ident);
+ free(ident);
+
+ // FIXME: Johns: I want to place commands in queue, even if not
+ // FIXME: enough resources are available.
+ // FIXME: training queue full check is not correct for network.
+ // FIXME: this can be correct written, with a little more code.
+ if( Selected[0]->Orders[0].Action==UnitActionTrain
+ && (Selected[0]->Data.Train.Count==MAX_UNIT_TRAIN
+ || !EnableTrainingQueue) ) {
+ NotifyPlayer(Selected[0]->Player,NotifyYellow,Selected[0]->X,
+ Selected[0]->Y, "Unit training queue is full" );
+ } else if( PlayerCheckFood(ThisPlayer,type)
+ && !PlayerCheckUnitType(ThisPlayer,type) ) {
+ //PlayerSubUnitType(ThisPlayer,type);
+ SendCommandTrainUnit(Selected[0],type
+ ,!(KeyModifiers&ModifierShift));
+ ClearStatusLine();
+ }
+
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-cast-spell
+*/
+local SCM CclCommandCastSpell(SCM arg)
+{
+ int i;
+ char * spell_str;
+ SpellType * spell;
+ int spell_id;
+
+ spell_str=gh_scm2newstr(arg,NULL);
+ spell=SpellTypeByIdent(spell_str);
+ spell_id=SpellIdByIdent(spell_str);
+ free(spell_str);
+
+ // FIXME: maxy: make the modifiers available from ccl (and maybe
+ // which mouse button was pressed, too, for the action scripts)
+
+ if( KeyModifiers&ModifierControl ) {
+ // auto-cast the spell
+ int autocast;
+ if( !CanAutoCastSpell(spell) ) {
+ PlayGameSound(GameSounds.PlacementError.Sound
+ ,MaxSampleVolume);
+ return SCM_UNSPECIFIED;
+ }
+
+ autocast=0;
+ // If any selected unit doesn't have autocast on turn it on
+ // for everyone
+ for( i=0; i<NumSelected; ++i ) {
+ if( Selected[i]->AutoCastSpell!=spell) {
+ autocast=1;
+ break;
+ }
+ }
+ for( i=0; i<NumSelected; ++i ) {
+ if( !autocast || Selected[i]->AutoCastSpell!=spell ) {
+ SendCommandAutoSpellCast(Selected[i],spell_id,autocast);
+ }
+ }
+ } else {
+ // select spell target
+ CursorSpell = spell_id;
+ ChooseTargetBegin(ButtonSpellCast);
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-move
+*/
+local SCM CclCommandMove(void)
+{
+ ChooseTargetBegin(ButtonMove);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-stop
+*/
+local SCM CclCommandStop(void)
+{
+ int i;
+ for( i=0; i<NumSelected; ++i ) {
+ SendCommandStopUnit(Selected[i]);
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-research
+*/
+local SCM CclCommandResearch(SCM arg)
+{
+ char * what;
+ Upgrade * upgrade;
+
+ what = gh_scm2newstr(arg,NULL);
+ upgrade=UpgradeByIdent( what );
+ free(what);
+
+ if( !PlayerCheckCosts(ThisPlayer,upgrade->Costs) ) {
+ //PlayerSubCosts(ThisPlayer,Upgrades[i].Costs);
+ // FIXME: key modifier check does not belong here
+ SendCommandResearch(Selected[0],upgrade
+ ,!(KeyModifiers&ModifierShift));
+ ClearStatusLine();
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-unload
+*/
+local SCM CclCommandUnload(void)
+{
+ ChooseTargetBegin(ButtonUnload);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Build a string with unit/upgrade costs
+*/
+local SCM CclGetCostString(SCM arg)
+{
+ char s[80];
+ char * pos;
+ char * ident;
+ int i;
+ int * costs;
+ ident = gh_scm2newstr(arg, NULL);
+ UnitType * type;
+ Upgrade * upgrade;
+ costs = NULL;
+ type=UnitTypeByIdent(ident);
+ if( type ) {
+ costs=type->Stats[ThisPlayer->Player].Costs;
+ } else {
+ upgrade=UpgradeByIdent(ident);
+ if( upgrade ) {
+ costs=upgrade->Costs;
+ }
+ /* TODO: mana costs
+ SetCosts(SpellTypeById( v )->ManaCost,0,NULL);
+ */
+ }
+ if( !costs ) {
+ sprintf(s, "[NO COSTS: '%s']", ident);
+ free(ident);
+ return gh_str02scm(s);
+ }
+ free(ident);
+
+ pos = s;
+ // do not draw time cost
+ for( i=1; i<MaxCosts; i++ ) {
+ if( costs[i] ) {
+ pos += sprintf(pos, "$%d %d ", i, costs[i]);
+ }
+ }
+ return gh_str02scm(s);
+}
+
+/**
+** Check whether unit or upgrade is allowed
+*/
+local SCM CclCheckAllowed(SCM arg)
+{
+ int allow;
+ char * what;
+ what = gh_scm2newstr(arg,NULL);
+ allow = CheckDependByIdent( ThisPlayer,what );
+ if( allow && !strncmp( what, "upgrade-", 8 ) ) {
+ allow=UpgradeIdentAllowed( ThisPlayer, what )=='A';
+ }
+ free(what);
+ return allow?SCM_BOOL_T:SCM_BOOL_F;
+}
+
+/**
+** FIXME: docu for command-upgrade-to
+*/
+local SCM CclCommandUpgradeTo(SCM arg)
+{
+ char * what;
+ UnitType * type;
+ what = gh_scm2newstr(arg,NULL);
+ type = UnitTypeByIdent(what);
+ free(what);
+
+ if( !PlayerCheckUnitType(ThisPlayer,type) ) {
+ DebugLevel3("Upgrade to %s %d %d\n"
+ _C_ type->Ident
+ _C_ type->_Costs[GoldCost]
+ _C_ type->_Costs[WoodCost]);
+ // FIXME: should not check for key modifiers here
+ SendCommandUpgradeTo(Selected[0],type
+ ,!(KeyModifiers&ModifierShift));
+ ClearStatusLine();
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-attack-ground
+*/
+local SCM CclCommandAttackGround(void)
+{
+ ChooseTargetBegin(ButtonAttackGround);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-return-goods
+*/
+local SCM CclCommandReturnGoods(void)
+{
+ int i;
+ for( i=0; i<NumSelected; ++i ) {
+ // FIXME: should not check for key modifiers here
+ SendCommandReturnGoods(Selected[i],NoUnitP
+ ,!(KeyModifiers&ModifierShift));
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** generic cancel command
+** mainly used when in target selection mode
+*/
+local SCM CclCommandCancel(void)
+{
+ if( CursorState==CursorStateSelect ) {
+ ClearStatusLine();
+ GameCursor=TheUI.Point.Cursor;
+ CursorBuilding=NULL;
+ CursorState=CursorStatePoint;
+ MustRedraw|=RedrawCursor;
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-cancel-build
+*/
+local SCM CclCommandCancelBuilding(void)
+{
+ SendCommandCancelBuilding(Selected[0],
+ Selected[0]->Data.Builded.Worker);
+ ClearStatusLine();
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-cancel-train-unit
+*/
+local SCM CclCommandCancelTrainUnit(void)
+{
+ DebugCheck( Selected[0]->Orders[0].Action!=UnitActionTrain
+ || !Selected[0]->Data.Train.Count );
+ SendCommandCancelTraining(Selected[0],-1,NULL);
+ ClearStatusLine();
+ // The SelectedUnitChanged hook will be called when the command
+ // finally got through, I hope.
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-repair
+*/
+local SCM CclCommandRepair(void)
+{
+ ChooseTargetBegin(ButtonRepair);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-stand-ground
+*/
+local SCM CclCommandStandGround(void)
+{
+ int i;
+ for( i=0; i<NumSelected; ++i ) {
+ // FIXME: key modifiers don't belong here
+ SendCommandStandGround(Selected[i]
+ ,!(KeyModifiers&ModifierShift));
+ }
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu for command-demolish
+*/
+local SCM CclCommandDemolish(void)
+{
+ ChooseTargetBegin(ButtonDemolish);
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** FIXME: docu
+** FIXME: a bit a confusing name, see below
+*/
+local SCM CclSelectedIsBuilding(void)
+{
+ if( NumSelected == 0) {
+ return SCM_UNSPECIFIED;
+ }
+ if( Selected[0]->Type->Building ) {
+ return SCM_BOOL_T;
+ } else {
+ return SCM_BOOL_F;
+ }
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedIsTraining(void)
+{
+ if( NumSelected == 0) {
+ return SCM_UNSPECIFIED;
+ }
+ if( Selected[0]->Orders[0].Action==UnitActionTrain ) {
+ return SCM_BOOL_T;
+ } else {
+ return SCM_BOOL_F;
+ }
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedIsUpgrading(void)
+{
+ if( NumSelected == 0) {
+ return SCM_UNSPECIFIED;
+ }
+ if( Selected[0]->Orders[0].Action==UnitActionResearch
+ || Selected[0]->Orders[0].Action==UnitActionUpgradeTo ) {
+ return SCM_BOOL_T;
+ } else {
+ return SCM_BOOL_F;
+ }
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedGetRace(void)
+{
+ if( NumSelected == 0 ) {
+ return SCM_UNSPECIFIED;
+ }
+ DebugLevel0Fn("RaceString: %s\n" _C_ Selected[0]->Player->RaceName);
+ return gh_str02scm(Selected[0]->Player->RaceName);
+ //return gh_symbol2scm(Selected[0]->Player->RaceName);
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedGetSpeed(void)
+{
+ if( NumSelected == 0 ) {
+ return SCM_UNSPECIFIED;
+ }
+ return gh_int2scm(Selected[0]->Stats->Speed);
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedOwnedByPlayer(void)
+{
+ if( NumSelected == 0) {
+ return SCM_BOOL_F;
+ }
+ if( Selected[0]->Player==ThisPlayer ) {
+ return SCM_BOOL_T;
+ } else {
+ return SCM_BOOL_F;
+ }
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedMixedUnits(void)
+{
+ int i;
+ UnitType * type;
+ if( NumSelected<2 ) {
+ return SCM_BOOL_F;
+ }
+
+ type = Selected[0]->Type;
+ for ( i=1; i<NumSelected; i++ ) {
+ if ( Selected[i]->Type != type ) {
+ return SCM_BOOL_T;
+ }
+ }
+ return SCM_BOOL_F;
+}
+
+/**
+** FIXME: docu
+*/
+local SCM CclSelectedDrawButtons(void)
+{
+ if( NumSelected > 0 ) {
+ if( Selected[0]->Type->AddButtonsHook == NIL ) {
+ DebugLevel0Fn("Hook is NIL!\n");
+ } else {
+ /*
+ DebugLevel0Fn("Running hook:\n");
+ gh_display(Selected[0]->Type->AddButtonsHook);
+ gh_newline();
+ */
+ gh_apply(Selected[0]->Type->AddButtonsHook,NIL);
+ }
+ }
+ return SCM_UNSPECIFIED;
+}
+#endif
+
/**
** Enable/disable the global color cycling.
**
@@ -186,7 +741,6 @@
SCM old;
old=gh_int2scm(TheUI.Saturation);
-
i=gh_scm2int(saturation);
if( i<-100 || i>200 ) {
PrintFunction();
@@ -617,6 +1171,24 @@
return id;
}
+/// Get an integer value from a list.
+local int SCM_PopInt(SCM * list)
+{
+ SCM value;
+ value=gh_car(*list);
+ *list=gh_cdr(*list);
+ return gh_scm2int(value);
+}
+
+/// Get a string value from a list.
+local char* SCM_PopNewStr(SCM * list)
+{
+ SCM value;
+ value=gh_car(*list);
+ *list=gh_cdr(*list);
+ return gh_scm2newstr(value, NULL);
+}
+
/**
** Define the look+feel of the user interface.
**
@@ -626,7 +1198,6 @@
local SCM CclDefineUI(SCM list)
{
SCM value;
- SCM temp;
SCM sublist;
char* str;
int x;
@@ -696,663 +1267,529 @@
ui->OriginalResources=TheUI.OriginalResources;
+ ui->Resource.File=NULL;
+ ui->ResourceX=-1;
+ ui->ResourceY=-1;
+
+ ui->InfoPanel.File=NULL;
+ ui->InfoPanelX=-1;
+ ui->InfoPanelY=-1;
+
+ ui->ButtonPanel.File=NULL;
+ ui->ButtonPanelX=-1;
+ ui->ButtonPanelY=-1;
+
+ ui->MenuButtonGraphic.File=NULL;
+ ui->MenuButtonGraphicX=-1;
+ ui->MenuButtonGraphicY=-1;
+
+ ui->MinimapPanel.File=NULL;
+ ui->MinimapPanelX=-1;
+ ui->MinimapPanelY=-1;
+
+ ui->MinimapPosX=-1;
+ ui->MinimapPosY=-1;
+
//
- // Now the real values.
+ // Parse the arguments, already the new tagged format.
+ // maxy: this could be much simpler
//
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("normal-font-color")) ) {
- value=gh_car(list);
- list=gh_cdr(list);
- ui->NormalFontColor=gh_scm2newstr(value,NULL);
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("reverse-font-color")) ) {
+ while( !gh_null_p(list) ) {
value=gh_car(list);
list=gh_cdr(list);
- ui->ReverseFontColor=gh_scm2newstr(value,NULL);
- }
- // Filler
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("filler")) ) {
- sublist=gh_car(list);
- list=gh_cdr(list);
- ui->NumFillers++;
- ui->Filler=realloc(ui->Filler,ui->NumFillers*sizeof(*ui->Filler));
- ui->FillerX=realloc(ui->FillerX,ui->NumFillers*sizeof(*ui->FillerX));
- ui->FillerY=realloc(ui->FillerY,ui->NumFillers*sizeof(*ui->FillerY));
- while( !gh_null_p(sublist) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- if( gh_eq_p(value,gh_symbol2scm("file")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->Filler[ui->NumFillers-1].File=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ if( gh_eq_p(value,gh_symbol2scm("normal-font-color")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ ui->NormalFontColor=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("reverse-font-color")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ ui->ReverseFontColor=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("filler")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->NumFillers++;
+ ui->Filler=realloc(ui->Filler,ui->NumFillers*sizeof(*ui->Filler));
+
ui->FillerX=realloc(ui->FillerX,ui->NumFillers*sizeof(*ui->FillerX));
+
ui->FillerY=realloc(ui->FillerY,ui->NumFillers*sizeof(*ui->FillerY));
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->FillerX[ui->NumFillers-1]=gh_scm2int(gh_car(value));
- ui->FillerY[ui->NumFillers-1]=gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag",value);
+ if( gh_eq_p(value,gh_symbol2scm("file")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->Filler[ui->NumFillers-1].File=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->FillerX[ui->NumFillers-1]=gh_scm2int(gh_car(value));
+
ui->FillerY[ui->NumFillers-1]=gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag",value);
+ }
}
- }
- }
-
- // Resource
- temp=gh_car(list);
- if( !gh_list_p(temp) ) {
- str=NULL;
- x=-1;
- y=-1;
- } else {
- list=gh_cdr(list);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- str=gh_scm2newstr(value,NULL);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
- }
-
- ui->Resource.File=str;
- ui->ResourceX=x;
- ui->ResourceY=y;
-
- // Resource Icons
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("resources")) ) {
- sublist=gh_car(list);
- list=gh_cdr(list);
- while( !gh_null_p(sublist) ) {
- SCM slist;
- int res;
- char* name;
+ } else if( gh_eq_p(value,gh_symbol2scm("resource-line")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->Resource.File=SCM_PopNewStr(&sublist);
+ ui->ResourceX=SCM_PopInt(&sublist);
+ ui->ResourceY=SCM_PopInt(&sublist);
+ } else if( gh_eq_p(value,gh_symbol2scm("resources")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
+ SCM slist;
+ int res;
+ char* name;
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- name=gh_scm2newstr(value,NULL);
- for( res=0; res<MaxCosts; ++res ) {
- if( !strcmp(name,DefaultResourceNames[res]) ) {
- break;
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ name=gh_scm2newstr(value,NULL);
+ for( res=0; res<MaxCosts; ++res ) {
+ if( !strcmp(name,DefaultResourceNames[res]) ) {
+ break;
+ }
}
- }
- if( res==MaxCosts ) {
- if( !strcmp(name,"food") ) {
- res=FoodCost;
- } else if( !strcmp(name,"score") ) {
- res=ScoreCost;
- } else {
- errl("Resource not found",value);
+ if( res==MaxCosts ) {
+ if( !strcmp(name,"food") ) {
+ res=FoodCost;
+ } else if( !strcmp(name,"score") ) {
+ res=ScoreCost;
+ } else {
+ errl("Resource not found",value);
+ }
}
- }
- free(name);
- 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("pos")) ) {
- value=gh_car(slist);
- slist=gh_cdr(slist);
- ui->Resources[res].IconX=gh_scm2int(gh_car(value));
- ui->Resources[res].IconY=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("file")) ) {
- value=gh_car(slist);
- slist=gh_cdr(slist);
- ui->Resources[res].Icon.File=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("row")) ) {
+ free(name);
+ slist=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ while( !gh_null_p(slist) ) {
value=gh_car(slist);
slist=gh_cdr(slist);
- ui->Resources[res].IconRow=gh_scm2int(value);
+ if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(slist);
+ slist=gh_cdr(slist);
+ ui->Resources[res].IconX=gh_scm2int(gh_car(value));
+
ui->Resources[res].IconY=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("file")) ) {
+ value=gh_car(slist);
+ slist=gh_cdr(slist);
+ ui->Resources[res].Icon.File=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("row")) ) {
+ value=gh_car(slist);
+ slist=gh_cdr(slist);
+ ui->Resources[res].IconRow=gh_scm2int(value);
+ } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+ value=gh_car(slist);
+ slist=gh_cdr(slist);
+ ui->Resources[res].IconW=gh_scm2int(gh_car(value));
+
ui->Resources[res].IconH=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
+ value=gh_car(slist);
+ slist=gh_cdr(slist);
+ ui->Resources[res].TextX=gh_scm2int(gh_car(value));
+
ui->Resources[res].TextY=gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag",value);
+ }
+ }
+ }
+ } 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);
+ sublist=gh_cdr(sublist);
+ ui->CompleteBarColor=gh_scm2int(value);
+ } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ 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")) ) {
- value=gh_car(slist);
- slist=gh_cdr(slist);
- ui->Resources[res].IconW=gh_scm2int(gh_car(value));
- ui->Resources[res].IconH=gh_scm2int(gh_car(gh_cdr(value)));
+ 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")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->CompleteBarText=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->CompleteBarFont=CclFontByIdentifier(value);
} else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
- value=gh_car(slist);
- slist=gh_cdr(slist);
- ui->Resources[res].TextX=gh_scm2int(gh_car(value));
- ui->Resources[res].TextY=gh_scm2int(gh_car(gh_cdr(value)));
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->CompleteTextX=gh_scm2int(gh_car(value));
+ ui->CompleteTextY=gh_scm2int(gh_car(gh_cdr(value)));
} else {
errl("Unsupported tag",value);
}
}
- }
- }
-
- // Info Panel
- temp=gh_car(list);
- if( !gh_list_p(temp) ) {
- str=NULL;
- x=-1;
- y=-1;
- } else {
- list=gh_cdr(list);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- str=gh_scm2newstr(value,NULL);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
- }
-
- ui->InfoPanel.File=str;
- ui->InfoPanelX=x;
- ui->InfoPanelY=y;
-
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
- ui->InfoPanelW=x;
- ui->InfoPanelH=y;
-
- // Completed Bar
- value=gh_car(list);
- list=gh_cdr(list);
- 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);
- sublist=gh_cdr(sublist);
- ui->CompleteBarColor=gh_scm2int(value);
- } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
- 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")) ) {
- 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")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->CompleteBarText=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->CompleteBarFont=CclFontByIdentifier(value);
- } else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->CompleteTextX=gh_scm2int(gh_car(value));
- ui->CompleteTextY=gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag",value);
- }
- }
- }
-
- // Button Panel
- temp=gh_car(list);
- if( !gh_list_p(temp) ) {
- str=NULL;
- x=-1;
- y=-1;
- } else {
- list=gh_cdr(list);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- str=gh_scm2newstr(value,NULL);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
- }
-
- ui->ButtonPanel.File=str;
- ui->ButtonPanelX=x;
- ui->ButtonPanelY=y;
-
- // The Map
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("map-area")) ) {
- int w;
- int h;
-
- w=0;
- h=0;
- 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("pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->MapArea.X=gh_scm2int(gh_car(value));
- ui->MapArea.Y=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+ } else if( gh_eq_p(value,gh_symbol2scm("button-panel")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->ButtonPanel.File=SCM_PopNewStr(&sublist);
+ ui->ButtonPanelX=SCM_PopInt(&sublist);
+ ui->ButtonPanelY=SCM_PopInt(&sublist);
+ } else if( gh_eq_p(value,gh_symbol2scm("map-area")) ) {
+ int w;
+ int h;
+
+ w=0;
+ h=0;
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- w=gh_scm2int(gh_car(value));
- h=gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag",value);
+ if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->MapArea.X=gh_scm2int(gh_car(value));
+ ui->MapArea.Y=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ w=gh_scm2int(gh_car(value));
+ h=gh_scm2int(gh_car(gh_cdr(value)));
+ } else {
+ errl("Unsupported tag",value);
+ }
}
- }
- ui->MapArea.EndX=ui->MapArea.X+w-1;
- ui->MapArea.EndY=ui->MapArea.Y+h-1;
- }
-
- // Menu Button
- temp=gh_car(list);
- if( !gh_list_p(temp) ) {
- str=NULL;
- x=-1;
- y=-1;
- } else {
- list=gh_cdr(list);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- str=gh_scm2newstr(value,NULL);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
-
- }
-
- ui->MenuButtonGraphic.File=str;
- ui->MenuButtonGraphicX=x;
- ui->MenuButtonGraphicY=y;
-
- // Minimap
- temp=gh_car(list);
- list=gh_cdr(list);
-
- if( !gh_list_p(temp) ) {
- fprintf(stderr,"list expected\n");
- return SCM_UNSPECIFIED;
- }
-
- value=gh_car(temp);
- temp=gh_cdr(temp);
- str=gh_scm2newstr(value,NULL);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- x=gh_scm2int(value);
- value=gh_car(temp);
- temp=gh_cdr(temp);
- y=gh_scm2int(value);
-
- ui->Minimap.File=str;
- ui->MinimapX=x;
- ui->MinimapY=y;
-
- // Status Line
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("status-line")) ) {
- 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("file")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->StatusLine.File=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->StatusLineX=gh_scm2int(gh_car(value));
- ui->StatusLineY=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->StatusLineTextX=gh_scm2int(gh_car(value));
- ui->StatusLineTextY=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
+ ui->MapArea.EndX=ui->MapArea.X+w-1;
+ ui->MapArea.EndY=ui->MapArea.Y+h-1;
+ } else if( gh_eq_p(value,gh_symbol2scm("menu-panel")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->MenuButtonGraphic.File=SCM_PopNewStr(&sublist);
+ ui->MenuButtonGraphicX=SCM_PopInt(&sublist);
+ ui->MenuButtonGraphicY=SCM_PopInt(&sublist);
+ } else if( gh_eq_p(value,gh_symbol2scm("minimap-panel")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->MinimapPanel.File=SCM_PopNewStr(&sublist);
+ ui->MinimapPanelX=SCM_PopInt(&sublist);
+ ui->MinimapPanelY=SCM_PopInt(&sublist);
+ } else if( gh_eq_p(value,gh_symbol2scm("minimap-pos")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ ui->MinimapPosX=SCM_PopInt(&sublist);
+ ui->MinimapPosY=SCM_PopInt(&sublist);
+ } else if( gh_eq_p(value,gh_symbol2scm("status-line")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->StatusLineFont=CclFontByIdentifier(value);
- } else {
- errl("Unsupported tag",value);
+ if( gh_eq_p(value,gh_symbol2scm("file")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->StatusLine.File=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->StatusLineX=gh_scm2int(gh_car(value));
+ ui->StatusLineY=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("text-pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->StatusLineTextX=gh_scm2int(gh_car(value));
+ ui->StatusLineTextY=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("font")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->StatusLineFont=CclFontByIdentifier(value);
+ } else {
+ errl("Unsupported tag",value);
+ }
}
- }
- }
-
- // Buttons
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("menu-button")) ) {
- 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("pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->MenuButton.X=gh_scm2int(gh_car(value));
- ui->MenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->MenuButton.Width=gh_scm2int(gh_car(value));
- ui->MenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->MenuButton.Text=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ } else if( gh_eq_p(value,gh_symbol2scm("menu-button")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->MenuButton.Button=scm2buttonid(value);
- } else {
- errl("Unsupported tag",value);
+ if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->MenuButton.X=gh_scm2int(gh_car(value));
+ ui->MenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->MenuButton.Width=gh_scm2int(gh_car(value));
+ ui->MenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->MenuButton.Text=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->MenuButton.Button=scm2buttonid(value);
+ } else {
+ errl("Unsupported tag",value);
+ }
}
- }
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("network-menu-button")) ) {
- 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("pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkMenuButton.X=gh_scm2int(gh_car(value));
- ui->NetworkMenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkMenuButton.Width=gh_scm2int(gh_car(value));
- ui->NetworkMenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkMenuButton.Text=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ } else if( gh_eq_p(value,gh_symbol2scm("network-menu-button")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->NetworkMenuButton.Button=scm2buttonid(value);
- } else {
- errl("Unsupported tag",value);
+ if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkMenuButton.X=gh_scm2int(gh_car(value));
+ ui->NetworkMenuButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkMenuButton.Width=gh_scm2int(gh_car(value));
+
ui->NetworkMenuButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkMenuButton.Text=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkMenuButton.Button=scm2buttonid(value);
+ } else {
+ errl("Unsupported tag",value);
+ }
}
- }
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("network-diplomacy-button")) ) {
- 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("pos")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkDiplomacyButton.X=gh_scm2int(gh_car(value));
- ui->NetworkDiplomacyButton.Y=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("size")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkDiplomacyButton.Width=gh_scm2int(gh_car(value));
-
ui->NetworkDiplomacyButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
- } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->NetworkDiplomacyButton.Text=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ } else if( gh_eq_p(value,gh_symbol2scm("network-diplomacy-button")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->NetworkDiplomacyButton.Button=scm2buttonid(value);
- } else {
- errl("Unsupported tag",value);
- }
- }
- }
- value=gh_car(list);
- list=gh_cdr(list);
- 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)));
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkDiplomacyButton.X=gh_scm2int(gh_car(value));
+
ui->NetworkDiplomacyButton.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)));
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkDiplomacyButton.Width=gh_scm2int(gh_car(value));
+
ui->NetworkDiplomacyButton.Height=gh_scm2int(gh_car(gh_cdr(value)));
+ } else if( gh_eq_p(value,gh_symbol2scm("caption")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkDiplomacyButton.Text=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("style")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->NetworkDiplomacyButton.Button=scm2buttonid(value);
} else {
errl("Unsupported tag",value);
}
}
- }
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("training-buttons")) ) {
- SCM slist;
- SCM sslist;
- Button* b;
+ } 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->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")) ) {
+ 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);
- b->Width=gh_scm2int(gh_car(value));
- b->Height=gh_scm2int(gh_car(gh_cdr(value)));
- } else {
- errl("Unsupported tag",value);
+ 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);
+ }
}
}
- }
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("button-buttons")) ) {
- SCM slist;
- SCM sslist;
- Button* b;
+ } 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->NumButtonButtons++;
- ui->ButtonButtons=realloc(ui->ButtonButtons,
- ui->NumButtonButtons*sizeof(*ui->ButtonButtons));
- b=&ui->ButtonButtons[ui->NumButtonButtons-1];
- while( !gh_null_p(sslist) ) {
- value=gh_car(sslist);
- sslist=gh_cdr(sslist);
- if( gh_eq_p(value,gh_symbol2scm("pos")) ) {
+ 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);
- 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")) ) {
+ 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")) ) {
+ 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->NumButtonButtons++;
+ ui->ButtonButtons=realloc(ui->ButtonButtons,
+
ui->NumButtonButtons*sizeof(*ui->ButtonButtons));
+ b=&ui->ButtonButtons[ui->NumButtonButtons-1];
+ while( !gh_null_p(sslist) ) {
value=gh_car(sslist);
sslist=gh_cdr(sslist);
- b->Width=gh_scm2int(gh_car(value));
- b->Height=gh_scm2int(gh_car(gh_cdr(value)));
+ 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("cursors")) ) {
+ 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("point")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->Point.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("glass")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->Glass.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("cross")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->Cross.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("yellow")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->YellowHair.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("green")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->GreenHair.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("red")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->RedHair.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("scroll")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->Scroll.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-e")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowE.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-ne")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowNE.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-n")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowN.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-nw")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowNW.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-w")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowW.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-sw")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowSW.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-s")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowS.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("arrow-se")) ) {
+ value=gh_car(sublist);
+ sublist=gh_cdr(sublist);
+ ui->ArrowSE.Name=gh_scm2newstr(value,NULL);
} else {
errl("Unsupported tag",value);
}
}
- }
- }
+ } else if( gh_eq_p(value,gh_symbol2scm("menu-panels")) ) {
+ sublist=gh_car(list);
+ list=gh_cdr(list);
+ while( !gh_null_p(sublist) ) {
+ MenuPanel** menupanel;
- // Cursors
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("cursors")) ) {
- 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("point")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->Point.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("glass")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->Glass.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("cross")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->Cross.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("yellow")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->YellowHair.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("green")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->GreenHair.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("red")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->RedHair.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("scroll")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->Scroll.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-e")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowE.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-ne")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowNE.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-n")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowN.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-nw")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowNW.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-w")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowW.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-sw")) ) {
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- ui->ArrowSW.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-s")) ) {
+ menupanel=&ui->MenuPanels;
+ while( *menupanel ) {
+ menupanel=&(*menupanel)->Next;
+ }
+ *menupanel=calloc(1,sizeof(**menupanel));
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->ArrowS.Name=gh_scm2newstr(value,NULL);
- } else if( gh_eq_p(value,gh_symbol2scm("arrow-se")) ) {
+ (*menupanel)->Ident=gh_scm2newstr(value,NULL);
value=gh_car(sublist);
sublist=gh_cdr(sublist);
- ui->ArrowSE.Name=gh_scm2newstr(value,NULL);
- } else {
- errl("Unsupported tag",value);
- }
- }
- }
-
- // Menu Panels
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("menu-panels")) ) {
- sublist=gh_car(list);
- list=gh_cdr(list);
- while( !gh_null_p(sublist) ) {
- MenuPanel** menupanel;
-
- menupanel=&ui->MenuPanels;
- while( *menupanel ) {
- menupanel=&(*menupanel)->Next;
+ (*menupanel)->Panel.File=gh_scm2newstr(value,NULL);
}
- *menupanel=calloc(1,sizeof(**menupanel));
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- (*menupanel)->Ident=gh_scm2newstr(value,NULL);
- value=gh_car(sublist);
- sublist=gh_cdr(sublist);
- (*menupanel)->Panel.File=gh_scm2newstr(value,NULL);
}
}
- // Backgrounds
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("victory-background")) ) {
- value=gh_car(list);
- list=gh_cdr(list);
- ui->VictoryBackground.File=gh_scm2newstr(value,NULL);
- }
- value=gh_car(list);
- list=gh_cdr(list);
- if( gh_eq_p(value,gh_symbol2scm("defeat-background")) ) {
- value=gh_car(list);
- list=gh_cdr(list);
- ui->DefeatBackground.File=gh_scm2newstr(value,NULL);
- }
-
return SCM_UNSPECIFIED;
}
@@ -1512,7 +1949,11 @@
old=ShowCommandKey;
ShowCommandKey=gh_scm2bool(flag);
+#ifndef NEW_UI
UpdateButtonPanel();
+#else
+ MustRedraw |= RedrawButtonPanel;
+#endif
return gh_bool2scm(old);
}
@@ -2434,6 +2875,7 @@
return SCM_UNSPECIFIED;
}
+#ifndef NEW_UI
/**
** Define a button.
**
@@ -2630,6 +3072,205 @@
return SCM_UNSPECIFIED;
}
+#else
+/**
+** Define a button.
+**
+** FIXME: need some general data structure to make this parsing easier.
+**
+** @param list List describing the button.
+*/
+local SCM CclAddButton(SCM list)
+{
+ SCM value;
+ char* s1;
+ int pos;
+ ButtonAction ba;
+ pos = -1;
+
+ //DebugLevel3Fn("Add button\n");
+ DebugLevel0Fn("Add button\n");
+
+ memset(&ba,0,sizeof(ba));
+ //
+ // Parse the arguments, already the new tagged format.
+ //
+ 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);
+ pos=gh_scm2int(value);
+ } else if( gh_eq_p(value,gh_symbol2scm("icon")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ ba.Icon.Name=gh_scm2newstr(value,NULL);
+ } else if( gh_eq_p(value,gh_symbol2scm("action")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ // Protect the action script against the garbage collector
+ CclGcProtect(value);
+ ba.Action=value;
+ } else if( gh_eq_p(value,gh_symbol2scm("key")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ s1=gh_scm2newstr(value,NULL);
+ ba.Key=*s1;
+ free(s1);
+ } else if( gh_eq_p(value,gh_symbol2scm("hint")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ ba.Hint=gh_scm2newstr(value,NULL);
+ } else {
+ s1=gh_scm2newstr(value,NULL);
+ fprintf(stderr,"Unsupported tag %s\n",s1);
+ free(s1);
+ }
+ }
+
+
+ // maxy: allocated memory goes into currentButtons[], must not be freed
+ AddButton(pos,ba.Icon.Name,ba.Action,ba.Key,ba.Hint);
+
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Remove all displayed buttons from the command panel.
+*/
+local SCM CclRemoveAllButtons(void)
+{
+ CleanButtons();
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Remove a single button from the command panel.
+**
+** @param id The button number.
+*/
+local SCM CclRemoveButton(SCM id)
+{
+ RemoveButton(gh_scm2int(id));
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Set the hook called when the ui enters "set-destination" mode
+**
+** @param script The script to run.
+*/
+local SCM CclSetChooseTargetBeginHook(SCM script)
+{
+ if( ChooseTargetBeginHook ) {
+ CclGcUnprotect(ChooseTargetBeginHook);
+ }
+ CclGcProtect(script);
+ ChooseTargetBeginHook = script;
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Set the hook called when the ui leaves "set-destination" mode
+**
+** @param script The script to run.
+*/
+local SCM CclSetChooseTargetFinishHook(SCM script)
+{
+ if( ChooseTargetFinishHook ) {
+ CclGcUnprotect(ChooseTargetFinishHook);
+ }
+ CclGcProtect(script);
+ ChooseTargetFinishHook = script;
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Set the hook called when the units selection was changed.
+**
+** @param script The script to run.
+*/
+local SCM CclSetSelectionChangedHook(SCM script)
+{
+ if( SelectionChangedHook ) {
+ CclGcUnprotect(SelectionChangedHook);
+ }
+ CclGcProtect(script);
+ SelectionChangedHook = script;
+ return SCM_UNSPECIFIED;
+}
+
+/**
+** Set the hook when the selected unit was updated.
+**
+** @param script The script to run.
+*/
+local SCM CclSetSelectedUnitChangedHook(SCM script)
+{
+ if( SelectedUnitChangedHook ) {
+ CclGcUnprotect(SelectedUnitChangedHook);
+ }
+ CclGcProtect(script);
+ SelectedUnitChangedHook = script;
+ return SCM_UNSPECIFIED;
+}
+#endif
+
+/**
+** Run the set-selection-changed-hook.
+*/
+global void SelectionChanged(void)
+{
+#ifndef NEW_UI
+ UpdateButtonPanel();
+ MustRedraw|=RedrawInfoPanel;
+#else
+ // could be in the middle of choosing a place to build when a
+ // worker gets killed
+ ChooseTargetFinish();
+
+ if (!GameRunning) {
+ return;
+ }
+ DebugLevel0Fn("Calling the selection-changed-hook.\n");
+ if( !gh_null_p(SelectionChangedHook) ) {
+ //if( [ccl debugging] ) { // display executed command
+ gh_display(SelectionChangedHook);
+ gh_newline();
+ //}
+ gh_apply(SelectionChangedHook, NIL);
+ } else {
+ DebugLevel0Fn("Hook empty!\n");
+ }
+ MustRedraw|=RedrawInfoPanel;
+#endif
+}
+
+/**
+** The selected unit has been altered.
+*/
+global void SelectedUnitChanged(void)
+{
+#ifndef NEW_UI
+ UpdateButtonPanel();
+#else
+ DebugLevel0Fn("Calling the selected-unit-changed-hook.\n");
+ if (!GameRunning) {
+ return;
+ }
+ if( !gh_null_p(SelectionChangedHook) ) {
+ //if( [ccl debugging] ) { // display executed command
+ //gh_display(gh_car(SelectedUnitChangedHook));
+ //gh_display(SelectedUnitChangedHook);
+ //gh_newline();
+ //}
+ gh_apply(SelectedUnitChangedHook, NIL);
+ } else {
+ DebugLevel0Fn("Hook empty!\n");
+ }
+#endif
+}
/**
** The next 6 functions set color cycling index
@@ -2962,7 +3603,17 @@
gh_new_procedure0_0("right-button-moves",CclRightButtonMoves);
gh_new_procedure1_0("set-fancy-buildings!",CclSetFancyBuildings);
+#ifndef NEW_UI
gh_new_procedureN("define-button",CclDefineButton);
+#else
+
gh_new_procedure1_0("set-selection-changed-hook",CclSetSelectionChangedHook);
+
gh_new_procedure1_0("set-selected-unit-changed-hook",CclSetSelectedUnitChangedHook);
+
gh_new_procedure1_0("set-choose-target-begin-hook",CclSetChooseTargetBeginHook);
+
gh_new_procedure1_0("set-choose-target-finish-hook",CclSetChooseTargetFinishHook);
+ gh_new_procedureN("add-button",CclAddButton);
+ gh_new_procedure1_0("remove-button",CclRemoveButton);
+ gh_new_procedure0_0("remove-all-buttons",CclRemoveAllButtons);
+#endif
gh_new_procedureN("define-menu-item",CclDefineMenuItem);
gh_new_procedureN("define-menu",CclDefineMenu);
@@ -2999,6 +3650,48 @@
gh_new_procedure0_0("reset-keystroke-help",CclResetKeystrokeHelp);
gh_new_procedureN("add-keystroke-help",CclAddKeystrokeHelp);
+#ifdef NEW_UI
+ //
+ // Commands for buttons
+ //
+ gh_new_procedure0_0("command-patrol",CclCommandPatrol);
+ gh_new_procedure0_0("command-harvest",CclCommandHarvest);
+ gh_new_procedure0_0("command-attack",CclCommandAttack);
+ gh_new_procedure0_0("command-cancel-upgrade",CclCommandCancelUpgrade);
+ gh_new_procedure1_0("command-build",CclCommandBuild);
+ gh_new_procedure1_0("command-train-unit",CclCommandTrainUnit);
+ gh_new_procedure1_0("command-cast-spell",CclCommandCastSpell);
+ gh_new_procedure0_0("command-move",CclCommandMove);
+ gh_new_procedure0_0("command-stop",CclCommandStop);
+ gh_new_procedure1_0("command-research",CclCommandResearch);
+ gh_new_procedure0_0("command-unload",CclCommandUnload);
+ gh_new_procedure1_0("command-upgrade-to",CclCommandUpgradeTo);
+ gh_new_procedure0_0("command-attack-ground",CclCommandAttackGround);
+ gh_new_procedure0_0("command-return-goods",CclCommandReturnGoods);
+ gh_new_procedure0_0("command-cancel",CclCommandCancel);
+ gh_new_procedure0_0("command-cancel-building",CclCommandCancelBuilding);
+ gh_new_procedure0_0("command-cancel-train-unit",CclCommandCancelTrainUnit);
+ gh_new_procedure0_0("command-repair",CclCommandRepair);
+ gh_new_procedure0_0("command-stand-ground",CclCommandStandGround);
+ gh_new_procedure0_0("command-demolish",CclCommandDemolish);
+
+ gh_new_procedure1_0("check-allowed",CclCheckAllowed);
+ gh_new_procedure1_0("get-cost-string",CclGetCostString);
+
+ //
+ // FIXME: make those functions use an unit handle instead
+ // and add (get-selected-unit).
+ //
+ gh_new_procedure0_0("selected-is-building",CclSelectedIsBuilding);
+ gh_new_procedure0_0("selected-is-training",CclSelectedIsTraining);
+ gh_new_procedure0_0("selected-is-upgrading",CclSelectedIsUpgrading);
+ gh_new_procedure0_0("selected-get-race",CclSelectedGetRace);
+ gh_new_procedure0_0("selected-get-speed",CclSelectedGetSpeed);
+ gh_new_procedure0_0("selected-owned-by-player",CclSelectedOwnedByPlayer);
+ gh_new_procedure0_0("selected-mixed-units",CclSelectedMixedUnits);
+ gh_new_procedure0_0("selected-draw-buttons",CclSelectedDrawButtons);
+
+#endif
InitMenuFuncHash();
}
Index: stratagus/src/ui/icons.c
diff -u stratagus/src/ui/icons.c:1.42 stratagus/src/ui/icons.c:1.43
--- stratagus/src/ui/icons.c:1.42 Fri Jul 11 10:35:33 2003
+++ stratagus/src/ui/icons.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: icons.c,v 1.42 2003/07/11 14:35:33 n0body Exp $
+// $Id: icons.c,v 1.43 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -415,58 +415,6 @@
VideoDrawRectangleClip(ColorGreen, x, y, width, height);
} else if (flags & IconAutoCast) {
VideoDrawRectangleClip(ColorBlue, x, y, width, height);
- }
-}
-
-/**
-** Save state of the icons to file.
-**
-** @param file Output file.
-*/
-global void SaveIcons(FILE* file)
-{
- char* const* cp;
- int i;
-
- fprintf(file, "\n;;; -----------------------------------------\n");
- fprintf(file, ";;; MODULE: icons $Id: icons.c,v 1.42 2003/07/11 14:35:33
n0body Exp $\n\n");
-
- //
- // Mapping the original icon numbers in puds to our internal strings
- //
- if ((cp = IconWcNames)) {
- fprintf(file, "(define-icon-wc-names");
-
- i = 90;
- while (*cp) {
- if (i + strlen(*cp) > 79) {
- i = fprintf(file, "\n ");
- }
- i += fprintf(file, " '%s", *cp++);
- }
- fprintf(file, ")\n\n");
- }
-
- //
- // Icons
- //
- for (i = 0; i < NumIcons; ++i) {
- fprintf(file, "(define-icon '%s", Icons[i]->Ident);
- if (Icons[i]->Tileset) {
- fprintf(file, " 'tileset '%s", Icons[i]->Tileset);
- }
- fprintf(file, "\n 'size '(%d %d) 'normal '(%d \"%s\"))\n",
- Icons[i]->Width, Icons[i]->Height,
- Icons[i]->Index, Icons[i]->File->FileName);
- }
- fprintf(file, "\n");
-
- //
- // Icons aliases
- //
- for (i = 0; i < NumIconAliases; ++i) {
- fprintf(file, "(define-icon-alias '%s '%s)\n",
- IconAliases[i * 2 + 0], IconAliases[i * 2 + 1]);
}
}
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.132 stratagus/src/ui/interface.c:1.133
--- stratagus/src/ui/interface.c:1.132 Sat Aug 2 09:34:25 2003
+++ stratagus/src/ui/interface.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.c,v 1.132 2003/08/02 13:34:25 grumbel Exp $
+// $Id: interface.c,v 1.133 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -119,7 +119,9 @@
KeyState=KeyStateInput;
Input[0]='\0';
InputIndex=0;
+#ifndef NEW_UI
ClearCosts();
+#endif
ShowInput();
}
@@ -135,7 +137,7 @@
local void UiUnselectAll(void)
{
UnSelectAll();
- UpdateButtonPanel();
+ SelectionChanged();
}
/**
@@ -195,8 +197,8 @@
}
SelectGroup(group);
- UpdateButtonPanel();
- MustRedraw|=RedrawMap|RedrawPanels;
+ SelectionChanged();
+ MustRedraw|=RedrawMap|RedrawInfoPanel;
}
/**
@@ -231,8 +233,8 @@
}
}
- UpdateButtonPanel();
- MustRedraw|=RedrawMap|RedrawPanels;
+ SelectionChanged();
+ MustRedraw|=RedrawMap|RedrawInfoPanel;
}
/**
@@ -622,10 +624,15 @@
LastIdleWorker=unit;
SelectSingleUnit(unit);
ClearStatusLine();
+#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel=0;
- UpdateButtonPanel();
+#else
+ // stupid trick, just in case SelectionChanged() should be slow it
+ // will probably feel faster if you hear the sound at once :)
+#endif
PlayUnitSound(Selected[0],VoiceSelected);
+ SelectionChanged();
ViewportCenterViewpoint(TheUI.SelectedViewport,unit->X,unit->Y);
}
}
@@ -1251,9 +1258,12 @@
return 1;
case KeyCodeAlt:
KeyModifiers |= ModifierAlt;
+ // maxy: disabled
+#ifndef NEW_UI
if (InterfaceState == IfaceStateNormal) {
- UpdateButtonPanel(); //VLADI: to allow alt-buttons
+ SelectedUnitChanged(); //VLADI: to allow alt-buttons
}
+#endif
return 1;
case KeyCodeSuper:
KeyModifiers |= ModifierSuper;
@@ -1291,9 +1301,12 @@
return 1;
case KeyCodeAlt:
KeyModifiers&=~ModifierAlt;
+ // maxy: disabled
+#ifndef NEW_UI
if (InterfaceState == IfaceStateNormal) {
- UpdateButtonPanel(); //VLADI: to allow alt-buttons
+ SelectedUnitChanged(); //VLADI: to allow alt-buttons
}
+#endif
return 1;
case KeyCodeSuper:
KeyModifiers&=~ModifierSuper;
Index: stratagus/src/ui/mainscr.c
diff -u stratagus/src/ui/mainscr.c:1.113 stratagus/src/ui/mainscr.c:1.114
--- stratagus/src/ui/mainscr.c:1.113 Tue Jul 22 10:32:22 2003
+++ stratagus/src/ui/mainscr.c Fri Aug 8 06:16:44 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainscr.c,v 1.113 2003/07/22 14:32:22 n0body Exp $
+// $Id: mainscr.c,v 1.114 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -953,19 +953,67 @@
*/
global void DrawStatusLine(void)
{
+#ifdef NEW_UI
+ int i, x;
+ char * startpos;
+ char * endpos;
+ char * endline;
+ char * s;
+#endif
if (TheUI.StatusLine.Graphic) {
VideoDrawSub(TheUI.StatusLine.Graphic
,0,0
,TheUI.StatusLine.Graphic->Width,TheUI.StatusLine.Graphic->Height
,TheUI.StatusLineX,TheUI.StatusLineY);
}
+#ifdef NEW_UI
+ // maxy: split "$1", "$2", ... from the string and draw resource icon
instead
+ // beware: stringhandling in C :-/
+#endif
if( StatusLine[0] ) {
PushClipping();
SetClipping(TheUI.StatusLineTextX,TheUI.StatusLineTextY
,TheUI.StatusLineX+TheUI.StatusLine.Graphic->Width-1
,TheUI.StatusLineY+TheUI.StatusLine.Graphic->Height-1);
+#ifndef NEW_UI
VideoDrawTextClip(TheUI.StatusLineTextX,TheUI.StatusLineTextY
,TheUI.StatusLineFont,StatusLine);
+#else
+
+ // need one more to easily read one char too far
+ s = calloc(1, strlen(StatusLine)+2);
+ strcpy(s, StatusLine);
+ startpos = s;
+ endline = s + strlen(s);
+ x = TheUI.StatusLineTextX;
+ do {
+ endpos = strchr(startpos, '$');
+ if( !endpos ) {
+ endpos = endline;
+ } else {
+ // replace the $
+ *endpos = '\0';
+ }
+ x += VideoDrawTextClip(x, TheUI.StatusLineTextY
+ ,TheUI.StatusLineFont,startpos);
+ if( endpos[1]>='0' && endpos[1]<='9' ) {
+ i = endpos[1]-'0';
+ if( TheUI.Resources[i].Icon.Graphic ) {
+ VideoDrawSub(TheUI.Resources[i].Icon.Graphic
+
,0,TheUI.Resources[i].IconRow*TheUI.Resources[i].IconH
+
,TheUI.Resources[i].IconW,TheUI.Resources[i].IconH
+ ,x,TheUI.StatusLineY+1);
+ // FIXME: hardcoded useable icon width
+ x += 15;
+ }
+ } else if( endpos[1] == '$' ) {
+ // escaped "$$"
+ endpos--;
+ }
+ // skip the "$1" characters
+ startpos = endpos + 2;
+ } while( startpos < endline );
+#endif
PopClipping();
}
}
@@ -994,6 +1042,7 @@
}
}
+#ifndef NEW_UI
/*----------------------------------------------------------------------------
-- COSTS
----------------------------------------------------------------------------*/
@@ -1100,6 +1149,7 @@
memset(costs,0,sizeof(costs));
SetCosts(0,0,costs);
}
+#endif
/*----------------------------------------------------------------------------
-- INFO PANEL
Index: stratagus/src/ui/menu_proc.c
diff -u stratagus/src/ui/menu_proc.c:1.99 stratagus/src/ui/menu_proc.c:1.100
--- stratagus/src/ui/menu_proc.c:1.99 Fri Aug 1 15:30:37 2003
+++ stratagus/src/ui/menu_proc.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menu_proc.c,v 1.99 2003/08/01 19:30:37 grumbel Exp $
+// $Id: menu_proc.c,v 1.100 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -2326,7 +2326,11 @@
MenuButtonUnderCursorSave = -1;
MenuButtonCurSelSave = -1;
+#ifndef NEW_UI
CancelBuildingMode();
+#else
+ ChooseTargetFinish();
+#endif
// Recursion protection:
if (loop) {
Index: stratagus/src/ui/mouse.c
diff -u stratagus/src/ui/mouse.c:1.133 stratagus/src/ui/mouse.c:1.134
--- stratagus/src/ui/mouse.c:1.133 Sat Jul 12 10:09:17 2003
+++ stratagus/src/ui/mouse.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.133 2003/07/12 14:09:17 n0body Exp $
+// $Id: mouse.c,v 1.134 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -78,6 +78,7 @@
-- Functions
----------------------------------------------------------------------------*/
+#ifndef NEW_UI
/**
** Cancel building cursor mode.
*/
@@ -90,6 +91,7 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
}
+#endif
/**
** Called when right button is pressed
@@ -549,8 +551,8 @@
//
// Minimap
//
- if( x>=TheUI.MinimapX+24 && x<TheUI.MinimapX+24+MINIMAP_W
- && y>=TheUI.MinimapY+2 && y<TheUI.MinimapY+2+MINIMAP_H ) {
+ if( x>=TheUI.MinimapPosX && x<TheUI.MinimapPosX+MINIMAP_W
+ && y>=TheUI.MinimapPosY && y<TheUI.MinimapPosY+MINIMAP_H ) {
CursorOn=CursorOnMinimap;
return;
}
@@ -644,18 +646,18 @@
*/
global void RestrictCursorToMinimap(void)
{
- if (CursorX < TheUI.MinimapX + 24) {
- CursorStartX = TheUI.MinimapX + 24;
- } else if (CursorX >= TheUI.MinimapX + 24 + MINIMAP_W) {
- CursorStartX = TheUI.MinimapX + 24 + MINIMAP_W - 1;
+ if (CursorX < TheUI.MinimapPosX) {
+ CursorStartX = TheUI.MinimapPosX;
+ } else if (CursorX >= TheUI.MinimapPosX + MINIMAP_W) {
+ CursorStartX = TheUI.MinimapPosX + MINIMAP_W - 1;
} else {
CursorStartX = CursorX;
}
- if (CursorY < TheUI.MinimapY + 2) {
- CursorStartY = TheUI.MinimapY + 2;
- } else if (CursorY >= TheUI.MinimapY + 2 + MINIMAP_H) {
- CursorStartY = TheUI.MinimapY + 2 + MINIMAP_H - 1;
+ if (CursorY < TheUI.MinimapPosY) {
+ CursorStartY = TheUI.MinimapPosY;
+ } else if (CursorY >= TheUI.MinimapPosY + MINIMAP_H) {
+ CursorStartY = TheUI.MinimapPosY + MINIMAP_H - 1;
} else {
CursorStartY = CursorY;
}
@@ -1118,9 +1120,15 @@
if( dest && unit==dest ) {
continue; // no unit can cast spell on himself
}
+#ifndef NEW_UI
// CursorValue here holds the spell type id
SendCommandSpellCast(unit,x,y,dest,CursorValue,
!(KeyModifiers&ModifierShift));
+#else
+ // CursorSpell here holds the spell type id
+ SendCommandSpellCast(unit,x,y,dest,CursorSpell,
+ !(KeyModifiers&ModifierShift));
+#endif
}
}
@@ -1140,8 +1148,10 @@
x=sx/TileSizeX;
y=sy/TileSizeY;
+#ifndef NEW_UI
CurrentButtonLevel=0; // reset unit buttons to normal
UpdateButtonPanel();
+#endif
switch( CursorAction ) {
case ButtonMove:
SendMove(x,y);
@@ -1221,10 +1231,12 @@
}
ClearStatusLine();
+#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel = 0; // reset unit buttons to normal
- UpdateButtonPanel();
- MustRedraw|=RedrawPanels;
+#endif
+ SelectionChanged();
+ MustRedraw|=RedrawInfoPanel;
}
//.............................................................................
@@ -1243,10 +1255,58 @@
const Viewport* vp;
vp = TheUI.MouseViewport;
+
+#ifdef NEW_UI
+ // to redraw the cursor immediately (and avoid up to 1 sec delay
+ if( CursorBuilding ) {
+ // Possible Selected[0] was removed from map
+ // need to make sure there is an unit to build
+ if( Selected[0] && (MouseButtons&LeftButton) ) {// enter select mode
+ int x;
+ int y;
+ int i;
+ int j;
+ int explored;
+
+ x=Viewport2MapX(TheUI.MouseViewport,CursorX);
+ y=Viewport2MapY(TheUI.MouseViewport,CursorY);
+ // FIXME: error messages
+
+ explored=1;
+ for( j=0; explored && j<Selected[0]->Type->TileHeight; ++j ) {
+ for( i=0; i<Selected[0]->Type->TileWidth; ++i ) {
+ if( !IsMapFieldExplored(ThisPlayer,x+i,y+j) ) {
+ explored=0;
+ break;
+ }
+ }
+ }
+ if( CanBuildUnitType(Selected[0],CursorBuilding,x,y)
+ && (explored || ReplayRevealMap) ) {
+ PlayGameSound(GameSounds.PlacementSuccess.Sound
+ ,MaxSampleVolume);
+ SendCommandBuildBuilding(Selected[0],x,y,CursorBuilding
+ ,!(KeyModifiers&ModifierShift));
+ if( KeyModifiers&ModifierAlt ) {
+ return;
+ }
+ } else {
+ PlayGameSound(GameSounds.PlacementError.Sound
+ ,MaxSampleVolume);
+ }
+ }
+ ChooseTargetFinish();
+ // FIXME: maxy: this does not allow clicking on
+ // the minimap while choosing locations
+ return;
+ }
+#endif
+
//
// Clicking on the map.
//
if( CursorOn==CursorOnMap ) {
+#ifndef NEW_UI
ClearStatusLine();
ClearCosts();
CursorState=CursorStatePoint;
@@ -1254,7 +1314,7 @@
CurrentButtonLevel = 0;
UpdateButtonPanel();
MustRedraw|=RedrawButtonPanel|RedrawCursor;
-
+#endif
sx = CursorX - vp->X + TileSizeX * vp->MapX;
sy = CursorY - vp->Y + TileSizeY * vp->MapY;
@@ -1266,6 +1326,9 @@
,vp->MapY*TileSizeY+CursorY - vp->Y);
SendCommand(sx, sy);
}
+#ifdef NEW_UI
+ ChooseTargetFinish();
+#endif
return;
}
@@ -1281,6 +1344,7 @@
if( MouseButtons&LeftButton ) {
sx=mx*TileSizeX;
sy=my*TileSizeY;
+#ifndef NEW_UI
ClearStatusLine();
ClearCosts();
CursorState=CursorStatePoint;
@@ -1288,9 +1352,13 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
MustRedraw|=RedrawButtonPanel|RedrawCursor;
+#endif
MakeLocalMissile(MissileTypeGreenCross
,sx+TileSizeX/2,sy+TileSizeY/2,0,0);
SendCommand(sx,sy);
+#ifdef NEW_UI
+ ChooseTargetFinish();
+#endif
} else {
ViewportCenterViewpoint(TheUI.SelectedViewport, mx, my);
}
@@ -1300,11 +1368,15 @@
if( CursorOn==CursorOnButton ) {
// FIXME: other buttons?
if( ButtonAreaUnderCursor==ButtonAreaButton ) {
+#ifdef NEW_UI
+ ChooseTargetFinish();
+#endif
DoButtonButtonClicked(ButtonUnderCursor);
return;
}
}
+#ifndef NEW_UI
ClearStatusLine();
ClearCosts();
CursorState=CursorStatePoint;
@@ -1312,6 +1384,9 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
MustRedraw|=RedrawButtonPanel|RedrawCursor;
+#else
+ ChooseTargetFinish();
+#endif
}
/**
@@ -1383,6 +1458,7 @@
TheUI.SelectedViewport - TheUI.Viewports);
}
+#ifndef NEW_UI
// to redraw the cursor immediately (and avoid up to 1 sec delay
if( CursorBuilding ) {
// Possible Selected[0] was removed from map
@@ -1425,6 +1501,7 @@
}
return;
}
+#endif
if( MouseButtons&LeftButton ) { // enter select mode
CursorStartX=CursorX;
@@ -1569,7 +1646,13 @@
//
} else if( ButtonAreaUnderCursor==ButtonAreaButton ) {
if( !GameObserve && !GamePaused ) {
+#ifndef NEW_UI
DoButtonButtonClicked(ButtonUnderCursor);
+#else
+ if( ButtonUnderCursor >= 0 && ButtonUnderCursor < 9 ) {
+ DoButtonButtonClicked(ButtonUnderCursor);
+ }
+#endif
}
}
} else if( (MouseButtons&MiddleButton) ) {
@@ -1753,9 +1836,11 @@
if( num ) {
ClearStatusLine();
+#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel = 0; // reset unit buttons to normal
- UpdateButtonPanel();
+#endif
+ SelectionChanged();
//
// Play selecting sound.
Index: stratagus/src/ui/ui.c
diff -u stratagus/src/ui/ui.c:1.69 stratagus/src/ui/ui.c:1.70
--- stratagus/src/ui/ui.c:1.69 Sat Jul 12 11:03:14 2003
+++ stratagus/src/ui/ui.c Fri Aug 8 06:16:44 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.c,v 1.69 2003/07/12 15:03:14 n0body Exp $
+// $Id: ui.c,v 1.70 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -245,11 +245,11 @@
TheUI.MenuButtonGraphic.Graphic->Height);
#endif
}
- if( TheUI.Minimap.File ) {
- TheUI.Minimap.Graphic=LoadGraphic(TheUI.Minimap.File);
+ if( TheUI.MinimapPanel.File ) {
+ TheUI.MinimapPanel.Graphic=LoadGraphic(TheUI.MinimapPanel.File);
#ifdef USE_OPENGL
- MakeTexture(TheUI.Minimap.Graphic,TheUI.Minimap.Graphic->Width,
- TheUI.Minimap.Graphic->Height);
+
MakeTexture(TheUI.MinimapPanel.Graphic,TheUI.MinimapPanel.Graphic->Width,
+ TheUI.MinimapPanel.Graphic->Height);
#endif
}
if( TheUI.StatusLine.File ) {
@@ -295,187 +295,6 @@
}
/**
-** Save the UI structure.
-**
-** @param file Save file handle
-** @param ui User interface to save
-*/
-local void SaveUi(FILE* file,const UI* ui)
-{
- int i;
- MenuPanel* menupanel;
-
- fprintf(file,"(define-ui '%s %d %d\t; Selector",
- ui->Name,ui->Width,ui->Height);
-
- fprintf(file,"\n 'normal-font-color '%s"
- "\n 'reverse-font-color '%s",
- ui->NormalFontColor, ui->ReverseFontColor);
- fprintf(file,"\n");
-
- fprintf(file,"\n 'filler (list");
- fprintf(file,"\n 'file \"%s\"",ui->Filler[0].File);
- fprintf(file,"\n 'pos '(%3d %3d)",ui->FillerX[0],ui->FillerY[0]);
- fprintf(file,")\n");
-
- fprintf(file,"\n ; Resource line");
- fprintf(file,"\n (list \"%s\" %d %d)",
- ui->Resource.File,ui->ResourceX,ui->ResourceY);
-
- fprintf(file,"\n 'resources (list");
- for( i=1; i<MaxCosts+2; ++i ) {
- if( !ui->Resources[i].Icon.File ) {
- continue;
- }
- fprintf(file,"\n '%s",
- i<MaxCosts ? DefaultResourceNames[i] :
- i==FoodCost ? "food" : "score");
- fprintf(file," (list 'file \"%s\" 'row %d\n"
- " 'pos '(%d %d) 'size '(%d %d) 'text-pos '(%d %d))",
- ui->Resources[i].Icon.File,ui->Resources[i].IconRow,
- ui->Resources[i].IconX,ui->Resources[i].IconY,
- ui->Resources[i].IconW,ui->Resources[i].IconH,
- ui->Resources[i].TextX,ui->Resources[i].TextY);
- }
- fprintf(file,")\n");
-
- fprintf(file," ; Info panel\n");
- fprintf(file," (list \"%s\" %d %d %d %d)\n",
- ui->InfoPanel.File,
- ui->InfoPanelX,ui->InfoPanelY,
- ui->InfoPanelW,ui->InfoPanelH);
-
- fprintf(file,"\n 'completed-bar '(");
- fprintf(file,"\n color %d",ui->CompleteBarColor);
- fprintf(file,"\n pos (%3d %3d)",ui->CompleteBarX,ui->CompleteBarY);
- fprintf(file,"\n size (%d %d)",ui->CompleteBarW,ui->CompleteBarH);
- fprintf(file,"\n text \"%s\"",ui->CompleteBarText);
- fprintf(file,"\n font %s",FontNames[ui->CompleteBarFont]);
- fprintf(file,"\n text-pos (%3d %3d)",
- ui->CompleteTextX,ui->CompleteTextY);
- fprintf(file,")\n\n");
-
- fprintf(file," ; Button panel\n");
- fprintf(file," (list \"%s\" %d %d)\n",
- ui->ButtonPanel.File,ui->ButtonPanelX,ui->ButtonPanelY);
-
- fprintf(file,"\n 'map-area (list");
- fprintf(file,"\n 'pos '(%3d %3d)",
- ui->MapArea.X, ui->MapArea.Y);
- fprintf(file,"\n 'size '(%d %d)",
- ui->MapArea.EndX-ui->MapArea.X+1,
- ui->MapArea.EndY-ui->MapArea.Y+1);
- fprintf(file,")\n\n");
-
- fprintf(file," ; Menu button background\n");
- fprintf(file," (list \"%s\" %d %d)\n",
- ui->MenuButtonGraphic.File,ui->MenuButtonGraphicX,
- ui->MenuButtonGraphicY);
-
- fprintf(file," ; Minimap background\n");
- fprintf(file," (list \"%s\" %d %d)\n",
- ui->Minimap.File,ui->MinimapX,ui->MinimapY);
-
- fprintf(file,"\n 'status-line '(");
- fprintf(file,"\n file \"%s\"",ui->StatusLine.File);
- fprintf(file,"\n pos (%d %d)",ui->StatusLineX,ui->StatusLineY);
- fprintf(file,"\n text-pos (%d %d)",
- ui->StatusLineTextX,ui->StatusLineTextY);
- fprintf(file,"\n font %s",FontNames[ui->StatusLineFont]);
- fprintf(file,")\n");
-
- fprintf(file,"\n 'menu-button '(");
- fprintf(file,"\n pos (%d %d)",
- ui->MenuButton.X,ui->MenuButton.Y);
- fprintf(file,"\n size (%d %d)",
- ui->MenuButton.Width,ui->MenuButton.Height);
- fprintf(file,"\n caption \"%s\"",
- ui->MenuButton.Text);
- fprintf(file,"\n style %s",
- MenuButtonStyle(ui->MenuButton.Button));
- fprintf(file,")");
-
- fprintf(file,"\n 'network-menu-button '(");
- fprintf(file,"\n pos (%d %d)",
- ui->NetworkMenuButton.X,ui->NetworkMenuButton.Y);
- fprintf(file,"\n size (%d %d)",
- ui->NetworkMenuButton.Width,ui->NetworkMenuButton.Height);
- fprintf(file,"\n caption \"%s\"",
- ui->NetworkMenuButton.Text);
- fprintf(file,"\n style %s",
- MenuButtonStyle(ui->NetworkMenuButton.Button));
- fprintf(file,")");
-
- fprintf(file,"\n 'network-diplomacy-button '(");
- fprintf(file,"\n pos (%d %d)",
- ui->NetworkDiplomacyButton.X,ui->NetworkDiplomacyButton.Y);
- fprintf(file,"\n size (%d %d)",
- ui->NetworkDiplomacyButton.Width,ui->NetworkDiplomacyButton.Height);
- fprintf(file,"\n caption \"%s\"",
- ui->NetworkDiplomacyButton.Text);
- fprintf(file,"\n style %s",
- MenuButtonStyle(ui->NetworkDiplomacyButton.Button));
- fprintf(file,")");
-
- fprintf(file,"\n\n 'info-buttons '(");
- for( i=0; i<ui->NumInfoButtons; ++i ) {
- fprintf(file,"\n (pos (%3d %3d) size (%d %d))",
- ui->InfoButtons[i].X,ui->InfoButtons[i].Y,
- ui->InfoButtons[i].Width,ui->InfoButtons[i].Height);
- }
- fprintf(file,")");
- fprintf(file,"\n 'training-buttons '(");
- for( i=0; i<ui->NumTrainingButtons; ++i ) {
- fprintf(file,"\n (pos (%3d %3d) size (%d %d))",
- ui->TrainingButtons[i].X,ui->TrainingButtons[i].Y,
- ui->TrainingButtons[i].Width,ui->TrainingButtons[i].Height);
- }
- fprintf(file,")");
- fprintf(file,"\n 'button-buttons '(");
- for( i=0; i<ui->NumButtonButtons; ++i ) {
- fprintf(file,"\n (pos (%3d %3d) size (%d %d))",
- ui->ButtonButtons[i].X,ui->ButtonButtons[i].Y,
- ui->ButtonButtons[i].Width,ui->ButtonButtons[i].Height);
- }
- fprintf(file,")");
-
- fprintf(file,"\n\n 'cursors '(");
- fprintf(file,"\n point %s", ui->Point.Name);
- fprintf(file,"\n glass %s", ui->Glass.Name);
- fprintf(file,"\n cross %s", ui->Cross.Name);
- fprintf(file,"\n yellow %s", ui->YellowHair.Name);
- fprintf(file,"\n green %s", ui->GreenHair.Name);
- fprintf(file,"\n red %s", ui->RedHair.Name);
- fprintf(file,"\n scroll %s", ui->Scroll.Name);
-
- fprintf(file,"\n arrow-e %s", ui->ArrowE.Name);
- fprintf(file,"\n arrow-ne %s", ui->ArrowNE.Name);
- fprintf(file,"\n arrow-n %s", ui->ArrowN.Name);
- fprintf(file,"\n arrow-nw %s", ui->ArrowNW.Name);
- fprintf(file,"\n arrow-w %s", ui->ArrowW.Name);
- fprintf(file,"\n arrow-sw %s", ui->ArrowSW.Name);
- fprintf(file,"\n arrow-s %s", ui->ArrowS.Name);
- fprintf(file,"\n arrow-se %s", ui->ArrowSE.Name);
- fprintf(file,")\n");
-
- fprintf(file,"\n 'menu-panels '(");
- menupanel=ui->MenuPanels;
- while( menupanel ) {
- fprintf(file,"\n %s \"%s\"",
- menupanel->Ident,menupanel->Panel.File);
- menupanel=menupanel->Next;
- }
- fprintf(file,")\n");
-
- fprintf(file,"\n 'victory-background \"%s\"",
- ui->VictoryBackground.File);
- fprintf(file,"\n 'defeat-background \"%s\"",
- ui->DefeatBackground.File);
-
- fprintf(file," )\n\n");
-}
-
-/**
** Save the viewports.
**
** @param file Save file handle
@@ -501,36 +320,8 @@
*/
global void SaveUserInterface(FILE* file)
{
- int i;
-
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: ui $Id: ui.c,v 1.69 2003/07/12 15:03:14 n0body
Exp $\n\n");
-
- // Contrast, Brightness, Saturation
- fprintf(file,"(set-contrast! %d)\n",TheUI.Contrast);
- fprintf(file,"(set-brightness! %d)\n",TheUI.Brightness);
- fprintf(file,"(set-saturation! %d)\n\n",TheUI.Saturation);
- // Scrolling
- fprintf(file,"(set-mouse-scroll! %s)\n",TheUI.MouseScroll ? "#t" : "#f");
- fprintf(file,"(set-mouse-scroll-speed! %d)\n",SpeedMouseScroll);
- fprintf(file,"(set-key-scroll! %s)\n",TheUI.KeyScroll ? "#t" : "#f");
- fprintf(file,"(set-key-scroll-speed! %d)\n",SpeedKeyScroll);
- fprintf(file,"(set-reverse-map-move! %s)\n\n",
- TheUI.ReverseMouseMove ? "#t" : "#f");
-
- fprintf(file,"(set-mouse-adjust! %d)\n",TheUI.MouseAdjust);
- fprintf(file,"(set-mouse-scale! %d)\n\n",TheUI.MouseScale);
-
- fprintf(file,"(set-original-resources! %s)\n\n",
- TheUI.OriginalResources ? "#t" : "#f");
-
- // Save the UIs for all resolutions
- for( i=0; UI_Table[i]; ++i ) {
- SaveUi(file,UI_Table[i]);
- }
-
- // FIXME: maxy: strange things could happen to the saved viewports
- // when loading them on a different resolution
+ fprintf(file,";;; MODULE: ui $Id: ui.c,v 1.70 2003/08/08 10:16:44
martinxyz Exp $\n\n");
SaveViewports(file,&TheUI);
}
@@ -577,7 +368,7 @@
free(ui->MenuButtonGraphic.File);
// Minimap
- free(ui->Minimap.File);
+ free(ui->MinimapPanel.File);
// Status Line
free(ui->StatusLine.File);
@@ -647,7 +438,7 @@
VideoSaveFree(TheUI.InfoPanel.Graphic);
VideoSaveFree(TheUI.ButtonPanel.Graphic);
VideoSaveFree(TheUI.MenuButtonGraphic.Graphic);
- VideoSaveFree(TheUI.Minimap.Graphic);
+ VideoSaveFree(TheUI.MinimapPanel.Graphic);
VideoSaveFree(TheUI.StatusLine.Graphic);
menupanel=TheUI.MenuPanels;
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.70
stratagus/src/unit/ccl_unittype.c:1.71
--- stratagus/src/unit/ccl_unittype.c:1.70 Sat Aug 2 09:34:26 2003
+++ stratagus/src/unit/ccl_unittype.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.70 2003/08/02 13:34:26 grumbel Exp $
+// $Id: ccl_unittype.c,v 1.71 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -101,6 +101,10 @@
}
type->NumDirections=8;
+#ifdef NEW_UI
+ type->AddButtonsHook = NIL;
+
+#endif
//
// Parse the list: (still everything could be changed!)
//
@@ -482,6 +486,13 @@
errl("Unsupported sound tag",value);
}
}
+#ifdef NEW_UI
+ } else if( gh_eq_p(value,gh_symbol2scm("add-buttons")) ) {
+ value=gh_car(list);
+ list=gh_cdr(list);
+ CclGcProtect(value);
+ type->AddButtonsHook = value;
+#endif
} else {
// FIXME: this leaves a half initialized unit-type
printf("\n%s\n",type->Name);
Index: stratagus/src/unit/depend.c
diff -u stratagus/src/unit/depend.c:1.26 stratagus/src/unit/depend.c:1.27
--- stratagus/src/unit/depend.c:1.26 Fri Jul 11 10:35:34 2003
+++ stratagus/src/unit/depend.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: depend.c,v 1.26 2003/07/11 14:35:34 n0body Exp $
+// $Id: depend.c,v 1.27 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -270,69 +270,6 @@
** Initialize unit and upgrade dependencies.
*/
global void InitDependencies(void){}
-
-/**
-** Save state of the dependencies to file.
-**
-** @param file Output file.
-*/
-global void SaveDependencies(FILE* file)
-{
- unsigned u;
- const DependRule* node;
- const DependRule* rule;
- const DependRule* temp;
-
- fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: dependencies $Id: depend.c,v 1.26 2003/07/11
14:35:34 n0body Exp $\n\n");
-
- // Save all dependencies
-
- for( u=0; u<sizeof(DependHash)/sizeof(*DependHash); ++u ) {
- node=DependHash[u];
- while( node ) { // all hash links
- fprintf(file,"(define-dependency '");
- switch( node->Type ) {
- case DependRuleUnitType:
- fprintf(file,"%s",node->Kind.UnitType->Ident);
- break;
- case DependRuleUpgrade:
- fprintf(file,"%s",node->Kind.Upgrade->Ident);
- break;
- }
- // All or cases
-
- fprintf(file,"\n '(");
- rule=node->Rule;
- for( ;; ) {
- temp=rule;
- while( temp ) {
- switch( temp->Type ) {
- case DependRuleUnitType:
- fprintf(file,"%s",temp->Kind.UnitType->Ident);
- break;
- case DependRuleUpgrade:
- fprintf(file,"%s",temp->Kind.Upgrade->Ident);
- break;
- }
- temp=temp->Rule;
- if( temp ) {
- fprintf(file," ");
- }
- }
- fprintf(file,")");
- if( !(rule=rule->Next) ) {
- break;
- }
- fprintf(file,"\n 'or '( ");
- }
-
- fprintf(file,")\n");
-
- node=node->Next;
- }
- }
-}
/**
** Clean up unit and upgrade dependencies.
Index: stratagus/src/unit/unittype.c
diff -u stratagus/src/unit/unittype.c:1.79 stratagus/src/unit/unittype.c:1.80
--- stratagus/src/unit/unittype.c:1.79 Thu Jul 24 15:27:33 2003
+++ stratagus/src/unit/unittype.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.79 2003/07/24 19:27:33 n0body Exp $
+// $Id: unittype.c,v 1.80 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -585,380 +585,6 @@
}
/**
-** Save state of the animitions set to file.
-**
-** We save only the first occurance of an animation.
-**
-** @param type Save animations of this unit-type.
-** @param file Output file.
-*/
-local void SaveAnimations(const UnitType* type,FILE* file)
-{
- const Animations* anims;
- int i;
- int q;
-
- if( !(anims=type->Animations) ) {
- return;
- }
-
- //
- // Look if this is the first use of it.
- //
- for( i=0; i<NumUnitTypes && UnitTypes[i]!=type ; ++i ) {
- if( UnitTypes[i]->Animations==anims ) {
- return; // allready handled.
- }
- }
-
- fprintf(file,"\n;;------\n;;\t");
- //
- // Print all units that use this animation.
- //
- q=0;
- for( i=0 ; i<NumUnitTypes ; ++i ) {
- if( UnitTypes[i]->Animations==anims ) {
- if( q ) {
- fprintf(file,", ");
- }
- fprintf(file,"%s",UnitTypes[i]->Name);
- q=1;
- }
- }
- fprintf(file,"\n(define-animations 'animations-%s",type->Ident+5);
-
- SaveAnimation("still",anims->Still,file);
- SaveAnimation("move",anims->Move,file);
- SaveAnimation("attack",anims->Attack,file);
- SaveAnimation("die",anims->Die,file);
-
- fprintf(file,")\n");
-}
-
-/**
-** Save state of an unit-type to file.
-**
-** @param file Output file.
-** @param type Unit-type to save.
-** @param all Flag save all values.
-**
-** @todo Arrange the variables more logical
-*/
-local void SaveUnitType(FILE* file,const UnitType* type,int all)
-{
- int i;
- int flag;
-
- fprintf(file,"(define-unit-type '%s",type->Ident);
- fprintf(file," 'name \"%s\"\n ",type->Name);
- // Graphic files
- if( type->SameSprite ) {
- fprintf(file,"'use '%s",type->SameSprite);
- } else {
- fputs("'files '(",file);
- for( flag=i=0; i<TilesetMax; ++i ) {
- if( type->File[i] ) {
- if( flag ) {
- fputs("\n ",file);
- }
- fprintf(file,"%s \"%s\"",Tilesets[i]->Ident,type->File[i]);
- flag=1;
- }
- }
- fputs(")",file);
- }
- fprintf(file,"\n 'size '(%d %d)\n",type->Width,type->Height);
- if( type->ShadowFile ) {
- fprintf(file," 'shadow '(file \"%s\" width %d height %d)\n",
- type->ShadowFile, type->ShadowWidth, type->ShadowHeight);
- }
-
- //
- // Animations are shared, find first use of the unit-type animation.
- //
- for( i=0; i<NumUnitTypes && UnitTypes[i]!=type ; ++i ) {
- if( UnitTypes[i]->Animations==type->Animations ) {
- break;
- }
- }
- fprintf(file," 'animations 'animations-%s",UnitTypes[i]->Ident+5);
- fprintf(file," 'icon '%s\n",IdentOfIcon(type->Icon.Icon));
- for( i=flag=0; i<MaxCosts; ++i ) {
- if( all || type->_Costs[i] ) {
- if( !flag ) {
- fputs(" 'costs '(",file);
- flag=1;
- } else {
- fputs(" ",file);
- }
- fprintf(file,"%s %d",DefaultResourceNames[i],type->_Costs[i]);
- }
- }
- if( flag ) {
- fputs(")\n",file);
- }
-
- if( type->Construction ) {
- fprintf(file," 'construction '%s\n",type->Construction->Ident);
- }
- fprintf(file," 'speed %d\n",type->_Speed);
- fprintf(file," 'hit-points %d\n",type->_HitPoints);
- if( all || type->_MaxMana ) {
- fprintf(file," 'max-mana %d\n",type->_MaxMana);
- }
- if( all || type->Magic ) {
- fprintf(file," 'magic %d\n",type->Magic);
- }
- fprintf(file," 'tile-size '(%d %d)",type->TileWidth,type->TileHeight);
- fprintf(file," 'box-size '(%d %d)\n",type->BoxWidth,type->BoxHeight);
- fprintf(file," 'sight-range %d",type->_SightRange);
- if( all || type->ReactRangeComputer ) {
- fprintf(file," 'computer-reaction-range %d",type->ReactRangeComputer);
- }
- if( all || type->ReactRangePerson ) {
- fprintf(file," 'person-reaction-range %d",type->ReactRangePerson);
- }
- fputs("\n",file);
-
- if( all || type->_Armor ) {
- fprintf(file," 'armor %d",type->_Armor);
- } else {
- fputs(" ",file);
- }
- fprintf(file," 'basic-damage %d",type->_BasicDamage);
- fprintf(file," 'piercing-damage %d",type->_PiercingDamage);
- fprintf(file," 'missile '%s\n",type->Missile.Name);
- fprintf(file," 'draw-level %d",type->DrawLevel);
- if( all || type->MinAttackRange ) {
- fprintf(file," 'min-attack-range %d",type->MinAttackRange);
- fprintf(file," 'max-attack-range %d\n",type->_AttackRange);
- } else if( type->_AttackRange ) {
- fprintf(file," 'max-attack-range %d\n",type->_AttackRange);
- }
- if( all || type->WeaponsUpgradable ) {
- fprintf(file," 'weapons-upgradable %d",type->WeaponsUpgradable);
- if( all || type->ArmorUpgradable ) {
- fprintf(file," 'armor-upgradable %d\n",type->ArmorUpgradable);
- } else {
- fputs("\n",file);
- }
- } else if( type->ArmorUpgradable ) {
- fprintf(file," 'armor-upgradable %d\n",type->ArmorUpgradable);
- }
- fprintf(file," 'priority %d",type->Priority);
- if( all || type->AnnoyComputerFactor ) {
- fprintf(file," 'annoy-computer-factor %d",type->AnnoyComputerFactor);
- }
- fputs("\n",file);
- if( all || type->DecayRate ) {
- fprintf(file," 'decay-rate %d\n",type->DecayRate);
- }
- if( all || type->Points ) {
- fprintf(file," 'points %d\n",type->Points);
- }
- if( all || type->Demand ) {
- fprintf(file," 'demand %d\n",type->Demand);
- }
- if( all || type->Supply ) {
- fprintf(file," 'supply %d\n",type->Supply);
- }
-
- if( type->CorpseName ) {
- fprintf(file," 'corpse '(%s %d)\n",
- type->CorpseName,type->CorpseScript);
- }
- if( type->ExplodeWhenKilled ) {
- fprintf(file," 'explode-when-killed\n");
- }
-
- fprintf(file," ");
- switch( type->UnitType ) {
- case UnitTypeLand:
- fputs("'type-land",file);
- break;
- case UnitTypeFly:
- fputs("'type-fly",file);
- break;
- case UnitTypeNaval:
- fputs("'type-naval",file);
- break;
- default:
- fputs("'type-unknown",file);
- break;
- }
- fprintf(file,"\n");
-
- fprintf(file," ");
- switch( type->MouseAction ) {
- case MouseActionNone:
- if( all ) {
- fprintf(file,"'right-none");
- }
- break;
- case MouseActionAttack:
- fprintf(file,"'right-attack");
- break;
- case MouseActionMove:
- fprintf(file,"'right-move");
- break;
- case MouseActionHarvest:
- fprintf(file,"'right-harvest");
- break;
- case MouseActionHaulOil:
- fprintf(file,"'right-haul-oil");
- break;
- case MouseActionDemolish:
- fprintf(file,"'right-demolish");
- break;
- case MouseActionSail:
- fprintf(file,"'right-sail");
- break;
- default:
- fprintf(file,"'right-unknown");
- break;
- }
- fprintf(file,"\n");
-
- if( type->GroundAttack ) {
- fprintf(file," 'can-ground-attack\n");
- }
- if( type->CanAttack ) {
- fprintf(file," 'can-attack\n");
- }
- if( type->CanTarget ) {
- fprintf(file," ");
- if( type->CanTarget&CanTargetLand ) {
- fprintf(file,"'can-target-land ");
- }
- if( type->CanTarget&CanTargetSea ) {
- fprintf(file,"'can-target-sea ");
- }
- if( type->CanTarget&CanTargetAir ) {
- fprintf(file,"'can-target-air ");
- }
- if( type->CanTarget&~7 ) {
- fprintf(file,"'can-target-other ");
- }
- fprintf(file,"\n");
- }
-
- if( type->Building ) {
- fprintf(file," 'building\n");
- }
- if( type->ShoreBuilding ) {
- fprintf(file," 'shore-building\n");
- }
- if( type->LandUnit ) {
- fprintf(file," 'land-unit\n");
- }
- if( type->AirUnit ) {
- fprintf(file," 'air-unit\n");
- }
- if( type->SeaUnit ) {
- fprintf(file," 'sea-unit\n");
- }
-
- if( type->Critter ) {
- fprintf(file," 'critter\n");
- }
- if( type->Revealer ) {
- fprintf(file," 'revealer\n");
- }
- if( type->Submarine ) {
- fprintf(file," 'submarine\n");
- }
- if( type->CanSeeSubmarine ) {
- fprintf(file," 'can-see-submarine\n");
- }
- if( type->Transporter ) {
- fprintf(file," 'transporter\n");
- }
-
- if( type->CowerWorker ) {
- fprintf(file," 'cower-worker\n");
- }
- if( type->Tanker ) {
- fprintf(file," 'tanker\n");
- }
- if( type->GivesResource==OilCost ) {
- fprintf(file," 'gives-oil\n");
- }
- // Save store info.
- for (flag=i=0;i<MaxCosts;i++)
- if (type->CanStore[i]) {
- if (!flag) {
- flag=1;
- fprintf(file," 'can-store '(%s",DefaultResourceNames[i]);
- } else {
- fprintf(file," %s",DefaultResourceNames[i]);
- }
- }
- if (flag)
- fprintf(file,")");
- if( type->GivesResource==GoldCost ) {
- fprintf(file," 'gives-gold\n");
- }
- if( type->MustBuildOnTop ) {
- fprintf(file," 'must-build-on-top '%s\n",type->MustBuildOnTop->Ident);
- }
-
- if( type->Vanishes ) {
- fprintf(file," 'vanishes\n");
- }
- if( type->Tower ) {
- fprintf(file," 'tower\n");
- }
- if( type->Hero ) {
- fprintf(file," 'hero\n");
- }
- if( type->Volatile ) {
- fprintf(file," 'volatile\n");
- }
- if( type->CowerMage ) {
- fprintf(file," 'cower-mage\n");
- }
- if( type->IsUndead ) {
- fprintf(file," 'isundead\n");
- }
- if( type->CanCastSpell ) {
- fprintf(file," 'can-cast-spell\n");
- }
- if( type->Organic ) {
- fprintf(file," 'organic\n");
- }
- if( type->SelectableByRectangle ) {
- fprintf(file," 'selectable-by-rectangle\n");
- }
- if( type->Teleporter ) {
- fprintf(file," 'teleporter\n");
- }
-
- fprintf(file," 'sounds '(");
- if( type->Sound.Selected.Name ) {
- fprintf(file,"\n selected \"%s\"",type->Sound.Selected.Name);
- }
- if( type->Sound.Acknowledgement.Name ) {
- fprintf(file,"\n acknowledge \"%s\"",
- type->Sound.Acknowledgement.Name);
- }
- if( type->Sound.Ready.Name ) {
- fprintf(file,"\n ready \"%s\"",type->Sound.Ready.Name);
- }
- if( type->Sound.Help.Name ) {
- fprintf(file,"\n help \"%s\"",type->Sound.Help.Name);
- }
- if( type->Sound.Dead.Name ) {
- fprintf(file,"\n dead \"%s\"",type->Sound.Dead.Name);
- }
- // FIXME: Attack should be removed!
- if( type->Weapon.Attack.Name ) {
- fprintf(file,"\n attack \"%s\"",type->Weapon.Attack.Name);
- }
- fprintf(file,")");
- fprintf(file,")\n\n");
-}
-
-/**
** Save state of an unit-stats to file.
**
** @param stats Unit-stats to save.
@@ -1003,36 +629,11 @@
*/
global void SaveUnitTypes(FILE* file)
{
- char* const* sp;
int i;
int j;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.79 2003/07/24
19:27:33 n0body Exp $\n\n");
-
- // Original number to internal unit-type name.
-
- i=fprintf(file,"(define-unittype-wc-names");
- for( sp=UnitTypeWcNames; *sp; ++sp ) {
- if( i+strlen(*sp)>79 ) {
- i=fprintf(file,"\n ");
- }
- i+=fprintf(file," '%s",*sp);
- }
- fprintf(file,")\n");
-
- // Save all animations.
-
- for( i=0; i<NumUnitTypes; ++i ) {
- SaveAnimations(UnitTypes[i],file);
- }
-
- // Save all types
-
- for( i=0; i<NumUnitTypes; ++i ) {
- fputc('\n',file);
- SaveUnitType(file,UnitTypes[i],0);
- }
+ fprintf(file,";;; MODULE: unittypes $Id: unittype.c,v 1.80 2003/08/08
10:16:44 martinxyz Exp $\n\n");
// Save all stats
Index: stratagus/src/unit/upgrade.c
diff -u stratagus/src/unit/upgrade.c:1.55 stratagus/src/unit/upgrade.c:1.56
--- stratagus/src/unit/upgrade.c:1.55 Tue Jul 22 10:32:22 2003
+++ stratagus/src/unit/upgrade.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: upgrade.c,v 1.55 2003/07/22 14:32:22 n0body Exp $
+// $Id: upgrade.c,v 1.56 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -550,8 +550,9 @@
int p;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: upgrades $Id: upgrade.c,v 1.55 2003/07/22
14:32:22 n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: upgrades $Id: upgrade.c,v 1.56 2003/08/08
10:16:44 martinxyz Exp $\n\n");
+ /* remove?
//
// Save all upgrades
//
@@ -562,10 +563,12 @@
for( j=0; j<MaxCosts; ++j ) {
fprintf(file," %5d",Upgrades[i].Costs[j]);
}
-
fprintf(file,"))\n");
}
fprintf(file,"\n");
+ */
+
+ // FIXME: can at least partially be removed
//
// Save all upgrade modifiers.
@@ -1463,7 +1466,7 @@
// Upgrades could change the buttons displayed.
//
if( player==ThisPlayer ) {
- UpdateButtonPanel();
+ SelectedUnitChanged();
MustRedraw|=RedrawInfoPanel;
}
}
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.59 stratagus/src/video/cursor.c:1.60
--- stratagus/src/video/cursor.c:1.59 Tue Jul 22 10:32:22 2003
+++ stratagus/src/video/cursor.c Fri Aug 8 06:16:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.c,v 1.59 2003/07/22 14:32:22 n0body Exp $
+// $Id: cursor.c,v 1.60 2003/08/08 10:16:44 martinxyz Exp $
//@{
@@ -74,7 +74,11 @@
global CursorStates CursorState;/// current cursor state (point,...)
global int CursorAction; /// action for selection
+#ifndef NEW_UI
global int CursorValue; /// value for CursorAction (spell type
f.e.)
+#else
+global int CursorSpell; /// spell type while selecting target
+#endif
//Event changed mouse position, can alter at any moment
global int CursorX; /// cursor position on screen X
@@ -1103,12 +1107,13 @@
/**
** Save cursor state.
*/
+/* should not be necessary
global void SaveCursors(FILE* file)
{
int i;
fprintf(file,"\n;;; -----------------------------------------\n");
- fprintf(file,";;; MODULE: cursors $Id: cursor.c,v 1.59 2003/07/22 14:32:22
n0body Exp $\n\n");
+ fprintf(file,";;; MODULE: cursors $Id: cursor.c,v 1.60 2003/08/08 10:16:44
martinxyz Exp $\n\n");
for( i=0; Cursors[i].OType; ++i ) {
fprintf(file,"(define-cursor '%s '%s\n",
@@ -1142,6 +1147,7 @@
fprintf(file,";;(unit-under-cursor %s\n",
UnitUnderCursor ? UnitReference(UnitUnderCursor) : "()");
}
+*/
/**
** Cleanup cursor module
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus ./Rules.make.in ./configure.in data/c...,
Martin Renold <=