- Fixed. The Firedemon was missing a game filter.

SBARINfO update:
- Added: disablegrin, disableouch, disablepain, and disablerampage flags to
  drawmugshot.
- Fixed: LowerHealthCap did not work properly.
- Fixed: Various bugs I noticed in the fullscreenoffsets code.

SVN r1122 (trunk)
This commit is contained in:
Christoph Oelckers 2008-08-07 07:17:29 +00:00
parent 535f209560
commit 344f1072a6
9 changed files with 127 additions and 77 deletions

View file

@ -1,3 +1,12 @@
August 7, 2008 (Changes by Graf Zahl)
- Fixed. The Firedemon was missing a game filter.
August 7, 2008 (SBARINfO update)
- Added: disablegrin, disableouch, disablepain, and disablerampage flags to
drawmugshot.
- Fixed: LowerHealthCap did not work properly.
- Fixed: Various bugs I noticed in the fullscreenoffsets code.
August 6, 2008
- The x87 precision control is now explicitly set for double precision, since
GCC defaults to extended precision instead, unlike Visual C++.

View file

@ -707,7 +707,7 @@ private:
// face, for lack of a better place to put it.
if (CPlayer->mo->InvSel == NULL || (level.flags & LEVEL_NOINVENTORYBAR))
{
FTexture *face = MugShot.GetFace(CPlayer, "STF", 5, false, false);
FTexture *face = MugShot.GetFace(CPlayer, "STF", 5);
if (face != NULL)
{
DrawPartialImage(&StatusBarTex, 142, 37);

View file

@ -202,8 +202,8 @@ struct FMugShot
FMugShot();
void Tick(player_t *player);
bool SetState(const char *state_name, bool wait_till_done=false, bool reset=false);
int UpdateState(player_t *player, bool xdeath, bool animated_god_mode);
FTexture *GetFace(player_t *player, const char *default_face, int accuracy, bool xdeath, bool animated_god_mode);
int UpdateState(player_t *player, int stateflags=0);
FTexture *GetFace(player_t *player, const char *default_face, int accuracy, int stateflags=0);
FMugShotState *CurrentState;
int RampageTimer;

View file

@ -39,6 +39,7 @@
#include "d_player.h"
#include "d_event.h"
#include "sbar.h"
#include "sbarinfo.h"
#define ST_RAMPAGEDELAY (2*TICRATE)
#define ST_MUCHPAIN 20
@ -322,7 +323,7 @@ bool FMugShot::SetState(const char *state_name, bool wait_till_done, bool reset)
//
//===========================================================================
int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
int FMugShot::UpdateState(player_t *player, int stateflags)
{
int i;
angle_t badguyangle;
@ -331,7 +332,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
if (player->health > 0)
{
if (bEvilGrin)
if (bEvilGrin && !(stateflags & DRAWMUGSHOT_DISABLEGRIN))
{
if (player->bonuscount)
{
@ -344,7 +345,9 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
}
}
if (player->damagecount)
if (player->damagecount &&
// Now go in if pain is disabled but we think ouch will be shown (and ouch is not disabled!)
(!(stateflags & DRAWMUGSHOT_DISABLEPAIN) || (((FaceHealth != -1 && FaceHealth - player->health > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DRAWMUGSHOT_DISABLEOUCH))))
{
int damage_angle = 1;
if (player->attacker && player->attacker != player->mo)
@ -376,7 +379,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
}
}
bool use_ouch = false;
if ((FaceHealth != -1 && FaceHealth - player->health > ST_MUCHPAIN) || bOuchActive)
if (((FaceHealth != -1 && FaceHealth - player->health > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DRAWMUGSHOT_DISABLEOUCH))
{
use_ouch = true;
full_state_name = "ouch.";
@ -403,7 +406,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
else
{
bool use_ouch = false;
if ((FaceHealth != -1 && player->health - FaceHealth > ST_MUCHPAIN) || bOuchActive)
if (((FaceHealth != -1 && player->health - FaceHealth > ST_MUCHPAIN) || bOuchActive) && !(stateflags & DRAWMUGSHOT_DISABLEOUCH))
{
use_ouch = true;
full_state_name = "ouch.";
@ -421,7 +424,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
}
}
if (RampageTimer == ST_RAMPAGEDELAY)
if (RampageTimer == ST_RAMPAGEDELAY && !(stateflags & DRAWMUGSHOT_DISABLERAMPAGE))
{
SetState("rampage", !bNormal); //If we have nothing better to show, use the rampage face.
return 0;
@ -432,7 +435,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
bool good;
if ((player->cheats & CF_GODMODE) || (player->mo != NULL && player->mo->flags2 & MF2_INVULNERABLE))
{
good = SetState(animated_god_mode ? "godanimated" : "god");
good = SetState((stateflags & DRAWMUGSHOT_ANIMATEDGODMODE) ? "godanimated" : "god");
}
else
{
@ -446,7 +449,7 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
}
else
{
if (!xdeath || !(player->cheats & CF_EXTREMELYDEAD))
if (!(stateflags & DRAWMUGSHOT_XDEATHFACE) || !(player->cheats & CF_EXTREMELYDEAD))
{
full_state_name = "death.";
}
@ -469,9 +472,9 @@ int FMugShot::UpdateState(player_t *player, bool xdeath, bool animated_god_mode)
//
//===========================================================================
FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accuracy, bool xdeath, bool animated_god_mode)
FTexture *FMugShot::GetFace(player_t *player, const char *default_face, int accuracy, int stateflags)
{
int angle = UpdateState(player, xdeath, animated_god_mode);
int angle = UpdateState(player, stateflags);
int level = 0;
while (player->health < (accuracy-1-level) * (player->mo->GetMaxHealth()/accuracy))
{

View file

@ -238,8 +238,12 @@ enum //drawshader flags
enum //drawmugshot flags
{
DRAWMUGSHOT_XDEATHFACE = 1,
DRAWMUGSHOT_ANIMATEDGODMODE = 2,
DRAWMUGSHOT_XDEATHFACE = 0x1,
DRAWMUGSHOT_ANIMATEDGODMODE = 0x2,
DRAWMUGSHOT_DISABLEGRIN = 0x4,
DRAWMUGSHOT_DISABLEOUCH = 0x8,
DRAWMUGSHOT_DISABLEPAIN = 0x10,
DRAWMUGSHOT_DISABLERAMPAGE = 0x20,
};
enum //drawkeybar flags
@ -344,7 +348,7 @@ private:
void DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool translate=false, bool dim=false, bool center=false);
void DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0);
void DrawNumber(int num, int len, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing=0, bool fillzeros=false);
void DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets);
void DrawFace(const char *defaultFace, int accuracy, int stateflags, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets);
int updateState(bool xdth, bool animatedgodmode);
void DrawInventoryBar(int type, int num, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, bool alwaysshow,
int counterx, int countery, EColorRange translation, bool drawArtiboxes, bool noArrows, bool alwaysshowcounter);

View file

@ -546,7 +546,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
if(cmd.flags & DRAWNUMBER_HEALTH)
{
value = health;
if(SBarInfoScript->lowerHealthCap && cmd.value < 0) //health shouldn't display negatives
if(SBarInfoScript->lowerHealthCap && value < 0) //health shouldn't display negatives
{
value = 0;
}
@ -671,7 +671,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
xdth = true;
if(cmd.flags & DRAWMUGSHOT_ANIMATEDGODMODE)
animatedgodmode = true;
DrawFace(cmd.string[0], cmd.special, xdth, animatedgodmode, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
int stateflags = cmd.flags & (DRAWMUGSHOT_XDEATHFACE | DRAWMUGSHOT_ANIMATEDGODMODE | DRAWMUGSHOT_DISABLEGRIN | DRAWMUGSHOT_DISABLEOUCH | DRAWMUGSHOT_DISABLEPAIN | DRAWMUGSHOT_DISABLERAMPAGE);
DrawFace(cmd.string[0], cmd.special, stateflags, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
break;
}
case SBARINFO_DRAWSELECTEDINVENTORY:
@ -879,6 +880,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
int x, y, w, h;
int cx, cy, cw, ch, cr, cb;
if(!block.fullScreenOffsets)
{
// Calc real screen coordinates for bar
x = cmd.x + ST_X + xOffset;
y = cmd.y + ST_Y + yOffset;
@ -888,6 +891,14 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
}
}
else
{
x = cmd.x + xOffset;
y = cmd.y + yOffset;
w = fg->GetScaledWidth();
h = fg->GetScaledHeight();
}
if(cmd.special3 != 0)
{
@ -915,6 +926,8 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
}
}
if(!block.fullScreenOffsets)
{
// Calc clipping rect for background
cx = cmd.x + ST_X + cmd.special3 + xOffset;
cy = cmd.y + ST_Y + cmd.special3 + yOffset;
@ -924,6 +937,14 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
{
screen->VirtualToRealCoordsInt(cx, cy, cw, ch, 320, 200, true);
}
}
else
{
cx = cmd.x + cmd.special3 + xOffset;
cy = cmd.y + cmd.special3 + yOffset;
cw = fg->GetScaledWidth() - fg->GetScaledLeftOffset() - cmd.special3 * 2;
ch = fg->GetScaledHeight() - fg->GetScaledTopOffset() - cmd.special3 * 2;
}
if (horizontal)
{
@ -1019,10 +1040,20 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
};
bool vertical = !!(cmd.flags & DRAWSHADER_VERTICAL);
bool reverse = !!(cmd.flags & DRAWSHADER_REVERSE);
screen->DrawTexture (shaders[(vertical << 1) + reverse], ST_X+cmd.x+xOffset, ST_Y+cmd.y+yOffset,
DTA_DestWidth, cmd.special,
DTA_DestHeight, cmd.special2,
DTA_Bottom320x200, Scaled,
int x = cmd.x + xOffset;
int y = cmd.y + yOffset;
int w = cmd.special;
int h = cmd.special2;
if(!block.fullScreenOffsets)
{
x += ST_X;
y += ST_Y;
if(Scaled)
screen->VirtualToRealCoordsInt(x, y, w, h, 320, 200, true);
}
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_Alpha, alpha,
DTA_AlphaChannel, true,
DTA_FillColor, 0,
@ -1219,11 +1250,14 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
y -= (texture->GetHeight()/2)-texture->TopOffset;
}
x += xOffset;
y += yOffset;
int w, h;
if(!fullScreenOffsets)
{
// I'll handle the conversion from fixed to int myself for more control
fixed_t fx = (x + ST_X + xOffset) << FRACBITS;
fixed_t fy = (y + ST_Y + yOffset) << FRACBITS;
fixed_t fx = (x + ST_X) << FRACBITS;
fixed_t fy = (y + ST_Y) << FRACBITS;
fixed_t fw = texture->GetScaledWidth() << FRACBITS;
fixed_t fh = texture->GetScaledHeight() << FRACBITS;
if(Scaled)
@ -1231,8 +1265,14 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
x = fx >> FRACBITS;
y = fy >> FRACBITS;
// Round to nearest
int w = (fw + (FRACUNIT>>1)) >> FRACBITS;
int h = (fh + (FRACUNIT>>1)) >> FRACBITS;
w = (fw + (FRACUNIT>>1)) >> FRACBITS;
h = (fh + (FRACUNIT>>1)) >> FRACBITS;
}
else
{
w = texture->GetScaledWidth();
h = texture->GetScaledHeight();
}
screen->DrawTexture(texture, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
@ -1240,18 +1280,6 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(texture, x, y,
DTA_DestWidth, texture->GetScaledWidth(),
DTA_DestHeight, texture->GetScaledHeight(),
DTA_Translation, translate ? getTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
}
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing)
@ -1278,31 +1306,25 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
}
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
int rx, ry, rw, rh;
rx = x + xOffset;
ry = y + yOffset;
rw = character->GetScaledWidth();
rh = character->GetScaledHeight();
if(!fullScreenOffsets)
{
int rx = x + ST_X + xOffset;
int ry = y + ST_Y + yOffset;
int rw = character->GetScaledWidth();
int rh = character->GetScaledHeight();
rx += ST_X;
ry += ST_Y;
if(Scaled)
screen->VirtualToRealCoordsInt(rx, ry, rw, rh, 320, 200, true);
}
screen->DrawTexture(character, rx, ry,
DTA_DestWidth, rw,
DTA_DestHeight, rh,
DTA_Translation, drawingFont->GetColorTranslation(translation),
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(character, x, y,
DTA_DestWidth, character->GetScaledWidth(),
DTA_DestHeight, character->GetScaledHeight(),
DTA_Translation, drawingFont->GetColorTranslation(translation),
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
if(SBarInfoScript->spacingCharacter == '\0')
x += width + spacing - (character->LeftOffset+1);
else //width gets changed at the call to GetChar()
@ -1341,9 +1363,9 @@ void DSBarInfo::DrawNumber(int num, int len, int x, int y, int xOffset, int yOff
}
//draws the mug shot
void DSBarInfo::DrawFace(const char *defaultFace, int accuracy, bool xdth, bool animatedgodmode, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets)
void DSBarInfo::DrawFace(const char *defaultFace, int accuracy, int stateflags, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets)
{
FTexture *face = MugShot.GetFace(CPlayer, defaultFace, accuracy, xdth, animatedgodmode);
FTexture *face = MugShot.GetFace(CPlayer, defaultFace, accuracy, stateflags);
if (face != NULL)
{
DrawGraphic(face, x, y, xOffset, yOffset, alpha, fullScreenOffsets);

View file

@ -657,11 +657,20 @@ void SBarInfo::ParseSBarInfoBlock(FScanner &sc, SBarInfoBlock &block)
cmd.flags |= DRAWMUGSHOT_XDEATHFACE;
else if(sc.Compare("animatedgodmode"))
cmd.flags |= DRAWMUGSHOT_ANIMATEDGODMODE;
else if(sc.Compare("disablegrin"))
cmd.flags |= DRAWMUGSHOT_DISABLEGRIN;
else if(sc.Compare("disableouch"))
cmd.flags |= DRAWMUGSHOT_DISABLEOUCH;
else if(sc.Compare("disablepain"))
cmd.flags |= DRAWMUGSHOT_DISABLEPAIN;
else if(sc.Compare("disablerampage"))
cmd.flags |= DRAWMUGSHOT_DISABLERAMPAGE;
else
sc.ScriptError("Unknown flag '%s'.", sc.String);
if(!sc.CheckToken('|'))
sc.MustGetToken(',');
}
this->getCoordinates(sc, cmd, block.fullScreenOffsets);
sc.MustGetToken(';');
break;

View file

@ -573,6 +573,8 @@ void FBehavior::StaticLoadDefaultModules ()
FBehavior *FBehavior::StaticLoadModule (int lumpnum, FileReader * fr, int len)
{
if (lumpnum == -1) return;
for (unsigned int i = 0; i < StaticModules.Size(); ++i)
{
if (StaticModules[i]->LumpNum == lumpnum)

View file

@ -3,6 +3,7 @@
ACTOR FireDemon 10060
{
Game Hexen
SpawnID 5
Health 80
ReactionTime 8