Removed original resources option
This commit is contained in:
parent
e221a945f4
commit
5615581a12
4 changed files with 60 additions and 110 deletions
src
|
@ -184,8 +184,6 @@ typedef struct _ui_ {
|
|||
int ResourceX; /// Resource X position
|
||||
int ResourceY; /// Resource Y position
|
||||
|
||||
int OriginalResources; /// Original resource mode
|
||||
|
||||
struct {
|
||||
#if 0
|
||||
int IconX; /// Icon X position
|
||||
|
|
|
@ -490,30 +490,30 @@ global void DrawUnitInfo(const Unit* unit)
|
|||
}
|
||||
|
||||
}
|
||||
if (type->CanCastSpell) {
|
||||
if (0) {
|
||||
VideoDrawText(x + 59, y + 8 + 140 + 1, GameFont, "Magic:");
|
||||
VideoDrawRectangleClip(ColorGray, x + 108, y + 8 + 140, 61, 14);
|
||||
VideoDrawRectangleClip(ColorBlack, x + 108 + 1, y + 8 + 140 + 1, 61 - 2, 14 - 2);
|
||||
i = (100 * unit->Mana) / unit->Type->_MaxMana;
|
||||
i = (i * (61 - 4)) / 100;
|
||||
VideoFillRectangleClip(ColorBlue, x + 108 + 2, y + 8 + 140 + 2, i, 14 - 4);
|
||||
if (type->CanCastSpell) {
|
||||
if (0) {
|
||||
VideoDrawText(x + 59, y + 8 + 140 + 1, GameFont, "Magic:");
|
||||
VideoDrawRectangleClip(ColorGray, x + 108, y + 8 + 140, 61, 14);
|
||||
VideoDrawRectangleClip(ColorBlack, x + 108 + 1, y + 8 + 140 + 1, 61 - 2, 14 - 2);
|
||||
i = (100 * unit->Mana) / unit->Type->_MaxMana;
|
||||
i = (i * (61 - 4)) / 100;
|
||||
VideoFillRectangleClip(ColorBlue, x + 108 + 2, y + 8 + 140 + 2, i, 14 - 4);
|
||||
|
||||
VideoDrawNumber(x + 128, y + 8 + 140 + 1, GameFont, unit->Mana);
|
||||
} else {
|
||||
int w;
|
||||
w = 140;
|
||||
/* fix to display mana bar properly for any maxmana value */
|
||||
/* max mana can vary for the unit */
|
||||
i = (100 * unit->Mana) / unit->Type->_MaxMana;
|
||||
i = (i * w) / 100;
|
||||
VideoDrawRectangleClip(ColorGray, x + 16, y + 8 + 140, w + 4, 16 );
|
||||
VideoDrawRectangleClip(ColorBlack,x + 16 + 1, y + 8 + 140 + 1, w + 2, 16 - 2);
|
||||
VideoFillRectangleClip(ColorBlue, x + 16 + 2, y + 8 + 140 + 2, i, 16 - 4);
|
||||
VideoDrawNumber(x + 128, y + 8 + 140 + 1, GameFont, unit->Mana);
|
||||
} else {
|
||||
int w;
|
||||
w = 140;
|
||||
/* fix to display mana bar properly for any maxmana value */
|
||||
/* max mana can vary for the unit */
|
||||
i = (100 * unit->Mana) / unit->Type->_MaxMana;
|
||||
i = (i * w) / 100;
|
||||
VideoDrawRectangleClip(ColorGray, x + 16, y + 8 + 140, w + 4, 16 );
|
||||
VideoDrawRectangleClip(ColorBlack,x + 16 + 1, y + 8 + 140 + 1, w + 2, 16 - 2);
|
||||
VideoFillRectangleClip(ColorBlue, x + 16 + 2, y + 8 + 140 + 2, i, 16 - 4);
|
||||
|
||||
VideoDrawNumber(x + 16 + w / 2, y + 8 + 140 + 1, GameFont, unit->Mana);
|
||||
}
|
||||
VideoDrawNumber(x + 16 + w / 2, y + 8 + 140 + 1, GameFont, unit->Mana);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
@ -536,74 +536,49 @@ global void DrawResources(void)
|
|||
TheUI.ResourceX,TheUI.ResourceY);
|
||||
}
|
||||
|
||||
if (TheUI.OriginalResources) {
|
||||
// FIXME: could write a sub function for this
|
||||
VideoDrawSubClip(TheUI.Resources[GoldCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[GoldCost].IconRow * TheUI.Resources[GoldCost].IconH,
|
||||
TheUI.Resources[GoldCost].IconW,
|
||||
TheUI.Resources[GoldCost].IconH,
|
||||
TheUI.ResourceX + 90, TheUI.ResourceY);
|
||||
VideoDrawNumber(TheUI.ResourceX + 107, TheUI.ResourceY + 1,
|
||||
GameFont, ThisPlayer->Resources[GoldCost]);
|
||||
VideoDrawSubClip(TheUI.Resources[WoodCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[WoodCost].IconRow * TheUI.Resources[WoodCost].IconH,
|
||||
TheUI.Resources[WoodCost].IconW,
|
||||
TheUI.Resources[WoodCost].IconH,
|
||||
TheUI.ResourceX + 178, TheUI.ResourceY);
|
||||
VideoDrawNumber(TheUI.ResourceX + 195, TheUI.ResourceY + 1,
|
||||
GameFont, ThisPlayer->Resources[WoodCost]);
|
||||
VideoDrawSubClip(TheUI.Resources[OilCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[OilCost].IconRow * TheUI.Resources[OilCost].IconH,
|
||||
TheUI.Resources[OilCost].IconW,
|
||||
TheUI.Resources[OilCost].IconH,
|
||||
TheUI.ResourceX + 266, TheUI.ResourceY);
|
||||
VideoDrawNumber(TheUI.ResourceX + 283, TheUI.ResourceY + 1,
|
||||
GameFont, ThisPlayer->Resources[OilCost]);
|
||||
} else {
|
||||
for (i = 0; i < MaxCosts; ++i) {
|
||||
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,
|
||||
TheUI.Resources[i].IconX, TheUI.Resources[i].IconY);
|
||||
}
|
||||
if (TheUI.Resources[i].TextX != -1) {
|
||||
v = ThisPlayer->Resources[i];
|
||||
VideoDrawNumber(TheUI.Resources[i].TextX,
|
||||
TheUI.Resources[i].TextY + (v > 99999) * 3,
|
||||
v > 99999 ? SmallFont : GameFont, v);
|
||||
}
|
||||
for (i = 0; i < MaxCosts; ++i) {
|
||||
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,
|
||||
TheUI.Resources[i].IconX, TheUI.Resources[i].IconY);
|
||||
}
|
||||
if (TheUI.Resources[FoodCost].Icon.Graphic) {
|
||||
VideoDrawSubClip(TheUI.Resources[FoodCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[FoodCost].IconRow * TheUI.Resources[FoodCost].IconH,
|
||||
TheUI.Resources[FoodCost].IconW, TheUI.Resources[FoodCost].IconH,
|
||||
TheUI.Resources[FoodCost].IconX, TheUI.Resources[FoodCost].IconY);
|
||||
}
|
||||
if (TheUI.Resources[FoodCost].TextX != -1) {
|
||||
sprintf(tmp, "%d/%d", ThisPlayer->NumFoodUnits, ThisPlayer->Food);
|
||||
if (ThisPlayer->Food < ThisPlayer->NumFoodUnits) {
|
||||
VideoDrawReverseText(TheUI.Resources[FoodCost].TextX,
|
||||
TheUI.Resources[FoodCost].TextY, GameFont, tmp);
|
||||
} else {
|
||||
VideoDrawText(TheUI.Resources[FoodCost].TextX,
|
||||
TheUI.Resources[FoodCost].TextY, GameFont, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (TheUI.Resources[ScoreCost].Icon.Graphic) {
|
||||
VideoDrawSubClip(TheUI.Resources[ScoreCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[ScoreCost].IconRow * TheUI.Resources[ScoreCost].IconH,
|
||||
TheUI.Resources[ScoreCost].IconW, TheUI.Resources[ScoreCost].IconH,
|
||||
TheUI.Resources[ScoreCost].IconX, TheUI.Resources[ScoreCost].IconY);
|
||||
}
|
||||
if (TheUI.Resources[ScoreCost].TextX != -1) {
|
||||
v = ThisPlayer->Score;
|
||||
VideoDrawNumber(TheUI.Resources[ScoreCost].TextX,
|
||||
TheUI.Resources[ScoreCost].TextY + (v > 99999) * 3,
|
||||
if (TheUI.Resources[i].TextX != -1) {
|
||||
v = ThisPlayer->Resources[i];
|
||||
VideoDrawNumber(TheUI.Resources[i].TextX,
|
||||
TheUI.Resources[i].TextY + (v > 99999) * 3,
|
||||
v > 99999 ? SmallFont : GameFont, v);
|
||||
}
|
||||
}
|
||||
if (TheUI.Resources[FoodCost].Icon.Graphic) {
|
||||
VideoDrawSubClip(TheUI.Resources[FoodCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[FoodCost].IconRow * TheUI.Resources[FoodCost].IconH,
|
||||
TheUI.Resources[FoodCost].IconW, TheUI.Resources[FoodCost].IconH,
|
||||
TheUI.Resources[FoodCost].IconX, TheUI.Resources[FoodCost].IconY);
|
||||
}
|
||||
if (TheUI.Resources[FoodCost].TextX != -1) {
|
||||
sprintf(tmp, "%d/%d", ThisPlayer->NumFoodUnits, ThisPlayer->Food);
|
||||
if (ThisPlayer->Food < ThisPlayer->NumFoodUnits) {
|
||||
VideoDrawReverseText(TheUI.Resources[FoodCost].TextX,
|
||||
TheUI.Resources[FoodCost].TextY, GameFont, tmp);
|
||||
} else {
|
||||
VideoDrawText(TheUI.Resources[FoodCost].TextX,
|
||||
TheUI.Resources[FoodCost].TextY, GameFont, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
if (TheUI.Resources[ScoreCost].Icon.Graphic) {
|
||||
VideoDrawSubClip(TheUI.Resources[ScoreCost].Icon.Graphic, 0,
|
||||
TheUI.Resources[ScoreCost].IconRow * TheUI.Resources[ScoreCost].IconH,
|
||||
TheUI.Resources[ScoreCost].IconW, TheUI.Resources[ScoreCost].IconH,
|
||||
TheUI.Resources[ScoreCost].IconX, TheUI.Resources[ScoreCost].IconY);
|
||||
}
|
||||
if (TheUI.Resources[ScoreCost].TextX != -1) {
|
||||
v = ThisPlayer->Score;
|
||||
VideoDrawNumber(TheUI.Resources[ScoreCost].TextX,
|
||||
TheUI.Resources[ScoreCost].TextY + (v > 99999) * 3,
|
||||
v > 99999 ? SmallFont : GameFont, v);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
|
|
@ -476,22 +476,6 @@ local SCM CclProcessMenu(SCM id)
|
|||
return SCM_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
** Enable/disable resource extension, use original resource display.
|
||||
**
|
||||
** @param flag True = turn on, false = off.
|
||||
** @return The old state of scrolling.
|
||||
*/
|
||||
local SCM CclSetOriginalResources(SCM flag)
|
||||
{
|
||||
int old;
|
||||
|
||||
old = TheUI.OriginalResources;
|
||||
TheUI.OriginalResources = gh_scm2bool(flag);
|
||||
|
||||
return gh_bool2scm(old);
|
||||
}
|
||||
|
||||
/**
|
||||
** Define a cursor.
|
||||
**
|
||||
|
@ -784,8 +768,6 @@ local SCM CclDefineUI(SCM list)
|
|||
ui->MouseAdjust = TheUI.MouseAdjust;
|
||||
ui->MouseScale = TheUI.MouseScale;
|
||||
|
||||
ui->OriginalResources = TheUI.OriginalResources;
|
||||
|
||||
ui->Resource.File = NULL;
|
||||
ui->ResourceX = -1;
|
||||
ui->ResourceY = -1;
|
||||
|
@ -2967,8 +2949,6 @@ global void UserInterfaceCclRegister(void)
|
|||
gh_new_procedure1_0("display-picture", CclDisplayPicture);
|
||||
gh_new_procedure1_0("process-menu", CclProcessMenu);
|
||||
|
||||
gh_new_procedure1_0("set-original-resources!", CclSetOriginalResources);
|
||||
|
||||
gh_new_procedureN("define-cursor", CclDefineCursor);
|
||||
gh_new_procedure1_0("set-game-cursor!", CclSetGameCursor);
|
||||
gh_new_procedureN("define-ui", CclDefineUI);
|
||||
|
|
|
@ -529,9 +529,6 @@ global void SaveUserInterface(CLFile* file)
|
|||
CLprintf(file, "(set-mouse-adjust! %d)\n", TheUI.MouseAdjust);
|
||||
CLprintf(file, "(set-mouse-scale! %d)\n\n", TheUI.MouseScale);
|
||||
|
||||
CLprintf(file, "(set-original-resources! %s)\n\n",
|
||||
TheUI.OriginalResources ? "#t" : "#f");
|
||||
|
||||
// Save the UIs for all resolutions
|
||||
for (i = 0; UI_Table[i]; ++i) {
|
||||
SaveUi(file, UI_Table[i]);
|
||||
|
|
Loading…
Add table
Reference in a new issue