Made Green Action Cross Configurable

This commit is contained in:
mr-russ 2003-09-17 08:17:13 +00:00
parent ba2ec0c2bd
commit 1066f16d8f
8 changed files with 67 additions and 23 deletions

View file

@ -36,7 +36,7 @@
<li>Future 1.19 Release<p>
<ul>
<li>++
<li>Fixed Bug #4721: Sound effects are white noise (from Nehal Mistry and Russell Smith).
<li>Made Green Action Cross Configurable (from Russell Smith).
<li>NEW_UI: Can highlight buttons now to show actions (from Martin Renold).
<li>Removed old pathfinder, A-Star is not an option now (from Russell Smith).
<li>Added MinRange to Orders, Pathfinder finds correct paths for a ranged attack now (from Russell Smith).

View file

@ -62,6 +62,7 @@
<a href="#set-brightness!">set-brightness!</a>
<a href="#set-building-capture!">set-building-capture!</a>
<a href="#set-burn-buildings!">set-burn-buildings!</a>
<a href="#set-click-missile!">set-click-missile!</a>
<a href="#set-color-cycle-all!">set-color-cycle-all!</a>
<a href="#set-contrast!">set-contrast!</a>
<a href="#set-double-click-delay!">set-double-click-delay!</a>
@ -435,6 +436,27 @@ Enable or disable building capture.
<pre>
(set-burn-buildings! 25 2)
</pre>
<h4>Used</h4>
<a href="../../data/ccl/stratagus.ccl"> $LIBRARYPATH/ccl/stratagus.ccl </a>
<a name="set-click-missile!"></a>
<h3>(set-click-missile! missile)</h3>
Sets the missile to use for displaying when a player clicks on a location on the map.
<dl>
<dt>missile</dt>
<dd>The missile to use, as defined in the missiles section</dd>
</dl>
<h4>Example</h4>
<pre>
(set-click-missile! 'missile-green-cross)
</pre>
<h4>Used</h4>
<a href="../../data/ccl/stratagus.ccl"> $LIBARYPATH/ccl/stratagus.ccl </a>

View file

@ -179,9 +179,6 @@ local void AiMarkWaterTransporter(const Unit* unit,unsigned char* matrix)
}
if( CanMoveToMask(x,y,mask) ) { // reachable
/*MakeLocalMissile(MissileTypeRedCross,
x*TileSizeX+TileSizeX/2,y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2,y*TileSizeY+TileSizeY/2);*/
*m=66;
points[wp].X=x; // push the point
@ -309,9 +306,6 @@ local int AiFindTarget(const Unit* unit,unsigned char* matrix,
}
if( CanMoveToMask(x,y,mask) ) { // reachable
/*MakeLocalMissile(MissileTypeGreenCross,
x*TileSizeX+TileSizeX/2,y*TileSizeY+TileSizeY/2,
x*TileSizeX+TileSizeX/2,y*TileSizeY+TileSizeY/2);*/
*m=1;
points[wp].X=x; // push the point

View file

@ -487,8 +487,6 @@ extern char** MissileTypeWcNames; /// Mapping wc-number 2 symbol
extern MissileType* MissileTypes; /// All missile-types
extern MissileType* MissileTypeSmallFire; /// Small fire missile-type
extern MissileType* MissileTypeBigFire; /// Big fire missile-type
extern MissileType* MissileTypeGreenCross; /// Green cross missile-type
extern MissileType* MissileTypeRedCross; /// Red cross missile-type
extern MissileType* MissileTypeExplosion; /// Explosion missile-type
extern MissileType* MissileTypeHit; /// Hit missile-type

View file

@ -466,6 +466,7 @@ extern char* MenuBackground; /// File for menu background
extern char* MenuBackgroundWithTitle; /// File for menu with title
extern char* TitleMusic; /// File for title music
extern char* MenuMusic; /// File for menu music
extern char* ClickMissile; /// Missile to show when you click
extern char* StratagusLibPath; /// Location of stratagus data
extern int SpeedBuild; /// Speed factor for building

View file

@ -103,8 +103,6 @@ global int NumMissileTypes; /// number of missile-types made.
*/
global MissileType* MissileTypeSmallFire; /// Small fire missile-type
global MissileType* MissileTypeBigFire; /// Big fire missile-type
global MissileType* MissileTypeGreenCross; /// Green cross missile-type
global MissileType* MissileTypeRedCross; /// Red cross missile-type
/// missile-type for the explosion missile
global MissileType* MissileTypeExplosion;
global MissileType* MissileTypeHit; /// Hit missile-type
@ -1659,8 +1657,6 @@ global void InitMissileTypes(void)
MissileTypeSmallFire=MissileTypeByIdent("missile-small-fire");
MissileTypeBigFire=MissileTypeByIdent("missile-big-fire");
MissileTypeGreenCross=MissileTypeByIdent("missile-green-cross");
MissileTypeRedCross=MissileTypeByIdent("missile-red-cross");
MissileTypeExplosion = MissileTypeByIdent("missile-explosion");
MissileTypeHit = MissileTypeByIdent("missile-hit");
}
@ -1689,8 +1685,6 @@ global void CleanMissileTypes(void)
MissileTypeSmallFire=NULL;
MissileTypeBigFire=NULL;
MissileTypeGreenCross=NULL;
MissileTypeRedCross=NULL;
MissileTypeHit=NULL;
}

View file

@ -1230,11 +1230,13 @@ local void UISelectStateButtonDown(unsigned button __attribute__((unused)))
sx = CursorX - vp->X + TileSizeX * vp->MapX;
sy = CursorY - vp->Y + TileSizeY * vp->MapY;
if( MouseButtons&LeftButton ) {
MakeLocalMissile(MissileTypeGreenCross
if( ClickMissile ) {
MakeLocalMissile(MissileTypeByIdent(ClickMissile)
,vp->MapX*TileSizeX+CursorX - vp->X
,vp->MapY*TileSizeY+CursorY - vp->Y
,vp->MapX*TileSizeX+CursorX - vp->X
,vp->MapY*TileSizeY+CursorY - vp->Y);
}
SendCommand(sx, sy);
}
#ifdef NEW_UI
@ -1264,8 +1266,10 @@ local void UISelectStateButtonDown(unsigned button __attribute__((unused)))
UpdateButtonPanel();
MustRedraw|=RedrawButtonPanel|RedrawCursor;
#endif
MakeLocalMissile(MissileTypeGreenCross
if( ClickMissile ) {
MakeLocalMissile(MissileTypeByIdent(ClickMissile)
,sx+TileSizeX/2,sy+TileSizeY/2,0,0);
}
SendCommand(sx,sy);
#ifdef NEW_UI
ChooseTargetFinish();
@ -1454,11 +1458,13 @@ global void UIHandleButtonDown(unsigned button)
if( UnitUnderCursor && (unit=UnitOnMapTile(x/TileSizeX,y/TileSizeY)) ) {
unit->Blink=4; // if right click on building -- blink
} else { // if not not click on building -- green cross
MakeLocalMissile(MissileTypeGreenCross
,TheUI.MouseViewport->MapX*TileSizeX
+CursorX-TheUI.MouseViewport->X
,TheUI.MouseViewport->MapY*TileSizeY
+CursorY-TheUI.MouseViewport->Y,0,0);
if( ClickMissile ) {
MakeLocalMissile(MissileTypeByIdent(ClickMissile)
,TheUI.MouseViewport->MapX*TileSizeX
+CursorX-TheUI.MouseViewport->X
,TheUI.MouseViewport->MapY*TileSizeY
+CursorY-TheUI.MouseViewport->Y,0,0);
}
}
DoRightButton(x,y);
}
@ -1472,9 +1478,11 @@ global void UIHandleButtonDown(unsigned button)
ScreenMinimap2MapX(CursorX), ScreenMinimap2MapY(CursorY));
} else if( MouseButtons&RightButton ) {
if( !GameObserve && !GamePaused ) {
MakeLocalMissile(MissileTypeGreenCross
if( ClickMissile ) {
MakeLocalMissile(MissileTypeByIdent(ClickMissile)
,ScreenMinimap2MapX(CursorX)*TileSizeX+TileSizeX/2
,ScreenMinimap2MapY(CursorY)*TileSizeY+TileSizeY/2,0,0);
}
// DoRightButton() takes screen map coordinates
DoRightButton(ScreenMinimap2MapX(CursorX) * TileSizeX,
ScreenMinimap2MapY(CursorY) * TileSizeY);

View file

@ -64,6 +64,7 @@ local SCM ChooseTargetBeginHook; /// Script to draw target selection buttons
local SCM ChooseTargetFinishHook; /// Script to draw target selection buttons
#endif
global char* ClickMissile;
/*----------------------------------------------------------------------------
-- Functions
----------------------------------------------------------------------------*/
@ -783,6 +784,30 @@ local SCM CclSetMouseScale(SCM scale)
return old;
}
/**
** Set which missile is used for right click
**
** @param missile missile name to use
** @return old value
*/
local SCM CclSetClickMissile(SCM missile)
{
SCM old;
old=NIL;
if( ClickMissile ) {
old=gh_str02scm(ClickMissile);
free( ClickMissile );
ClickMissile = NULL;
}
if( !gh_null_p(missile) ) {
ClickMissile=gh_scm2newstr(missile,NULL);
}
return old;
}
/**
** Game contrast.
**
@ -3691,6 +3716,8 @@ global void UserInterfaceCclRegister(void)
gh_new_procedure1_0("set-mouse-adjust!",CclSetMouseAdjust);
gh_new_procedure1_0("set-mouse-scale!",CclSetMouseScale);
gh_new_procedure1_0("set-click-missile!",CclSetClickMissile);
gh_new_procedure1_0("set-contrast!",CclSetContrast);
gh_new_procedure1_0("set-brightness!",CclSetBrightness);
gh_new_procedure1_0("set-saturation!",CclSetSaturation);