- fixed SW status bar.

This commit is contained in:
Christoph Oelckers 2021-05-16 10:25:56 +02:00
parent 8d8b3cda46
commit 83f151529b
5 changed files with 28 additions and 15 deletions

View file

@ -531,9 +531,9 @@ void GameInterface::LevelCompleted(MapRecord* map, int skill)
SummaryInfo info{}; SummaryInfo info{};
info.kills = Player->Kills; info.kills = Player[screenpeek].Kills;
info.maxkills = TotalKillable; info.maxkills = TotalKillable;
info.secrets = Player->SecretsFound; info.secrets = Player[screenpeek].SecretsFound;
info.maxsecrets = LevelSecrets; info.maxsecrets = LevelSecrets;
info.time = PlayClock / 120; info.time = PlayClock / 120;

View file

@ -245,8 +245,8 @@ x(PANEL_SM_FONT_G6, 3607)
x(PANEL_SM_FONT_G7, 3608) x(PANEL_SM_FONT_G7, 3608)
x(PANEL_SM_FONT_G8, 3609) x(PANEL_SM_FONT_G8, 3609)
x(PANEL_SM_FONT_G9, 3610) x(PANEL_SM_FONT_G9, 3610)
x(PANEL_SM_FONT_G10, 3611) x(PANEL_SM_FONT_G10, 3600)
x(PANEL_SM_FONT_G11, 3612) x(PANEL_SM_FONT_G11, 3611)
x(PANEL_SM_FONT_Y0, 3613) x(PANEL_SM_FONT_Y0, 3613)
x(PANEL_SM_FONT_Y1, 3614) x(PANEL_SM_FONT_Y1, 3614)
x(PANEL_SM_FONT_Y2, 3615) x(PANEL_SM_FONT_Y2, 3615)
@ -257,8 +257,8 @@ x(PANEL_SM_FONT_Y6, 3619)
x(PANEL_SM_FONT_Y7, 3620) x(PANEL_SM_FONT_Y7, 3620)
x(PANEL_SM_FONT_Y8, 3621) x(PANEL_SM_FONT_Y8, 3621)
x(PANEL_SM_FONT_Y9, 3622) x(PANEL_SM_FONT_Y9, 3622)
x(PANEL_SM_FONT_Y10, 3623) x(PANEL_SM_FONT_Y10, 3612)
x(PANEL_SM_FONT_Y11, 3624) x(PANEL_SM_FONT_Y11, 3623)
x(PANEL_SM_FONT_R0, 3625) x(PANEL_SM_FONT_R0, 3625)
x(PANEL_SM_FONT_R1, 3626) x(PANEL_SM_FONT_R1, 3626)
x(PANEL_SM_FONT_R2, 3627) x(PANEL_SM_FONT_R2, 3627)
@ -269,8 +269,8 @@ x(PANEL_SM_FONT_R6, 3631)
x(PANEL_SM_FONT_R7, 3632) x(PANEL_SM_FONT_R7, 3632)
x(PANEL_SM_FONT_R8, 3633) x(PANEL_SM_FONT_R8, 3633)
x(PANEL_SM_FONT_R9, 3634) x(PANEL_SM_FONT_R9, 3634)
x(PANEL_SM_FONT_R10, 3635) x(PANEL_SM_FONT_R10, 3624)
x(PANEL_SM_FONT_R11, 3636) x(PANEL_SM_FONT_R11, 3635)
x(PANEL_KEY_RED, 2392) x(PANEL_KEY_RED, 2392)
x(PANEL_KEY_GREEN, 2393) x(PANEL_KEY_GREEN, 2393)
x(PANEL_KEY_BLUE, 2394) x(PANEL_KEY_BLUE, 2394)

View file

@ -7765,7 +7765,8 @@ DEFINE_ACTION_FUNCTION(_SW, RealWeapon)
{ {
PARAM_PROLOGUE; PARAM_PROLOGUE;
PARAM_INT(inv); PARAM_INT(inv);
ACTION_RETURN_INT(DamageData[inv].with_weapon); int w = DamageData[inv].with_weapon;
ACTION_RETURN_INT(w == -1? inv : w);
} }
END_SW_NS END_SW_NS

View file

@ -152,6 +152,8 @@ public:
{ {
numberFont = Create<DHUDFont>( BigFont, 0, Off, 1, 1 ); numberFont = Create<DHUDFont>( BigFont, 0, Off, 1, 1 );
miniFont = Create<DHUDFont>(SmallFont2, 0, Off, 1, 1 ); miniFont = Create<DHUDFont>(SmallFont2, 0, Off, 1, 1 );
numberFont->Release();
miniFont->Release();
} }
private: private:
@ -1088,7 +1090,16 @@ void UpdateStatusBar()
UpdateFrame(); UpdateFrame();
} }
StatusBar->UpdateStatusBar(); SummaryInfo info{};
info.kills = Player[screenpeek].Kills;
info.maxkills = TotalKillable;
info.secrets = Player[screenpeek].SecretsFound;
info.maxsecrets = LevelSecrets;
info.time = Scale(PlayClock, 1000, 120);
::UpdateStatusBar(&info);
PLAYERp pp = &Player[screenpeek]; PLAYERp pp = &Player[screenpeek];
if (pp->cookieTime > 0) if (pp->cookieTime > 0)
{ {

View file

@ -152,14 +152,15 @@ class SWStatusBar : RazeStatusBar
{ {
let ch = buffer.ByteAt(i); let ch = buffer.ByteAt(i);
if (ch == " ") if (ch == "/") ch = 10;
else if (ch == ":") ch = 11;
else if (ch >= "0" && ch <= "9") ch -= 48;
else
{ {
if (ch != " ") Console.Printf("Invalid char %c", ch);
x += 4; x += 4;
continue; continue;
} }
else if (ch == 0x5c) ch = 0;
else if (ch == ":") ch = 11;
else ch -= 47;
let font_pic = SmallSBFont[color][ch]; let font_pic = SmallSBFont[color][ch];
DrawTexture(font_pic, (x, y), DI_ITEM_LEFT_TOP, col:Raze.shadeToLight(shade)); DrawTexture(font_pic, (x, y), DI_ITEM_LEFT_TOP, col:Raze.shadeToLight(shade));
@ -375,7 +376,7 @@ class SWStatusBar : RazeStatusBar
"PANEL_SKELKEY_RED" "PANEL_SKELKEY_RED"
}; };
let tex = TexMan.CheckForTexture("PANEL_KEY_RED", TexMan.Type_Any); let tex = TexMan.CheckForTexture("PANEL_KEY_RED", TexMan.Type_Any);
let size = TexMan.GetScaledSize(tex); let size = TexMan.GetScaledSize(tex) + (1, 2);
i = 0; i = 0;
for (row = 0; row < 2; row++) for (row = 0; row < 2; row++)