mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 23:02:08 +00:00
SBarinfo Update #18
- Simplified the DrawGraphic function in sbarinfo_display.cpp - Added xOffset, yOffset, and alpha to every drawing function in sbarinfo_display.cpp. So Strife popups can be handeled better and allow for other effects (translucent bars?). I'm thinking about making a struct for these five (also x and y) arguments so that the argument lists don't become a mess. - Changed DRAWIMAGE in sbarinfo_display.cpp to not use so many calls to DrawGraphic. - DrawKeyBar wasn't using screen->DrawTexture. - Added a Fade transition for popups. It takes two args fade in rate and fade out rate. Both are floats (1.0 = 1 tic to complete 0.5 = 2 tics to complete and so on). - Added a translucency arg to statusbars. 1.0 = opaque and 0.0 = invisible. SVN r939 (trunk)
This commit is contained in:
parent
6ce25fe6c3
commit
0d29164522
5 changed files with 184 additions and 130 deletions
|
@ -1,3 +1,18 @@
|
||||||
|
April 25, 2008 (SBarInfo Update #18)
|
||||||
|
- Simplified the DrawGraphic function in sbarinfo_display.cpp
|
||||||
|
- Added xOffset, yOffset, and alpha to every drawing function in
|
||||||
|
sbarinfo_display.cpp. So Strife popups can be handeled better and allow for
|
||||||
|
other effects (translucent bars?). I'm thinking about making a struct for
|
||||||
|
these five (also x and y) arguments so that the argument lists don't become a
|
||||||
|
mess.
|
||||||
|
- Changed DRAWIMAGE in sbarinfo_display.cpp to not use so many calls to
|
||||||
|
DrawGraphic.
|
||||||
|
- DrawKeyBar wasn't using screen->DrawTexture.
|
||||||
|
- Added a Fade transition for popups. It takes two args fade in rate and fade
|
||||||
|
out rate. Both are floats (1.0 = 1 tic to complete 0.5 = 2 tics to complete
|
||||||
|
and so on).
|
||||||
|
- Added a translucency arg to statusbars. 1.0 = opaque and 0.0 = invisible.
|
||||||
|
|
||||||
April 24, 2008
|
April 24, 2008
|
||||||
- Fixed: When an instrument's envelope runs out, it does not immediately ramp
|
- Fixed: When an instrument's envelope runs out, it does not immediately ramp
|
||||||
to zero. Rather, it lets the remainder of the sample finish playing.
|
to zero. Rather, it lets the remainder of the sample finish playing.
|
||||||
|
|
|
@ -53,6 +53,7 @@ enum PopupTransition
|
||||||
{
|
{
|
||||||
TRANSITION_NONE,
|
TRANSITION_NONE,
|
||||||
TRANSITION_SLIDEINBOTTOM,
|
TRANSITION_SLIDEINBOTTOM,
|
||||||
|
TRANSITION_FADE,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Popup
|
struct Popup
|
||||||
|
@ -63,6 +64,8 @@ struct Popup
|
||||||
int height;
|
int height;
|
||||||
int width;
|
int width;
|
||||||
int speed;
|
int speed;
|
||||||
|
int speed2;
|
||||||
|
int alpha;
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
|
||||||
|
@ -74,6 +77,7 @@ struct Popup
|
||||||
bool isDoneMoving();
|
bool isDoneMoving();
|
||||||
int getXOffset();
|
int getXOffset();
|
||||||
int getYOffset();
|
int getYOffset();
|
||||||
|
int getAlpha(int maxAlpha=FRACUNIT);
|
||||||
};
|
};
|
||||||
|
|
||||||
//SBarInfo
|
//SBarInfo
|
||||||
|
@ -81,6 +85,8 @@ struct SBarInfoBlock
|
||||||
{
|
{
|
||||||
TArray<SBarInfoCommand> commands;
|
TArray<SBarInfoCommand> commands;
|
||||||
bool forceScaled;
|
bool forceScaled;
|
||||||
|
int alpha;
|
||||||
|
|
||||||
SBarInfoBlock();
|
SBarInfoBlock();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -372,15 +378,15 @@ public:
|
||||||
void ShowPop(int popnum);
|
void ShowPop(int popnum);
|
||||||
void SetMugShotState(const char* stateName, bool waitTillDone=false);
|
void SetMugShotState(const char* stateName, bool waitTillDone=false);
|
||||||
private:
|
private:
|
||||||
void doCommands(SBarInfoBlock &block, int xOffset=0, int yOffset=0);
|
void doCommands(SBarInfoBlock &block, int xOffset=0, int yOffset=0, int alpha=FRACUNIT);
|
||||||
void DrawGraphic(FTexture* texture, int x, int y, int flags=0);
|
void DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool translate=false, bool dim=false, bool center=false);
|
||||||
void DrawString(const char* str, int x, int y, EColorRange translation, int spacing=0);
|
void DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing=0);
|
||||||
void DrawNumber(int num, int len, int x, int y, EColorRange translation, int spacing=0, bool fillzeros=false);
|
void DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing=0, bool fillzeros=false);
|
||||||
void DrawFace(FString &defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y);
|
void DrawFace(FString &defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha);
|
||||||
int updateState(bool xdth, bool animatedgodmode);
|
int updateState(bool xdth, bool animatedgodmode);
|
||||||
void DrawInventoryBar(int type, int num, int x, int y, bool alwaysshow,
|
void DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool alwaysshow,
|
||||||
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter);
|
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter);
|
||||||
void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int padleft, int padright, int chainsize,
|
void DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, int padleft, int padright, int chainsize,
|
||||||
bool wiggle, bool translate);
|
bool wiggle, bool translate);
|
||||||
FRemapTable* getTranslation();
|
FRemapTable* getTranslation();
|
||||||
|
|
||||||
|
|
|
@ -310,22 +310,25 @@ void DSBarInfo::Draw (EHudState state)
|
||||||
SetScaled(true);
|
SetScaled(true);
|
||||||
setsizeneeded = true;
|
setsizeneeded = true;
|
||||||
}
|
}
|
||||||
doCommands(SBarInfoScript->huds[hud]);
|
doCommands(SBarInfoScript->huds[hud], 0, 0, SBarInfoScript->huds[hud].alpha);
|
||||||
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR))
|
if(CPlayer->inventorytics > 0 && !(level.flags & LEVEL_NOINVENTORYBAR))
|
||||||
{
|
{
|
||||||
if(state == HUD_StatusBar)
|
if(state == HUD_StatusBar)
|
||||||
doCommands(SBarInfoScript->huds[STBAR_INVENTORY]);
|
doCommands(SBarInfoScript->huds[STBAR_INVENTORY], 0, 0, SBarInfoScript->huds[STBAR_INVENTORY].alpha);
|
||||||
else if(state == HUD_Fullscreen)
|
else if(state == HUD_Fullscreen)
|
||||||
doCommands(SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN]);
|
doCommands(SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN], 0, 0, SBarInfoScript->huds[STBAR_INVENTORYFULLSCREEN].alpha);
|
||||||
}
|
}
|
||||||
if(currentPopup != POP_None)
|
if(currentPopup != POP_None)
|
||||||
{
|
{
|
||||||
|
int popbar = 0;
|
||||||
if(currentPopup == POP_Log)
|
if(currentPopup == POP_Log)
|
||||||
doCommands(SBarInfoScript->huds[STBAR_POPUPLOG], SBarInfoScript->popups[currentPopup].getXOffset(), SBarInfoScript->popups[currentPopup].getYOffset());
|
popbar = STBAR_POPUPLOG;
|
||||||
else if(currentPopup == POP_Keys)
|
else if(currentPopup == POP_Keys)
|
||||||
doCommands(SBarInfoScript->huds[STBAR_POPUPKEYS], SBarInfoScript->popups[currentPopup].getXOffset(), SBarInfoScript->popups[currentPopup].getYOffset());
|
popbar = STBAR_POPUPKEYS;
|
||||||
else if(currentPopup == POP_Status)
|
else if(currentPopup == POP_Status)
|
||||||
doCommands(SBarInfoScript->huds[STBAR_POPUPSTATUS], SBarInfoScript->popups[currentPopup].getXOffset(), SBarInfoScript->popups[currentPopup].getYOffset());
|
popbar = STBAR_POPUPSTATUS;
|
||||||
|
doCommands(SBarInfoScript->huds[popbar], SBarInfoScript->popups[currentPopup].getXOffset(), SBarInfoScript->popups[currentPopup].getYOffset(),
|
||||||
|
SBarInfoScript->popups[currentPopup].getAlpha(SBarInfoScript->huds[popbar].alpha));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -469,7 +472,7 @@ void DSBarInfo::SetMugShotState(const char* stateName, bool waitTillDone)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int alpha)
|
||||||
{
|
{
|
||||||
//prepare ammo counts
|
//prepare ammo counts
|
||||||
AAmmo *ammo1, *ammo2;
|
AAmmo *ammo1, *ammo2;
|
||||||
|
@ -489,8 +492,6 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
for(unsigned int i = 0;i < block.commands.Size();i++)
|
for(unsigned int i = 0;i < block.commands.Size();i++)
|
||||||
{
|
{
|
||||||
SBarInfoCommand& cmd = block.commands[i];
|
SBarInfoCommand& cmd = block.commands[i];
|
||||||
cmd.x += xOffset;
|
|
||||||
cmd.y += yOffset;
|
|
||||||
switch(cmd.type) //read and execute all the commands
|
switch(cmd.type) //read and execute all the commands
|
||||||
{
|
{
|
||||||
case SBARINFO_DRAWSWITCHABLEIMAGE: //draw the alt image if we don't have the item else this is like a normal drawimage
|
case SBARINFO_DRAWSWITCHABLEIMAGE: //draw the alt image if we don't have the item else this is like a normal drawimage
|
||||||
|
@ -545,49 +546,50 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
if(drawAlt != 0) //draw 'off' image
|
if(drawAlt != 0) //draw 'off' image
|
||||||
{
|
{
|
||||||
if(cmd.special != -1 && drawAlt == 1)
|
if(cmd.special != -1 && drawAlt == 1)
|
||||||
DrawGraphic(Images[cmd.special], cmd.x, cmd.y, cmd.flags);
|
DrawGraphic(Images[cmd.special], cmd.x, cmd.y, xOffset, yOffset, alpha, (cmd.flags & DRAWIMAGE_TRANSLATABLE), false, (cmd.flags & DRAWIMAGE_OFFSET_CENTER));
|
||||||
else if(cmd.special2 != -1 && drawAlt == 2)
|
else if(cmd.special2 != -1 && drawAlt == 2)
|
||||||
DrawGraphic(Images[cmd.special2], cmd.x, cmd.y, cmd.flags);
|
DrawGraphic(Images[cmd.special2], cmd.x, cmd.y, xOffset, yOffset, alpha, (cmd.flags & DRAWIMAGE_TRANSLATABLE), false, (cmd.flags & DRAWIMAGE_OFFSET_CENTER));
|
||||||
else if(cmd.special3 != -1 && drawAlt == 3)
|
else if(cmd.special3 != -1 && drawAlt == 3)
|
||||||
DrawGraphic(Images[cmd.special3], cmd.x, cmd.y, cmd.flags);
|
DrawGraphic(Images[cmd.special3], cmd.x, cmd.y, xOffset, yOffset, alpha, (cmd.flags & DRAWIMAGE_TRANSLATABLE), false, (cmd.flags & DRAWIMAGE_OFFSET_CENTER));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWIMAGE:
|
case SBARINFO_DRAWIMAGE:
|
||||||
|
{
|
||||||
|
FTexture *texture = NULL;
|
||||||
if((cmd.flags & DRAWIMAGE_PLAYERICON))
|
if((cmd.flags & DRAWIMAGE_PLAYERICON))
|
||||||
DrawGraphic(TexMan[CPlayer->mo->ScoreIcon], cmd.x, cmd.y, cmd.flags);
|
texture = TexMan[CPlayer->mo->ScoreIcon];
|
||||||
else if((cmd.flags & DRAWIMAGE_AMMO1))
|
else if((cmd.flags & DRAWIMAGE_AMMO1))
|
||||||
{
|
{
|
||||||
if(ammo1 != NULL)
|
if(ammo1 != NULL)
|
||||||
DrawGraphic(TexMan[ammo1->Icon], cmd.x, cmd.y, cmd.flags);
|
texture = TexMan[ammo1->Icon];
|
||||||
}
|
}
|
||||||
else if((cmd.flags & DRAWIMAGE_AMMO2))
|
else if((cmd.flags & DRAWIMAGE_AMMO2))
|
||||||
{
|
{
|
||||||
if(ammo2 != NULL)
|
if(ammo2 != NULL)
|
||||||
DrawGraphic(TexMan[ammo2->Icon], cmd.x, cmd.y, cmd.flags);
|
texture = TexMan[ammo2->Icon];
|
||||||
}
|
}
|
||||||
else if((cmd.flags & DRAWIMAGE_ARMOR))
|
else if((cmd.flags & DRAWIMAGE_ARMOR))
|
||||||
{
|
{
|
||||||
if(armor != NULL && armor->Amount != 0)
|
if(armor != NULL && armor->Amount != 0)
|
||||||
DrawGraphic(TexMan(armor->Icon), cmd.x, cmd.y, cmd.flags);
|
texture = TexMan(armor->Icon);
|
||||||
}
|
}
|
||||||
else if((cmd.flags & DRAWIMAGE_WEAPONICON))
|
else if((cmd.flags & DRAWIMAGE_WEAPONICON))
|
||||||
{
|
{
|
||||||
AWeapon *weapon = CPlayer->ReadyWeapon;
|
AWeapon *weapon = CPlayer->ReadyWeapon;
|
||||||
if(weapon != NULL && weapon->Icon > 0)
|
if(weapon != NULL && weapon->Icon > 0)
|
||||||
{
|
{
|
||||||
DrawGraphic(TexMan[weapon->Icon], cmd.x, cmd.y, cmd.flags);
|
texture = TexMan[weapon->Icon];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((cmd.flags & DRAWIMAGE_INVENTORYICON))
|
else if((cmd.flags & DRAWIMAGE_INVENTORYICON))
|
||||||
{
|
texture = TexMan[cmd.sprite];
|
||||||
DrawGraphic(TexMan[cmd.sprite], cmd.x, cmd.y, cmd.flags);
|
|
||||||
}
|
|
||||||
else if(cmd.sprite != -1)
|
else if(cmd.sprite != -1)
|
||||||
{
|
texture = Images[cmd.sprite];
|
||||||
DrawGraphic(Images[cmd.sprite], cmd.x, cmd.y, cmd.flags);
|
|
||||||
}
|
DrawGraphic(texture, cmd.x, cmd.y, xOffset, yOffset, alpha, (cmd.flags & DRAWIMAGE_TRANSLATABLE), false, (cmd.flags & DRAWIMAGE_OFFSET_CENTER));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SBARINFO_DRAWNUMBER:
|
case SBARINFO_DRAWNUMBER:
|
||||||
{
|
{
|
||||||
int value = cmd.value;
|
int value = cmd.value;
|
||||||
|
@ -695,12 +697,12 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool fillzeros = !!(cmd.flags & DRAWNUMBER_FILLZEROS);
|
bool fillzeros = !!(cmd.flags & DRAWNUMBER_FILLZEROS);
|
||||||
|
EColorRange translation = cmd.translation;
|
||||||
if(cmd.special3 != -1 && value <= cmd.special3) //low
|
if(cmd.special3 != -1 && value <= cmd.special3) //low
|
||||||
DrawNumber(value, cmd.special, cmd.x, cmd.y, cmd.translation2, cmd.special2, fillzeros);
|
translation = cmd.translation2;
|
||||||
else if(cmd.special4 != -1 && value >= cmd.special4) //high
|
else if(cmd.special4 != -1 && value >= cmd.special4) //high
|
||||||
DrawNumber(value, cmd.special, cmd.x, cmd.y, cmd.translation3, cmd.special2, fillzeros);
|
translation = cmd.translation3;
|
||||||
else
|
DrawNumber(value, cmd.special, cmd.x, cmd.y, xOffset, yOffset, alpha, translation, cmd.special2, fillzeros);
|
||||||
DrawNumber(value, cmd.special, cmd.x, cmd.y, cmd.translation, cmd.special2, fillzeros);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWMUGSHOT:
|
case SBARINFO_DRAWMUGSHOT:
|
||||||
|
@ -711,7 +713,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
xdth = true;
|
xdth = true;
|
||||||
if(cmd.flags & DRAWMUGSHOT_ANIMATEDGODMODE)
|
if(cmd.flags & DRAWMUGSHOT_ANIMATEDGODMODE)
|
||||||
animatedgodmode = true;
|
animatedgodmode = true;
|
||||||
DrawFace(cmd.string[0], cmd.special, xdth, animatedgodmode, cmd.x, cmd.y);
|
DrawFace(cmd.string[0], cmd.special, xdth, animatedgodmode, cmd.x, cmd.y, xOffset, yOffset, alpha);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWSELECTEDINVENTORY:
|
case SBARINFO_DRAWSELECTEDINVENTORY:
|
||||||
|
@ -719,11 +721,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
{
|
{
|
||||||
if((cmd.flags & DRAWSELECTEDINVENTORY_ARTIFLASH) && artiflash)
|
if((cmd.flags & DRAWSELECTEDINVENTORY_ARTIFLASH) && artiflash)
|
||||||
{
|
{
|
||||||
DrawDimImage(Images[ARTIFLASH_OFFSET+(4-artiflash)], cmd.x, cmd.y, CPlayer->mo->InvSel->Amount <= 0);
|
DrawGraphic(Images[ARTIFLASH_OFFSET+(4-artiflash)], cmd.x, cmd.y, xOffset, yOffset, alpha, false, CPlayer->mo->InvSel->Amount <= 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawDimImage(TexMan(CPlayer->mo->InvSel->Icon), cmd.x, cmd.y, CPlayer->mo->InvSel->Amount <= 0);
|
DrawGraphic(TexMan(CPlayer->mo->InvSel->Icon), cmd.x, cmd.y, xOffset, yOffset, alpha, false, CPlayer->mo->InvSel->Amount <= 0);
|
||||||
}
|
}
|
||||||
if((cmd.flags & DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER) || CPlayer->mo->InvSel->Amount != 1)
|
if((cmd.flags & DRAWSELECTEDINVENTORY_ALWAYSSHOWCOUNTER) || CPlayer->mo->InvSel->Amount != 1)
|
||||||
{
|
{
|
||||||
|
@ -731,12 +733,12 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
{
|
{
|
||||||
drawingFont = cmd.font;
|
drawingFont = cmd.font;
|
||||||
}
|
}
|
||||||
DrawNumber(CPlayer->mo->InvSel->Amount, 3, cmd.special2, cmd.special3, cmd.translation, cmd.special4);
|
DrawNumber(CPlayer->mo->InvSel->Amount, 3, cmd.special2, cmd.special3, xOffset, yOffset, alpha, cmd.translation, cmd.special4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((cmd.flags & DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY))
|
else if((cmd.flags & DRAWSELECTEDINVENTORY_ALTERNATEONEMPTY))
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SBARINFO_DRAWINVENTORYBAR:
|
case SBARINFO_DRAWINVENTORYBAR:
|
||||||
|
@ -757,7 +759,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
{
|
{
|
||||||
drawingFont = cmd.font;
|
drawingFont = cmd.font;
|
||||||
}
|
}
|
||||||
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox, noarrows, alwaysshowcounter);
|
DrawInventoryBar(cmd.special, cmd.value, cmd.x, cmd.y, xOffset, yOffset, alpha, alwaysshow, cmd.special2, cmd.special3, cmd.translation, artibox, noarrows, alwaysshowcounter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWBAR:
|
case SBARINFO_DRAWBAR:
|
||||||
|
@ -905,8 +907,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
int cx, cy, cw, ch, cr, cb;
|
int cx, cy, cw, ch, cr, cb;
|
||||||
|
|
||||||
// Calc real screen coordinates for bar
|
// Calc real screen coordinates for bar
|
||||||
x = cmd.x + ST_X;
|
x = cmd.x + ST_X + xOffset;
|
||||||
y = cmd.y + ST_Y;
|
y = cmd.y + ST_Y + yOffset;
|
||||||
w = fg->GetScaledWidth();
|
w = fg->GetScaledWidth();
|
||||||
h = fg->GetScaledHeight();
|
h = fg->GetScaledHeight();
|
||||||
if (Scaled)
|
if (Scaled)
|
||||||
|
@ -920,6 +922,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
screen->DrawTexture(fg, x, y,
|
screen->DrawTexture(fg, x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
DTA_DestHeight, h,
|
DTA_DestHeight, h,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -930,6 +933,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
screen->DrawTexture(bg, x, y,
|
screen->DrawTexture(bg, x, y,
|
||||||
DTA_DestWidth, w,
|
DTA_DestWidth, w,
|
||||||
DTA_DestHeight, h,
|
DTA_DestHeight, h,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -939,8 +943,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calc clipping rect for background
|
// Calc clipping rect for background
|
||||||
cx = cmd.x + ST_X + cmd.special3;
|
cx = cmd.x + ST_X + cmd.special3 + xOffset;
|
||||||
cy = cmd.y + ST_Y + cmd.special3;
|
cy = cmd.y + ST_Y + cmd.special3 + yOffset;
|
||||||
cw = fg->GetScaledWidth() - fg->GetScaledLeftOffset() - cmd.special3 * 2;
|
cw = fg->GetScaledWidth() - fg->GetScaledLeftOffset() - cmd.special3 * 2;
|
||||||
ch = fg->GetScaledHeight() - fg->GetScaledTopOffset() - cmd.special3 * 2;
|
ch = fg->GetScaledHeight() - fg->GetScaledTopOffset() - cmd.special3 * 2;
|
||||||
if (Scaled)
|
if (Scaled)
|
||||||
|
@ -987,6 +991,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
DTA_ClipTop, cy,
|
DTA_ClipTop, cy,
|
||||||
DTA_ClipRight, cr,
|
DTA_ClipRight, cr,
|
||||||
DTA_ClipBottom, cb,
|
DTA_ClipBottom, cb,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1003,6 +1008,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
DTA_ClipTop, cy,
|
DTA_ClipTop, cy,
|
||||||
DTA_ClipRight, cr,
|
DTA_ClipRight, cr,
|
||||||
DTA_ClipBottom, cb,
|
DTA_ClipBottom, cb,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1028,7 +1034,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
{
|
{
|
||||||
wiggle = !!(cmd.flags & DRAWGEM_WIGGLE);
|
wiggle = !!(cmd.flags & DRAWGEM_WIGGLE);
|
||||||
}
|
}
|
||||||
DrawGem(Images[cmd.special], Images[cmd.sprite], value, cmd.x, cmd.y, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
|
DrawGem(Images[cmd.special], Images[cmd.sprite], value, cmd.x, cmd.y, xOffset, yOffset, alpha, cmd.special2, cmd.special3, cmd.special4+1, wiggle, translate);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_DRAWSHADER:
|
case SBARINFO_DRAWSHADER:
|
||||||
|
@ -1040,10 +1046,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
};
|
};
|
||||||
bool vertical = !!(cmd.flags & DRAWSHADER_VERTICAL);
|
bool vertical = !!(cmd.flags & DRAWSHADER_VERTICAL);
|
||||||
bool reverse = !!(cmd.flags & DRAWSHADER_REVERSE);
|
bool reverse = !!(cmd.flags & DRAWSHADER_REVERSE);
|
||||||
screen->DrawTexture (shaders[(vertical << 1) + reverse], ST_X+cmd.x, ST_Y+cmd.y,
|
screen->DrawTexture (shaders[(vertical << 1) + reverse], ST_X+cmd.x+xOffset, ST_Y+cmd.y+yOffset,
|
||||||
DTA_DestWidth, cmd.special,
|
DTA_DestWidth, cmd.special,
|
||||||
DTA_DestHeight, cmd.special2,
|
DTA_DestHeight, cmd.special2,
|
||||||
DTA_Bottom320x200, Scaled,
|
DTA_Bottom320x200, Scaled,
|
||||||
|
DTA_Alpha, alpha,
|
||||||
DTA_AlphaChannel, true,
|
DTA_AlphaChannel, true,
|
||||||
DTA_FillColor, 0,
|
DTA_FillColor, 0,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
|
@ -1054,7 +1061,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
{
|
{
|
||||||
drawingFont = cmd.font;
|
drawingFont = cmd.font;
|
||||||
}
|
}
|
||||||
DrawString(cmd.string[0], cmd.x - drawingFont->StringWidth(cmd.string[0]), cmd.y, cmd.translation, cmd.special);
|
DrawString(cmd.string[0], cmd.x - drawingFont->StringWidth(cmd.string[0]), cmd.y, xOffset, yOffset, alpha, cmd.translation, cmd.special);
|
||||||
break;
|
break;
|
||||||
case SBARINFO_DRAWKEYBAR:
|
case SBARINFO_DRAWKEYBAR:
|
||||||
{
|
{
|
||||||
|
@ -1071,9 +1078,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
goto FinishDrawKeyBar;
|
goto FinishDrawKeyBar;
|
||||||
}
|
}
|
||||||
if(!vertical)
|
if(!vertical)
|
||||||
DrawImage(TexMan[item->Icon], cmd.x+(cmd.special*i), cmd.y);
|
DrawGraphic(TexMan[item->Icon], cmd.x+(cmd.special*i), cmd.y, xOffset, yOffset, alpha);
|
||||||
else
|
else
|
||||||
DrawImage(TexMan[item->Icon], cmd.x, cmd.y+(cmd.special*i));
|
DrawGraphic(TexMan[item->Icon], cmd.x, cmd.y+(cmd.special*i), xOffset, yOffset, alpha);
|
||||||
item = item->Inventory;
|
item = item->Inventory;
|
||||||
if(item == NULL)
|
if(item == NULL)
|
||||||
break;
|
break;
|
||||||
|
@ -1087,7 +1094,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
((cmd.flags & GAMETYPE_COOPERATIVE) && multiplayer && !deathmatch) ||
|
((cmd.flags & GAMETYPE_COOPERATIVE) && multiplayer && !deathmatch) ||
|
||||||
((cmd.flags & GAMETYPE_TEAMGAME) && teamplay))
|
((cmd.flags & GAMETYPE_TEAMGAME) && teamplay))
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SBARINFO_PLAYERCLASS:
|
case SBARINFO_PLAYERCLASS:
|
||||||
|
@ -1096,14 +1103,14 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
int spawnClass = CPlayer->cls->ClassIndex;
|
int spawnClass = CPlayer->cls->ClassIndex;
|
||||||
if(cmd.special == spawnClass || cmd.special2 == spawnClass || cmd.special3 == spawnClass)
|
if(cmd.special == spawnClass || cmd.special2 == spawnClass || cmd.special3 == spawnClass)
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SBARINFO_ASPECTRATIO:
|
case SBARINFO_ASPECTRATIO:
|
||||||
if(CheckRatio(screen->GetWidth(), screen->GetHeight()) == cmd.value)
|
if(CheckRatio(screen->GetWidth(), screen->GetHeight()) == cmd.value)
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SBARINFO_ISSELECTED:
|
case SBARINFO_ISSELECTED:
|
||||||
|
@ -1114,16 +1121,16 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
if(weapon2 != NULL)
|
if(weapon2 != NULL)
|
||||||
{
|
{
|
||||||
if((cmd.flags & SBARINFOEVENT_NOT) && (weapon1 != CPlayer->ReadyWeapon->GetSpecies() && weapon2 != CPlayer->ReadyWeapon->GetSpecies()))
|
if((cmd.flags & SBARINFOEVENT_NOT) && (weapon1 != CPlayer->ReadyWeapon->GetSpecies() && weapon2 != CPlayer->ReadyWeapon->GetSpecies()))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
else if(!(cmd.flags & SBARINFOEVENT_NOT) && (weapon1 == CPlayer->ReadyWeapon->GetSpecies() || weapon2 == CPlayer->ReadyWeapon->GetSpecies()))
|
else if(!(cmd.flags & SBARINFOEVENT_NOT) && (weapon1 == CPlayer->ReadyWeapon->GetSpecies() || weapon2 == CPlayer->ReadyWeapon->GetSpecies()))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!(cmd.flags & SBARINFOEVENT_NOT) && weapon1 == CPlayer->ReadyWeapon->GetSpecies())
|
if(!(cmd.flags & SBARINFOEVENT_NOT) && weapon1 == CPlayer->ReadyWeapon->GetSpecies())
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
else if((cmd.flags & SBARINFOEVENT_NOT) && weapon1 != CPlayer->ReadyWeapon->GetSpecies())
|
else if((cmd.flags & SBARINFOEVENT_NOT) && weapon1 != CPlayer->ReadyWeapon->GetSpecies())
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1150,11 +1157,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
if(((cmd.flags & SBARINFOEVENT_OR) && (match1 || match2)) || ((cmd.flags & SBARINFOEVENT_AND) && (match1 && match2)))
|
if(((cmd.flags & SBARINFOEVENT_OR) && (match1 || match2)) || ((cmd.flags & SBARINFOEVENT_AND) && (match1 && match2)))
|
||||||
{
|
{
|
||||||
if(!(cmd.flags & SBARINFOEVENT_NOT))
|
if(!(cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else if(cmd.flags & SBARINFOEVENT_NOT)
|
else if(cmd.flags & SBARINFOEVENT_NOT)
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else //Every thing here could probably be one long if statement but then it would be more confusing.
|
else //Every thing here could probably be one long if statement but then it would be more confusing.
|
||||||
|
@ -1162,11 +1169,11 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
if((usesammo1 && (AmmoType1 == IfAmmo1)) || (usesammo2 && (AmmoType2 == IfAmmo1)))
|
if((usesammo1 && (AmmoType1 == IfAmmo1)) || (usesammo2 && (AmmoType2 == IfAmmo1)))
|
||||||
{
|
{
|
||||||
if(!(cmd.flags & SBARINFOEVENT_NOT))
|
if(!(cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else if(cmd.flags & SBARINFOEVENT_NOT)
|
else if(cmd.flags & SBARINFOEVENT_NOT)
|
||||||
{
|
{
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1178,66 +1185,57 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset)
|
||||||
if(cmd.flags & SBARINFOEVENT_AND)
|
if(cmd.flags & SBARINFOEVENT_AND)
|
||||||
{
|
{
|
||||||
if((item1 != NULL && item2 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
if((item1 != NULL && item2 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
else if((item1 == NULL || item2 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
else if((item1 == NULL || item2 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else if(cmd.flags & SBARINFOEVENT_OR)
|
else if(cmd.flags & SBARINFOEVENT_OR)
|
||||||
{
|
{
|
||||||
if((item1 != NULL || item2 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
if((item1 != NULL || item2 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
else if((item1 == NULL && item2 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
else if((item1 == NULL && item2 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else if((item1 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
else if((item1 != NULL) && !(cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
else if((item1 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
else if((item1 == NULL) && (cmd.flags & SBARINFOEVENT_NOT))
|
||||||
doCommands(cmd.subBlock, xOffset, yOffset);
|
doCommands(cmd.subBlock, xOffset, yOffset, alpha);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmd.x -= xOffset;
|
|
||||||
cmd.y -= yOffset;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//draws an image with the specified flags
|
//draws an image with the specified flags
|
||||||
void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int flags)
|
void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha,
|
||||||
|
bool translate, bool dim, bool center) //flags
|
||||||
{
|
{
|
||||||
if (texture == NULL)
|
if (texture == NULL)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if((flags & DRAWIMAGE_OFFSET_CENTER))
|
if(center)
|
||||||
{
|
{
|
||||||
x -= (texture->GetWidth()/2)-texture->LeftOffset;
|
x -= (texture->GetWidth()/2)-texture->LeftOffset;
|
||||||
y -= (texture->GetHeight()/2)-texture->TopOffset;
|
y -= (texture->GetHeight()/2)-texture->TopOffset;
|
||||||
}
|
}
|
||||||
x += ST_X;
|
|
||||||
y += ST_Y;
|
x += ST_X + xOffset;
|
||||||
|
y += ST_Y + yOffset;
|
||||||
int w = texture->GetScaledWidth();
|
int w = texture->GetScaledWidth();
|
||||||
int h = texture->GetScaledHeight() + y;
|
int h = texture->GetScaledHeight() + y;
|
||||||
if(Scaled)
|
if(Scaled)
|
||||||
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
|
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
|
||||||
h -= y;
|
h -= y;
|
||||||
if((flags & DRAWIMAGE_TRANSLATABLE))
|
screen->DrawTexture(texture, x, y,
|
||||||
{
|
DTA_DestWidth, w,
|
||||||
screen->DrawTexture(texture, x, y,
|
DTA_DestHeight, h,
|
||||||
DTA_DestWidth, w,
|
DTA_Translation, translate ? getTranslation() : 0,
|
||||||
DTA_DestHeight, h,
|
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
|
||||||
DTA_Translation, getTranslation(),
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
screen->DrawTexture(texture, x, y,
|
|
||||||
DTA_DestWidth, w,
|
|
||||||
DTA_DestHeight, h,
|
|
||||||
TAG_DONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translation, int spacing)
|
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing)
|
||||||
{
|
{
|
||||||
x += spacing;
|
x += spacing;
|
||||||
while(*str != '\0')
|
while(*str != '\0')
|
||||||
|
@ -1261,8 +1259,8 @@ void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translatio
|
||||||
}
|
}
|
||||||
if(SBarInfoScript->spacingCharacter == '\0') //If we are monospaced lets use the offset
|
if(SBarInfoScript->spacingCharacter == '\0') //If we are monospaced lets use the offset
|
||||||
x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
|
x += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
|
||||||
int rx = x + ST_X;
|
int rx = x + ST_X + xOffset;
|
||||||
int ry = y + ST_Y;
|
int ry = y + ST_Y + yOffset;
|
||||||
int rw = character->GetScaledWidth();
|
int rw = character->GetScaledWidth();
|
||||||
int rh = character->GetScaledHeight();
|
int rh = character->GetScaledHeight();
|
||||||
if(Scaled)
|
if(Scaled)
|
||||||
|
@ -1271,6 +1269,7 @@ void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translatio
|
||||||
DTA_DestWidth, rw,
|
DTA_DestWidth, rw,
|
||||||
DTA_DestHeight, rh,
|
DTA_DestHeight, rh,
|
||||||
DTA_Translation, drawingFont->GetColorTranslation(translation),
|
DTA_Translation, drawingFont->GetColorTranslation(translation),
|
||||||
|
DTA_Alpha, alpha,
|
||||||
TAG_DONE);
|
TAG_DONE);
|
||||||
if(SBarInfoScript->spacingCharacter == '\0')
|
if(SBarInfoScript->spacingCharacter == '\0')
|
||||||
x += width + spacing - (character->LeftOffset+1);
|
x += width + spacing - (character->LeftOffset+1);
|
||||||
|
@ -1281,7 +1280,7 @@ void DSBarInfo::DrawString(const char* str, int x, int y, EColorRange translatio
|
||||||
}
|
}
|
||||||
|
|
||||||
//draws the specified number up to len digits
|
//draws the specified number up to len digits
|
||||||
void DSBarInfo::DrawNumber(int num, int len, int x, int y, EColorRange translation, int spacing, bool fillzeros)
|
void DSBarInfo::DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, EColorRange translation, int spacing, bool fillzeros)
|
||||||
{
|
{
|
||||||
FString value;
|
FString value;
|
||||||
int maxval = (int) ceil(pow(10., len))-1;
|
int maxval = (int) ceil(pow(10., len))-1;
|
||||||
|
@ -1306,11 +1305,11 @@ void DSBarInfo::DrawNumber(int num, int len, int x, int y, EColorRange translati
|
||||||
x -= int(drawingFont->StringWidth(value)+(spacing * value.Len()));
|
x -= int(drawingFont->StringWidth(value)+(spacing * value.Len()));
|
||||||
else //monospaced so just multiplay the character size
|
else //monospaced so just multiplay the character size
|
||||||
x -= int((drawingFont->GetCharWidth((int) SBarInfoScript->spacingCharacter) + spacing) * value.Len());
|
x -= int((drawingFont->GetCharWidth((int) SBarInfoScript->spacingCharacter) + spacing) * value.Len());
|
||||||
DrawString(value, x, y, translation, spacing);
|
DrawString(value, x, y, xOffset, yOffset, alpha, translation, spacing);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draws the mug shot
|
//draws the mug shot
|
||||||
void DSBarInfo::DrawFace(FString &defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y)
|
void DSBarInfo::DrawFace(FString &defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha)
|
||||||
{
|
{
|
||||||
int angle = updateState(xdth, animatedgodmode);
|
int angle = updateState(xdth, animatedgodmode);
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
@ -1320,18 +1319,7 @@ void DSBarInfo::DrawFace(FString &defaultFace, int accuracy, bool xdth, bool ani
|
||||||
FPlayerSkin *skin = &skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin];
|
FPlayerSkin *skin = &skins[CPlayer->morphTics ? CPlayer->MorphedPlayerClass : CPlayer->userinfo.skin];
|
||||||
FTexture *face = currentState->getCurrentFrameTexture(defaultFace, skin, level, angle);
|
FTexture *face = currentState->getCurrentFrameTexture(defaultFace, skin, level, angle);
|
||||||
if (face != NULL)
|
if (face != NULL)
|
||||||
{
|
DrawGraphic(face, x, y, xOffset, yOffset, alpha);
|
||||||
x += ST_X;
|
|
||||||
y += ST_Y;
|
|
||||||
int w = face->GetScaledWidth();
|
|
||||||
int h = face->GetScaledHeight();
|
|
||||||
if(Scaled)
|
|
||||||
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
|
|
||||||
screen->DrawTexture(face, x, y,
|
|
||||||
DTA_DestWidth, w,
|
|
||||||
DTA_DestHeight, h,
|
|
||||||
TAG_DONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1454,7 +1442,7 @@ int DSBarInfo::updateState(bool xdth, bool animatedgodmode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, bool alwaysshow,
|
void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool alwaysshow,
|
||||||
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter)
|
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter)
|
||||||
{ //yes, there is some Copy & Paste here too
|
{ //yes, there is some Copy & Paste here too
|
||||||
AInventory *item;
|
AInventory *item;
|
||||||
|
@ -1468,46 +1456,46 @@ void DSBarInfo::DrawInventoryBar(int type, int num, int x, int y, bool alwayssho
|
||||||
{
|
{
|
||||||
if(drawArtiboxes)
|
if(drawArtiboxes)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y);
|
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
DrawDimImage (TexMan(item->Icon), x+i*31, y, item->Amount <= 0);
|
DrawGraphic(TexMan(item->Icon), x+i*31, y, xOffset, yOffset, alpha, false, item->Amount <= 0);
|
||||||
if(alwaysshowcounter || item->Amount != 1)
|
if(alwaysshowcounter || item->Amount != 1)
|
||||||
{
|
{
|
||||||
DrawNumber(item->Amount, 3, counterx+i*31, countery, translation);
|
DrawNumber(item->Amount, 3, counterx+i*31, countery, xOffset, yOffset, alpha, translation);
|
||||||
}
|
}
|
||||||
if(item == CPlayer->mo->InvSel)
|
if(item == CPlayer->mo->InvSel)
|
||||||
{
|
{
|
||||||
if(type == GAME_Heretic)
|
if(type == GAME_Heretic)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y+29);
|
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y+29, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y);
|
DrawGraphic(Images[invBarOffset + imgSELECTBOX], x+i*31, y, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (; i < num && drawArtiboxes; ++i)
|
for (; i < num && drawArtiboxes; ++i)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y);
|
DrawGraphic(Images[invBarOffset + imgARTIBOX], x+i*31, y, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
// Is there something to the left?
|
// Is there something to the left?
|
||||||
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
|
if (!noArrows && CPlayer->mo->FirstInv() != CPlayer->mo->InvFirst)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[!(gametic & 4) ?
|
DrawGraphic(Images[!(gametic & 4) ?
|
||||||
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x-12, y);
|
invBarOffset + imgINVLFGEM1 : invBarOffset + imgINVLFGEM2], x-12, y, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
// Is there something to the right?
|
// Is there something to the right?
|
||||||
if (!noArrows && item != NULL)
|
if (!noArrows && item != NULL)
|
||||||
{
|
{
|
||||||
DrawGraphic(Images[!(gametic & 4) ?
|
DrawGraphic(Images[!(gametic & 4) ?
|
||||||
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x+num*31+2, y);
|
invBarOffset + imgINVRTGEM1 : invBarOffset + imgINVRTGEM2], x+num*31+2, y, xOffset, yOffset, alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//draws heretic/hexen style life gems
|
//draws heretic/hexen style life gems
|
||||||
void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int padleft, int padright, int chainsize,
|
void DSBarInfo::DrawGem(FTexture* chain, FTexture* gem, int value, int x, int y, int xOffset, int yOffset, int alpha, int padleft, int padright, int chainsize,
|
||||||
bool wiggle, bool translate)
|
bool wiggle, bool translate)
|
||||||
{
|
{
|
||||||
if(chain == NULL)
|
if(chain == NULL)
|
||||||
|
|
|
@ -255,18 +255,25 @@ void SBarInfo::ParseSBarInfo(int lump)
|
||||||
barNum = sc.MustMatchString(StatusBars);
|
barNum = sc.MustMatchString(StatusBars);
|
||||||
}
|
}
|
||||||
this->huds[barNum] = SBarInfoBlock();
|
this->huds[barNum] = SBarInfoBlock();
|
||||||
while(sc.CheckToken(','))
|
if(sc.CheckToken(','))
|
||||||
{
|
{
|
||||||
sc.MustGetToken(TK_Identifier);
|
while(sc.CheckToken(TK_Identifier))
|
||||||
if(sc.Compare("forcescaled"))
|
|
||||||
{
|
{
|
||||||
this->huds[barNum].forceScaled = true;
|
if(sc.Compare("forcescaled"))
|
||||||
}
|
{
|
||||||
else
|
this->huds[barNum].forceScaled = true;
|
||||||
{
|
}
|
||||||
sc.ScriptError("Unkown flag '%s'.", sc.String);
|
else
|
||||||
|
{
|
||||||
|
sc.ScriptError("Unkown flag '%s'.", sc.String);
|
||||||
|
}
|
||||||
|
if(!sc.CheckToken('|') || !sc.CheckToken(','))
|
||||||
|
goto FinishStatusBar; //No more args so we must skip over anything else and go to the end.
|
||||||
}
|
}
|
||||||
|
sc.MustGetToken(TK_FloatConst);
|
||||||
|
this->huds[barNum].alpha = FRACUNIT * sc.Float;
|
||||||
}
|
}
|
||||||
|
FinishStatusBar:
|
||||||
sc.MustGetToken('{');
|
sc.MustGetToken('{');
|
||||||
if(barNum == STBAR_AUTOMAP)
|
if(barNum == STBAR_AUTOMAP)
|
||||||
{
|
{
|
||||||
|
@ -336,6 +343,16 @@ void SBarInfo::ParseSBarInfo(int lump)
|
||||||
sc.MustGetToken(TK_IntConst);
|
sc.MustGetToken(TK_IntConst);
|
||||||
popup.speed = sc.Number;
|
popup.speed = sc.Number;
|
||||||
}
|
}
|
||||||
|
else if(sc.Compare("fade"))
|
||||||
|
{
|
||||||
|
popup.transition = TRANSITION_FADE;
|
||||||
|
sc.MustGetToken(',');
|
||||||
|
sc.MustGetToken(TK_FloatConst);
|
||||||
|
popup.speed = FRACUNIT * sc.Float;
|
||||||
|
sc.MustGetToken(',');
|
||||||
|
sc.MustGetToken(TK_FloatConst);
|
||||||
|
popup.speed2 = FRACUNIT * sc.Float;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sc.ScriptError("Unkown transition type: '%s'", sc.String);
|
sc.ScriptError("Unkown transition type: '%s'", sc.String);
|
||||||
}
|
}
|
||||||
|
@ -1264,6 +1281,7 @@ SBarInfoCommand::~SBarInfoCommand()
|
||||||
SBarInfoBlock::SBarInfoBlock()
|
SBarInfoBlock::SBarInfoBlock()
|
||||||
{
|
{
|
||||||
forceScaled = false;
|
forceScaled = false;
|
||||||
|
alpha = FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MugShotState *FindMugShotState(FString state)
|
const MugShotState *FindMugShotState(FString state)
|
||||||
|
@ -1286,6 +1304,7 @@ Popup::Popup()
|
||||||
speed = 0;
|
speed = 0;
|
||||||
x = 320;
|
x = 320;
|
||||||
y = 200;
|
y = 200;
|
||||||
|
alpha = FRACUNIT;
|
||||||
opened = false;
|
opened = false;
|
||||||
moving = false;
|
moving = false;
|
||||||
}
|
}
|
||||||
|
@ -1298,6 +1317,12 @@ void Popup::init()
|
||||||
{
|
{
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
else if(transition == TRANSITION_FADE)
|
||||||
|
{
|
||||||
|
alpha = 0;
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Popup::tick()
|
void Popup::tick()
|
||||||
|
@ -1316,9 +1341,22 @@ void Popup::tick()
|
||||||
else
|
else
|
||||||
moving = false;
|
moving = false;
|
||||||
}
|
}
|
||||||
|
else if(transition == TRANSITION_FADE)
|
||||||
|
{
|
||||||
|
if(moving)
|
||||||
|
{
|
||||||
|
if(opened)
|
||||||
|
alpha = clamp(alpha + speed, 0, FRACUNIT);
|
||||||
|
else
|
||||||
|
alpha = clamp(alpha - speed2, 0, FRACUNIT);
|
||||||
|
}
|
||||||
|
if(alpha == 0 || alpha == FRACUNIT)
|
||||||
|
moving = false;
|
||||||
|
else
|
||||||
|
moving = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moving = false;
|
|
||||||
if(opened)
|
if(opened)
|
||||||
{
|
{
|
||||||
y = 0;
|
y = 0;
|
||||||
|
@ -1329,6 +1367,7 @@ void Popup::tick()
|
||||||
y = height;
|
y = height;
|
||||||
x = width;
|
x = width;
|
||||||
}
|
}
|
||||||
|
moving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1347,6 +1386,13 @@ int Popup::getYOffset()
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Popup::getAlpha(int maxAlpha)
|
||||||
|
{
|
||||||
|
double a = (double) alpha / (double) FRACUNIT;
|
||||||
|
double b = (double) maxAlpha / (double) FRACUNIT;
|
||||||
|
return fixed_t((a * b) * FRACUNIT);
|
||||||
|
}
|
||||||
|
|
||||||
void Popup::open()
|
void Popup::open()
|
||||||
{
|
{
|
||||||
opened = true;
|
opened = true;
|
||||||
|
|
|
@ -989,15 +989,14 @@ void FMultiPatchTexture::ParsePatch(FScanner &sc, TexPart & part)
|
||||||
{
|
{
|
||||||
int r,g,b;
|
int r,g,b;
|
||||||
|
|
||||||
sc.MustGetNumber();
|
|
||||||
sc.MustGetStringName(",");
|
|
||||||
r = sc.Number;
|
r = sc.Number;
|
||||||
sc.MustGetNumber();
|
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
|
sc.MustGetNumber();
|
||||||
g = sc.Number;
|
g = sc.Number;
|
||||||
sc.MustGetNumber();
|
|
||||||
sc.MustGetStringName(",");
|
sc.MustGetStringName(",");
|
||||||
|
sc.MustGetNumber();
|
||||||
b = sc.Number;
|
b = sc.Number;
|
||||||
|
sc.MustGetStringName(",");
|
||||||
part.Blend = MAKERGB(r, g, b);
|
part.Blend = MAKERGB(r, g, b);
|
||||||
}
|
}
|
||||||
if (sc.CheckString(","))
|
if (sc.CheckString(","))
|
||||||
|
|
Loading…
Reference in a new issue