# Conflicts:
#	src/r_things.cpp
#	src/v_draw.cpp
This commit is contained in:
Rachael Alexanderson 2017-02-05 00:08:01 -05:00
commit 59f32d497d
45 changed files with 703 additions and 293 deletions

View file

@ -2934,8 +2934,8 @@ static void DrawMarker (FTexture *tex, double x, double y, int yadjust,
DTA_ClipLeft, f_x,
DTA_ClipRight, f_x + f_w,
DTA_FlipX, flip,
DTA_Translation, TranslationToTable(translation),
DTA_AlphaF, alpha,
DTA_TranslationIndex, translation,
DTA_Alpha, alpha,
DTA_FillColor, fillcolor,
DTA_RenderStyle, DWORD(renderstyle),
TAG_DONE);

View file

@ -65,11 +65,11 @@ bool DBot::Move (ticcmd_t *cmd)
bool try_ok;
int good;
if (player->mo->movedir == DI_NODIR)
if (player->mo->movedir >= DI_NODIR)
{
player->mo->movedir = DI_NODIR; // make sure it's valid.
return false;
if ((unsigned)player->mo->movedir >= 8)
I_Error ("Weird bot movedir!");
}
tryx = player->mo->X() + 8*xspeed[player->mo->movedir];
tryy = player->mo->Y() + 8*yspeed[player->mo->movedir];

View file

@ -1007,23 +1007,23 @@ void FNotifyBuffer::Draw()
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, notify.Text,
DTA_CleanNoMove, true, DTA_AlphaF, alpha, TAG_DONE);
DTA_CleanNoMove, true, DTA_Alpha, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (SCREENWIDTH -
SmallFont->StringWidth (notify.Text)*CleanXfac)/2,
line, notify.Text, DTA_CleanNoMove, true,
DTA_AlphaF, alpha, TAG_DONE);
DTA_Alpha, alpha, TAG_DONE);
}
else if (active_con_scaletext() == 1)
{
if (!center)
screen->DrawText (SmallFont, color, 0, line, notify.Text,
DTA_AlphaF, alpha, TAG_DONE);
DTA_Alpha, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (SCREENWIDTH -
SmallFont->StringWidth (notify.Text))/2,
line, notify.Text,
DTA_AlphaF, alpha, TAG_DONE);
DTA_Alpha, alpha, TAG_DONE);
}
else
{
@ -1032,7 +1032,7 @@ void FNotifyBuffer::Draw()
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
DTA_Alpha, alpha, TAG_DONE);
else
screen->DrawText (SmallFont, color, (screen->GetWidth() -
SmallFont->StringWidth (notify.Text) * active_con_scaletext()) / 2 / active_con_scaletext(),
@ -1040,7 +1040,7 @@ void FNotifyBuffer::Draw()
DTA_VirtualWidth, screen->GetWidth() / active_con_scaletext(),
DTA_VirtualHeight, screen->GetHeight() / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_AlphaF, alpha, TAG_DONE);
DTA_Alpha, alpha, TAG_DONE);
}
line += lineadv;
canskip = false;
@ -1121,7 +1121,7 @@ void C_DrawConsole (bool hw2d)
DTA_DestWidth, screen->GetWidth(),
DTA_DestHeight, screen->GetHeight(),
DTA_ColorOverlay, conshade,
DTA_AlphaF, (hw2d && gamestate != GS_FULLCONSOLE) ? (double)con_alpha : 1.,
DTA_Alpha, (hw2d && gamestate != GS_FULLCONSOLE) ? (double)con_alpha : 1.,
DTA_Masked, false,
TAG_DONE);
if (conline && visheight < screen->GetHeight())

View file

@ -457,7 +457,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -466,7 +466,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
@ -481,7 +481,7 @@ void DHUDMessage::DoDraw (int linenum, int x, int y, bool clean, int hudheight)
DTA_ClipRight, ClipRight,
DTA_ClipTop, ClipTop,
DTA_ClipBottom, ClipBot,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -560,7 +560,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -569,7 +569,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
@ -584,7 +584,7 @@ void DHUDMessageFadeOut::DoDraw (int linenum, int x, int y, bool clean, int hudh
DTA_ClipRight, ClipRight,
DTA_ClipTop, ClipTop,
DTA_ClipBottom, ClipBot,
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -660,7 +660,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
{
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -669,7 +669,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_VirtualWidth, SCREENWIDTH / active_con_scaletext(),
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
DTA_KeepRatio, true,
TAG_DONE);
@ -684,7 +684,7 @@ void DHUDMessageFadeInOut::DoDraw (int linenum, int x, int y, bool clean, int hu
DTA_ClipRight, ClipRight,
DTA_ClipTop, ClipTop,
DTA_ClipBottom, ClipBot,
DTA_AlphaF, trans,
DTA_Alpha, trans,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -842,7 +842,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
screen->DrawText (Font, TextColor, x, y, Lines[linenum].Text,
DTA_CleanNoMove, clean,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -853,7 +853,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
DTA_VirtualHeight, SCREENHEIGHT / active_con_scaletext(),
DTA_KeepRatio, true,
DTA_TextLen, LineVisible,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_RenderStyle, Style,
TAG_DONE);
}
@ -867,7 +867,7 @@ void DHUDMessageTypeOnFadeOut::DoDraw (int linenum, int x, int y, bool clean, in
DTA_ClipRight, ClipRight,
DTA_ClipTop, ClipTop,
DTA_ClipBottom, ClipBot,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_TextLen, LineVisible,
DTA_RenderStyle, Style,
TAG_DONE);

View file

@ -138,7 +138,7 @@ void SetHUDIcon(PClassInventory *cls, FTextureID tex)
// center of the box. The image is scaled down if it doesn't fit
//
//---------------------------------------------------------------------------
static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans=0xc000)
static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, double trans = 0.75)
{
double scale1, scale2;
@ -174,7 +174,7 @@ static void DrawImageToBox(FTexture * tex, int x, int y, int w, int h, int trans
//
//---------------------------------------------------------------------------
static void DrawHudText(FFont *font, int color, char * text, int x, int y, int trans=0xc000)
static void DrawHudText(FFont *font, int color, char * text, int x, int y, double trans = 0.75)
{
int zerowidth;
FTexture *tex_zero = font->GetChar('0', &zerowidth);
@ -207,7 +207,7 @@ static void DrawHudText(FFont *font, int color, char * text, int x, int y, int t
//
//---------------------------------------------------------------------------
static void DrawHudNumber(FFont *font, int color, int num, int x, int y, int trans=0xc000)
static void DrawHudNumber(FFont *font, int color, int num, int x, int y, double trans = 0.75)
{
char text[15];
@ -227,11 +227,11 @@ static void DrawStatLine(int x, int &y, const char *prefix, const char *string)
y -= SmallFont->GetHeight()-1;
screen->DrawText(SmallFont, hudcolor_statnames, x, y, prefix,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE);
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75, TAG_DONE);
screen->DrawText(SmallFont, hudcolor_stats, x+statspace, y, string,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0xc000, TAG_DONE);
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.75, TAG_DONE);
}
static void DrawStatus(player_t * CPlayer, int x, int y)
@ -654,7 +654,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
FTextureID icon = !AltIcon.isNull()? AltIcon : inv->Icon;
if (!icon.isValid()) continue;
int trans= (wi && (type==wi->AmmoType1 || type==wi->AmmoType2)) ? 0xc000:0x6000;
double trans= (wi && (type==wi->AmmoType1 || type==wi->AmmoType2)) ? 0.75 : 0.375;
int maxammo = inv->MaxAmount;
int ammo = ammoitem? ammoitem->Amount : 0;
@ -731,16 +731,16 @@ FTextureID GetInventoryIcon(AInventory *item, DWORD flags, bool *applyscale=NULL
static void DrawOneWeapon(player_t * CPlayer, int x, int & y, AWeapon * weapon)
{
int trans;
double trans;
// Powered up weapons and inherited sister weapons are not displayed.
if (weapon->WeaponFlags & WIF_POWERED_UP) return;
if (weapon->SisterWeapon && weapon->IsKindOf(weapon->SisterWeapon->GetClass())) return;
trans=0x6666;
trans=0.4;
if (CPlayer->ReadyWeapon)
{
if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans=0xd999;
if (weapon==CPlayer->ReadyWeapon || weapon==CPlayer->ReadyWeapon->SisterWeapon) trans = 0.85;
}
FTextureID picnum = GetInventoryIcon(weapon, DI_ALTICONFIRST);
@ -809,7 +809,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
{
screen->DrawTexture(invgems[!!(level.time&4)], x-10, y,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE);
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE);
}
for(i=0;i<numitems && rover;rover=rover->NextInv())
@ -820,7 +820,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
if (AltIcon.Exists() && (rover->Icon.isValid() || AltIcon.isValid()) )
{
int trans = rover==CPlayer->mo->InvSel ? 0x10000 : 0x6666;
double trans = rover==CPlayer->mo->InvSel ? 1.0 : 0.4;
DrawImageToBox(TexMan[AltIcon.isValid()? AltIcon : rover->Icon], x, y, 19, 25, trans);
if (rover->Amount>1)
@ -845,7 +845,7 @@ static void DrawInventory(player_t * CPlayer, int x,int y)
{
screen->DrawTexture(invgems[2 + !!(level.time&4)], x-10, y,
DTA_KeepRatio, true,
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0x6666, TAG_DONE);
DTA_VirtualWidth, hudwidth, DTA_VirtualHeight, hudheight, DTA_Alpha, 0.4, TAG_DONE);
}
}
}

View file

@ -1267,10 +1267,10 @@ public:
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(MIN<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(MIN<double>(INT_MAX, dcb)),
DTA_Translation, translate ? GetTranslation() : 0,
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_AlphaChannel, alphaMap,
DTA_FillColor, 0,
TAG_DONE);
@ -1284,10 +1284,10 @@ public:
DTA_ClipTop, static_cast<int>(dcy),
DTA_ClipRight, static_cast<int>(MIN<double>(INT_MAX, dcr)),
DTA_ClipBottom, static_cast<int>(MIN<double>(INT_MAX, dcb)),
DTA_Translation, translate ? GetTranslation() : 0,
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
TAG_DONE);
}
}
@ -1344,10 +1344,10 @@ public:
DTA_ClipTop, static_cast<int>(rcy),
DTA_ClipRight, static_cast<int>(rcr),
DTA_ClipBottom, static_cast<int>(rcb),
DTA_Translation, translate ? GetTranslation() : 0,
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
DTA_AlphaChannel, alphaMap,
DTA_FillColor, 0,
TAG_DONE);
@ -1361,10 +1361,10 @@ public:
DTA_ClipTop, static_cast<int>(rcy),
DTA_ClipRight, static_cast<int>(rcr),
DTA_ClipBottom, static_cast<int>(rcb),
DTA_Translation, translate ? GetTranslation() : 0,
DTA_TranslationIndex, translate ? GetTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & SBarInfoCommand::CENTER_BOTTOM) == SBarInfoCommand::CENTER_BOTTOM,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
TAG_DONE);
}
}
@ -1382,7 +1382,7 @@ public:
const BYTE* str = (const BYTE*) cstring;
const EColorRange boldTranslation = EColorRange(translation ? translation - 1 : NumTextColors - 1);
FRemapTable *remap = font->GetColorTranslation(translation);
int fontcolor = translation;
if(fullScreenOffsets)
{
@ -1408,7 +1408,7 @@ public:
{
EColorRange newColor = V_ParseFontColor(++str, translation, boldTranslation);
if(newColor != CR_UNDEFINED)
remap = font->GetColorTranslation(newColor);
fontcolor = newColor;
continue;
}
@ -1417,20 +1417,22 @@ public:
width = font->GetCharWidth((unsigned char) *str);
else
width = font->GetCharWidth((unsigned char) script->spacingCharacter);
FTexture* character = font->GetChar((unsigned char) *str, &width);
if(character == NULL) //missing character.
FTexture* c = font->GetChar((unsigned char) *str, &width);
if(c == NULL) //missing character.
{
str++;
continue;
}
int character = (unsigned char)*str;
if(script->spacingCharacter == '\0') //If we are monospaced lets use the offset
ax += (character->LeftOffset+1); //ignore x offsets since we adapt to character size
ax += (c->LeftOffset+1); //ignore x offsets since we adapt to character size
double rx, ry, rw, rh;
rx = ax + xOffset;
ry = ay + yOffset;
rw = character->GetScaledWidthDouble();
rh = character->GetScaledHeightDouble();
rw = c->GetScaledWidthDouble();
rh = c->GetScaledHeightDouble();
if(script->spacingCharacter != '\0')
{
@ -1484,32 +1486,31 @@ public:
double salpha = (Alpha *HR_SHADOW);
double srx = rx + (shadowX*xScale);
double sry = ry + (shadowY*yScale);
screen->DrawTexture(character, srx, sry,
screen->DrawChar(font, CR_UNTRANSLATED, srx, sry, character,
DTA_DestWidthF, rw,
DTA_DestHeightF, rh,
DTA_AlphaF, salpha,
DTA_Alpha, salpha,
DTA_FillColor, 0,
TAG_DONE);
}
screen->DrawTexture(character, rx, ry,
screen->DrawChar(font, fontcolor, rx, ry, character,
DTA_DestWidthF, rw,
DTA_DestHeightF, rh,
DTA_Translation, remap,
DTA_AlphaF, Alpha,
DTA_Alpha, Alpha,
TAG_DONE);
if(script->spacingCharacter == '\0')
ax += width + spacing - (character->LeftOffset+1);
ax += width + spacing - (c->LeftOffset+1);
else //width gets changed at the call to GetChar()
ax += font->GetCharWidth((unsigned char) script->spacingCharacter) + spacing;
str++;
}
}
FRemapTable* GetTranslation() const
uint32_t GetTranslation() const
{
if(gameinfo.gametype & GAME_Raven)
return translationtables[TRANSLATION_PlayersExtra][int(CPlayer - players)];
return translationtables[TRANSLATION_Players][int(CPlayer - players)];
return TRANSLATION(TRANSLATION_PlayersExtra, int(CPlayer - players));
return TRANSLATION(TRANSLATION_Players, int(CPlayer - players));
}
AInventory *ammo1, *ammo2;

View file

@ -446,7 +446,7 @@ private:
screen->DrawTexture (Images[CursorImage],
42 + 35*i + ST_X, 12 + ST_Y,
DTA_Bottom320x200, Scaled,
DTA_AlphaF, 1. - ItemFlash,
DTA_Alpha, 1. - ItemFlash,
TAG_DONE);
}
if (item->Icon.isValid())
@ -518,7 +518,7 @@ private:
DTA_HUDRules, HUD_Normal,
DTA_LeftOffset, cursor->GetWidth(),
DTA_TopOffset, cursor->GetHeight(),
DTA_AlphaF, ItemFlash,
DTA_Alpha, ItemFlash,
TAG_DONE);
}
DrINumberOuter (CPlayer->mo->InvSel->Amount, -51, -10, false, 7);
@ -542,7 +542,7 @@ private:
{
screen->DrawTexture (Images[CursorImage], -100+i*35, -21,
DTA_HUDRules, HUD_HorizCenter,
DTA_Alpha, TRANSLUC75,
DTA_Alpha, 0.75,
TAG_DONE);
}
if (item->Icon.isValid())
@ -575,7 +575,7 @@ private:
left = screen->GetWidth()/2 - 160*CleanXfac;
top = bottom + height * yscale;
screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_AlphaF, 0.75, TAG_DONE);
screen->DrawTexture (Images[back], left, top, DTA_CleanNoMove, true, DTA_Alpha, 0.75, TAG_DONE);
screen->DrawTexture (Images[bars], left, top, DTA_CleanNoMove, true, TAG_DONE);
@ -844,7 +844,7 @@ private:
void DrINumberOuter(signed int val, int x, int y, bool center = false, int w = 9) const;
void DrBNumberOuterFont(signed int val, int x, int y, int w = 3) const;
void DrawDimImage(FTexture *image, int x, int y, bool dimmed) const;
void DrawImage(FTexture *image, int x, int y, FRemapTable *translation = NULL) const;
void DrawImage(FTexture *image, int x, int y/*, FRemapTable *translation = NULL*/) const;
};
@ -869,7 +869,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center,
else if (val == 0)
{
screen->DrawTexture(Images[imgINumbers], x + 1, y + 1,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
screen->DrawTexture(Images[imgINumbers], x, y,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
@ -883,7 +883,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center,
while (val != 0)
{
screen->DrawTexture(Images[imgINumbers + val % 10], x + 1, y + 1,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
x -= w;
val /= 10;
@ -891,7 +891,7 @@ void DStrifeStatusBar::DrINumberOuter(signed int val, int x, int y, bool center,
if (negative)
{
screen->DrawTexture(Images[imgNEGATIVE], x + 1, y + 1,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW,
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW,
DTA_HUDRules, center ? HUD_HorizCenter : HUD_Normal, TAG_DONE);
}
@ -940,15 +940,13 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
if (val == 0)
{
pic = BigFont->GetChar('0', &v);
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2, '0',
DTA_HUDRules, HUD_Normal,
DTA_AlphaF, HR_SHADOW,
DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
screen->DrawTexture(pic, xpos - v / 2, y,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '0',
DTA_HUDRules, HUD_Normal,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
return;
}
@ -965,11 +963,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
while (val != 0)
{
pic = BigFont->GetChar('0' + val % 10, &v);
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2,
DTA_HUDRules, HUD_Normal,
DTA_AlphaF, HR_SHADOW,
DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
val /= 10;
xpos -= w;
@ -979,11 +976,10 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
pic = BigFont->GetChar('-', &v);
if (pic != NULL)
{
screen->DrawTexture(pic, xpos - v / 2 + 2, y + 2,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2 + 2, y + 2, '-',
DTA_HUDRules, HUD_Normal,
DTA_AlphaF, HR_SHADOW,
DTA_Alpha, HR_SHADOW,
DTA_FillColor, 0,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
}
}
@ -994,9 +990,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
while (val != 0)
{
pic = BigFont->GetChar('0' + val % 10, &v);
screen->DrawTexture(pic, xpos - v / 2, y,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '0',
DTA_HUDRules, HUD_Normal,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
val /= 10;
xpos -= w;
@ -1006,9 +1001,8 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
pic = BigFont->GetChar('-', &v);
if (pic != NULL)
{
screen->DrawTexture(pic, xpos - v / 2, y,
screen->DrawChar(BigFont, CR_UNTRANSLATED, xpos - v / 2, y, '-',
DTA_HUDRules, HUD_Normal,
DTA_Translation, BigFont->GetColorTranslation(CR_UNTRANSLATED),
TAG_DONE);
}
}
@ -1023,12 +1017,11 @@ void DStrifeStatusBar::DrBNumberOuterFont(signed int val, int x, int y, int size
//---------------------------------------------------------------------------
void DStrifeStatusBar::DrawImage(FTexture *img,
int x, int y, FRemapTable *translation) const
int x, int y) const
{
if (img != NULL)
{
screen->DrawTexture(img, x + ST_X, y + ST_Y,
DTA_Translation, translation,
DTA_Bottom320x200, Scaled,
TAG_DONE);
}

View file

@ -388,15 +388,8 @@ void DIntermissionScreenText::Drawer ()
w *= CleanXfac;
if (cx + w > SCREENWIDTH)
continue;
if (pic != NULL)
{
screen->DrawTexture (pic,
cx,
cy,
DTA_Translation, range,
DTA_CleanNoMove, true,
TAG_DONE);
}
screen->DrawChar(SmallFont, mTextColor, cx, cy, c, DTA_CleanNoMove, true, TAG_DONE);
cx += w;
}
}
@ -432,16 +425,15 @@ void DIntermissionScreenCast::Init(FIntermissionAction *desc, bool first)
if (mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn)))
{
advplayerstate = mDefaults->MissileState;
casttranslation = translationtables[TRANSLATION_Players][consoleplayer];
casttranslation = TRANSLATION(TRANSLATION_Players, consoleplayer);
}
else
{
advplayerstate = NULL;
casttranslation = NULL;
casttranslation = 0;
if (mDefaults->Translation != 0)
{
casttranslation = translationtables[GetTranslationType(mDefaults->Translation)]
[GetTranslationIndex(mDefaults->Translation)];
casttranslation = mDefaults->Translation;
}
}
castdeath = false;
@ -630,8 +622,8 @@ void DIntermissionScreenCast::Drawer ()
DTA_DestHeightF, pic->GetScaledHeightDouble() * castscale.Y,
DTA_DestWidthF, pic->GetScaledWidthDouble() * castscale.X,
DTA_RenderStyle, mDefaults->RenderStyle,
DTA_AlphaF, mDefaults->Alpha,
DTA_Translation, casttranslation,
DTA_Alpha, mDefaults->Alpha,
DTA_TranslationIndex, casttranslation,
TAG_DONE);
}
}

View file

@ -234,7 +234,7 @@ class DIntermissionScreenCast : public DIntermissionScreen
TArray<FICastSound> mCastSounds;
int casttics;
const FRemapTable *casttranslation; // [RH] Draw "our hero" with their chosen suit color
uint32_t casttranslation; // [RH] Draw "our hero" with their chosen suit color
FState* caststate;
FState* basestate;
FState* advplayerstate;

View file

@ -89,6 +89,10 @@ public:
desc->mItems[mStartItem+5] = new DOptionMenuItemStaticText(" ", false);
desc->mItems[mStartItem+6] = new DOptionMenuItemCommand("Undo changes", "undocolorpic");
desc->mItems[mStartItem+7] = new DOptionMenuItemStaticText(" ", false);
for (auto &p : desc->mItems)
{
GC::WriteBarrier(p);
}
desc->mSelectedItem = mStartItem + 2;
Init(parent, desc);
desc->mIndent = 0;

View file

@ -322,6 +322,10 @@ FOptionMenuDescriptor *UpdateJoystickConfigMenu(IJoystickConfig *joy)
opt->mItems.Push(it);
}
}
for (auto &p : opt->mItems)
{
GC::WriteBarrier(p);
}
opt->mScrollPos = 0;
opt->mSelectedItem = -1;
opt->mIndent = 0;
@ -402,6 +406,10 @@ void UpdateJoystickMenu(IJoystickConfig *selected)
if (i == itemnum) opt->mSelectedItem = opt->mItems.Size();
}
}
for (auto &p : opt->mItems)
{
GC::WriteBarrier(p);
}
if (opt->mSelectedItem >= (int)opt->mItems.Size())
{
opt->mSelectedItem = opt->mItems.Size() - 1;

View file

@ -44,6 +44,10 @@
IMPLEMENT_CLASS(DListMenu, false, false)
IMPLEMENT_POINTERS_START(DListMenu)
IMPLEMENT_POINTER(mFocusControl)
IMPLEMENT_POINTERS_END
//=============================================================================
//
//
@ -101,7 +105,7 @@ void DListMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
//
//=============================================================================
DListMenuItem *DListMenu::GetItem(FName name)
DMenuItemBase *DListMenu::GetItem(FName name)
{
for(unsigned i=0;i<mDesc->mItems.Size(); i++)
{
@ -274,27 +278,27 @@ void DListMenu::Drawer ()
// base class for menu items
//
//=============================================================================
IMPLEMENT_CLASS(DListMenuItem, true, false)
IMPLEMENT_CLASS(DMenuItemBase, true, false)
bool DListMenuItem::CheckCoordinate(int x, int y)
bool DMenuItemBase::CheckCoordinate(int x, int y)
{
return false;
}
void DListMenuItem::Ticker()
void DMenuItemBase::Ticker()
{
}
void DListMenuItem::Drawer(bool selected)
void DMenuItemBase::Drawer(bool selected)
{
}
bool DListMenuItem::Selectable()
bool DMenuItemBase::Selectable()
{
return false;
}
void DListMenuItem::DrawSelector(int xofs, int yofs, FTextureID tex)
void DMenuItemBase::DrawSelector(int xofs, int yofs, FTextureID tex)
{
if (tex.isNull())
{
@ -315,57 +319,57 @@ void DListMenuItem::DrawSelector(int xofs, int yofs, FTextureID tex)
}
}
bool DListMenuItem::Activate()
bool DMenuItemBase::Activate()
{
return false; // cannot be activated
}
FName DListMenuItem::GetAction(int *pparam)
FName DMenuItemBase::GetAction(int *pparam)
{
return mAction;
}
bool DListMenuItem::SetString(int i, const char *s)
bool DMenuItemBase::SetString(int i, const char *s)
{
return false;
}
bool DListMenuItem::GetString(int i, char *s, int len)
bool DMenuItemBase::GetString(int i, char *s, int len)
{
return false;
}
bool DListMenuItem::SetValue(int i, int value)
bool DMenuItemBase::SetValue(int i, int value)
{
return false;
}
bool DListMenuItem::GetValue(int i, int *pvalue)
bool DMenuItemBase::GetValue(int i, int *pvalue)
{
return false;
}
void DListMenuItem::Enable(bool on)
void DMenuItemBase::Enable(bool on)
{
mEnabled = on;
}
bool DListMenuItem::MenuEvent(int mkey, bool fromcontroller)
bool DMenuItemBase::MenuEvent(int mkey, bool fromcontroller)
{
return false;
}
bool DListMenuItem::MouseEvent(int type, int x, int y)
bool DMenuItemBase::MouseEvent(int type, int x, int y)
{
return false;
}
bool DListMenuItem::CheckHotkey(int c)
bool DMenuItemBase::CheckHotkey(int c)
{
return false;
}
int DListMenuItem::GetWidth()
int DMenuItemBase::GetWidth()
{
return 0;
}
@ -379,7 +383,7 @@ int DListMenuItem::GetWidth()
IMPLEMENT_CLASS(DListMenuItemStaticPatch, false, false)
DListMenuItemStaticPatch::DListMenuItemStaticPatch(int x, int y, FTextureID patch, bool centered)
: DListMenuItem(x, y)
: DMenuItemBase(x, y)
{
mTexture = patch;
mCentered = centered;
@ -415,7 +419,7 @@ void DListMenuItemStaticPatch::Drawer(bool selected)
IMPLEMENT_CLASS(DListMenuItemStaticText, false, false)
DListMenuItemStaticText::DListMenuItemStaticText(int x, int y, const char *text, FFont *font, EColorRange color, bool centered)
: DListMenuItem(x, y)
: DMenuItemBase(x, y)
{
mText = text;
mFont = font;
@ -452,7 +456,7 @@ void DListMenuItemStaticText::Drawer(bool selected)
IMPLEMENT_CLASS(DListMenuItemSelectable, false, false)
DListMenuItemSelectable::DListMenuItemSelectable(int x, int y, int height, FName action, int param)
: DListMenuItem(x, y, action)
: DMenuItemBase(x, y, action)
{
mHeight = height;
mParam = param;

View file

@ -305,7 +305,7 @@ void DMenu::Drawer ()
}
else
{
screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_AlphaF, BackbuttonAlpha, TAG_DONE);
screen->DrawTexture(tex, x, y, DTA_CleanNoMove, true, DTA_Alpha, BackbuttonAlpha, TAG_DONE);
}
}
}

View file

@ -92,12 +92,12 @@ struct FMenuDescriptor
virtual size_t PropagateMark() { return 0; }
};
class DListMenuItem;
class DMenuItemBase;
class DOptionMenuItem;
struct FListMenuDescriptor : public FMenuDescriptor
{
TArray<DListMenuItem *> mItems;
TArray<DMenuItemBase *> mItems;
int mSelectedItem;
int mSelectOfsX;
int mSelectOfsY;
@ -255,9 +255,9 @@ public:
//
//=============================================================================
class DListMenuItem : public DObject
class DMenuItemBase : public DObject
{
DECLARE_CLASS(DListMenuItem, DObject)
DECLARE_CLASS(DMenuItemBase, DObject)
protected:
int mXpos, mYpos;
FName mAction;
@ -265,7 +265,7 @@ protected:
public:
bool mEnabled;
DListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None)
DMenuItemBase(int xpos = 0, int ypos = 0, FName action = NAME_None)
{
mXpos = xpos;
mYpos = ypos;
@ -295,9 +295,9 @@ public:
void SetX(int x) { mXpos = x; }
};
class DListMenuItemStaticPatch : public DListMenuItem
class DListMenuItemStaticPatch : public DMenuItemBase
{
DECLARE_CLASS(DListMenuItemStaticPatch, DListMenuItem)
DECLARE_CLASS(DListMenuItemStaticPatch, DMenuItemBase)
protected:
FTextureID mTexture;
bool mCentered;
@ -308,9 +308,9 @@ public:
void Drawer(bool selected);
};
class DListMenuItemStaticText : public DListMenuItem
class DListMenuItemStaticText : public DMenuItemBase
{
DECLARE_CLASS(DListMenuItemStaticText, DListMenuItem)
DECLARE_CLASS(DListMenuItemStaticText, DMenuItemBase)
protected:
FString mText;
FFont *mFont;
@ -329,9 +329,9 @@ public:
//
//=============================================================================
class DListMenuItemPlayerDisplay : public DListMenuItem
class DListMenuItemPlayerDisplay : public DMenuItemBase
{
DECLARE_CLASS(DListMenuItemPlayerDisplay, DListMenuItem)
DECLARE_CLASS(DListMenuItemPlayerDisplay, DMenuItemBase)
FListMenuDescriptor *mOwner;
FTexture *mBackdrop;
@ -379,9 +379,9 @@ public:
//
//=============================================================================
class DListMenuItemSelectable : public DListMenuItem
class DListMenuItemSelectable : public DMenuItemBase
{
DECLARE_CLASS(DListMenuItemSelectable, DListMenuItem)
DECLARE_CLASS(DListMenuItemSelectable, DMenuItemBase)
protected:
int mHotkey;
int mHeight;
@ -520,25 +520,26 @@ public:
class DListMenu : public DMenu
{
DECLARE_CLASS(DListMenu, DMenu)
HAS_OBJECT_POINTERS;
protected:
FListMenuDescriptor *mDesc;
DListMenuItem *mFocusControl;
DMenuItemBase *mFocusControl;
public:
DListMenu(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
virtual void Init(DMenu *parent = NULL, FListMenuDescriptor *desc = NULL);
DListMenuItem *GetItem(FName name);
DMenuItemBase *GetItem(FName name);
bool Responder (event_t *ev);
bool MenuEvent (int mkey, bool fromcontroller);
bool MouseEvent(int type, int x, int y);
void Ticker ();
void Drawer ();
void SetFocus(DListMenuItem *fc)
void SetFocus(DMenuItemBase *fc)
{
mFocusControl = fc;
}
bool CheckFocus(DListMenuItem *fc)
bool CheckFocus(DMenuItemBase *fc)
{
return mFocusControl == fc;
}
@ -555,9 +556,9 @@ public:
//
//=============================================================================
class DOptionMenuItem : public DListMenuItem
class DOptionMenuItem : public DMenuItemBase
{
DECLARE_ABSTRACT_CLASS(DOptionMenuItem, DListMenuItem)
DECLARE_ABSTRACT_CLASS(DOptionMenuItem, DMenuItemBase)
protected:
FString mLabel;
bool mCentered;
@ -566,7 +567,7 @@ protected:
public:
DOptionMenuItem(const char *text = nullptr, FName action = NAME_None, bool center = false)
: DListMenuItem(0, 0, action)
: DMenuItemBase(0, 0, action)
{
mLabel = text;
mCentered = center;
@ -609,6 +610,7 @@ extern FOptionMap OptionValues;
class DOptionMenu : public DMenu
{
DECLARE_CLASS(DOptionMenu, DMenu)
HAS_OBJECT_POINTERS;
bool CanScrollUp;
bool CanScrollDown;

View file

@ -294,7 +294,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
sc.MustGetString();
FTextureID tex = GetMenuTexture(sc.String);
DListMenuItem *it = new DListMenuItemStaticPatch(x, y, tex, centered);
DMenuItemBase *it = new DListMenuItemStaticPatch(x, y, tex, centered);
desc->mItems.Push(it);
}
else if (sc.Compare("StaticText") || sc.Compare("StaticTextCentered"))
@ -315,7 +315,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
cr = V_FindFontColor(sc.String);
if (cr == CR_UNTRANSLATED && !sc.Compare("untranslated")) cr = desc->mFontColor;
}
DListMenuItem *it = new DListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
DMenuItemBase *it = new DListMenuItemStaticText(x, y, label, desc->mFont, cr, centered);
desc->mItems.Push(it);
}
else if (sc.Compare("PatchItem"))
@ -335,7 +335,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
param = sc.Number;
}
DListMenuItem *it = new DListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
DMenuItemBase *it = new DListMenuItemPatch(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, tex, action, param);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -357,7 +357,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
param = sc.Number;
}
DListMenuItem *it = new DListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
DMenuItemBase *it = new DListMenuItemText(desc->mXpos, desc->mYpos, desc->mLinespacing, hotkey, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, param);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -426,7 +426,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
int ofs = sc.Number;
sc.MustGetStringName(",");
sc.MustGetString();
DListMenuItem *it = new DPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
DMenuItemBase *it = new DPlayerNameBox(desc->mXpos, desc->mYpos, desc->mLinespacing, ofs, text, desc->mFont, desc->mFontColor, sc.String);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -444,7 +444,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
sc.MustGetString();
values = sc.String;
}
DListMenuItem *it = new DValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
DMenuItemBase *it = new DValueTextItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, desc->mFontColor2, action, values);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -465,7 +465,7 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
sc.MustGetStringName(",");
sc.MustGetNumber();
int step = sc.Number;
DListMenuItem *it = new DSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
DMenuItemBase *it = new DSliderItem(desc->mXpos, desc->mYpos, desc->mLinespacing, text, desc->mFont, desc->mFontColor, action, min, max, step);
desc->mItems.Push(it);
desc->mYpos += desc->mLinespacing;
if (desc->mSelectedItem == -1) desc->mSelectedItem = desc->mItems.Size()-1;
@ -475,6 +475,10 @@ static void ParseListMenuBody(FScanner &sc, FListMenuDescriptor *desc)
sc.ScriptError("Unknown keyword '%s'", sc.String);
}
}
for (auto &p : desc->mItems)
{
GC::WriteBarrier(p);
}
}
//=============================================================================
@ -927,6 +931,10 @@ static void ParseOptionMenuBody(FScanner &sc, FOptionMenuDescriptor *desc)
sc.ScriptError("Unknown keyword '%s'", sc.String);
}
}
for (auto &p : desc->mItems)
{
GC::WriteBarrier(p);
}
}
//=============================================================================
@ -1081,7 +1089,7 @@ static void BuildEpisodeMenu()
ld->mSelectedItem = ld->mItems.Size();
for(unsigned i = 0; i < AllEpisodes.Size(); i++)
{
DListMenuItem *it;
DMenuItemBase *it;
if (AllEpisodes[i].mPicName.IsNotEmpty())
{
FTextureID tex = GetMenuTexture(AllEpisodes[i].mPicName);
@ -1101,6 +1109,10 @@ static void BuildEpisodeMenu()
ld->mAutoselect = ld->mSelectedItem;
}
success = true;
for (auto &p : ld->mItems)
{
GC::WriteBarrier(p);
}
}
}
}
@ -1125,6 +1137,7 @@ static void BuildEpisodeMenu()
{
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu(AllEpisodes[i].mEpisodeName, "Skillmenu", i);
od->mItems.Push(it);
GC::WriteBarrier(it);
}
}
}
@ -1230,6 +1243,10 @@ static void BuildPlayerclassMenu()
}
}
success = true;
for (auto &p : ld->mItems)
{
GC::WriteBarrier(p);
}
}
}
}
@ -1261,11 +1278,13 @@ static void BuildPlayerclassMenu()
{
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu(pname, "Episodemenu", i);
od->mItems.Push(it);
GC::WriteBarrier(it);
}
}
}
DOptionMenuItemSubmenu *it = new DOptionMenuItemSubmenu("Random", "Episodemenu", -1);
od->mItems.Push(it);
GC::WriteBarrier(it);
}
}
@ -1355,6 +1374,10 @@ static void InitKeySections()
menu->mItems.Push(item);
}
}
for (auto &p : menu->mItems)
{
GC::WriteBarrier(p);
}
}
}
}
@ -1465,7 +1488,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
for(unsigned int i = 0; i < AllSkills.Size(); i++)
{
FSkillInfo &skill = AllSkills[i];
DListMenuItem *li;
DMenuItemBase *li;
// Using a different name for skills that must be confirmed makes handling this easier.
FName action = (skill.MustConfirm && !AllEpisodes[gs->Episode].mNoSkill) ?
NAME_StartgameConfirm : NAME_Startgame;
@ -1488,6 +1511,7 @@ void M_StartupSkillMenu(FGameStartup *gs)
pItemText? *pItemText : skill.MenuName, ld->mFont, color,ld->mFontColor2, action, i);
}
ld->mItems.Push(li);
GC::WriteBarrier(li);
y += ld->mLinespacing;
}
if (AllEpisodes[gs->Episode].mNoSkill || AllSkills.Size() == 1)
@ -1541,6 +1565,7 @@ fail:
}
li = new DOptionMenuItemSubmenu(pItemText? *pItemText : skill.MenuName, action, i);
od->mItems.Push(li);
GC::WriteBarrier(li);
if (!done)
{
done = true;

View file

@ -332,29 +332,25 @@ void DTextEnterMenu::Drawer ()
const int ch = InputGridChars[y * INPUTGRID_WIDTH + x];
FTexture *pic = SmallFont->GetChar(ch, &width);
EColorRange color;
FRemapTable *remap;
// The highlighted character is yellow; the rest are dark gray.
color = (x == InputGridX && y == InputGridY) ? CR_YELLOW : CR_DARKGRAY;
remap = SmallFont->GetColorTranslation(color);
if (pic != NULL)
{
// Draw a normal character.
screen->DrawTexture(pic, xx + cell_width/2 - width*CleanXfac/2, yy + top_padding,
DTA_Translation, remap,
DTA_CleanNoMove, true,
TAG_DONE);
screen->DrawChar(SmallFont, color, xx + cell_width/2 - width*CleanXfac/2, yy + top_padding, ch, DTA_CleanNoMove, true, TAG_DONE);
}
else if (ch == ' ')
{
FRemapTable *remap = SmallFont->GetColorTranslation(color);
// Draw the space as a box outline. We also draw it 50% wider than it really is.
const int x1 = xx + cell_width/2 - width * CleanXfac * 3 / 4;
const int x2 = x1 + width * 3 * CleanXfac / 2;
const int y1 = yy + top_padding;
const int y2 = y1 + SmallFont->GetHeight() * CleanYfac;
const int palentry = remap->Remap[remap->NumEntries*2/3];
const uint32 palcolor = remap->Palette[remap->NumEntries*2/3];
const int palentry = remap->Remap[remap->NumEntries * 2 / 3];
const uint32 palcolor = remap->Palette[remap->NumEntries * 2 / 3];
screen->Clear(x1, y1, x2, y1+CleanYfac, palentry, palcolor); // top
screen->Clear(x1, y2, x2, y2+CleanYfac, palentry, palcolor); // bottom
screen->Clear(x1, y1+CleanYfac, x1+CleanXfac, y2, palentry, palcolor); // left

View file

@ -66,6 +66,10 @@ void M_DrawConText (int color, int x, int y, const char *str)
IMPLEMENT_CLASS(DOptionMenu, false, false)
IMPLEMENT_POINTERS_START(DOptionMenu)
IMPLEMENT_POINTER(mFocusControl)
IMPLEMENT_POINTERS_END
//=============================================================================
//
//

View file

@ -402,7 +402,7 @@ public:
if (mParentMenu->IsKindOf(RUNTIME_CLASS(DOptionMenu)))
{
DOptionMenu *m = barrier_cast<DOptionMenu*>(mParentMenu);
DListMenuItem *it = m->GetItem(NAME_Controlmessage);
DMenuItemBase *it = m->GetItem(NAME_Controlmessage);
if (it != NULL)
{
it->SetValue(0, which);
@ -1242,7 +1242,7 @@ IMPLEMENT_CLASS(DOptionMenuTextField, false, false)
//=============================================================================
//
// [TP] DOptionMenuNumberField
// [TP] FOptionMenuNumberField
//
// A numeric input field widget, for use with number CVars where sliders are inappropriate (i.e.
// where the user is interested in the exact value specifically)

View file

@ -350,19 +350,19 @@ void FBackdropTexture::Render()
//
//=============================================================================
IMPLEMENT_CLASS(DListMenuItemPlayerDisplay, false, false)
DListMenuItemPlayerDisplay::DListMenuItemPlayerDisplay(FListMenuDescriptor *menu, int x, int y, PalEntry c1, PalEntry c2, bool np, FName action)
: DListMenuItem(x, y, action)
: DMenuItemBase(x, y, action)
{
mOwner = menu;
FRemapTable *bdremap = translationtables[TRANSLATION_Players][MAXPLAYERS + 1];
for (int i = 0; i < 256; i++)
{
int r = c1.r + c2.r * i / 255;
int g = c1.g + c2.g * i / 255;
int b = c1.b + c2.b * i / 255;
mRemap.Remap[i] = ColorMatcher.Pick (r, g, b);
mRemap.Palette[i] = PalEntry(255, r, g, b);
bdremap->Remap[i] = ColorMatcher.Pick (r, g, b);
bdremap->Palette[i] = PalEntry(255, r, g, b);
}
mBackdrop = new FBackdropTexture;
mPlayerClass = NULL;
@ -570,10 +570,10 @@ void DListMenuItemPlayerDisplay::Drawer(bool selected)
int x = (mXpos - 160) * CleanXfac + (SCREENWIDTH>>1);
int y = (mYpos - 100) * CleanYfac + (SCREENHEIGHT>>1);
screen->DrawTexture (mBackdrop, x, y - 1,
screen->DrawTexture(mBackdrop, x, y - 1,
DTA_DestWidth, 72 * CleanXfac,
DTA_DestHeight, 80 * CleanYfac,
DTA_Translation, &mRemap,
DTA_TranslationIndex, TRANSLATION(TRANSLATION_Players, MAXPLAYERS + 1),
DTA_Masked, true,
TAG_DONE);
@ -601,13 +601,12 @@ void DListMenuItemPlayerDisplay::Drawer(bool selected)
FTexture *tex = TexMan(sprframe->Texture[mRotation]);
if (tex != NULL && tex->UseType != FTexture::TEX_Null)
{
FRemapTable *trans = NULL;
if (mTranslate) trans = translationtables[TRANSLATION_Players](MAXPLAYERS);
int trans = mTranslate? TRANSLATION(TRANSLATION_Players, MAXPLAYERS) : 0;
screen->DrawTexture (tex,
x + 36*CleanXfac, y + 71*CleanYfac,
DTA_DestWidthF, tex->GetScaledWidthDouble() * CleanXfac * Scale.X,
DTA_DestHeightF, tex->GetScaledHeightDouble() * CleanYfac * Scale.Y,
DTA_Translation, trans,
DTA_TranslationIndex, trans,
DTA_FlipX, sprframe->Flip & (1 << mRotation),
TAG_DONE);
}

View file

@ -499,11 +499,11 @@ class DPlayerMenu : public DListMenu
void UpdateTranslation();
void SendNewColor (int red, int green, int blue);
void PlayerNameChanged(DListMenuItem *li);
void ColorSetChanged (DListMenuItem *li);
void ClassChanged (DListMenuItem *li);
void AutoaimChanged (DListMenuItem *li);
void SkinChanged (DListMenuItem *li);
void PlayerNameChanged(DMenuItemBase *li);
void ColorSetChanged (DMenuItemBase *li);
void ClassChanged (DMenuItemBase *li);
void AutoaimChanged (DMenuItemBase *li);
void SkinChanged (DMenuItemBase *li);
public:
@ -527,7 +527,7 @@ IMPLEMENT_CLASS(DPlayerMenu, false, false)
void DPlayerMenu::Init(DMenu *parent, FListMenuDescriptor *desc)
{
DListMenuItem *li;
DMenuItemBase *li;
Super::Init(parent, desc);
PickPlayerClass();
@ -655,7 +655,7 @@ bool DPlayerMenu::Responder (event_t *ev)
{
// turn the player sprite around
mRotation = 8 - mRotation;
DListMenuItem *li = GetItem(NAME_Playerdisplay);
DMenuItemBase *li = GetItem(NAME_Playerdisplay);
if (li != NULL)
{
li->SetValue(DListMenuItemPlayerDisplay::PDF_ROTATION, mRotation);
@ -745,7 +745,7 @@ void DPlayerMenu::SendNewColor (int red, int green, int blue)
void DPlayerMenu::UpdateColorsets()
{
DListMenuItem *li = GetItem(NAME_Color);
DMenuItemBase *li = GetItem(NAME_Color);
if (li != NULL)
{
int sel = 0;
@ -781,7 +781,7 @@ void DPlayerMenu::UpdateSkins()
{
int sel = 0;
int skin;
DListMenuItem *li = GetItem(NAME_Skin);
DMenuItemBase *li = GetItem(NAME_Skin);
if (li != NULL)
{
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
@ -824,7 +824,7 @@ void DPlayerMenu::UpdateSkins()
//
//=============================================================================
void DPlayerMenu::PlayerNameChanged(DListMenuItem *li)
void DPlayerMenu::PlayerNameChanged(DMenuItemBase *li)
{
char pp[MAXPLAYERNAME+1];
const char *p;
@ -852,7 +852,7 @@ void DPlayerMenu::PlayerNameChanged(DListMenuItem *li)
//
//=============================================================================
void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
void DPlayerMenu::ColorSetChanged (DMenuItemBase *li)
{
int sel;
@ -862,9 +862,9 @@ void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
if (sel > 0) mycolorset = PlayerColorSets[sel-1];
DListMenuItem *red = GetItem(NAME_Red);
DListMenuItem *green = GetItem(NAME_Green);
DListMenuItem *blue = GetItem(NAME_Blue);
DMenuItemBase *red = GetItem(NAME_Red);
DMenuItemBase *green = GetItem(NAME_Green);
DMenuItemBase *blue = GetItem(NAME_Blue);
// disable the sliders if a valid colorset is selected
if (red != NULL) red->Enable(mycolorset == -1);
@ -885,7 +885,7 @@ void DPlayerMenu::ColorSetChanged (DListMenuItem *li)
//
//=============================================================================
void DPlayerMenu::ClassChanged (DListMenuItem *li)
void DPlayerMenu::ClassChanged (DMenuItemBase *li)
{
if (PlayerClasses.Size () == 1)
{
@ -919,7 +919,7 @@ void DPlayerMenu::ClassChanged (DListMenuItem *li)
//
//=============================================================================
void DPlayerMenu::SkinChanged (DListMenuItem *li)
void DPlayerMenu::SkinChanged (DMenuItemBase *li)
{
if (GetDefaultByType (PlayerClass->Type)->flags4 & MF4_NOSKIN ||
players[consoleplayer].userinfo.GetPlayerClassNum() == -1)
@ -950,7 +950,7 @@ void DPlayerMenu::SkinChanged (DListMenuItem *li)
//
//=============================================================================
void DPlayerMenu::AutoaimChanged (DListMenuItem *li)
void DPlayerMenu::AutoaimChanged (DMenuItemBase *li)
{
int sel;
@ -971,7 +971,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
int v;
if (mDesc->mSelectedItem >= 0)
{
DListMenuItem *li = mDesc->mItems[mDesc->mSelectedItem];
DMenuItemBase *li = mDesc->mItems[mDesc->mSelectedItem];
if (li->MenuEvent(mkey, fromcontroller))
{
FName current = li->GetAction(NULL);
@ -1067,7 +1067,7 @@ bool DPlayerMenu::MenuEvent (int mkey, bool fromcontroller)
bool DPlayerMenu::MouseEvent(int type, int x, int y)
{
int v;
DListMenuItem *li = mFocusControl;
DMenuItemBase *li = mFocusControl;
bool res = Super::MouseEvent(type, x, y);
if (li == NULL) li = mFocusControl;
if (li != NULL)

View file

@ -105,7 +105,7 @@ void DReadThisMenu::Drawer()
{
screen->DrawTexture (prevpic, 0, 0, DTA_Fullscreen, true, TAG_DONE);
}
screen->DrawTexture (tex, 0, 0, DTA_Fullscreen, true, DTA_AlphaF, alpha, TAG_DONE);
screen->DrawTexture (tex, 0, 0, DTA_Fullscreen, true, DTA_Alpha, alpha, TAG_DONE);
}

View file

@ -346,6 +346,7 @@ xx(SinH)
xx(TanH)
xx(ATan2)
xx(VectorAngle)
xx(New)
xx(Alpha)
xx(Angle)
xx(Args)

View file

@ -1061,10 +1061,10 @@ public:
mysnprintf(goldstr, countof(goldstr), "%d", coin != NULL ? coin->Amount : 0);
screen->DrawText(SmallFont, CR_GRAY, 21, 191, goldstr, DTA_320x200, true,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
screen->DrawTexture(TexMan(((AInventory *)GetDefaultByType(cointype))->Icon),
3, 190, DTA_320x200, true,
DTA_FillColor, 0, DTA_AlphaF, HR_SHADOW, TAG_DONE);
DTA_FillColor, 0, DTA_Alpha, HR_SHADOW, TAG_DONE);
screen->DrawText(SmallFont, CR_GRAY, 20, 190, goldstr, DTA_320x200, true, TAG_DONE);
screen->DrawTexture(TexMan(((AInventory *)GetDefaultByType(cointype))->Icon),
2, 189, DTA_320x200, true, TAG_DONE);

View file

@ -570,8 +570,9 @@ bool P_Move (AActor *actor)
return true;
}
if (actor->movedir == DI_NODIR)
if (actor->movedir >= DI_NODIR)
{
actor->movedir = DI_NODIR; // make sure it's valid.
return false;
}
@ -585,9 +586,6 @@ bool P_Move (AActor *actor)
return false;
}
if ((unsigned)actor->movedir >= 8)
I_Error ("Weird actor->movedir!");
// killough 10/98: allow dogs to drop off of taller ledges sometimes.
// dropoff==1 means always allow it, dropoff==2 means only up to 128 high,
// and only if the target is immediately on the other side of the line.

View file

@ -740,6 +740,8 @@ void R_InitTranslationTables ()
}
// The menu player also gets a separate translation table
PushIdentityTable(TRANSLATION_Players);
// This one is for the backdrop in the menu
PushIdentityTable(TRANSLATION_Players);
// The three standard translations from Doom or Heretic (seven for Strife),
// plus the generic ice translation.

View file

@ -4918,6 +4918,70 @@ ExpEmit FxATan2::Emit(VMFunctionBuilder *build)
return out;
}
//==========================================================================
//
//
//
//==========================================================================
FxNew::FxNew(FxExpression *v)
: FxExpression(EFX_New, v->ScriptPosition)
{
val = new FxClassTypeCast(NewClassPointer(RUNTIME_CLASS(DObject)), v, false);
ValueType = NewPointer(RUNTIME_CLASS(DObject));
}
//==========================================================================
//
//
//
//==========================================================================
FxNew::~FxNew()
{
SAFE_DELETE(val);
}
//==========================================================================
//
//
//
//==========================================================================
FxExpression *FxNew::Resolve(FCompileContext &ctx)
{
CHECKRESOLVED();
SAFE_RESOLVE(val, ctx);
if (!val->ValueType->IsKindOf(RUNTIME_CLASS(PClassPointer)))
{
ScriptPosition.Message(MSG_ERROR, "Class type expected");
delete this;
return nullptr;
}
if (val->isConstant())
{
auto cls = static_cast<PClass *>(static_cast<FxConstant*>(val)->GetValue().GetPointer());
ValueType = NewPointer(cls);
}
return this;
}
//==========================================================================
//
//
//
//==========================================================================
ExpEmit FxNew::Emit(VMFunctionBuilder *build)
{
assert(ValueType == val->ValueType);
ExpEmit from = val->Emit(build);
from.Free(build);
ExpEmit to(build, REGT_POINTER);
build->Emit(from.Konst ? OP_NEW_K : OP_NEW, to.RegNum, from.RegNum);
return to;
}
//==========================================================================
//
// The atan2 opcode only takes registers as parameters, so any constants
@ -6489,7 +6553,9 @@ ExpEmit FxStackVariable::Emit(VMFunctionBuilder *build)
if (membervar->BitValue == -1)
{
if (offsetreg == -1) offsetreg = build->GetConstantInt(0);
build->Emit(membervar->Type->GetLoadOp(), loc.RegNum, build->FramePointer.RegNum, offsetreg);
auto op = membervar->Type->GetLoadOp();
if (op == OP_LO) op = OP_LOS;
build->Emit(op, loc.RegNum, build->FramePointer.RegNum, offsetreg);
}
else
{
@ -7428,6 +7494,15 @@ FxExpression *FxFunctionCall::Resolve(FCompileContext& ctx)
}
break;
case NAME_New:
if (CheckArgSize(MethodName, ArgList, 1, 1, ScriptPosition))
{
func = new FxNew(ArgList[0]);
ArgList[0] = nullptr;
}
break;
default:
ScriptPosition.Message(MSG_ERROR, "Call to unknown function '%s'", MethodName.GetChars());
break;

View file

@ -242,6 +242,7 @@ enum EFxType
EFX_Conditional,
EFX_Abs,
EFX_ATan2,
EFX_New,
EFX_MinMax,
EFX_Random,
EFX_RandomPick,
@ -1176,6 +1177,26 @@ public:
private:
ExpEmit ToReg(VMFunctionBuilder *build, FxExpression *val);
};
//==========================================================================
//
//
//
//==========================================================================
class FxNew : public FxExpression
{
FxExpression *val;
public:
FxNew(FxExpression *v);
~FxNew();
FxExpression *Resolve(FCompileContext&);
ExpEmit Emit(VMFunctionBuilder *build);
};
//==========================================================================
//
//

View file

@ -53,6 +53,7 @@
#include "vm.h"
#include "p_checkposition.h"
#include "r_sky.h"
#include "v_font.h"
static TArray<FPropertyInfo*> properties;
static TArray<AFuncDesc> AFTable;
@ -801,34 +802,51 @@ void InitThingdef()
pstruct->Size = sizeof(player_t);
pstruct->Align = alignof(player_t);
PArray *parray = NewArray(pstruct, MAXPLAYERS);
PField *playerf = new PField("players", parray, VARF_Native | VARF_Static, (intptr_t)&players);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
PField *fieldptr = new PField("players", parray, VARF_Native | VARF_Static, (intptr_t)&players);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
pstruct->AddNativeField("weapons", NewNativeStruct("WeaponSlots", nullptr), myoffsetof(player_t, weapons), VARF_Native);
parray = NewArray(TypeBool, MAXPLAYERS);
playerf = new PField("playeringame", parray, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&playeringame);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("playeringame", parray, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&playeringame);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
playerf = new PField("gameaction", TypeUInt8, VARF_Native | VARF_Static, (intptr_t)&gameaction);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("gameaction", TypeUInt8, VARF_Native | VARF_Static, (intptr_t)&gameaction);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
playerf = new PField("skyflatnum", TypeTextureID, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&skyflatnum);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("skyflatnum", TypeTextureID, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&skyflatnum);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
playerf = new PField("globalfreeze", TypeUInt8, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&bglobal.freeze);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("globalfreeze", TypeUInt8, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&bglobal.freeze);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
playerf = new PField("consoleplayer", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&consoleplayer);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("consoleplayer", TypeSInt32, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&consoleplayer);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
auto fontptr = NewPointer(NewNativeStruct("Font", nullptr));
fieldptr = new PField("smallfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&SmallFont);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("smallfont2", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&SmallFont2);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("bigfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&BigFont);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("confont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&ConFont);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
fieldptr = new PField("intermissionfont", fontptr, VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&IntermissionFont);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
// Argh. It sucks when bad hacks need to be supported. WP_NOCHANGE is just a bogus pointer but it used everywhere as a special flag.
// It cannot be defined as constant because constants can either be numbers or strings but nothing else, so the only 'solution'
// is to create a static variable from it and reference that in the script. Yuck!!!
static AWeapon *wpnochg = WP_NOCHANGE;
playerf = new PField("WP_NOCHANGE", NewPointer(RUNTIME_CLASS(AWeapon), false), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&wpnochg);
Namespaces.GlobalNamespace->Symbols.AddSymbol(playerf);
fieldptr = new PField("WP_NOCHANGE", NewPointer(RUNTIME_CLASS(AWeapon), false), VARF_Native | VARF_Static | VARF_ReadOnly, (intptr_t)&wpnochg);
Namespaces.GlobalNamespace->Symbols.AddSymbol(fieldptr);
// synthesize a symbol for each flag from the flag name tables to avoid redundant declaration of them.
for (auto &fl : FlagLists)

View file

@ -193,6 +193,7 @@ enum
enum EVMAbortException
{
X_OTHER,
X_READ_NIL,
X_WRITE_NIL,
X_TOO_MANY_TRIES,

View file

@ -281,8 +281,8 @@ unsigned VMFunctionBuilder::GetConstantAddress(void *ptr, VM_ATAG tag)
AddrKonst *locp = AddressConstantMap.CheckKey(ptr);
if (locp != NULL)
{
// There should only be one tag associated with a memory location.
assert(locp->Tag == tag);
// There should only be one tag associated with a memory location. Exceptions are made for null pointers that got allocated through constant arrays.
assert(ptr == nullptr || locp->Tag == tag);
return locp->KonstNum;
}
else

View file

@ -72,6 +72,7 @@
#define RFRF MODE_AF | MODE_BF | MODE_CUNUSED
#define RSRS MODE_AS | MODE_BS | MODE_CUNUSED
#define RPRP MODE_AP | MODE_BP | MODE_CUNUSED
#define RPKP MODE_AP | MODE_BKP | MODE_CUNUSED
#define RXRXI8 MODE_AX | MODE_BX | MODE_CIMMZ
#define RPRPRP MODE_AP | MODE_BP | MODE_CP
#define RPRPKP MODE_AP | MODE_BP | MODE_CKP

View file

@ -209,6 +209,18 @@ begin:
reg.a[a] = GC::ReadBarrier(*(DObject **)ptr);
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
OP(LOS):
ASSERTA(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);
reg.a[a] = *(DObject **)ptr;
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
OP(LOS_R):
ASSERTA(a); ASSERTA(B); ASSERTD(C);
GETADDR(PB,RC,X_READ_NIL);
reg.a[a] = *(DObject **)ptr;
reg.atag[a] = ATAG_OBJECT;
NEXTOP;
OP(LP):
ASSERTA(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);
@ -759,6 +771,14 @@ begin:
assert(0);
NEXTOP;
OP(NEW_K):
OP(NEW):
{
PClass *cls = (PClass*)(pc->op == OP_NEW ? reg.a[C] : konsta[C].v);
reg.a[B] = cls->CreateNew();
NEXTOP;
}
OP(TRY):
assert(try_depth < MAX_TRY_DEPTH);
if (try_depth >= MAX_TRY_DEPTH)

View file

@ -554,6 +554,10 @@ CVMAbortException::CVMAbortException(EVMAbortException reason, const char *morei
AppendMessage("string format failed.");
break;
case X_OTHER:
// no prepended message.
break;
default:
{
size_t len = strlen(m_Message);

View file

@ -44,6 +44,8 @@ xx(LS, ls, RSRPKI, LS_R, 4, REGT_INT), // load string
xx(LS_R, ls, RSRPRI, NOP, 0, 0),
xx(LO, lo, RPRPKI, LO_R, 4, REGT_INT), // load object
xx(LO_R, lo, RPRPRI, NOP, 0, 0),
xx(LOS, los, RPRPKI, LOS_R, 4, REGT_INT), // load object (stack version without read barrier)
xx(LOS_R, lo, RPRPRI, NOP, 0, 0),
xx(LP, lp, RPRPKI, LP_R, 4, REGT_INT), // load pointer
xx(LP_R, lp, RPRPRI, NOP, 0, 0),
xx(LV2, lv2, RVRPKI, LV2_R, 4, REGT_INT), // load vector2
@ -104,6 +106,8 @@ xx(TAIL_K, tail, KPI8, TAIL, 1, REGT_POINTER),
xx(RESULT, result, __BCP, NOP, 0, 0), // Result should go in register encoded in BC (in caller, after CALL)
xx(RET, ret, I8BCP, NOP, 0, 0), // Copy value from register encoded in BC to return value A, possibly returning
xx(RETI, reti, I8I16, NOP, 0, 0), // Copy immediate from BC to return value A, possibly returning
xx(NEW, new, RPRP, NOP, 0, 0),
xx(NEW_K, new, RPKP, NOP, 0, 0),
xx(TRY, try, I24, NOP, 0, 0), // When an exception is thrown, start searching for a handler at pc + ABC
xx(UNTRY, untry, I8, NOP, 0, 0), // Pop A entries off the exception stack
xx(THROW, throw, THROW, NOP, 0, 0), // A == 0: Throw exception object pB

View file

@ -91,6 +91,17 @@ CVAR (Bool, hud_scale, true, CVAR_ARCHIVE);
static int LastPal = -1;
static uint32 LastRGB;
DEFINE_ACTION_FUNCTION(_Screen, GetWidth)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(screen->GetWidth());
}
DEFINE_ACTION_FUNCTION(_Screen, GetHeight)
{
PARAM_PROLOGUE;
ACTION_RETURN_INT(screen->GetHeight());
}
static int PalFromRGB(uint32 rgb)
{
@ -115,6 +126,7 @@ static int PalFromRGB(uint32 rgb)
return LastPal;
}
void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ...)
{
va_list tags;
@ -130,6 +142,31 @@ void DCanvas::DrawTexture (FTexture *img, double x, double y, int tags_first, ..
DrawTextureParms(img, parms);
}
static int ListGetInt(VMVa_List &tags);
void DCanvas::DrawTexture(FTexture *img, double x, double y, VMVa_List &args)
{
DrawParms parms;
uint32_t tag = ListGetInt(args);
bool res = ParseDrawTextureTags(img, x, y, tag, args, &parms, false);
if (!res) return;
DrawTextureParms(img, parms);
}
DEFINE_ACTION_FUNCTION(_Screen, DrawTexture)
{
PARAM_PROLOGUE;
PARAM_INT(texid);
PARAM_BOOL(animate);
PARAM_FLOAT(x);
PARAM_FLOAT(y);
FTexture *tex = animate ? TexMan(FSetTextureID(texid)) : TexMan[FSetTextureID(texid)];
VMVa_List args = { param + 4, 0, numparam - 4 };
screen->DrawTexture(tex, x, y, args);
return 0;
}
DEFINE_ACTION_FUNCTION(_Screen, DrawHUDTexture)
{
PARAM_PROLOGUE;
@ -167,7 +204,7 @@ void DCanvas::DrawTextureParms(FTexture *img, DrawParms &parms)
{
parms.colorOverlay = PalEntry(parms.colorOverlay).InverseColor();
}
// Note that this overrides DTA_Translation in software, but not in hardware.
// Note that this overrides the translation in software, but not in hardware.
if (!viewport->RenderTarget->IsBgra())
{
FDynamicColormap *colormap = GetSpecialLights(MAKERGB(255, 255, 255),
@ -390,7 +427,70 @@ bool DCanvas::SetTextureParms(DrawParms *parms, FTexture *img, double xx, double
return false;
}
bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag, va_list tags, DrawParms *parms, bool fortext) const
static void ListEnd(va_list &tags)
{
va_end(tags);
}
static int ListGetInt(va_list &tags)
{
return va_arg(tags, int);
}
static inline double ListGetDouble(va_list &tags)
{
return va_arg(tags, double);
}
// These two options are only being used by the D3D version of the HUD weapon drawer, they serve no purpose anywhere else.
static inline FSpecialColormap * ListGetSpecialColormap(va_list &tags)
{
return va_arg(tags, FSpecialColormap *);
}
static inline FColormapStyle * ListGetColormapStyle(va_list &tags)
{
return va_arg(tags, FColormapStyle *);
}
static void ListEnd(VMVa_List &tags)
{
}
static int ListGetInt(VMVa_List &tags)
{
if (tags.curindex < tags.numargs && tags.args[tags.curindex].Type == REGT_INT)
{
return tags.args[tags.curindex++].i;
}
ThrowAbortException(X_OTHER, "Invalid parameter in draw function, int expected");
return 0;
}
static inline double ListGetDouble(VMVa_List &tags)
{
if (tags.curindex < tags.numargs && tags.args[tags.curindex].Type == REGT_FLOAT)
{
return tags.args[tags.curindex++].f;
}
ThrowAbortException(X_OTHER, "Invalid parameter in draw function, float expected");
return 0;
}
static inline FSpecialColormap * ListGetSpecialColormap(VMVa_List &tags)
{
ThrowAbortException(X_OTHER, "Invalid tag in draw function");
return nullptr;
}
static inline FColormapStyle * ListGetColormapStyle(VMVa_List &tags)
{
ThrowAbortException(X_OTHER, "Invalid tag in draw function");
return nullptr;
}
template<class T>
bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, bool fortext) const
{
INTBOOL boolval;
int intval;
@ -401,7 +501,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
{
if (img == NULL || img->UseType == FTexture::TEX_Null)
{
va_end(tags);
ListEnd(tags);
return false;
}
}
@ -409,7 +509,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
// Do some sanity checks on the coordinates.
if (x < -16383 || x > 16383 || y < -16383 || y > 16383)
{
va_end(tags);
ListEnd(tags);
return false;
}
@ -451,44 +551,42 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
// doubles when passed as function arguments.)
while (tag != TAG_DONE)
{
DWORD data;
switch (tag)
{
default:
data = va_arg(tags, DWORD);
ListGetInt(tags);
break;
case DTA_DestWidth:
assert(fortext == false);
if (fortext) return false;
parms->cleanmode = DTA_Base;
parms->destwidth = va_arg(tags, int);
parms->destwidth = ListGetInt(tags);
break;
case DTA_DestWidthF:
assert(fortext == false);
if (fortext) return false;
parms->cleanmode = DTA_Base;
parms->destwidth = va_arg(tags, double);
parms->destwidth = ListGetDouble(tags);
break;
case DTA_DestHeight:
assert(fortext == false);
if (fortext) return false;
parms->cleanmode = DTA_Base;
parms->destheight = va_arg(tags, int);
parms->destheight = ListGetInt(tags);
break;
case DTA_DestHeightF:
assert(fortext == false);
if (fortext) return false;
parms->cleanmode = DTA_Base;
parms->destheight = va_arg(tags, double);
parms->destheight = ListGetDouble(tags);
break;
case DTA_Clean:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->scalex = 1;
@ -498,7 +596,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_CleanNoMove:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->scalex = CleanXfac;
@ -508,7 +606,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_CleanNoMove_1:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->scalex = CleanXfac_1;
@ -518,7 +616,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_320x200:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->cleanmode = DTA_Base;
@ -530,7 +628,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_Bottom320x200:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->cleanmode = DTA_Base;
@ -543,32 +641,32 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_HUDRules:
intval = va_arg(tags, int);
intval = ListGetInt(tags);
parms->cleanmode = intval == HUD_HorizCenter ? DTA_HUDRulesC : DTA_HUDRules;
break;
case DTA_VirtualWidth:
parms->cleanmode = DTA_Base;
parms->virtWidth = va_arg(tags, int);
parms->virtWidth = ListGetInt(tags);
break;
case DTA_VirtualWidthF:
parms->cleanmode = DTA_Base;
parms->virtWidth = va_arg(tags, double);
parms->virtWidth = ListGetDouble(tags);
break;
case DTA_VirtualHeight:
parms->cleanmode = DTA_Base;
parms->virtHeight = va_arg(tags, int);
parms->virtHeight = ListGetInt(tags);
break;
case DTA_VirtualHeightF:
parms->cleanmode = DTA_Base;
parms->virtHeight = va_arg(tags, double);
parms->virtHeight = ListGetDouble(tags);
break;
case DTA_Fullscreen:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
assert(fortext == false);
@ -580,66 +678,58 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_Alpha:
parms->Alpha = FIXED2FLOAT(MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t)));
break;
case DTA_AlphaF:
parms->Alpha = (float)(MIN<double>(1., va_arg(tags, double)));
parms->Alpha = (float)(MIN<double>(1., ListGetDouble(tags)));
break;
case DTA_AlphaChannel:
parms->alphaChannel = va_arg(tags, INTBOOL);
parms->alphaChannel = ListGetInt(tags);
break;
case DTA_FillColor:
parms->fillcolor = va_arg(tags, uint32);
parms->fillcolor = ListGetInt(tags);
fillcolorset = true;
break;
case DTA_Translation:
parms->remap = va_arg(tags, FRemapTable *);
if (parms->remap != NULL && parms->remap->Inactive)
{ // If it's inactive, pretend we were passed NULL instead.
parms->remap = NULL;
}
case DTA_TranslationIndex:
parms->remap = TranslationToTable(ListGetInt(tags));
break;
case DTA_ColorOverlay:
parms->colorOverlay = va_arg(tags, DWORD);
parms->colorOverlay = ListGetInt(tags);
break;
case DTA_FlipX:
parms->flipX = va_arg(tags, INTBOOL);
parms->flipX = ListGetInt(tags);
break;
case DTA_TopOffset:
assert(fortext == false);
if (fortext) return false;
parms->top = va_arg(tags, int);
parms->top = ListGetInt(tags);
break;
case DTA_TopOffsetF:
assert(fortext == false);
if (fortext) return false;
parms->top = va_arg(tags, double);
parms->top = ListGetDouble(tags);
break;
case DTA_LeftOffset:
assert(fortext == false);
if (fortext) return false;
parms->left = va_arg(tags, int);
parms->left = ListGetInt(tags);
break;
case DTA_LeftOffsetF:
assert(fortext == false);
if (fortext) return false;
parms->left = va_arg(tags, double);
parms->left = ListGetDouble(tags);
break;
case DTA_CenterOffset:
assert(fortext == false);
if (fortext) return false;
if (va_arg(tags, int))
if (ListGetInt(tags))
{
parms->left = img->GetScaledWidthDouble() * 0.5;
parms->top = img->GetScaledHeightDouble() * 0.5;
@ -649,7 +739,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
case DTA_CenterBottomOffset:
assert(fortext == false);
if (fortext) return false;
if (va_arg(tags, int))
if (ListGetInt(tags))
{
parms->left = img->GetScaledWidthDouble() * 0.5;
parms->top = img->GetScaledHeightDouble();
@ -659,29 +749,29 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
case DTA_WindowLeft:
assert(fortext == false);
if (fortext) return false;
parms->windowleft = va_arg(tags, int);
parms->windowleft = ListGetInt(tags);
break;
case DTA_WindowLeftF:
assert(fortext == false);
if (fortext) return false;
parms->windowleft = va_arg(tags, double);
parms->windowleft = ListGetDouble(tags);
break;
case DTA_WindowRight:
assert(fortext == false);
if (fortext) return false;
parms->windowright = va_arg(tags, int);
parms->windowright = ListGetInt(tags);
break;
case DTA_WindowRightF:
assert(fortext == false);
if (fortext) return false;
parms->windowright = va_arg(tags, double);
parms->windowright = ListGetDouble(tags);
break;
case DTA_ClipTop:
parms->uclip = va_arg(tags, int);
parms->uclip = ListGetInt(tags);
if (parms->uclip < 0)
{
parms->uclip = 0;
@ -689,7 +779,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_ClipBottom:
parms->dclip = va_arg(tags, int);
parms->dclip = ListGetInt(tags);
if (parms->dclip > this->GetHeight())
{
parms->dclip = this->GetHeight();
@ -697,7 +787,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_ClipLeft:
parms->lclip = va_arg(tags, int);
parms->lclip = ListGetInt(tags);
if (parms->lclip < 0)
{
parms->lclip = 0;
@ -705,7 +795,7 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_ClipRight:
parms->rclip = va_arg(tags, int);
parms->rclip = ListGetInt(tags);
if (parms->rclip > this->GetWidth())
{
parms->rclip = this->GetWidth();
@ -713,18 +803,18 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_ShadowAlpha:
parms->shadowAlpha = MIN<fixed_t>(OPAQUE, va_arg (tags, fixed_t));
parms->shadowAlpha = (float)MIN(1., ListGetDouble(tags));
break;
case DTA_ShadowColor:
parms->shadowColor = va_arg(tags, int);
parms->shadowColor = ListGetInt(tags);
break;
case DTA_Shadow:
boolval = va_arg(tags, INTBOOL);
boolval = ListGetInt(tags);
if (boolval)
{
parms->shadowAlpha = FRACUNIT/2;
parms->shadowAlpha = 0.5;
parms->shadowColor = 0;
}
else
@ -734,47 +824,52 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
break;
case DTA_Masked:
parms->masked = va_arg(tags, INTBOOL);
parms->masked = ListGetInt(tags);
break;
case DTA_BilinearFilter:
parms->bilinear = va_arg(tags, INTBOOL);
parms->bilinear = ListGetInt(tags);
break;
case DTA_KeepRatio:
// I think this is a terribly misleading name, since it actually turns
// *off* aspect ratio correction.
parms->keepratio = va_arg(tags, INTBOOL);
parms->keepratio = ListGetInt(tags);
break;
case DTA_RenderStyle:
parms->style.AsDWORD = va_arg(tags, DWORD);
parms->style.AsDWORD = ListGetInt(tags);
break;
case DTA_SpecialColormap:
parms->specialcolormap = va_arg(tags, FSpecialColormap *);
parms->specialcolormap = ListGetSpecialColormap(tags);
break;
case DTA_ColormapStyle:
parms->colormapstyle = va_arg(tags, FColormapStyle *);
parms->colormapstyle = ListGetColormapStyle(tags);
break;
case DTA_TextLen:
parms->maxstrlen = va_arg(tags, int);
parms->maxstrlen = ListGetInt(tags);
break;
case DTA_CellX:
parms->cellx = va_arg(tags, int);
parms->cellx = ListGetInt(tags);
break;
case DTA_CellY:
parms->celly = va_arg(tags, int);
parms->celly = ListGetInt(tags);
break;
}
tag = va_arg(tags, DWORD);
tag = ListGetInt(tags);
}
ListEnd(tags);
if (parms->remap != nullptr && parms->remap->Inactive)
{ // If it's inactive, pretend we were passed NULL instead.
parms->remap = nullptr;
}
va_end (tags);
if (parms->uclip >= parms->dclip || parms->lclip >= parms->rclip)
{
@ -819,6 +914,10 @@ bool DCanvas::ParseDrawTextureTags (FTexture *img, double x, double y, DWORD tag
}
return true;
}
// explicitly instantiate both versions for v_text.cpp.
template bool DCanvas::ParseDrawTextureTags<va_list>(FTexture *img, double x, double y, DWORD tag, va_list& tags, DrawParms *parms, bool fortext) const;
template bool DCanvas::ParseDrawTextureTags<VMVa_List>(FTexture *img, double x, double y, DWORD tag, VMVa_List& tags, DrawParms *parms, bool fortext) const;
void DCanvas::VirtualToRealCoords(double &x, double &y, double &w, double &h,
double vwidth, double vheight, bool vbottom, bool handleaspect) const

View file

@ -525,6 +525,13 @@ FFont *FFont::FindFont (const char *name)
return font;
}
DEFINE_ACTION_FUNCTION(FFont, FindFont)
{
PARAM_PROLOGUE;
PARAM_STRING(name);
ACTION_RETURN_POINTER(FFont::FindFont(name));
}
//==========================================================================
//
// RecordTextureColors

View file

@ -66,7 +66,8 @@ enum EColorRange
CR_PURPLE,
CR_DARKGRAY,
CR_CYAN,
NUM_TEXT_COLORS
NUM_TEXT_COLORS,
FORCE_DWORD = 0x7fffffff // required for script access.
};
extern int NumTextColors;

View file

@ -52,7 +52,7 @@
//
// Write a single character using the given font
//
void DCanvas::DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...)
void DCanvas::DrawChar (FFont *font, int normalcolor, double x, double y, int character, int tag_first, ...)
{
if (font == NULL)
return;

View file

@ -75,9 +75,8 @@ enum
DTA_DestWidth, // width of area to draw to
DTA_DestHeight, // height of area to draw to
DTA_Alpha, // alpha value for translucency
DTA_AlphaF, // alpha value for translucency
DTA_FillColor, // color to stencil onto the destination (RGB is the color for truecolor drawers, A is the palette index for paletted drawers)
DTA_Translation, // translation table to recolor the source
DTA_TranslationIndex, // translation table to recolor the source
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
DTA_320x200, // bool: scale texture size and position to fit on a virtual 320x200 screen
@ -163,7 +162,7 @@ struct DrawParms
uint32 colorOverlay;
INTBOOL alphaChannel;
INTBOOL flipX;
fixed_t shadowAlpha;
float shadowAlpha;
int shadowColor;
INTBOOL keepratio;
INTBOOL masked;
@ -178,6 +177,12 @@ struct DrawParms
bool virtBottom;
};
struct VMVa_List
{
VMValue *args;
int curindex;
int numargs;
};
//
// VIDEO
//
@ -253,6 +258,7 @@ public:
// 2D Texture drawing
bool SetTextureParms(DrawParms *parms, FTexture *img, double x, double y) const;
void DrawTexture (FTexture *img, double x, double y, int tags, ...);
void DrawTexture(FTexture *img, double x, double y, VMVa_List &);
void FillBorder (FTexture *img); // Fills the border around a 4:3 part of the screen on non-4:3 displays
void VirtualToRealCoords(double &x, double &y, double &w, double &h, double vwidth, double vheight, bool vbottom=false, bool handleaspect=true) const;
@ -265,7 +271,7 @@ public:
#endif
// 2D Text drawing
void DrawText (FFont *font, int normalcolor, int x, int y, const char *string, int tag_first, ...);
void DrawChar (FFont *font, int normalcolor, int x, int y, BYTE character, int tag_first, ...);
void DrawChar (FFont *font, int normalcolor, double x, double y, int character, int tag_first, ...);
protected:
BYTE *Buffer;
@ -278,7 +284,9 @@ protected:
bool ClipBox (int &left, int &top, int &width, int &height, const BYTE *&src, const int srcpitch) const;
void DrawTextureV(FTexture *img, double x, double y, uint32 tag, va_list tags) = delete;
virtual void DrawTextureParms(FTexture *img, DrawParms &parms);
bool ParseDrawTextureTags (FTexture *img, double x, double y, uint32 tag, va_list tags, DrawParms *parms, bool fortext) const;
template<class T>
bool ParseDrawTextureTags(FTexture *img, double x, double y, DWORD tag, T& tags, DrawParms *parms, bool fortext) const;
DCanvas() {}

View file

@ -722,10 +722,10 @@ void WI_drawBackground()
static int WI_DrawCharPatch (FFont *font, int charcode, int x, int y, EColorRange translation=CR_UNTRANSLATED, bool nomove=false)
{
int width;
screen->DrawTexture(font->GetChar(charcode, &width), x, y,
font->GetChar(charcode, &width);
screen->DrawChar(font, translation, x, y, charcode,
nomove ? DTA_CleanNoMove : DTA_Clean, true,
DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : OPAQUE/2,
DTA_Translation, font->GetColorTranslation(translation),
DTA_ShadowAlpha, (gameinfo.gametype & GAME_DoomChex) ? 0 : 0.5,
TAG_DONE);
return x - width;
}

View file

@ -6,6 +6,9 @@
#include "zscript/actor.txt"
#include "zscript/actor_checks.txt"
#include "zscript/menu/menu.txt"
#include "zscript/menu/menuitembase.txt"
#include "zscript/inventory/inventory.txt"
#include "zscript/inventory/inv_misc.txt"
#include "zscript/inventory/stateprovider.txt"

View file

@ -34,9 +34,45 @@ struct TexMan
struct Screen native
{
enum EColorRange
{
CR_UNDEFINED = -1,
CR_BRICK,
CR_TAN,
CR_GRAY,
CR_GREY = CR_GRAY,
CR_GREEN,
CR_BROWN,
CR_GOLD,
CR_RED,
CR_BLUE,
CR_ORANGE,
CR_WHITE,
CR_YELLOW,
CR_UNTRANSLATED,
CR_BLACK,
CR_LIGHTBLUE,
CR_CREAM,
CR_OLIVE,
CR_DARKGREEN,
CR_DARKRED,
CR_DARKBROWN,
CR_PURPLE,
CR_DARKGRAY,
CR_CYAN,
NUM_TEXT_COLORS
};
native static int GetWidth();
native static int GetHeight();
native static void DrawHUDTexture(TextureID tex, double x, double y);
}
struct Font native
{
native static Font FindFont(String name);
}
struct Console native
{
native static void HideConsole();

View file

@ -40,7 +40,7 @@ extend class Actor
void AdjustPlayerAngle(FTranslatedLineTarget t)
{
double difference = t.angleFromSource;
double difference = deltaangle(angle, t.angleFromSource);
if (abs(difference) > MAX_ANGLE_ADJUST)
{
if (difference > 0)

View file

@ -0,0 +1,17 @@
class Menu : Object native
{
//native static int MenuTime();
}
struct FOptionMenuSettings
{
int mTitleColor;
int mFontColor;
int mFontColorValue;
int mFontColorMore;
int mFontColorHeader;
int mFontColorHighlight;
int mFontColorSelection;
int mLinespacing;
}

View file

@ -0,0 +1,66 @@
//=============================================================================
//
// base class for menu items
//
//=============================================================================
class MenuItemBase : Object native
{
protected int mXpos, mYpos;
protected Name mAction;
bool mEnabled;
protected void Init(int xpos = 0, int ypos = 0, Name actionname = 'None')
{
mXpos = xpos;
mYpos = ypos;
mAction = actionname;
mEnabled = true;
}
virtual bool CheckCoordinate(int x, int y) { return false; }
virtual void Ticker() {}
virtual void Drawer(bool selected) {}
virtual bool Selectable() {return false; }
virtual bool Activate() { return false; }
virtual Name, int GetAction() { return mAction, 0; }
virtual bool SetString(int i, String s) { return false; }
virtual bool, String GetString(int i) { return false, ""; }
virtual bool SetValue(int i, int value) { return false; }
virtual bool, int GetValue(int i) { return false, 0; }
virtual void Enable(bool on) { mEnabled = on; }
virtual bool MenuEvent (int mkey, bool fromcontroller) { return false; }
virtual bool MouseEvent(int type, int x, int y) { return false; }
virtual bool CheckHotkey(int c) { return false; }
virtual int GetWidth() { return 0; }
virtual void OffsetPositionY(int ydelta) { mYpos += ydelta; }
virtual int GetY() { return mYpos; }
virtual int GetX() { return mXpos; }
virtual void SetX(int x) { mXpos = x; }
/*
virtual void DrawSelector(int xofs, int yofs, TextureID tex)
{
if (tex.isNull())
{
if ((Menu.MenuTime() % 8) < 6)
{
screen.DrawText(ConFont, OptionSettings.mFontColorSelection,
(mXpos + xofs - 160) * CleanXfac + screen.GetWidth() / 2,
(mYpos + yofs - 100) * CleanYfac + screen.GetHeight() / 2,
"\xd",
DTA_CellX, 8 * CleanXfac,
DTA_CellY, 8 * CleanYfac,
TAG_DONE);
}
}
else
{
screen.DrawTexture (tex, mXpos + xofs, mYpos + yofs, DTA_Clean, true, TAG_DONE);
}
}
*/
}