[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus ./configure.in doc/ChangeLog.html doc...
From: |
Martin Renold |
Subject: |
[Stratagus-CVS] stratagus ./configure.in doc/ChangeLog.html doc... |
Date: |
Tue, 07 Oct 2003 08:03:46 -0400 |
CVSROOT: /cvsroot/stratagus
Module name: stratagus
Branch:
Changes by: Martin Renold <address@hidden> 03/10/07 08:03:45
Modified files:
. : configure.in
doc : ChangeLog.html
doc/ccl : ccl-index.html ui.html
src/action : action_attack.c action_move.c action_train.c
src/clone : mainloop.c player.c unit.c
src/include : cursor.h interface.h stratagus.h ui.h
unittype.h
src/ui : botpanel.c button_checks.c ccl_ui.c interface.c
mainscr.c menu_proc.c mouse.c
src/unit : ccl_unittype.c unittype.c
src/video : cursor.c
Added files:
contrib : new_ui.patch
Log message:
removed NEW_UI, added patch
Patches:
Index: stratagus/configure.in
diff -u stratagus/configure.in:1.26 stratagus/configure.in:1.27
--- stratagus/configure.in:1.26 Wed Sep 24 22:39:47 2003
+++ stratagus/configure.in Tue Oct 7 08:03:34 2003
@@ -45,17 +45,6 @@
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/doc/ChangeLog.html
diff -u stratagus/doc/ChangeLog.html:1.549 stratagus/doc/ChangeLog.html:1.550
--- stratagus/doc/ChangeLog.html:1.549 Tue Oct 7 06:40:35 2003
+++ stratagus/doc/ChangeLog.html Tue Oct 7 08:03:35 2003
@@ -2,7 +2,7 @@
<html>
<head>
<!--
----- $Id: ChangeLog.html,v 1.549 2003/10/07 10:40:35 martinxyz Exp $
+---- $Id: ChangeLog.html,v 1.550 2003/10/07 12:03:35 martinxyz Exp $
---- (c) Copyright 1998-2003 by Lutz Sammer
@@ -36,6 +36,7 @@
<li>Future 2.00 Release<p>
<ul>
<li>++
+ <li>NEW_UI: Giving it up, removed #ifdef, saved patch in contrib/ (from
Martin Renold).
<li>Removed NEW_SHIPS (from Martin Renold).
<li>Allowing minimap transparency for undiscovered areas (from Martin
Renold).
<li>Fixed Sync bug, qsort must return a unique answer, regardless of sort
order (from Russell Smith and Jimmy Salmon).
Index: stratagus/doc/ccl/ccl-index.html
diff -u stratagus/doc/ccl/ccl-index.html:1.44
stratagus/doc/ccl/ccl-index.html:1.45
--- stratagus/doc/ccl/ccl-index.html:1.44 Fri Sep 26 16:49:24 2003
+++ stratagus/doc/ccl/ccl-index.html Tue Oct 7 08:03:36 2003
@@ -78,8 +78,6 @@
<dd></dd>
<dt><a href="triggers.html#action-wait">action-wait</a></dt>
<dd></dd>
-<dt><a href="ui.html#add-button">add-button</a></dt>
-<dd></dd>
<dt><a href="game.html#add-keystroke-help">add-keystroke-help</a></dt>
<dd></dd>
<dt><a href="game.html#add-message">add-message</a></dt>
@@ -138,50 +136,8 @@
<dd></dd>
<dt><a href="game.html#change-units-owner">change-units-owner</a></dt>
<dd></dd>
-<dt><a href="ui.html#check-allowed">check-allowed</a></dt>
-<dd></dd>
<dt><a href="research.html#check-dependency">check-dependency</a></dt>
<dd></dd>
-<dt><a href="ui.html#command-attack">command-attack</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-attack-ground">command-attack-ground</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-build">command-build</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-cancel">command-cancel</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-cancel-building">command-cancel-building</a></dt>
-<dd></dd>
-<dt><a
href="ui.html#command-cancel-train-unit">command-cancel-train-unit</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-cancel-upgrade">command-cancel-upgrade</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-cast-spell">command-cast-spell</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-demolish">command-demolish</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-harvest">command-harvest</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-move">command-move</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-patrol">command-patrol</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-repair">command-repair</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-research">command-research</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-return-goods">command-return-goods</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-stand-ground">command-stand-ground</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-stop">command-stop</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-train-unit">command-train-unit</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-unload">command-unload</a></dt>
-<dd></dd>
-<dt><a href="ui.html#command-upgrade-to">command-upgrade-to</a></dt>
-<dd></dd>
<dt><a href="game.html#create-unit">create-unit</a></dt>
<dd></dd>
<dt><a href="game.html#credits">credits</a></dt>
@@ -202,6 +158,8 @@
<dd></dd>
<dt><a
href="game.html#define-burning-building">define-burning-building</a></dt>
<dd></dd>
+<dt><a href="ui.html#define-button">define-button</a></dt>
+<dd></dd>
<dt><a href="game.html#define-campaign">define-campaign</a></dt>
<dd></dd>
<dt><a href="game.html#define-construction">define-construction</a></dt>
@@ -270,8 +228,6 @@
<dd></dd>
<dt><a href="game.html#game-cycle">game-cycle</a></dt>
<dd></dd>
-<dt><a href="ui.html#get-cost-string">get-cost-string</a></dt>
-<dd></dd>
<dt><a href="research.html#get-dependency">get-dependency</a></dt>
<dd></dd>
<dt><a href="game.html#get-player-resource">get-player-resource</a></dt>
@@ -360,10 +316,6 @@
<dd></dd>
<dt><a href="ui.html#process-menu">process-menu</a></dt>
<dd></dd>
-<dt><a href="ui.html#remove-all-buttons">remove-all-buttons</a></dt>
-<dd></dd>
-<dt><a href="ui.html#remove-button">remove-button</a></dt>
-<dd></dd>
<dt><a href="game.html#remove-objective">remove-objective</a></dt>
<dd></dd>
<dt><a href="game.html#replay-log">replay-log</a></dt>
@@ -376,26 +328,6 @@
<dd></dd>
<dt><a href="config.html#right-button-moves">right-button-moves</a></dt>
<dd></dd>
-<dt><a href="ui.html#selected-draw-buttons">selected-draw-buttons</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-get-action">selected-get-action</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-get-race">selected-get-race</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-get-speed">selected-get-speed</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-is-building">selected-is-building</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-is-training">selected-is-training</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-is-upgrading">selected-is-upgrading</a></dt>
-<dd></dd>
-<dt><a href="ui.html#selected-mixed-units">selected-mixed-units</a></dt>
-<dd></dd>
-<dt><a
href="ui.html#selected-owned-by-player">selected-owned-by-player</a></dt>
-<dd></dd>
-<dt><a
href="ui.html#selected-resource-loaded">selected-resource-loaded</a></dt>
-<dd></dd>
<dt><a href="game.html#selection">selection</a></dt>
<dd></dd>
<dt><a
href="config.html#set-all-players-building-limit!">set-all-players-building-limit!</a></dt>
@@ -412,9 +344,7 @@
<dd></dd>
<dt><a href="sound.html#set-cd-mode!">set-cd-mode!</a></dt>
<dd></dd>
-<dt><a
href="ui.html#set-choose-target-begin-hook">set-choose-target-begin-hook</a></dt>
-<dd></dd>
-<dt><a
href="ui.html#set-choose-target-finish-hook">set-choose-target-finish-hook</a></dt>
+<dt><a href="config.html#set-click-missile!">set-click-missile!</a></dt>
<dd></dd>
<dt><a href="config.html#set-color-cycle-all!">set-color-cycle-all!</a></dt>
<dd></dd>
@@ -502,10 +432,6 @@
<dd></dd>
<dt><a href="config.html#set-saturation!">set-saturation!</a></dt>
<dd></dd>
-<dt><a
href="ui.html#set-selected-unit-changed-hook">set-selected-unit-changed-hook</a></dt>
-<dd></dd>
-<dt><a
href="ui.html#set-selection-changed-hook">set-selection-changed-hook</a></dt>
-<dd></dd>
<dt><a href="config.html#set-selection-style!">set-selection-style!</a></dt>
<dd></dd>
<dt><a href="game.html#set-shared-vision!">set-shared-vision!</a></dt>
@@ -615,7 +541,7 @@
<!-- SCRIPT END -->
</dl>
-Last changed: $Id: ccl-index.html,v 1.44 2003/09/26 20:49:24 jsalmon3 Exp $<br>
+Last changed: $Id: ccl-index.html,v 1.45 2003/10/07 12:03:36 martinxyz Exp
$<br>
All trademarks and copyrights on this page are owned by their respective
owners.
<address>(c) 2002-2003 by <a href="http://stratagus.org">
The Stratagus Project</a></address></body></html>
Index: stratagus/doc/ccl/ui.html
diff -u stratagus/doc/ccl/ui.html:1.17 stratagus/doc/ccl/ui.html:1.18
--- stratagus/doc/ccl/ui.html:1.17 Mon Oct 6 16:54:14 2003
+++ stratagus/doc/ccl/ui.html Tue Oct 7 08:03:37 2003
@@ -47,50 +47,7 @@
<a href="unittype.html">NEXT</a>
<a href="ccl-index.html">Index</a>
<hr>
-<a href="#add-button">add-button</a>
-<a href="#set-selection-changed-hook">set-selection-changed-hook</a>
-<a href="#set-selected-unit-changed-hook">set-selected-unit-changed-hook</a>
-<a href="#set-choose-target-begin-hook">set-choose-target-begin-hook</a>
-<a href="#set-choose-target-finish-hook">set-choose-target-finish-hook</a>
-<a href="#add-button">add-button</a>
-<a href="#remove-button">remove-button</a>
-<a href="#remove-all-buttons">remove-all-buttons</a>
-
-<a href="#command-patrol">command-patrol</a>
-<a href="#command-harvest">command-harvest</a>
-<a href="#command-attack">command-attack</a>
-<a href="#command-cancel-upgrade">command-cancel-upgrade</a>
-<a href="#command-build">command-build</a>
-<a href="#command-train-unit">command-train-unit</a>
-<a href="#command-cast-spell">command-cast-spell</a>
-<a href="#command-move">command-move</a>
-<a href="#command-stop">command-stop</a>
-<a href="#command-research">command-research</a>
-<a href="#command-unload">command-unload</a>
-<a href="#command-upgrade-to">command-upgrade-to</a>
-<a href="#command-attack-ground">command-attack-ground</a>
-<a href="#command-return-goods">command-return-goods</a>
-<a href="#command-cancel">command-cancel</a>
-<a href="#command-cancel-building">command-cancel-building</a>
-<a href="#command-cancel-train-unit">command-cancel-train-unit</a>
-<a href="#command-repair">command-repair</a>
-<a href="#command-stand-ground">command-stand-ground</a>
-<a href="#command-demolish">command-demolish</a>
-
-<a href="#check-allowed">check-allowed</a>
-<a href="#get-cost-string">get-cost-string</a>
-
-<a href="#selected-is-building">selected-is-building</a>
-<a href="#selected-is-training">selected-is-training</a>
-<a href="#selected-is-upgrading">selected-is-upgrading</a>
-<a href="#selected-get-race">selected-get-race</a>
-<a href="#selected-get-speed">selected-get-speed</a>
-<a href="#selected-owned-by-player">selected-owned-by-player</a>
-<a href="#selected-mixed-units">selected-mixed-units</a>
-<a href="#selected-get-action">selected-get-action</a>
-<a href="#selected-resource-loaded">selected-resource-loaded</a>
-<a href="#selected-draw-buttons">selected-draw-buttons</a>
-
+<a href="#define-button">define-button</a>
<a href="#define-cursor">define-cursor</a>
<a href="#define-font">define-font</a>
<a href="#define-font-colors">define-font-colors</a>
@@ -107,30 +64,46 @@
Everything around the user interface.
<h2>Functions</h2>
-<a name="add-button"></a>
-<h3>(add-button 'tag1 value1 'tag2 value2 ...)</h3>
+<a name="define-button"></a>
+<h3>(define-button 'tag1 value1 'tag2 value2 ...)</h3>
-Add a button to the button panel during the game. This is usually
-called from the 'button-hook of the unittypes (FIXME link), or from
-the selection-changed-hook (FIXME link) directly.
-See also (remove-all-buttons) (FIXME link)<br>
-Possible tags:
+Define a button in the button panel show during the game. Possible tags:
<dl>
+<dt>forunit</dt>
+<dd>List of units the button applies to, or '(*) for all units.
+</dd>
<dt>pos</dt>
-<dd>Position number. Currently buttons can be added only to the button
-panel.
+<dd>Position number.
<pre>
0 1 2
3 4 5
6 7 8
</pre>
</dd>
+<dt>level</dt>
+<dd>Visible when in this button level (0 default, 9 cancel-only)
+</dd>
<dt>icon</dt>
<dd>Name of the icon to display.
</dd>
<dt>action</dt>
-<dd>Script to eval when the button is pressed.
+<dd>Action to perform when the button is clicked. Can be any of the following:
+move, stop, attack, repair, harvest, button, build, train-unit, patrol,
+stand-ground, attack-ground, return-goods, demolish, cast-spell, research,
+upgrade-to, unload, cancel, cancel-upgrade, cancel-train-unit, cancel-build.
+</dd>
+<dt>value</dt>
+<dd>Optional value associated with the action.
+</dd>
+<dt>allowed</dt>
+<dd>Optional check to see if a button is allowed. Can be any of the following:
+check-true, check-false, check-upgrade, check-units-or, check-units-and,
+check-network, check-no-work, check-no-research, check-attack,
+check-upgrade-to, check-research, check-single-research.
+</dd>
+<dt>allowarg</dt>
+<dd>Optional argument used by the allowed function.
</dd>
<dt>key</dt>
<dd>Shortcut key for the button.
@@ -138,394 +111,17 @@
<dt>hint</dt>
<dd>Hint to be displayed for the button.
</dd>
-<dt>highlight</dt>
-<dd>If given and true, highlight the button by drawing an extra border
-(used for showing actions).
-</dd>
</dl>
<h4>Example</h4>
<pre>
- ;; add a patrol button
- (add-button 'pos 4
- 'icon (string-append "icon-" (selected-get-race) "-patrol-land")
- 'key "p" 'hint "~!PATROL"
- 'action (lambda () (command-patrol)))
-</pre>
-
-<a name="remove-button"></a>
-<h3>(remove-button id)</h3>
-Remove button number id.
-<h4>Example</h4>
- (remove-button 4)
-<pre>
-</pre>
-
-<a name="remove-all-buttons"></a>
-<h3>(remove-all-buttons)</h3>
-Removes all buttons from the button panel.
-
-<a name="set-selection-changed-hook"></a>
-<h3>(set-selection-changed-hook '(begin ...))</h3>
-Set the script that will be evaluated whenever the player selects an other set
of units.
-You will probably want call things like <a
href="#remove-all-buttons">remove-all-buttons</a>
-and <a href="#add-button">add-button</a> here, after examining the selection
with other helper functions.
-<p>
-I suggest you define a helper function that rebuilds the buttons, and
-call it from both selection-changed-hook and
-<a href="#set-selected-unit-changed-hook">selected-unit-changed-hook</a>.
-
-<h4>Example</h4>
-<pre>
- ; (Those are extracts from the demogame ccls)
-
- ; FIXME: this is most likely a very ugly hack to scheme
- (define (set-global symbol value)
- (set-symbol-value! symbol value nil))
- (define (get-global symbol)
- (symbol-value symbol nil))
-
- (set-selection-changed-hook '(begin
- (set-global 'button-level 0)
- (rebuild-buttons)))
-
- (set-selected-unit-changed-hook '(begin
- (rebuild-buttons)))
-
- ; Build all the command buttons from scratch.
- (define (rebuild-buttons)
- (remove-all-buttons)
- (if (selected-owned-by-player) (begin
- ; draw some generic buttons
- (if (= (get-global 'button-level) 0) (begin
- (if (> (selected-get-speed) 0) (begin
- (generic-movement-buttons)
- (if (selected-mixed-units) (begin
- (generic-combat-buttons))
- ; Uniform selection: draw the unit's own buttons
- (selected-draw-buttons))))
- (if (selected-is-building) (begin
- ; there can be only one building selected
- ; no common buttons should be here for now,
- ; "destroy building" or something could be added.
- (add-button 'pos 7
- 'icon 'icon-move-peasant
- 'key "m" 'hint "SET ~!MOVE"
- 'action (lambda () (command-move)))
- ;
- ; Call the building's own button-draw hook
- ;
- (selected-draw-buttons)
- ; FIXME: maybe non-buildings could be upgrading too
- ; note: upgrade is both researching and changing unit type
- (if (selected-is-upgrading) (begin
- ; could be optimized by not calling (selected-draw-buttons)
- (remove-all-buttons)
- (add-button 'pos 9 'icon 'icon-cancel
- 'key "\033" 'hint "~<ESC~> CANCEL UPGRADE"
- 'action (lambda() (command-cancel-upgrade))))))))
- (begin ; else: button level is not zero
- ;
- ; Generic cancel button to go back to button level 0
- ;
- (add-button 'pos 9 'icon 'icon-cancel
- 'key "\033" 'hint "~<ESC~> CANCEL"
- 'action (lambda()
- (set-global 'button-level 0)
- (rebuild-buttons)))
- ;
- ; Call the unit's own button-draw hook
- ;
- (selected-draw-buttons))))))
- ; no command buttons for enemy units.
-</pre>
-
-<a name="set-selected-unit-changed-hook"></a>
-<h3>(set-selected-unit-changed-hook)</h3>
-
-Set the script that will be evaluated when one of the selected units
-experiences some kind of upgrade, or when a global research is
-completed (this is when you might want new buttons to appear, or old
-ones to remove, or button images to be changed). This is seperated
-from <a href="#set-selection-changed-hook">set-selection-changed-hook</a>
-because you probably don't want to break out of a subbutton (eg selecting
-the building to build) here.
-
-<h4>Example</h4>
-<pre>
- (set-selected-unit-changed-hook '(begin
- (writes nil "[debug] selected-unit-changed-hook called")
- (rebuild-buttons)))
-</pre>
-
-<a name="set-choose-target-begin-hook"></a>
-<h3>(set-choose-target-begin-hook)</h3>
-
-Set the script that will be evaluated when the user is asked to select
-some target. You will want to change the buttons. FIXME: other hooks
-can interrupt the select-target process, so a global flag must be set
-
-<h4>Example</h4>
-<pre>
- ; When doing a target selection, only draw a cancel button.
- ; If you leave them both empty, you can choose another building while
- ; setting the destination and similar things.
- (set-choose-target-begin-hook '(begin
- (set-global 'button-level 9)
- (rebuild-buttons)))
- (set-choose-target-finish-hook '(begin
- (set-global 'button-level 0)
- (rebuild-buttons)))
-</pre>
-
-<a name="set-choose-target-finish-hook"></a>
-<h3>(set-choose-target-finish-hook)</h3>
-Set the script that will be evaluated when the user has finished to
-select a target. See <a
href="#set-choose-target-begin-hook">set-choose-target-begin-hook</a>
-for details.
-
-<a name="command-patrol"></a>
-<h3>(command-patrol)</h3>
-(While game is running) Let the player select a destination where the
-currently selected units will patrol to.
-
-<a name="command-harvest"></a>
-<h3>(command-harvest)</h3>
-(While game is running) Let the player select a destination where the
-currently selected units will harvest.
-
-<a name="command-attack"></a>
-<h3>(command-attack)</h3>
-(While game is running) Let the player select a destination where the
-currently selected units will attack.
-
-<a name="command-cancel-upgrade"></a>
-<h3>(command-cancel-upgrade)</h3>
-(While game is running) Cancel the upgrade the currently selected unit
-is doing.
-
-<a name="command-build"></a>
-<h3>(command-build unittype)</h3>
-(While game is running) Let the player select a destination where a
-building will be placed. Costs are checked.
-<h4>Example</h4>
-<pre>
- (command-build 'unit-farm)
+ (define-button 'pos 9 'level 0 'icon 'icon-exorcism
+ 'action 'cast-spell 'value 'spell-exorcism
+ 'allowed 'check-upgrade 'allow-arg '(upgrade-exorcism)
+ 'key "e" 'hint "~!EXORCISM"
+ 'for-unit '(unit-paladin unit-knight-rider unit-man-of-light))
</pre>
-<a name="command-train-unit"></a>
-<h3>(command-train-unit unittype)</h3>
-(While game is running) Let the current unit train another unit (I
-wonder whether this works with non-buildings, too?)
-<h4>Example</h4>
-<pre>
- ; define a helper function to add training buttons
- (define (train-button type pos key hint)
- (if (check-allowed (string-append 'unit- type))
- (add-button
- 'icon (string-append 'icon- type)
- 'hint (string-append hint " " (get-cost-string (string-append
'unit- type)))
- 'pos pos
- 'key key
- 'action (lambda ()
- (writes nil "Train-command\n")
- (command-train-unit (string-append 'unit- type))))))
-</pre>
-
-<a name="command-cast-spell"></a>
-<h3>(command-cast-spell spellid)</h3>
-(While game is running) Let the current unit(selection) cast a spell.
-<br>FIXME: untested.
-
-<h4>Example</h4>
-<pre>
- FIXME
-</pre>
-
-<a name="command-move"></a>
-<h3>(command-move)</h3>
-(While game is running) Let the player select a destination where the
-currently selected units will move to.
-
-<a name="command-stop"></a>
-<h3>(command-stop)</h3>
-(While game is running) stop the selected units.
-
-<a name="command-research"></a>
-<h3>(command-research upgrade)</h3>
-(While game is running) Command the selected unit to research the
-given upgrade.
-
-<a name="command-unload"></a>
-<h3>(command-unload)</h3>
-(While game is running) Let the player select a destination where the
-currently selected unit(s) will unload to.
-
-<a name="command-upgrade-to"></a>
-<h3>(command-upgrade-to unittype)</h3>
-(While game is running) Command the selected unit to upgrade to
-another unittype.
-
-<a name="command-attack-ground"></a>
-<h3>(command-attack-ground)</h3>
-(While game is running) Let the player select a destination where the
-currently selected unit(s) will attack a ground area.
-
-<a name="command-return-goods"></a>
-<h3>(command-return-goods)</h3>
-(While game is running) Let the currently selected units return their
-goods.
-
-<a name="command-cancel"></a>
-<h3>(command-cancel)</h3>
-(While game is running) This cancels selecting a
-destination. (FIXME: or is it used elsewhere too?)
-
-<a name="command-cancel-building"></a>
-<h3>(command-cancel-building)</h3>
-(While game is running) This cancels building.
-(FIXME: does it work?)
-
-<a name="command-cancel-train-unit"></a>
-<h3>(command-cancel-train-unit)</h3>
-(While game is running) Let the first selected unit remove one item
-from the training queue.
-(FIXME: or does it rather empty the training queue completely?)
-
-<a name="command-repair"></a>
-<h3>(command-repair)</h3>
-(While game is running) Let the player select a destination that the
-currently selected units will repair.
-
-<a name="command-stand-ground"></a>
-<h3>(command-stand-ground)</h3>
-Command the selected units not to move. (FIXME: correct?)
-
-<a name="command-demolish"></a>
-<h3>(command-demolish)</h3>
-(While game is running) Let the player select a destination where the
-currently selected units go demolishing (explode there).
-
-<a name="check-allowed"></a>
-<h3>(check-allowed thing)</h3>
-Check whether thing is allowed. Thing can be an upgrade or an unit.
-<h4>Example</h4>
-<pre>
- (if (check-allowed 'unit-keep)
- (add-button 'pos 2
- 'icon 'icon-keep
- 'key "k"
- 'hint (string-append "UPGRADE TO ~!KEEP " (get-cost-string 'unit-keep))
- 'action (lambda () (command-upgrade-to 'unit-keep))))
-</pre>
-
-<a name="get-cost-string"></a>
-<h3>(get-cost-string thing)</h3>
-Returns a string with the costs of thing (unit or upgrade), useful to
-give as button hint.
-<br>
-The string contains the special characters like
-"$1" that will let a resource icon appear instead of the
-text.
-
-<h4>Example</h4>
-<pre>
- 'hint (string-append "UPGRADE TO ~!KEEP " (get-cost-string 'unit-keep))
-</pre>
-
-<a name="selected-is-building"></a>
-<h3>(selected-is-building)</h3>
-Returns true if the selected unit is a building. FIXME: bad name
-
-<a name="selected-is-training"></a>
-<h3>(selected-is-training)</h3>
-Returns true if the selected unit is training.
-
-<a name="selected-is-upgrading"></a>
-<h3>(selected-is-upgrading)</h3>
-Returns true if the selected unit is upgrading.
-
-<a name="selected-get-race"></a>
-<h3>(selected-get-race)</h3>
-Returns the race of the selected unit.
-<h4>Example</h4>
-<pre>
- ; not yet used, could be useful for something like
- 'icon (string-append "icon-" (selected-get-race) "shield1")
- ; if the icons are named properly
-</pre>
-
-<a name="selected-get-speed"></a>
-<h3>(selected-get-speed)</h3>
-
-Gets the speed of the selected unit, as defined in the
-unittype. Useful to decide whether to draw a movement button.
-<br>
-Note that the speed declared in the unittype is just to display something,
-the real unit speed is hidden in the animation script.
-
-<a name="selected-owned-by-player"></a>
-<h3>(selected-owned-by-player)</h3>
-
-Returns true if the selected unit(s) is owned by the current
-player.
-<br>
-Note that the player cannot select more than one enemy unit a
-a time.
-
-<a name="selected-mixed-units"></a>
-<h3>(selected-mixed-units)</h3>
-Returns true if the selection contains more than one unittype.
-<h4>Example</h4>
-<pre>
- (if (selected-mixed-units) (begin
- ; attack/stand/patrol buttons for mixed selections
- (generic-combat-buttons))
- ; Uniform selection: draw the unit's own buttons
- (selected-draw-buttons))
-</pre>
-
-<a name="selected-get-action"></a>
-<h3>(selected-get-action)</h3>
-Returns the name of the current action as a string. Possible values are:
-<p>
-Invalid (No unit selected), Mixed (multiple units selected, and they
-are doing different things), None, Still, StandGround, Follow, Move,
-Attack, AttackGround, Die, SpellCast, Train, Train, UpgradeTo,
-Research, Builded, Board, Unload, Patrol, Build, Repair, Resource,
-ReturnGoods, Demolish.
-<p>
-Note that those are case-sensitive.
-
-<h4>Example</h4>
-<pre>
- (add-button 'pos 3
- 'icon (string-append "icon-sword1")
- 'key "a" 'hint "~!ATTACK"
- 'highlight (= (strcmp (selected-get-action) 'Attack) 0)
- 'action (lambda () (command-attack))))
-</pre>
-
-<a name="selected-resource-loaded"></a>
-<h3>(selected-resource-loaded)</h3>
-Returns the name of the resource the selected units have loaded,
-'mixed if there are different resources loaded, or nil (false) if
-there are no resources loaded.
-<h4>Example</h4>
-<pre>
- (if (selected-resource-loaded) (begin
- (writes nil (string-append "[debug] Selected unit has loaded "
(selected-resource-loaded) " resources.\n"))
- (add-button 'pos 6
- ; could build icon string from the resource name :)
- 'icon 'icon-return-goods-peasant
- 'key "g" 'hint "RETURN WITH ~!GOODS"
- 'action (lambda () (command-return-goods)))))
-</pre>
-
-<a name="selected-draw-buttons"></a>
-<h3>(selected-draw-buttons)</h3>
-Run the 'add-buttons hook from the first selected unittype.
-
<a name="define-cursor"></a>
<h3>(define-cursor 'ident 'race 'tag1 value1 'tag2 value2 ...)</h3>
@@ -1069,21 +665,20 @@
minimapx (+ minimapy 148))
</pre>
</dd>
-<dt>minimap</dt>
+<dt>minimap-panel</dt>
<dd>
<pre>
- 'minimap (list
- 'file (string-append "graphics/ui/" race "/minimap.png")
- 'panel-pos (list minimapx minimapy)
- 'pos (list (+ minimapx 27) (+ minimapy 13))
- 'size '(128 128)
- 'transparent)
-</pre>
-There is a minimap panel an the minimap on it. The panel graphic has
-certain palette restrictions (FIXME: exactly? probably the same as the
-tileset?). Pos is the absoloute position of the minimap on the screen
-(the upper left corner of it). If you give 'transparent, the panel
-graphic will be displayed on unexplored terrain, black otherwise.
+ 'minimap-panel (list
+ (string-append "graphics/ui/" race "/minimap.png")
+ minimapx minimapy)
+</pre>
+</dd>
+<dt>minimap-pos</dt>
+<dd>
+<pre>
+ 'minimap-pos (list
+ (+ minimapx 27) (+ minimapy 13))
+</pre>
</dd>
<dt>status-line</dt>
<dd>
@@ -1293,7 +888,7 @@
<h4>Not Used</h4>
<hr>
-Last changed: $Id: ui.html,v 1.17 2003/10/06 20:54:14 martinxyz Exp $<br>
+Last changed: $Id: ui.html,v 1.18 2003/10/07 12:03:37 martinxyz Exp $<br>
All trademarks and copyrights on this page are owned by their respective
owners.
<address>(c) 2002-2003 by <a href="http://stratagus.org">
The Stratagus Project</a></address></body></html>
Index: stratagus/src/action/action_attack.c
diff -u stratagus/src/action/action_attack.c:1.85
stratagus/src/action/action_attack.c:1.86
--- stratagus/src/action/action_attack.c:1.85 Fri Oct 3 15:58:23 2003
+++ stratagus/src/action/action_attack.c Tue Oct 7 08:03:38 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_attack.c,v 1.85 2003/10/03 19:58:23 jsalmon3 Exp $
+// $Id: action_attack.c,v 1.86 2003/10/07 12:03:38 martinxyz Exp $
//@{
@@ -52,9 +52,6 @@
#include "map.h"
#include "pathfinder.h"
#include <string.h>
-#ifdef NEW_UI
-#include "interface.h"
-#endif
/*----------------------------------------------------------------------------
-- Defines
@@ -165,13 +162,7 @@
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;
}
@@ -377,11 +368,7 @@
unit->SavedOrder.Goal = NoUnitP;
if (unit->Selected && unit->Player == ThisPlayer) {
-#ifndef NEW_UI
MustRedraw |= RedrawButtonPanel;
-#else
- SelectedUnitChanged();
-#endif
}
return;
}
@@ -454,11 +441,7 @@
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_move.c
diff -u stratagus/src/action/action_move.c:1.68
stratagus/src/action/action_move.c:1.69
--- stratagus/src/action/action_move.c:1.68 Tue Oct 7 06:40:36 2003
+++ stratagus/src/action/action_move.c Tue Oct 7 08:03:38 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.68 2003/10/07 10:40:36 martinxyz Exp $
+// $Id: action_move.c,v 1.69 2003/10/07 12:03:38 martinxyz Exp $
//@{
@@ -154,11 +154,9 @@
MapMarkUnitSight(unit);
// 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);
SelectionChanged();
}
Index: stratagus/src/action/action_train.c
diff -u stratagus/src/action/action_train.c:1.57
stratagus/src/action/action_train.c:1.58
--- stratagus/src/action/action_train.c:1.57 Fri Oct 3 18:42:30 2003
+++ stratagus/src/action/action_train.c Tue Oct 7 08:03:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: action_train.c,v 1.57 2003/10/03 22:42:30 jsalmon3 Exp $
+// $Id: action_train.c,v 1.58 2003/10/07 12:03:39 martinxyz Exp $
//@{
@@ -194,13 +194,8 @@
}
if (IsOnlySelected(unit)) {
-#ifndef NEW_UI
UpdateButtonPanel();
MustRedraw |= RedrawPanels;
-#else
- SelectedUnitChanged();
- MustRedraw |= RedrawInfoPanel;
-#endif
}
return;
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.145
stratagus/src/clone/mainloop.c:1.146
--- stratagus/src/clone/mainloop.c:1.145 Sat Oct 4 01:26:48 2003
+++ stratagus/src/clone/mainloop.c Tue Oct 7 08:03:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.145 2003/10/04 05:26:48 jsalmon3 Exp $
+// $Id: mainloop.c,v 1.146 2003/10/07 12:03:39 martinxyz Exp $
//@{
@@ -610,15 +610,11 @@
}
if( MustRedraw&RedrawStatusLine ) {
DrawStatusLine();
-#ifndef NEW_UI
MustRedraw|=RedrawCosts;
-#endif
}
-#ifndef NEW_UI
if( MustRedraw&RedrawCosts ) {
DrawCosts();
}
-#endif
if( MustRedraw&RedrawTimer ) {
DrawTimer();
}
@@ -708,11 +704,7 @@
,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.91 stratagus/src/clone/player.c:1.92
--- stratagus/src/clone/player.c:1.91 Fri Sep 26 14:52:18 2003
+++ stratagus/src/clone/player.c Tue Oct 7 08:03:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: player.c,v 1.91 2003/09/26 18:52:18 jsalmon3 Exp $
+// $Id: player.c,v 1.92 2003/10/07 12:03:39 martinxyz Exp $
//@{
@@ -190,9 +190,8 @@
int j;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: players $Id: player.c,v 1.91 2003/09/26
18:52:18 jsalmon3 Exp $\n\n");
+ CLprintf(file,";;; MODULE: players $Id: player.c,v 1.92 2003/10/07
12:03:39 martinxyz Exp $\n\n");
-#ifndef NEW_UI
//
// Dump table wc2 race numbers -> internal symbol.
//
@@ -210,7 +209,6 @@
}
CLprintf(file,")\n\n");
}
-#endif
//
// Dump table wc2 race numbers -> internal symbol.
Index: stratagus/src/clone/unit.c
diff -u stratagus/src/clone/unit.c:1.307 stratagus/src/clone/unit.c:1.308
--- stratagus/src/clone/unit.c:1.307 Tue Oct 7 06:40:37 2003
+++ stratagus/src/clone/unit.c Tue Oct 7 08:03:39 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unit.c,v 1.307 2003/10/07 10:40:37 martinxyz Exp $
+// $Id: unit.c,v 1.308 2003/10/07 12:03:39 martinxyz Exp $
//@{
@@ -635,12 +635,10 @@
unit->Removed=1;
// Remove unit from the current selection
if( unit->Selected ) {
-#ifndef NEW_UI
if( NumSelected==1 ) { // Remove building cursor
CancelBuildingMode();
}
MustRedraw|=RedrawPanels;
-#endif
UnSelectUnit(unit);
SelectionChanged();
}
@@ -3717,7 +3715,7 @@
int InRun, RunStart;
CLprintf(file,"\n;;; -----------------------------------------\n");
- CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.307 2003/10/07 10:40:37
martinxyz Exp $\n\n");
+ CLprintf(file,";;; MODULE: units $Id: unit.c,v 1.308 2003/10/07 12:03:39
martinxyz Exp $\n\n");
//
// Local variables
Index: stratagus/src/include/cursor.h
diff -u stratagus/src/include/cursor.h:1.35 stratagus/src/include/cursor.h:1.36
--- stratagus/src/include/cursor.h:1.35 Sun Aug 17 11:57:07 2003
+++ stratagus/src/include/cursor.h Tue Oct 7 08:03:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.h,v 1.35 2003/08/17 15:57:07 n0body Exp $
+// $Id: cursor.h,v 1.36 2003/10/07 12:03:40 martinxyz Exp $
#ifndef __CURSOR_H__
#define __CURSOR_H__
@@ -179,11 +179,7 @@
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/interface.h
diff -u stratagus/src/include/interface.h:1.82
stratagus/src/include/interface.h:1.83
--- stratagus/src/include/interface.h:1.82 Sun Sep 14 07:51:33 2003
+++ stratagus/src/include/interface.h Tue Oct 7 08:03:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.h,v 1.82 2003/09/14 11:51:33 martinxyz Exp $
+// $Id: interface.h,v 1.83 2003/10/07 12:03:40 martinxyz Exp $
#ifndef __INTERFACE_H__
#define __INTERFACE_H__
@@ -40,9 +40,6 @@
#include "player.h"
#include "unit.h"
#include "icons.h"
-#ifdef NEW_UI
-#include "ccl.h"
-#endif
/*----------------------------------------------------------------------------
-- Definitons
@@ -60,7 +57,6 @@
ButtonSpellCast, /// order cast spell
ButtonUnload, /// order unload unit
ButtonDemolish, /// order demolish/explode
-#ifndef NEW_UI
ButtonStop, /// order stop
ButtonButton, /// choose other button set
ButtonTrain, /// order train
@@ -72,18 +68,14 @@
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
enum _button_cmd_ Action; /// command on button press
@@ -93,10 +85,6 @@
ButtonCheckFunc Allowed;
char* AllowStr; /// argument for allowed
char* UnitMask; /// for which units is it available
-#else
- SCM Action; /// script on button press
- int Highlight; /// whether to draw a border
-#endif
IconConfig Icon; /// icon to display
int Key; /// alternative on keyboard
char* Hint; /// tip text
@@ -309,18 +297,11 @@
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, int highlight);
- /// Remove a single button from the panel
-global void RemoveButton(int pos);
-#endif
/// Save all buttons
extern void SaveButtons(CLFile* file);
@@ -407,13 +388,11 @@
/// 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);
@@ -426,18 +405,13 @@
/// 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
//
@@ -467,7 +441,6 @@
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
@@ -476,12 +449,6 @@
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/stratagus.h
diff -u stratagus/src/include/stratagus.h:1.17
stratagus/src/include/stratagus.h:1.18
--- stratagus/src/include/stratagus.h:1.17 Sat Oct 4 01:26:49 2003
+++ stratagus/src/include/stratagus.h Tue Oct 7 08:03:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: stratagus.h,v 1.17 2003/10/04 05:26:49 jsalmon3 Exp $
+// $Id: stratagus.h,v 1.18 2003/10/07 12:03:40 martinxyz Exp $
#ifndef __STRATAGUS_H__
#define __STRATAGUS_H__
@@ -401,9 +401,7 @@
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/ui.h
diff -u stratagus/src/include/ui.h:1.68 stratagus/src/include/ui.h:1.69
--- stratagus/src/include/ui.h:1.68 Mon Oct 6 16:54:14 2003
+++ stratagus/src/include/ui.h Tue Oct 7 08:03:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ui.h,v 1.68 2003/10/06 20:54:14 martinxyz Exp $
+// $Id: ui.h,v 1.69 2003/10/07 12:03:40 martinxyz Exp $
#ifndef __UI_H__
#define __UI_H__
@@ -333,12 +333,6 @@
extern int SpeedMouseScroll; /// Mouse Scrolling Speed, in Frames
// only exported to save them
-#ifdef NEW_UI
-extern SCM SelectionChangedHook; /// Script to add/remove buttons
-extern SCM SelectedUnitChangedHook; /// Script to refresh buttons
-extern SCM ChooseTargetBeginHook; /// Script to draw target selection buttons
-extern SCM ChooseTargetFinishHook; /// Script to draw target selection buttons
-#endif
/*----------------------------------------------------------------------------
-- Functions
Index: stratagus/src/include/unittype.h
diff -u stratagus/src/include/unittype.h:1.116
stratagus/src/include/unittype.h:1.117
--- stratagus/src/include/unittype.h:1.116 Fri Sep 26 05:15:22 2003
+++ stratagus/src/include/unittype.h Tue Oct 7 08:03:40 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.h,v 1.116 2003/09/26 09:15:22 mr-russ Exp $
+// $Id: unittype.h,v 1.117 2003/10/07 12:03:40 martinxyz Exp $
#ifndef __UNITTYPE_H__
#define __UNITTYPE_H__
@@ -598,9 +598,6 @@
#include "upgrade_structs.h"
#include "construct.h"
#include "etlib/hash.h"
-#ifdef NEW_UI
-#include "ccl.h"
-#endif
/*----------------------------------------------------------------------------
-- Declarations
@@ -819,10 +816,6 @@
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/ui/botpanel.c
diff -u stratagus/src/ui/botpanel.c:1.90 stratagus/src/ui/botpanel.c:1.91
--- stratagus/src/ui/botpanel.c:1.90 Tue Sep 30 14:41:09 2003
+++ stratagus/src/ui/botpanel.c Tue Oct 7 08:03:40 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: botpanel.c,v 1.90 2003/09/30 18:41:09 jsalmon3 Exp $
+// $Id: botpanel.c,v 1.91 2003/10/07 12:03:40 martinxyz Exp $
//@{
@@ -56,10 +56,8 @@
-- Defines
----------------------------------------------------------------------------*/
-#ifndef NEW_UI
/// How many different buttons are allowed
#define MAX_BUTTONS 2048
-#endif
/*----------------------------------------------------------------------------
-- Variables
@@ -68,14 +66,12 @@
/// 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
@@ -86,7 +82,6 @@
*/
global void InitButtons(void)
{
-#ifndef NEW_UI
int z;
//
@@ -96,10 +91,6 @@
UnitButtonTable[z]->Icon.Icon =
IconByIdent(UnitButtonTable[z]->Icon.Name);
}
-#else
- // FIXME: proabably not necessary
- //CleanButtons();
-#endif
}
/**
@@ -107,16 +98,13 @@
*/
global void SaveButtons(CLFile* file)
{
-#ifndef NEW_UI
int i;
int n;
char* cp;
-#endif
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.90 2003/09/30
18:41:09 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: buttons $Id: botpanel.c,v 1.91 2003/10/07
12:03:40 martinxyz Exp $\n\n");
-#ifndef NEW_UI
for (i = 0; i < NumUnitButtons; ++i) {
CLprintf(file, "(define-button 'pos %d 'level %d 'icon '%s\n",
UnitButtonTable[i]->Pos, UnitButtonTable[i]->Level,
@@ -250,25 +238,6 @@
}
CLprintf(file, "))\n\n");
}
-#else
-
- CLprintf(file, "(set-selection-changed-hook '");
- lprin1CL(SelectionChangedHook, file);
- CLprintf(file, ")\n");
-
- CLprintf(file, "(set-selected-unit-changed-hook '");
- lprin1CL(SelectedUnitChangedHook, file);
- CLprintf(file, ")\n");
-
- CLprintf(file, "(set-choose-target-begin-hook '");
- lprin1CL(ChooseTargetBeginHook, file);
- CLprintf(file, ")\n");
-
- CLprintf(file, "(set-choose-target-finish-hook '");
- lprin1CL(ChooseTargetFinishHook, file);
- CLprintf(file, ")\n");
-
-#endif
CLprintf(file, "(set-show-command-key! %s)\n\n",
ShowCommandKey ? "#t" : "#f");
@@ -291,42 +260,18 @@
-- 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, int highlight)
-#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?
@@ -383,56 +328,14 @@
// 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;
- ba->Highlight = highlight;
-#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;
//
@@ -461,14 +364,6 @@
CurrentButtonLevel = 0;
CurrentButtons = NULL;
-#else
- int i;
-
- DebugLevel0Fn("CleanButtons()\n");
- for (i = 0; i < 9; ++i) {
- CleanButton(CurrentButtons + i);
- }
-#endif
}
/**
@@ -478,13 +373,9 @@
{
int i;
int v;
-#ifndef NEW_UI
const UnitStats* stats;
const ButtonAction* buttons;
char buf[8];
-#else
- const ButtonAction* ba;
-#endif
//
// Draw background
@@ -495,26 +386,17 @@
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) {
-#endif
// cursor is on that button
if (ButtonAreaUnderCursor == ButtonAreaButton &&
@@ -538,7 +420,6 @@
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:
@@ -617,26 +498,15 @@
break;
}
}
-#else
- if (ba->Highlight) {
- v |= IconSelected;
- }
-#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;
@@ -668,9 +538,6 @@
ClearCosts();
break;
}
-#else
- SetStatusLine(ba->Hint);
-#endif
}
//
@@ -678,26 +545,15 @@
//
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);
@@ -711,7 +567,6 @@
-- Functions
----------------------------------------------------------------------------*/
-#ifndef NEW_UI
/**
** Update bottom panel for multiple units.
*/
@@ -1199,39 +1054,7 @@
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.
@@ -1244,7 +1067,6 @@
{
int i;
-#ifndef NEW_UI
if (CurrentButtons) { // buttons
// cade: this is required for action queues SHIFT+M should be `m'
@@ -1259,22 +1081,6 @@
}
}
}
-#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.12
stratagus/src/ui/button_checks.c:1.13
--- stratagus/src/ui/button_checks.c:1.12 Mon Sep 29 22:53:02 2003
+++ stratagus/src/ui/button_checks.c Tue Oct 7 08:03:41 2003
@@ -26,11 +26,10 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: button_checks.c,v 1.12 2003/09/30 02:53:02 jsalmon3 Exp $
+// $Id: button_checks.c,v 1.13 2003/10/07 12:03:41 martinxyz Exp $
//@{
-#ifndef NEW_UI
/*----------------------------------------------------------------------------
-- Includes
----------------------------------------------------------------------------*/
@@ -286,6 +285,3 @@
}
//@}
-#else
-// FIXME: maxy: remove this file.
-#endif
Index: stratagus/src/ui/ccl_ui.c
diff -u stratagus/src/ui/ccl_ui.c:1.131 stratagus/src/ui/ccl_ui.c:1.132
--- stratagus/src/ui/ccl_ui.c:1.131 Mon Oct 6 16:54:15 2003
+++ stratagus/src/ui/ccl_ui.c Tue Oct 7 08:03:41 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_ui.c,v 1.131 2003/10/06 20:54:15 martinxyz Exp $
+// $Id: ccl_ui.c,v 1.132 2003/10/07 12:03:41 martinxyz Exp $
//@{
@@ -47,22 +47,11 @@
#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
global char* ClickMissile;
global char* DamageMissile;
@@ -70,640 +59,6 @@
-- 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_eval(ChooseTargetBeginHook, NIL);
- }
- // FIXME: maybe write this from ccl?
- SetStatusLine("Select Target");
-}
-
-/**
-** FIXME: docu
-*/
-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_eval(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;
- UnitType* type;
-
- ident = gh_scm2newstr(arg, NULL);
- 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;
- UnitType* type;
-
- ident = gh_scm2newstr(arg, NULL);
- 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;
- UnitType* type;
- Upgrade* upgrade;
-
- ident = gh_scm2newstr(arg, NULL);
- 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;
- }
-}
-
-/**
-** Whether the selected unit is repairing.
-*/
-local SCM CclSelectedIsRepairing(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 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;
- }
-}
-
-/**
-** Return the name of the resource type that is loaded.
-*/
-local SCM CclSelectedResourceLoaded(void)
-{
- int i;
- int type;
- Unit* unit;
-
- type = -1;
- for (i = 0; i<NumSelected; ++i) {
- unit = Selected[i];
- if (unit->CurrentResource && unit->Value &&
- (!unit->Type->ResInfo[unit->CurrentResource]->LoseResources ||
- unit->Value >=
unit->Type->ResInfo[unit->CurrentResource]->ResourceCapacity)) {
- if (type == -1) {
- type = unit->CurrentResource;
- } else if (type != unit->CurrentResource) {
- return gh_str02scm("mixed");
- }
- }
- }
- if (type == -1) {
- return SCM_UNSPECIFIED;
- }
- return gh_str02scm(DefaultResourceNames[type]);
-}
-
-/**
-** 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 CclSelectedGetAction(void)
-{
- int j;
- UnitAction action;
-
- if (NumSelected == 0) {
- return gh_str02scm("Invalid");
- }
- action = Selected[0]->Orders[0].Action;
- for (j = 1; j < NumSelected; ++j) {
- if (Selected[j]->Orders[0].Action != action) {
- return gh_str02scm("Mixed");
- }
- }
-
- switch (action) {
- case UnitActionNone: return gh_str02scm("None");
- case UnitActionStill: return gh_str02scm("Still"); break;
- case UnitActionStandGround: return gh_str02scm("StandGround"); break;
- case UnitActionFollow: return gh_str02scm("Follow"); break;
- case UnitActionMove: return gh_str02scm("Move"); break;
- case UnitActionAttack: return gh_str02scm("Attack"); break;
- case UnitActionAttackGround: return gh_str02scm("AttackGround"); break;
- case UnitActionDie: return gh_str02scm("Die"); break;
- case UnitActionSpellCast: return gh_str02scm("SpellCast"); break;
- case UnitActionTrain: return gh_str02scm("Train"); break;
- case UnitActionUpgradeTo: return gh_str02scm("UpgradeTo"); break;
- case UnitActionResearch: return gh_str02scm("Research"); break;
- case UnitActionBuilded: return gh_str02scm("Builded"); break;
- case UnitActionBoard: return gh_str02scm("Board"); break;
- case UnitActionUnload: return gh_str02scm("Unload"); break;
- case UnitActionPatrol: return gh_str02scm("Patrol"); break;
- case UnitActionBuild: return gh_str02scm("Build"); break;
- case UnitActionRepair: return gh_str02scm("Repair"); break;
- case UnitActionResource: return gh_str02scm("Resource"); break;
- case UnitActionReturnGoods: return gh_str02scm("ReturnGoods"); break;
- case UnitActionDemolish: return gh_str02scm("Demolish"); break;
- default:
- DebugLevel0Fn("FIXME: invalid action id %d\n" _C_ action);
- return gh_str02scm("invalid");
- }
-}
-
-/**
-** 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_eval(Selected[0]->Type->AddButtonsHook, NIL);
- }
- }
- return SCM_UNSPECIFIED;
-}
-#endif
/**
** Enable/disable the global color cycling.
@@ -2149,11 +1504,7 @@
old = ShowCommandKey;
ShowCommandKey = gh_scm2bool(flag);
-#ifndef NEW_UI
UpdateButtonPanel();
-#else
- MustRedraw |= RedrawButtonPanel;
-#endif
return gh_bool2scm(old);
}
@@ -3084,7 +2435,6 @@
return SCM_UNSPECIFIED;
}
-#ifndef NEW_UI
/**
** Define a button.
**
@@ -3281,184 +2631,14 @@
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("highlight"))) {
- value = gh_car(list);
- list = gh_cdr(list);
- ba.Highlight = gh_scm2bool(value);
- } 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, ba.Highlight);
-
- 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_eval(SelectionChangedHook, NIL);
- } else {
- DebugLevel0Fn("Hook empty!\n");
- }
- MustRedraw |= RedrawInfoPanel;
-#endif
}
/**
@@ -3466,24 +2646,7 @@
*/
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_eval(SelectedUnitChangedHook, NIL);
- } else {
- DebugLevel0Fn("Hook empty!\n");
- }
-#endif
}
/**
@@ -3823,17 +2986,7 @@
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);
@@ -3870,50 +3023,6 @@
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-get-action", CclSelectedGetAction);
- gh_new_procedure0_0("selected-resource-loaded", CclSelectedResourceLoaded);
- gh_new_procedure0_0("selected-draw-buttons", CclSelectedDrawButtons);
-
-#endif
InitMenuFuncHash();
}
Index: stratagus/src/ui/interface.c
diff -u stratagus/src/ui/interface.c:1.138 stratagus/src/ui/interface.c:1.139
--- stratagus/src/ui/interface.c:1.138 Tue Sep 30 15:04:04 2003
+++ stratagus/src/ui/interface.c Tue Oct 7 08:03:41 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: interface.c,v 1.138 2003/09/30 19:04:04 jsalmon3 Exp $
+// $Id: interface.c,v 1.139 2003/10/07 12:03:41 martinxyz Exp $
//@{
@@ -119,9 +119,7 @@
KeyState = KeyStateInput;
Input[0] = '\0';
InputIndex = 0;
-#ifndef NEW_UI
ClearCosts();
-#endif
ShowInput();
}
@@ -624,13 +622,8 @@
LastIdleWorker = unit;
SelectSingleUnit(unit);
ClearStatusLine();
-#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel = 0;
-#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);
@@ -1260,11 +1253,9 @@
case KeyCodeAlt:
KeyModifiers |= ModifierAlt;
// maxy: disabled
-#ifndef NEW_UI
if (InterfaceState == IfaceStateNormal) {
SelectedUnitChanged(); //VLADI: to allow alt-buttons
}
-#endif
return 1;
case KeyCodeSuper:
KeyModifiers |= ModifierSuper;
@@ -1303,11 +1294,9 @@
case KeyCodeAlt:
KeyModifiers &= ~ModifierAlt;
// maxy: disabled
-#ifndef NEW_UI
if (InterfaceState == IfaceStateNormal) {
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.127 stratagus/src/ui/mainscr.c:1.128
--- stratagus/src/ui/mainscr.c:1.127 Sat Oct 4 01:40:11 2003
+++ stratagus/src/ui/mainscr.c Tue Oct 7 08:03:41 2003
@@ -27,7 +27,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainscr.c,v 1.127 2003/10/04 05:40:11 jsalmon3 Exp $
+// $Id: mainscr.c,v 1.128 2003/10/07 12:03:41 martinxyz Exp $
//@{
@@ -919,67 +919,18 @@
*/
global void DrawStatusLine(void)
{
-#ifdef NEW_UI
- int i;
- int x;
- char* startpos;
- char* endpos;
- char* endline;
- char* s;
-#endif
if (TheUI.StatusLine.Graphic) {
VideoDrawSubClip(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) {
- VideoDrawSubClip(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();
}
}
@@ -1008,7 +959,6 @@
}
}
-#ifndef NEW_UI
/*----------------------------------------------------------------------------
-- COSTS
----------------------------------------------------------------------------*/
@@ -1114,7 +1064,6 @@
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.103 stratagus/src/ui/menu_proc.c:1.104
--- stratagus/src/ui/menu_proc.c:1.103 Tue Sep 30 23:28:18 2003
+++ stratagus/src/ui/menu_proc.c Tue Oct 7 08:03:41 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menu_proc.c,v 1.103 2003/10/01 03:28:18 jsalmon3 Exp $
+// $Id: menu_proc.c,v 1.104 2003/10/07 12:03:41 martinxyz Exp $
//@{
@@ -2345,11 +2345,7 @@
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.152 stratagus/src/ui/mouse.c:1.153
--- stratagus/src/ui/mouse.c:1.152 Tue Oct 7 06:40:37 2003
+++ stratagus/src/ui/mouse.c Tue Oct 7 08:03:42 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mouse.c,v 1.152 2003/10/07 10:40:37 martinxyz Exp $
+// $Id: mouse.c,v 1.153 2003/10/07 12:03:42 martinxyz Exp $
//@{
@@ -78,7 +78,6 @@
-- Functions
----------------------------------------------------------------------------*/
-#ifndef NEW_UI
/**
** Cancel building cursor mode.
*/
@@ -91,7 +90,6 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
}
-#endif
/**
** Called when right button is pressed
@@ -1024,15 +1022,9 @@
continue; // no unit can cast spell on himself
// n0b0dy: why not?
}
-#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
}
}
@@ -1050,10 +1042,8 @@
x = sx / TileSizeX;
y = sy / TileSizeY;
-#ifndef NEW_UI
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
-#endif
switch (CursorAction) {
case ButtonMove:
SendMove(sx, sy);
@@ -1133,10 +1123,8 @@
}
ClearStatusLine();
-#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel = 0; // reset unit buttons to normal
-#endif
SelectionChanged();
MustRedraw |= RedrawInfoPanel;
}
@@ -1158,57 +1146,11 @@
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;
@@ -1216,7 +1158,6 @@
CurrentButtonLevel = 0;
UpdateButtonPanel();
MustRedraw |= RedrawButtonPanel | RedrawCursor;
-#endif
sx = CursorX - vp->X + TileSizeX * vp->MapX;
sy = CursorY - vp->Y + TileSizeY * vp->MapY;
@@ -1230,9 +1171,6 @@
}
SendCommand(sx, sy);
}
-#ifdef NEW_UI
- ChooseTargetFinish();
-#endif
return;
}
@@ -1248,7 +1186,6 @@
if (MouseButtons & LeftButton) {
sx = mx * TileSizeX;
sy = my * TileSizeY;
-#ifndef NEW_UI
ClearStatusLine();
ClearCosts();
CursorState = CursorStatePoint;
@@ -1256,15 +1193,11 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
MustRedraw |= RedrawButtonPanel | RedrawCursor;
-#endif
if (ClickMissile) {
MakeLocalMissile(MissileTypeByIdent(ClickMissile),
sx + TileSizeX / 2, sy + TileSizeY / 2, 0, 0);
}
SendCommand(sx, sy);
-#ifdef NEW_UI
- ChooseTargetFinish();
-#endif
} else {
ViewportCenterViewpoint(TheUI.SelectedViewport, mx, my);
}
@@ -1274,15 +1207,11 @@
if (CursorOn==CursorOnButton) {
// FIXME: other buttons?
if (ButtonAreaUnderCursor == ButtonAreaButton) {
-#ifdef NEW_UI
- ChooseTargetFinish();
-#endif
DoButtonButtonClicked(ButtonUnderCursor);
return;
}
}
-#ifndef NEW_UI
ClearStatusLine();
ClearCosts();
CursorState = CursorStatePoint;
@@ -1290,9 +1219,6 @@
CurrentButtonLevel = 0; // reset unit buttons to normal
UpdateButtonPanel();
MustRedraw |= RedrawButtonPanel | RedrawCursor;
-#else
- ChooseTargetFinish();
-#endif
}
/**
@@ -1364,7 +1290,6 @@
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
@@ -1407,7 +1332,6 @@
}
return;
}
-#endif
if (MouseButtons & LeftButton) { // enter select mode
CursorStartX = CursorX;
@@ -1558,13 +1482,7 @@
//
} 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)) {
@@ -1744,10 +1662,8 @@
if (num) {
ClearStatusLine();
-#ifndef NEW_UI
ClearCosts();
CurrentButtonLevel = 0; // reset unit buttons to normal
-#endif
SelectionChanged();
//
Index: stratagus/src/unit/ccl_unittype.c
diff -u stratagus/src/unit/ccl_unittype.c:1.91
stratagus/src/unit/ccl_unittype.c:1.92
--- stratagus/src/unit/ccl_unittype.c:1.91 Thu Oct 2 12:15:06 2003
+++ stratagus/src/unit/ccl_unittype.c Tue Oct 7 08:03:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: ccl_unittype.c,v 1.91 2003/10/02 16:15:06 jsalmon3 Exp $
+// $Id: ccl_unittype.c,v 1.92 2003/10/07 12:03:44 martinxyz Exp $
//@{
@@ -128,9 +128,6 @@
type->_RegenerationRate = 0;
}
type->NumDirections = 8;
-#ifdef NEW_UI
- type->AddButtonsHook = NIL;
-#endif
//
// Parse the list: (still everything could be changed!)
@@ -596,13 +593,6 @@
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/unittype.c
diff -u stratagus/src/unit/unittype.c:1.107 stratagus/src/unit/unittype.c:1.108
--- stratagus/src/unit/unittype.c:1.107 Fri Oct 3 14:24:03 2003
+++ stratagus/src/unit/unittype.c Tue Oct 7 08:03:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: unittype.c,v 1.107 2003/10/03 18:24:03 jsalmon3 Exp $
+// $Id: unittype.c,v 1.108 2003/10/07 12:03:44 martinxyz Exp $
//@{
@@ -1050,11 +1050,6 @@
CLprintf(file, " 'teleporter\n");
}
-#ifdef NEW_UI
- CLprintf(file, " 'add-buttons '");
- lprin1CL(type->AddButtonsHook, file);
- CLprintf(file, "\n");
-#endif
CLprintf(file, " 'sounds '(");
if (type->Sound.Selected.Name) {
@@ -1150,7 +1145,7 @@
char** sp;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.107 2003/10/03
18:24:03 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: unittypes $Id: unittype.c,v 1.108 2003/10/07
12:03:44 martinxyz Exp $\n\n");
// Original number to internal unit-type name.
Index: stratagus/src/video/cursor.c
diff -u stratagus/src/video/cursor.c:1.68 stratagus/src/video/cursor.c:1.69
--- stratagus/src/video/cursor.c:1.68 Sun Sep 28 15:05:44 2003
+++ stratagus/src/video/cursor.c Tue Oct 7 08:03:44 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: cursor.c,v 1.68 2003/09/28 19:05:44 jsalmon3 Exp $
+// $Id: cursor.c,v 1.69 2003/10/07 12:03:44 martinxyz Exp $
//@{
@@ -74,11 +74,7 @@
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
@@ -1124,7 +1120,7 @@
int i;
CLprintf(file, "\n;;; -----------------------------------------\n");
- CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.68 2003/09/28
19:05:44 jsalmon3 Exp $\n\n");
+ CLprintf(file, ";;; MODULE: cursors $Id: cursor.c,v 1.69 2003/10/07
12:03:44 martinxyz Exp $\n\n");
for (i = 0; Cursors[i].OType; ++i) {
CLprintf(file, "(define-cursor '%s '%s\n",
@@ -1150,11 +1146,7 @@
break;
}
CLprintf(file, ";;(cursor-action %d)\n", CursorAction);
-#ifndef NEW_UI
CLprintf(file, ";;(cursor-value %d)\n", CursorValue);
-#else
- CLprintf(file, ";;(cursor-spell %d)\n", CursorSpell);
-#endif
CLprintf(file, ";;(cursor-building '%s)\n",
CursorBuilding ? CursorBuilding->Ident : "()");
CLprintf(file, ";;(cursor-position '(%d %d)\n", CursorX, CursorY);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Stratagus-CVS] stratagus ./configure.in doc/ChangeLog.html doc...,
Martin Renold <=