Patch for horizontal life and magic bars from Iuri applied.
This commit is contained in:
parent
dfd2d7a7f8
commit
1b845c34a8
3 changed files with 109 additions and 18 deletions
src
|
@ -348,6 +348,8 @@ extern int ShowHealthBar; /// Flag: show health bar
|
|||
extern int ShowHealthDot; /// Flag: show health dot
|
||||
extern int ShowManaBar; /// Flag: show mana bar
|
||||
extern int ShowManaDot; /// Flag: show mana dot
|
||||
extern int ShowHealthHorizontal; /// Flag: show health bar horizontal
|
||||
extern int ShowManaHorizontal; /// Flag: show mana bar horizontal
|
||||
extern int ShowNoFull; /// Flag: show no full health or mana
|
||||
extern int DecorationOnTop; /// Flag: show health and mana on top
|
||||
extern int ShowSightRange; /// Flag: show right range
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "freecraft.h"
|
||||
#include "iolib.h"
|
||||
#include "iolib.h"
|
||||
|
||||
#ifdef USE_CCL
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
#include "ccl_sound.h"
|
||||
#include "ccl.h"
|
||||
#include "font.h"
|
||||
#include "pathfinder.h"
|
||||
#include "pathfinder.h"
|
||||
|
||||
#include <guile/gh.h> // I use guile for a quick hack
|
||||
|
||||
|
@ -81,7 +81,7 @@ extern void sgtk_init_gtk_gdk_glue();
|
|||
#include "ccl_sound.h"
|
||||
#include "ui.h"
|
||||
#include "font.h"
|
||||
#include "pathfinder.h"
|
||||
#include "pathfinder.h"
|
||||
#include "ai.h"
|
||||
|
||||
#endif // USE_CCL2
|
||||
|
@ -184,6 +184,30 @@ local SCM CclShowHealthDot(void)
|
|||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable display health as horizontal bar.
|
||||
*/
|
||||
local SCM CclShowHealthHorizontal(void)
|
||||
{
|
||||
ShowHealthBar=1;
|
||||
ShowHealthDot=0;
|
||||
ShowHealthHorizontal=1;
|
||||
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable display health as vertical bar.
|
||||
*/
|
||||
local SCM CclShowHealthVertical(void)
|
||||
{
|
||||
ShowHealthBar=1;
|
||||
ShowHealthDot=0;
|
||||
ShowHealthHorizontal=0;
|
||||
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable display mana as mana-bar.
|
||||
*/
|
||||
|
@ -216,6 +240,30 @@ local SCM CclShowFull(void)
|
|||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable display mana as horizontal bar.
|
||||
*/
|
||||
local SCM CclShowManaHorizontal(void)
|
||||
{
|
||||
ShowManaBar=1;
|
||||
ShowManaDot=0;
|
||||
ShowManaHorizontal=1;
|
||||
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable display mana as vertical bar.
|
||||
*/
|
||||
local SCM CclShowManaVertical(void)
|
||||
{
|
||||
ShowManaBar=1;
|
||||
ShowManaDot=0;
|
||||
ShowManaHorizontal=0;
|
||||
|
||||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Disable display of full bars/dots.
|
||||
*/
|
||||
|
@ -769,7 +817,7 @@ local void gh_main_prog(int argc,char* argv[])
|
|||
gh_new_procedureN("missile-type",CclMissileType);
|
||||
|
||||
MapCclRegister();
|
||||
PathfinderCclRegister();
|
||||
PathfinderCclRegister();
|
||||
UnitButtonCclRegister();
|
||||
UnitTypeCclRegister();
|
||||
SoundCclRegister();
|
||||
|
@ -854,6 +902,13 @@ global void CclInit(void)
|
|||
|
||||
init_subr_0("show-health-bar",CclShowHealthBar);
|
||||
init_subr_0("show-health-dot",CclShowHealthDot);
|
||||
// adicionado por protoman
|
||||
init_subr_0("show-health-vertical",CclShowHealthVertical);
|
||||
init_subr_0("show-health-horizontal",CclShowHealthHorizontal);
|
||||
init_subr_0("show-mana-vertical",CclShowManaVertical);
|
||||
init_subr_0("show-mana-horizontal",CclShowManaHorizontal);
|
||||
// fim
|
||||
|
||||
init_subr_0("show-mana-bar",CclShowManaBar);
|
||||
init_subr_0("show-mana-dot",CclShowManaDot);
|
||||
init_subr_0("show-full",CclShowFull);
|
||||
|
@ -879,7 +934,7 @@ global void CclInit(void)
|
|||
init_lsubr("missile-type",CclMissileType);
|
||||
|
||||
MapCclRegister();
|
||||
PathfinderCclRegister();
|
||||
PathfinderCclRegister();
|
||||
UnitButtonCclRegister();
|
||||
UnitTypeCclRegister();
|
||||
UpgradesCclRegister();
|
||||
|
|
|
@ -54,6 +54,10 @@ global int ShowSightRange; /// Flag: show right range
|
|||
global int ShowReactRange; /// Flag: show react range
|
||||
global int ShowAttackRange; /// Flag: show attack range
|
||||
global int ShowOrders; /// Flag: show orders of unit on map
|
||||
/// Flag: health horizontal instead of vertical
|
||||
global int ShowHealthHorizontal=1;
|
||||
/// Flag: health horizontal instead of vertical
|
||||
global int ShowManaHorizontal=1;
|
||||
|
||||
// FIXME: not all variables of this file are here
|
||||
// FIXME: perhaps split this file into two?
|
||||
|
@ -355,12 +359,27 @@ local void DrawDecoration(Unit* unit,const UnitType* type,int x,int y)
|
|||
} else {
|
||||
color=ColorRed;
|
||||
}
|
||||
VideoFillRectangleClip(color
|
||||
,x+(type->TileWidth*TileSizeX
|
||||
-type->BoxWidth)/2
|
||||
,y+(type->TileHeight*TileSizeY
|
||||
-type->BoxHeight)/2
|
||||
,2,(f*type->BoxHeight)/100);
|
||||
if ( ShowHealthHorizontal == 0) {
|
||||
VideoFillRectangleClip(color
|
||||
,x+(type->TileWidth*TileSizeX
|
||||
-type->BoxWidth)/2
|
||||
,y+(type->TileHeight*TileSizeY
|
||||
-type->BoxHeight)/2
|
||||
,2,(f*type->BoxHeight)/100);
|
||||
} else {
|
||||
VideoFillRectangleClip(ColorBlack
|
||||
,x+((type->TileWidth*TileSizeX-type->BoxWidth)/2)-1
|
||||
,(y+(type->TileHeight*TileSizeY-type->BoxHeight)/2)
|
||||
+type->BoxHeight+1
|
||||
,((f*type->BoxHeight)/100)+2
|
||||
,5);
|
||||
VideoFillRectangleClip(color
|
||||
,x+((type->TileWidth*TileSizeX-type->BoxWidth)/2)
|
||||
,(y+(type->TileHeight*TileSizeY-type->BoxHeight)/2)
|
||||
+type->BoxHeight+2
|
||||
,(f*type->BoxHeight)/100
|
||||
,3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -413,13 +432,28 @@ local void DrawDecoration(Unit* unit,const UnitType* type,int x,int y)
|
|||
if( ShowManaBar ) {
|
||||
if( type->CanCastSpell
|
||||
&& !(ShowNoFull && unit->Mana==255) ) {
|
||||
f=(100*unit->Mana)/255;
|
||||
VideoFillRectangleClip(ColorBlue
|
||||
,x+(type->TileWidth*TileSizeX
|
||||
+type->BoxWidth)/2
|
||||
,y+(type->TileHeight*TileSizeY
|
||||
-type->BoxHeight)/2
|
||||
,2,(f*type->BoxHeight)/100);
|
||||
if ( ShowManaHorizontal == 0) {
|
||||
f=(100*unit->Mana)/255;
|
||||
VideoFillRectangleClip(ColorBlue
|
||||
,x+(type->TileWidth*TileSizeX
|
||||
+type->BoxWidth)/2
|
||||
,y+(type->TileHeight*TileSizeY
|
||||
-type->BoxHeight)/2
|
||||
,2,(f*type->BoxHeight)/100);
|
||||
} else {
|
||||
f=(100*unit->Mana)/255;
|
||||
VideoFillRectangleClip(ColorBlack
|
||||
,x+((type->TileWidth*TileSizeX-type->BoxWidth)/2)-1
|
||||
,(y+(type->TileHeight*TileSizeY-type->BoxHeight)/2)+type->BoxHeight+6
|
||||
,(type->BoxHeight)+2
|
||||
,5);
|
||||
VideoFillRectangleClip(ColorBlue
|
||||
,x+(type->TileWidth*TileSizeX-type->BoxWidth)/2
|
||||
,(y+(type->TileHeight*TileSizeY-type->BoxHeight)/2)+type->BoxHeight+7
|
||||
,(f*type->BoxHeight)/100
|
||||
,3);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue