Fixed icons, shows now player color with new video code.

This commit is contained in:
johns 2000-05-21 22:27:53 +00:00
parent f219cda5d0
commit db47aaa3b9
4 changed files with 70 additions and 2 deletions

View file

@ -66,8 +66,13 @@ extern void CleanIcons(void); /// cleanup
extern IconId IconByIdent(const char* ident); /// name -> icon
extern const char* IdentOfIcon(IconId icon); /// icon -> name
#ifdef NEW_VIDEO
/// draw icons of an unit
extern void DrawUnitIcon(const void*,IconId,unsigned,unsigned,unsigned);
#else
/// draw icons of an unit
extern void DrawUnitIcon(IconId num,unsigned flags,unsigned x,unsigned y);
#endif
//@}

View file

@ -210,7 +210,9 @@ global void DrawButtonPanel(void)
return;
}
#ifndef NEW_VIDEO
PlayerPixels(ThisPlayer); // could only select own units.
#endif
for( i=0; i<9; ++i ) {
if( buttons[i].Pos!=-1 ) {
@ -270,8 +272,13 @@ global void DrawButtonPanel(void)
}
}
#ifdef NEW_VIDEO
DrawUnitIcon(ThisPlayer,buttons[i].Icon.Icon
,v,TheUI.Buttons[i+10].X,TheUI.Buttons[i+10].Y);
#else
DrawUnitIcon(buttons[i].Icon.Icon
,v,TheUI.Buttons[i+10].X,TheUI.Buttons[i+10].Y);
#endif
//
// Update status line for this button

View file

@ -398,7 +398,12 @@ global const char* IdentOfIcon(IconId icon)
** @param x X display position
** @param y Y display position
*/
#ifdef NEW_VIDEO
global void DrawUnitIcon(const void* player,IconId icon,unsigned flags
,unsigned x,unsigned y)
#else
global void DrawUnitIcon(IconId icon,unsigned flags,unsigned x,unsigned y)
#endif
{
int color;
@ -424,6 +429,9 @@ global void DrawUnitIcon(IconId icon,unsigned flags,unsigned x,unsigned y)
++x; ++y;
}
#ifdef NEW_VIDEO
GraphicPlayerPixels(player,Icons[0].IconGraphic);
#endif
VideoDrawSub(Icons[0].IconGraphic
,(icon%5)*Icons[0].Width,(icon/5)*Icons[0].Height
,Icons[0].Width,Icons[0].Height,x+4,y+4);

View file

@ -130,17 +130,23 @@ global void DrawUnitInfo(Unit* unit)
return;
} );
PlayerPixels(unit->Player);
//
// Draw icon in upper left corner
//
x=TheUI.Buttons[1].X;
y=TheUI.Buttons[1].Y;
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player,type->Icon.Icon
,(ButtonUnderCursor==1)
? (IconActive|(MouseButtons&LeftButton)) : 0
,x,y);
#else
PlayerPixels(unit->Player);
DrawUnitIcon(type->Icon.Icon
,(ButtonUnderCursor==1)
? (IconActive|(MouseButtons&LeftButton)) : 0
,x,y);
#endif
DrawLifeBar(unit,x,y);
x=TheUI.InfoPanelX;
@ -181,8 +187,14 @@ global void DrawUnitInfo(Unit* unit)
if( unit->Command.Action==UnitActionTrain ) {
if( OriginalTraining || unit->Command.Data.Train.Count==1 ) {
DrawText(x+37,y+8+78,GameFont,"Training:");
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player
,unit->Command.Data.Train.What[0]->Icon.Icon
,0,x+107,y+8+70);
#else
DrawUnitIcon(unit->Command.Data.Train.What[0]->Icon.Icon
,0,x+107,y+8+70);
#endif
DrawCompleted(
unit->Command.Data.Train.What[0]
@ -192,10 +204,18 @@ global void DrawUnitInfo(Unit* unit)
DrawTextCentered(x+114,y+8+29,GameFont,"Training...");
for( i = 0; i < unit->Command.Data.Train.Count; i++ ) {
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player
,unit->Command.Data.Train.What[i]->Icon.Icon
,(ButtonUnderCursor==i+4)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons2[i].X,TheUI.Buttons2[i].Y);
#else
DrawUnitIcon(unit->Command.Data.Train.What[i]->Icon.Icon
,(ButtonUnderCursor==i+4)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons2[i].X,TheUI.Buttons2[i].Y);
#endif
}
DrawCompleted(
@ -207,8 +227,14 @@ global void DrawUnitInfo(Unit* unit)
}
if( unit->Command.Action==UnitActionUpgradeTo ) {
DrawText(x+29,y+8+78,GameFont,"Upgrading:");
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player
,unit->Command.Data.UpgradeTo.What->Icon.Icon
,0,x+107,y+8+70);
#else
DrawUnitIcon(unit->Command.Data.UpgradeTo.What->Icon.Icon
,0,x+107,y+8+70);
#endif
DrawCompleted(
unit->Command.Data.UpgradeTo.What
@ -218,8 +244,14 @@ global void DrawUnitInfo(Unit* unit)
}
if( unit->Command.Action==UnitActionResearch ) {
DrawText(16,y+8+78,GameFont,"Researching:");
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player
,unit->Command.Data.Research.What->Icon
,0,x+107,y+8+70);
#else
DrawUnitIcon(unit->Command.Data.Research.What->Icon
,0,x+107,y+8+70);
#endif
DrawCompleted(
unit->Command.Data.Research.What->Costs[TimeCost]
@ -269,10 +301,18 @@ global void DrawUnitInfo(Unit* unit)
DrawText(x+91,y+8+33,GameFont,buf);
for( i=0; i<6; ++i ) {
if( unit->OnBoard[i]!=NoUnitP ) {
#ifdef NEW_VIDEO
DrawUnitIcon(unit->Player
,unit->OnBoard[i]->Type->Icon.Icon
,(ButtonUnderCursor==i+4)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons[i+4].X,TheUI.Buttons[i+4].Y);
#else
DrawUnitIcon(unit->OnBoard[i]->Type->Icon.Icon
,(ButtonUnderCursor==i+4)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons[i+4].X,TheUI.Buttons[i+4].Y);
#endif
DrawLifeBar(unit->OnBoard[i]
,TheUI.Buttons[i+4].X,TheUI.Buttons[i+4].Y);
// FIXME: show also the magic bar :) I want this always.
@ -690,10 +730,18 @@ global void DrawInfoPanel(void)
PlayerPixels(ThisPlayer); // can only be own!
DrawInfoPanelBackground(0);
for( i=0; i<NumSelected; ++i ) {
#ifdef NEW_VIDEO
DrawUnitIcon(ThisPlayer
,Selected[i]->Type->Icon.Icon
,(ButtonUnderCursor==i+1)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons[i+1].X,TheUI.Buttons[i+1].Y);
#else
DrawUnitIcon(Selected[i]->Type->Icon.Icon
,(ButtonUnderCursor==i+1)
? (IconActive|(MouseButtons&LeftButton)) : 0
,TheUI.Buttons[i+1].X,TheUI.Buttons[i+1].Y);
#endif
DrawLifeBar(Selected[i]
,TheUI.Buttons[i+1].X,TheUI.Buttons[i+1].Y);