From db47aaa3b9b931abbf64bba9d553235efcc815ca Mon Sep 17 00:00:00 2001 From: johns <> Date: Sun, 21 May 2000 22:27:53 +0000 Subject: [PATCH] Fixed icons, shows now player color with new video code. --- src/include/icons.h | 5 +++++ src/ui/botpanel.cpp | 7 ++++++ src/ui/icons.cpp | 8 +++++++ src/ui/mainscr.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/include/icons.h b/src/include/icons.h index cb2958ece..95d1d37c2 100644 --- a/src/include/icons.h +++ b/src/include/icons.h @@ -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 //@} diff --git a/src/ui/botpanel.cpp b/src/ui/botpanel.cpp index 5ae58b1c1..a3475d87d 100644 --- a/src/ui/botpanel.cpp +++ b/src/ui/botpanel.cpp @@ -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 diff --git a/src/ui/icons.cpp b/src/ui/icons.cpp index eb6223437..9398a6c56 100644 --- a/src/ui/icons.cpp +++ b/src/ui/icons.cpp @@ -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); diff --git a/src/ui/mainscr.cpp b/src/ui/mainscr.cpp index 6caae304c..e9d2998d3 100644 --- a/src/ui/mainscr.cpp +++ b/src/ui/mainscr.cpp @@ -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);