33 Commits

Author SHA1 Message Date
Muzychenko Andrey
c7f5f8cd30 Merge from master: fixed bug with mission accept scores.
Ref issue #81.
2021-11-04 18:49:49 +03:00
Muzychenko Andrey
da4b99e983 Added Unicode support in high score dialog.
Cherry picked form ecea9c812a.
2021-11-03 12:53:04 +03:00
Muzychenko Andrey
2abcaac437 Added Turkish translation.
This is the last WinXP language, for a total of 24.
2021-11-02 15:33:22 +03:00
Muzychenko Andrey
98da410251 Added Swedish translation. 2021-11-02 14:24:47 +03:00
Muzychenko Andrey
e020c0fe33 Added Portuguese translation. 2021-11-02 14:04:25 +03:00
Muzychenko Andrey
33b8b29f11 Added Norwegian translation. 2021-11-01 12:21:50 +03:00
Muzychenko Andrey
84a46082ab Added Dutch translation. 2021-11-01 11:09:13 +03:00
Muzychenko Andrey
a079117507 Added Korean translation. 2021-10-31 18:29:41 +03:00
Muzychenko Andrey
620ec011ec Added Spanish translation. 2021-10-31 17:35:41 +03:00
Muzychenko Andrey
1af8bb67d7 Added Greek translation. 2021-10-31 17:25:24 +03:00
Muzychenko Andrey
089ccbf549 Added Arabic translation. 2021-10-31 17:03:32 +03:00
Muzychenko Andrey
1428fb3770 Added Hebrew translation.
Switched to MessageBoxW in some places.
2021-10-31 13:18:21 +03:00
Muzychenko Andrey
1c1fbcb811 TTextBox: fixed DrawText texts getting overwritten by full redraw.
This bug is from the original 3DPB.
2021-10-30 18:25:49 +03:00
Muzychenko Andrey
c0ec8ec932 Added Finnish translation. 2021-10-30 16:50:49 +03:00
Muzychenko Andrey
71e25fd7fa Merge from master: control bugfix, no delay FT THole. 2021-10-30 16:21:01 +03:00
Muzychenko Andrey
b40b54ce51 Updated plans 2021-10-30 12:54:30 +03:00
Muzychenko Andrey
b4a85bcf2f Added Danish translation. 2021-10-29 17:40:02 +03:00
Muzychenko Andrey
acc2725bbe Added Czech translation. 2021-10-29 17:33:09 +03:00
Muzychenko Andrey
68c2055ce6 Added Brazilian Portuguese translation. 2021-10-29 17:25:26 +03:00
Muzychenko Andrey
09668f3468 Added Hungarian translation.
Disabled bitmap font in Italian translation.
2021-10-29 10:47:17 +03:00
Muzychenko Andrey
4878b6a835 Added Italian translation. 2021-10-28 18:17:36 +03:00
Muzychenko Andrey
bd606436bd Added French translation. 2021-10-28 11:41:30 +03:00
Raymai (Chee Boon)
457a982f72 Change only a few key places to make the program works as if it's Unicode build. (#75) 2021-10-28 10:58:19 +03:00
Muzychenko Andrey
e2f10333d9 Added Japanese translation. 2021-10-28 09:56:14 +03:00
Muzychenko Andrey
356977290e Added German translation. 2021-10-28 08:56:49 +03:00
Muzychenko Andrey
a65c40fe32 Added incomplete Polish translation.
Removed unused dialogs.
Fixed char sprintf in control.
Ref #28.
2021-10-27 09:22:53 +03:00
Muzychenko Andrey
d0c1ac60b6 TTextBox: converted to accept wchar input.
Ref #69.
2021-10-26 08:12:37 +03:00
Lim Chunwei
3c2fff9d07 Use a single Unicode charset and specify language-specific font for better viewing (?) (#69)
* Use a single Unicode charset and specify language-specific font for better (?) viewing

* Fix missing include for strcpy_s function

* Better (?) implementation of using strings (so that font names aren't limited to 30 chars)
2021-10-26 06:53:52 +03:00
Muzychenko Andrey
09c62f5909 Fixed mixed up Chinese language texts. 2021-10-25 17:40:38 +03:00
Muzychenko Andrey
cf215aaa6a Added Traditional Chinese and Simplified Chinese languages to options.
They don’t work without Chinese locale.
Ref #68.
2021-10-25 17:30:39 +03:00
Lim Chunwei
893d898d0a Simplified Chinese and Traditional Chinese translations (#68) 2021-10-25 14:10:47 +03:00
Muzychenko Andrey
502fc71afc Added experimental translation support.
Added Russian translation.
Ref issues #28, #56.
2021-10-24 18:23:46 +03:00
Muzychenko Andrey
cf8b53de01 Added scaling support in grtext_draw_ttext_in_box.
Issue #56.
2021-10-21 16:47:45 +03:00
22 changed files with 675 additions and 421 deletions

View File

@@ -27,10 +27,9 @@ Compile with Visual Studio; tested with 2017 and 2019.
* ~~Decompile original game~~
* ~~Resizable window, scaled graphics~~
* ~~Loader for high-res sprites from CADET.DAT~~
* Misc features of Full Tilt: 3 music tracs, multiball, centered textboxes, etc.
* Maybe: cross-platform port
* Needs UI framework with menu bar and dialog windows, like QT or Avalonia
* Needs a way play sounds and midi
* ~~Cross-platform port using SDL2, SDL2_mixer, ImGui~~
* Text translations
* Misc features of Full Tilt: 3 music tracks, multiball, centered textboxes, etc.
* Maybe x2: support for other two tables
* Table specific BL (control interactions and missions) is hardcoded, othere parts might be also patched

View File

@@ -49,7 +49,7 @@ int Sound::Init(HINSTANCE hInstance, int voices, void (* someFuncPtr)(int, MIXWA
{
/*FT does not have the file, defaults work OK*/
if (!pb::FullTiltMode)
MessageBoxA(winmain::hwnd_frame, pinball::get_rc_string(42, 0), "", 0x2000u);
MessageBoxW(winmain::hwnd_frame, pinball::get_rc_Wstring(42, 0), L"", 0x2000u);
}
WndClass.style = 0;

View File

@@ -82,7 +82,11 @@ void THole::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
ball->Position.X = Circle.Center.X;
ball->Position.Y = Circle.Center.Y;
ball->Acceleration.Z = 0.0;
Timer = timer::set(0.5f, this, TimerExpired);
// Ramp hole has no delay in FT.
auto captureTime = pb::FullTiltMode ? 0 : 0.5f;
Timer = timer::set(captureTime, this, TimerExpired);
if (!PinballTable->TiltLockFlag)
{
loader::play_sound(HardHitSoundId);

View File

@@ -303,7 +303,7 @@ void TPinballTable::tilt(float time)
{
pinball::InfoTextBox->Clear();
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(35, 0), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_Wstring(35, 0), -1.0);
loader::play_sound(SoundIndex3);
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
@@ -328,7 +328,7 @@ void TPinballTable::port_draw()
int TPinballTable::Message(int code, float value)
{
LPSTR rc_text;
LPWSTR rc_text;
switch (code)
{
case 1000:
@@ -382,9 +382,9 @@ int TPinballTable::Message(int code, float value)
LightGroup->Message(20, 0.0);
Plunger->Message(1016, 0.0);
if (Demo->ActiveFlag)
rc_text = pinball::get_rc_string(30, 0);
rc_text = pinball::get_rc_Wstring(30, 0);
else
rc_text = pinball::get_rc_string(26, 0);
rc_text = pinball::get_rc_Wstring(26, 0);
pinball::InfoTextBox->Display(rc_text, -1.0);
if (Demo)
Demo->Message(1014, 0.0);
@@ -477,11 +477,11 @@ int TPinballTable::Message(int code, float value)
{
if (PlayerCount <= 1)
{
char* textboxText;
wchar_t* textboxText;
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(30, 0);
textboxText = pinball::get_rc_Wstring(30, 0);
else
textboxText = pinball::get_rc_string(26, 0);
textboxText = pinball::get_rc_Wstring(26, 0);
pinball::InfoTextBox->Display(textboxText, -1.0);
break;
}
@@ -518,32 +518,32 @@ int TPinballTable::Message(int code, float value)
ComponentList->Get(i)->Message(1020, static_cast<float>(nextPlayer));
}
char* textboxText = nullptr;
wchar_t* textboxText = nullptr;
switch (nextPlayer)
{
case 0:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(30, 0);
textboxText = pinball::get_rc_Wstring(30, 0);
else
textboxText = pinball::get_rc_string(26, 0);
textboxText = pinball::get_rc_Wstring(26, 0);
break;
case 1:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(31, 0);
textboxText = pinball::get_rc_Wstring(31, 0);
else
textboxText = pinball::get_rc_string(27, 0);
textboxText = pinball::get_rc_Wstring(27, 0);
break;
case 2:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(32, 0);
textboxText = pinball::get_rc_Wstring(32, 0);
else
textboxText = pinball::get_rc_string(28, 0);
textboxText = pinball::get_rc_Wstring(28, 0);
break;
case 3:
if (Demo->ActiveFlag)
textboxText = pinball::get_rc_string(33, 0);
textboxText = pinball::get_rc_Wstring(33, 0);
else
textboxText = pinball::get_rc_string(29, 0);
textboxText = pinball::get_rc_Wstring(29, 0);
break;
default:
break;
@@ -560,7 +560,7 @@ int TPinballTable::Message(int code, float value)
case 1022:
loader::play_sound(SoundIndex2);
pinball::MissTextBox->Clear();
pinball::InfoTextBox->Display(pinball::get_rc_string(34, 0), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_Wstring(34, 0), -1.0);
EndGameTimeoutTimer = timer::set(3.0, this, EndGame_timeout);
break;
case 1024:
@@ -615,7 +615,7 @@ void TPinballTable::EndGame_timeout(int timerId, void* caller)
if (table->Demo)
table->Demo->Message(1022, 0.0);
control::handler(67, pinball::MissTextBox);
pinball::InfoTextBox->Display(pinball::get_rc_string(24, 0), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_Wstring(24, 0), -1.0);
}
void TPinballTable::LightShow_timeout(int timerId, void* caller)

View File

@@ -109,12 +109,12 @@ void TTextBox::Clear()
}
}
void TTextBox::Display(const char* text, float time)
void TTextBox::Display(const wchar_t* text, float time)
{
if (!text)
return;
if (Message1 && !strcmp(text, Message2->Text))
if (Message1 && !lstrcmpW(text, Message2->Text))
{
Message2->Refresh(time);
if (Message2 == Message1)
@@ -153,7 +153,7 @@ void TTextBox::Display(const char* text, float time)
}
}
void TTextBox::Draw()
void TTextBox::Draw(bool redraw)
{
auto bmp = BgBmp;
if (bmp)
@@ -172,6 +172,12 @@ void TTextBox::Draw()
bool display = false;
while (Message1)
{
if (redraw)
{
display = true;
break;
}
if (Message1->Time == -1.0f)
{
if (!Message1->NextMessage)
@@ -183,6 +189,8 @@ void TTextBox::Draw()
}
else if (Message1->TimeLeft() >= -2.0f)
{
if (Timer > 0)
timer::kill(Timer);
Timer = timer::set(max(Message1->TimeLeft(), 0.25f), this, TimerExpired);
display = true;
break;
@@ -211,8 +219,7 @@ void TTextBox::Draw()
render::vscreen.XPosition + OffsetX,
render::vscreen.YPosition + OffsetY,
Width,
Height,
255);
Height);
return;
}
@@ -224,7 +231,7 @@ void TTextBox::Draw()
break;
auto totalWidth = 0;
char* textEndSpace = nullptr;
wchar_t* textEndSpace = nullptr;
auto textEnd = text;
while (true)
{

View File

@@ -21,8 +21,8 @@ public:
~TTextBox() override;
int Message(int code, float value) override;
void Clear();
void Display(const char* text, float time);
void Draw();
void Display(const wchar_t* text, float time);
void Draw(bool redraw = false);
static void TimerExpired(int timerId, void* tb);
};

View File

@@ -3,17 +3,17 @@
#include "memory.h"
#include "pb.h"
TTextBoxMessage::TTextBoxMessage(const char* text, float time)
TTextBoxMessage::TTextBoxMessage(const wchar_t* text, float time)
{
NextMessage = nullptr;
Time = time;
EndTicks = pb::time_ticks + static_cast<int>(time * 1000.0f);
if (text)
{
const auto textLen = strlen(text) + 1;
Text = memory::allocate(textLen);
const auto textLen = lstrlenW(text) + 1;
Text = memory::allocate<wchar_t>(textLen);
if (Text)
strcpy_s(Text, textLen, text);
lstrcpynW(Text, text, textLen);
}
else
Text = nullptr;

View File

@@ -3,11 +3,11 @@ class TTextBoxMessage
{
public:
TTextBoxMessage* NextMessage;
char* Text;
wchar_t* Text;
float Time;
int EndTicks;
TTextBoxMessage(const char* text, float time);
TTextBoxMessage(const wchar_t* text, float time);
~TTextBoxMessage();
float TimeLeft() const;
void Refresh(float time);

File diff suppressed because it is too large Load Diff

View File

@@ -377,7 +377,7 @@ void fullscrn::paint()
fillRect(WindowRect1.right, menuHeight + WindowRect1.bottom, 0, 0);
}
}
render::paint();
pb::paint();
fullscrn_flag1 = 0;
}

View File

@@ -3,6 +3,7 @@
#include "fullscrn.h"
#include "memory.h"
#include "options.h"
#include "pinball.h"
#include "winmain.h"
@@ -287,7 +288,7 @@ void gdrv::end_blit_sequence()
ReleaseDC(hwnd, sequence_hdc);
}
void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest, int DestWidth, int DestHeight)
void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrc, int xDest, int yDest, int DestWidth, int DestHeight)
{
HDC dc = winmain::_GetDC(hwnd);
SetStretchBltMode(dc, stretchMode);
@@ -303,7 +304,7 @@ void gdrv::blit(gdrv_bitmap8* bmp, int xSrc, int ySrcOff, int xDest, int yDest,
DestWidth,
DestHeight,
xSrc,
bmp->Height - ySrcOff - DestHeight,
bmp->Height - ySrc - DestHeight,
DestWidth,
DestHeight,
bmp,
@@ -413,11 +414,24 @@ void gdrv::copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int heigh
}
void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6)
void gdrv::grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width, int height)
{
tagRECT rc{};
// Original font was 16 points, used with lowest table resolution
static const int fontSizes[3] =
{
16,
22,
28
};
xOff = static_cast<int>(xOff * fullscrn::ScaleX) + fullscrn::OffsetX;
yOff = static_cast<int>(yOff * fullscrn::ScaleY) + fullscrn::OffsetY;
width = static_cast<int>(width * fullscrn::ScaleX);
height = static_cast<int>(height * fullscrn::ScaleY);
auto fontSize = static_cast<int>(round(fontSizes[fullscrn::GetResolution()] * fullscrn::ScaleY));
HDC dc = GetDC(hwnd);
tagRECT rc{};
rc.left = xOff;
rc.right = width + xOff;
rc.top = yOff;
@@ -431,9 +445,38 @@ void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width,
if (fontColor)
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
}
int prevMode = SetBkMode(dc, 1);
const char* font;
switch (options::Options.Language)
{
case Languages::TraditionalChinese:
font = "Microsoft JhengHei";
break;
case Languages::SimplifiedChinese:
font = "Microsoft YaHei";
break;
case Languages::Japanese:
font = "MS UI Gothic";
break;
case Languages::Korean:
font = "Gulim";
break;
default:
font = "Arial";
}
// Default font does not scale well
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS, font);
HFONT hOldFont = static_cast<HFONT>(SelectObject(dc, hNewFont));
int prevMode = SetBkMode(dc, TRANSPARENT);
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
DrawTextA(dc, text, lstrlenA(text), &rc, 0x810u);
DrawTextW(dc, text, lstrlenW(text), &rc, DT_NOPREFIX | DT_WORDBREAK);
SelectObject(dc, hOldFont);
DeleteObject(hNewFont);
SetBkMode(dc, prevMode);
SetTextColor(dc, color);
ReleaseDC(hwnd, dc);

View File

@@ -64,7 +64,7 @@ public:
int srcXOff, int srcYOff);
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height, int a6);
static void grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width, int height);
private:
/*COLORONCOLOR or HALFTONE*/
static const int stretchMode = COLORONCOLOR;

View File

@@ -10,7 +10,7 @@
int high_score::dlg_enter_name;
int high_score::dlg_score;
int high_score::dlg_position;
LPCSTR high_score::default_name;
LPCWSTR high_score::default_name;
high_score_struct* high_score::dlg_hst;
winhelp_entry high_score::help[21]
@@ -40,7 +40,8 @@ winhelp_entry high_score::help[21]
int high_score::read(high_score_struct* table, int* ptrToSmth)
{
char Buffer[20];
char scoreBuffer[20];
wchar_t nameBuffer[20];
int scoreSum = 0;
clear_table(table);
@@ -52,18 +53,17 @@ int high_score::read(high_score_struct* table, int* ptrToSmth)
for (auto position = 0; position < 5; ++position)
{
auto tablePtr = &table[position];
_itoa_s(position, Buffer, 10);
lstrcatA(Buffer, ".Name");
options::get_string(optPath, Buffer, buf1, "", 32);
buf1[32] = 0;
lstrcpyA(tablePtr->Name, buf1);
_itoa_s(position, Buffer, 10);
lstrcatA(Buffer, ".Score");
options::get_string(optPath, Buffer, buf1, "", 300);
wsprintfW(nameBuffer, L"%d.Name", position);
options::get_string(optPath, nameBuffer, tablePtr->Name, L"", 32);
tablePtr->Name[31] = 0;
sprintf_s(scoreBuffer, "%d.Score", position);
options::get_string(optPath, scoreBuffer, buf1, "", 300);
tablePtr->Score = atol(buf1);
for (int i = lstrlenA(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
{
}
for (auto i = lstrlenW(tablePtr->Name) - 1; i >= 0; i--)
scoreSum += tablePtr->Name[i];
scoreSum += tablePtr->Score;
}
@@ -78,29 +78,30 @@ int high_score::read(high_score_struct* table, int* ptrToSmth)
int high_score::write(high_score_struct* table, int* ptrToSmth)
{
char Buffer[20];
char scoreBuffer[20];
wchar_t nameBuffer[20];
high_score_struct* tablePtr = table;
int scoreSum = 0;
CHAR* buf = memory::allocate(300u);
if (!buf)
return 1;
const CHAR* optPath = pinball::get_rc_string(166, 0);
auto optPath = pinball::get_rc_string(166, 0);
for (auto position = 0; position < 5; ++position)
{
_itoa_s(position, Buffer, 10);
lstrcatA(Buffer, ".Name");
options::set_string(optPath, Buffer, tablePtr->Name);
_itoa_s(position, Buffer, 10);
lstrcatA(Buffer, ".Score");
auto tablePtr = &table[position];
wsprintfW(nameBuffer, L"%d.Name", position);
options::set_string(optPath, nameBuffer, tablePtr->Name);
sprintf_s(scoreBuffer, "%d.Score", position);
_ltoa_s(tablePtr->Score, buf, 300, 10);
options::set_string(optPath, Buffer, buf);
for (int i = lstrlenA(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
{
}
options::set_string(optPath, scoreBuffer, buf);
for (auto i = lstrlenW(tablePtr->Name) - 1; i >= 0; i--)
scoreSum += tablePtr->Name[i];
scoreSum += tablePtr->Score;
++tablePtr;
}
scramble_number_string(scoreSum, buf);
options::set_string(optPath, "Verification", buf);
memory::free(buf);
@@ -130,7 +131,7 @@ int high_score::get_score_position(high_score_struct* table, int score)
return -1;
}
int high_score::place_new_score_into(high_score_struct* table, int score, LPSTR scoreStr, int position)
int high_score::place_new_score_into(high_score_struct* table, int score, LPWSTR name, int position)
{
if (position >= 0)
{
@@ -148,9 +149,9 @@ int high_score::place_new_score_into(high_score_struct* table, int score, LPSTR
}
high_score_struct* posTable = &table[position];
posTable->Score = score;
if (lstrlenA(scoreStr) >= 31)
scoreStr[31] = 0;
lstrcpyA(posTable->Name, scoreStr);
if (lstrlenW(name) >= 31)
name[31] = 0;
lstrcpyW(posTable->Name, name);
posTable->Name[31] = 0;
}
return position;
@@ -166,17 +167,17 @@ void high_score::show_high_score_dialog(high_score_struct* table)
dlg_enter_name = 0;
dlg_score = 0;
dlg_hst = table;
DialogBoxParamA(winmain::hinst, "dlg_highscores", winmain::hwnd_frame, HighScore, 0);
DialogBoxParamW(winmain::hinst, L"dlg_highscores", winmain::hwnd_frame, HighScore, 0);
}
void high_score::show_and_set_high_score_dialog(high_score_struct* table, int score, int pos, LPCSTR defaultName)
void high_score::show_and_set_high_score_dialog(high_score_struct* table, int score, int pos, LPCWSTR defaultName)
{
dlg_position = pos;
dlg_score = score;
dlg_hst = table;
dlg_enter_name = 1;
default_name = defaultName;
while (DialogBoxParamA(winmain::hinst, "dlg_highscores", winmain::hwnd_frame, HighScore, 0))
while (DialogBoxParamW(winmain::hinst, L"dlg_highscores", winmain::hwnd_frame, HighScore, 0))
{
}
}
@@ -185,8 +186,7 @@ INT_PTR high_score::HighScore(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND parent;
int nIDDlgItem;
CHAR String1[256];
CHAR name[32];
wchar_t name[32];
switch (msg)
{
@@ -204,7 +204,7 @@ INT_PTR high_score::HighScore(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
show_high_scores(hWnd, dlg_hst);
for (nIDDlgItem = DLG_HIGHSCORES_EditName1; nIDDlgItem < 611; ++nIDDlgItem)
{
ShowWindow(GetDlgItem(hWnd, nIDDlgItem), 0);
ShowWindow(GetDlgItem(hWnd, nIDDlgItem), SW_HIDE);
}
if (dlg_enter_name == 1)
{
@@ -214,12 +214,12 @@ INT_PTR high_score::HighScore(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return 1;
}
HWND nameTextBox = GetDlgItem(hWnd, dlg_position + DLG_HIGHSCORES_EditName1);
ShowWindow(nameTextBox, 5);
ShowWindow(nameTextBox, SW_SHOW);
EnableWindow(nameTextBox, 1);
SetFocus(nameTextBox);
if (default_name)
{
SetWindowTextA(nameTextBox, default_name);
SetWindowTextW(nameTextBox, default_name);
SendMessageA(nameTextBox, EM_SETSEL, 0, -1);
}
SendMessageA(nameTextBox, EM_SETLIMITTEXT, 31u, 0);
@@ -240,15 +240,15 @@ INT_PTR high_score::HighScore(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
break;
}
GetDlgItemTextA(hWnd, dlg_position + DLG_HIGHSCORES_EditName1, name, 32);
GetDlgItemTextW(hWnd, dlg_position + DLG_HIGHSCORES_EditName1, name, 32);
name[31] = 0;
place_new_score_into(dlg_hst, dlg_score, name, dlg_position);
break;
case DLG_HIGHSCORES_Cancel:
break;
case DLG_HIGHSCORES_Clear:
lstrcpyA(String1, pinball::get_rc_string(41, 0));
if (MessageBoxA(hWnd, pinball::get_rc_string(40, 0), String1, MB_DEFBUTTON2 | MB_OKCANCEL) == 1)
if (MessageBoxW(hWnd, pinball::get_rc_Wstring(40, 0),
pinball::get_rc_Wstring(41, 0), MB_DEFBUTTON2 | MB_OKCANCEL) == 1)
{
clear_table(dlg_hst);
if (dlg_enter_name)
@@ -277,7 +277,7 @@ void high_score::show_high_scores(HWND hDlg, high_score_struct* table)
{
if (dlg_enter_name == 1 && dlg_position == i)
{
hsdlg_show_score(hDlg, " ", dlg_score, i);
hsdlg_show_score(hDlg, L" ", dlg_score, i);
nextPosition = 1;
}
hsdlg_show_score(hDlg, tablePtr->Name, tablePtr->Score, i + nextPosition);
@@ -285,7 +285,7 @@ void high_score::show_high_scores(HWND hDlg, high_score_struct* table)
}
}
void high_score::hsdlg_show_score(HWND hDlg, LPCSTR name, int score, int position)
void high_score::hsdlg_show_score(HWND hDlg, LPCWSTR name, int score, int position)
{
CHAR scoreStr[36];
if (position < 5)
@@ -293,7 +293,7 @@ void high_score::hsdlg_show_score(HWND hDlg, LPCSTR name, int score, int positio
score::string_format(score, scoreStr);
if (scoreStr[0])
{
SetWindowTextA(GetDlgItem(hDlg, position + DLG_HIGHSCORES_StaticName1), name);
SetWindowTextW(GetDlgItem(hDlg, position + DLG_HIGHSCORES_StaticName1), name);
SetWindowTextA(GetDlgItem(hDlg, position + DLG_HIGHSCORES_Score1), scoreStr);
}
}

View File

@@ -3,7 +3,7 @@
struct high_score_struct
{
char Name[32];
wchar_t Name[32];
int Score;
};
@@ -15,19 +15,19 @@ public:
static int write(high_score_struct* table, int* ptrToSmth);
static void clear_table(high_score_struct* table);
static int get_score_position(high_score_struct* table, int score);
static int place_new_score_into(high_score_struct* table, int score, LPSTR scoreStr, int position);
static int place_new_score_into(high_score_struct* table, int score, LPWSTR name, int position);
static void scramble_number_string(int Value, char* Buffer);
static void show_high_score_dialog(high_score_struct* table);
static void show_and_set_high_score_dialog(high_score_struct* table, int score, int pos, LPCSTR defaultName);
static void show_and_set_high_score_dialog(high_score_struct* table, int score, int pos, LPCWSTR defaultName);
static INT_PTR __stdcall HighScore(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
static void show_high_scores(HWND hDlg, high_score_struct* table);
static void hsdlg_show_score(HWND hDlg, LPCSTR name, int score, int position);
static void hsdlg_show_score(HWND hDlg, LPCWSTR name, int score, int position);
private :
static int dlg_enter_name;
static int dlg_score;
static int dlg_position;
static LPCSTR default_name;
static LPCWSTR default_name;
static high_score_struct* dlg_hst;
static winhelp_entry help[21];
};

View File

@@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
#include "options.h"
#include "fullscrn.h"
@@ -68,9 +68,36 @@ short options::vk_list[28]
-1
};
void options::init(HMENU menuHandle)
LanguageMenuEntry options::LanguageMenu[]
{
{L"English", Languages::English},
{L"Русский", Languages::Russian},
{L"简化字", Languages::SimplifiedChinese},
{L"正體字", Languages::TraditionalChinese},
{L"Polski", Languages::Polish},
{L"Deutsch", Languages::German},
{L"日本", Languages::Japanese},
{L"Français", Languages::French},
{L"Italiano", Languages::Italian},
{L"Magyar", Languages::Hungarian},
{L"Português", Languages::Portuguese},
{L"Português do Brasil", Languages::BrazilianPortuguese},
{L"Čeština", Languages::Czech},
{L"Dansk", Languages::Danish},
{L"Suomi", Languages::Finnish},
{L"עִברִית", Languages::Hebrew},
{L"اَلْعَرَبِيَّة", Languages::Arabic},
{L"Ελληνικά", Languages::Greek},
{L"Español", Languages::Spanish},
{L"한국어", Languages::Korean},
{L"Nederlands", Languages::Dutch},
{L"Norsk", Languages::Norwegian},
{L"Svenska", Languages::Swedish},
{L"Türkçe", Languages::Turkish},
};
void options::ReadOptions()
{
MenuHandle = menuHandle;
Options.Sounds = 1;
Options.Music = 0;
Options.FullScreen = 0;
@@ -110,6 +137,45 @@ void options::init(HMENU menuHandle)
Options.UniformScaling = get_int(nullptr, "Uniform scaling", true);
Options.AlternativeRender = get_int(nullptr, "Alternative Render", false);
auto defaultLanguage = Languages::English;
auto language = static_cast<Languages>(get_int(nullptr, "Language", static_cast<int>(defaultLanguage)));
bool languageDefined = false;
for (auto menuEntry : LanguageMenu)
{
if (menuEntry.Language == language)
{
languageDefined = true;
break;
}
}
if (!languageDefined)
language = defaultLanguage;
Options.Language = language;
// Alternative approaches: resource DLLs, single-language builds.
// SetThreadUILanguage does not work properly on Windows XP.
bool winXp = false;
OSVERSIONINFO version{};
version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
#pragma warning (disable : 4996) // XP has no versionhelpers.h
if (GetVersionEx(&version))
#pragma warning (default : 4996)
{
if (version.dwMajorVersion < 6)
winXp = true;
}
if (winXp)
SetThreadLocale(MAKELCID(static_cast<LANGID>(Options.Language), SORT_DEFAULT));
else
SetThreadUILanguage(static_cast<LANGID>(Options.Language));
}
void options::init(HMENU menuHandle)
{
MenuHandle = menuHandle;
menu_check(Menu1_Sounds, Options.Sounds);
Sound::Enable(0, 7, Options.Sounds);
menu_check(Menu1_Music, Options.Music);
@@ -136,6 +202,21 @@ void options::init(HMENU menuHandle)
}
update_resolution_menu();
// Add language menu from code to decouple it from rc.
// AppendMenuW works with A window
auto hSubmenu = CreatePopupMenu();
auto index = Menu1_Language;
for (auto menuEntry : LanguageMenu)
{
UINT flags = MF_STRING;
if (menuEntry.Language == Options.Language)
flags |= MF_CHECKED;
AppendMenuW(hSubmenu, flags, index++, menuEntry.Name);
}
auto optionsMenu = GetSubMenu(MenuHandle, 1);
AppendMenu(optionsMenu, MF_STRING | MF_POPUP, reinterpret_cast<UINT_PTR>(hSubmenu), "Language");
}
void options::uninit()
@@ -153,6 +234,7 @@ void options::uninit()
set_int(nullptr, "Screen Resolution", Options.Resolution);
set_int(nullptr, "Uniform scaling", Options.UniformScaling);
set_int(nullptr, "Alternative Render", Options.AlternativeRender);
set_int(nullptr, "Language", static_cast<int>(Options.Language));
}
void options::path_init(LPCSTR regPath)
@@ -269,6 +351,43 @@ void options::set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value)
path_free();
}
void options::get_string(LPCSTR optPath, LPCWSTR lpValueName, LPWSTR dst, LPCWSTR defaultValue, int iMaxLength)
{
DWORD dwDisposition;
HKEY hKey;
lstrcpynW(dst, defaultValue, iMaxLength);
if (!OptionsRegPath)
return;
auto regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
{
DWORD bufferSize = iMaxLength * sizeof(wchar_t);
RegQueryValueExW(hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(dst), &bufferSize);
RegCloseKey(hKey);
}
path_free();
}
void options::set_string(LPCSTR optPath, LPCWSTR lpValueName, LPCWSTR value)
{
DWORD dwDisposition;
HKEY hKey;
if (!OptionsRegPath)
return;
auto regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
{
DWORD bufferSize = (lstrlenW(value) + 1) * sizeof(wchar_t);
RegSetValueExW(hKey, lpValueName, 0, 1u, LPBYTE(value), bufferSize);
RegCloseKey(hKey);
}
path_free();
}
void options::menu_check(UINT uIDCheckItem, int check)
{
@@ -356,15 +475,22 @@ void options::toggle(UINT uIDCheckItem)
default:
break;
}
if (uIDCheckItem >= Menu1_Language && uIDCheckItem < Menu1_LanguageMax)
{
auto languageId = uIDCheckItem - Menu1_Language;
Options.Language = LanguageMenu[languageId].Language;
winmain::Restart();
}
}
void options::update_resolution_menu()
{
auto maxResolution = fullscrn::get_max_supported_resolution();
fullscrn::SetMaxResolution(maxResolution);
const CHAR* maxResText = pinball::get_rc_string(maxResolution + 2030, 0);
PCWSTR maxResText = pinball::get_rc_Wstring(maxResolution + 2030, 0);
if (MenuHandle)
ModifyMenuA(MenuHandle, Menu1_MaximumResolution, 0, Menu1_MaximumResolution, maxResText);
ModifyMenuW(MenuHandle, Menu1_MaximumResolution, 0, Menu1_MaximumResolution, maxResText);
for (auto resIndex = 0; resIndex < 3; resIndex++)
{
@@ -397,14 +523,14 @@ void options::init_resolution()
void options::keyboard()
{
DialogBoxParamA(winmain::hinst, "KEYMAPPER", winmain::hwnd_frame, KeyMapDlgProc, 0);
DialogBoxParamW(winmain::hinst, L"KEYMAPPER", winmain::hwnd_frame, KeyMapDlgProc, 0);
}
INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
char keyName[20];
WCHAR keyName[20];
int keyBindings[6];
char rcString[256];
WCHAR rcString[256];
switch (msg)
{
@@ -428,7 +554,7 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
auto index = 128;
do
{
if (vkChar == MapVirtualKeyA(index, MAPVK_VK_TO_CHAR))
if (vkChar == MapVirtualKeyW(index, MAPVK_VK_TO_CHAR))
break;
++index;
}
@@ -465,30 +591,30 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{
if (vk2And || get_vk_key_name(curVK, keyName))
{
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK);
auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL,CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.LeftFlipperKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.RightFlipperKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.PlungerKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK);
SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.LeftTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.RightTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_INSERTSTRING, -1, (LPARAM)keyName);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETITEMDATA, ind, curVK);
if (curVK == Options.BottomTableBumpKey)
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
}
}
}
@@ -498,18 +624,18 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{
case KEYMAPPER_Ok:
{
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0);
keyBindings[0] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0);
keyBindings[1] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0);
keyBindings[2] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0);
keyBindings[3] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0);
keyBindings[4] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0);
keyBindings[5] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0));
auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETCURSEL, 0, 0);
keyBindings[0] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETCURSEL, 0, 0);
keyBindings[1] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETCURSEL, 0, 0);
keyBindings[2] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETCURSEL, 0, 0);
keyBindings[3] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETCURSEL, 0, 0);
keyBindings[4] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 0));
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETCURSEL, 0, 0);
keyBindings[5] = static_cast<int>(SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0));
auto sameKeyBound = 0;
auto index = 1;
@@ -522,8 +648,8 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
break;
if (*optPtr == keyBindings[keyInd])
{
lstrcpyA(rcString, pinball::get_rc_string(43, 0));
MessageBoxA(hDlg, pinball::get_rc_string(39, 0), rcString, 0x2000u);
lstrcpyW(rcString, pinball::get_rc_Wstring(43, 0));
MessageBoxW(hDlg, pinball::get_rc_Wstring(39, 0), rcString, 0x2000u);
sameKeyBound = 1;
}
}
@@ -551,23 +677,23 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
case KEYMAPPER_Default:
{
auto name = (LPARAM)get_vk_key_name(Options.LeftFlipperKeyDft, keyName);
auto ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
auto ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperL, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.RightFlipperKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_FlipperR, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.PlungerKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_Plunger, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.LeftTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpLeft, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.RightTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpRight, CB_SETCURSEL, ind, 0);
name = (LPARAM)get_vk_key_name(Options.BottomTableBumpKeyDft, keyName);
ind = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
ind = SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_FINDSTRINGEXACT, 0, name);
SendDlgItemMessageW(hDlg, KEYMAPPER_BumpBottom, CB_SETCURSEL, ind, 0);
return 0;
}
default:
@@ -581,10 +707,10 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
}
LPSTR options::get_vk_key_name(uint16_t vk, LPSTR keyName)
LPWSTR options::get_vk_key_name(uint16_t vk, LPWSTR keyName)
{
LONG scanCode = MapVirtualKeyA(vk, MAPVK_VK_TO_VSC) << 16;
LONG scanCode = MapVirtualKeyW(vk, MAPVK_VK_TO_VSC) << 16;
if (vk >= 0x21u && vk <= 0x2Eu)
scanCode |= 0x1000000u;
return GetKeyNameTextA(scanCode, keyName, 19) != 0 ? keyName : nullptr;
return GetKeyNameTextW(scanCode, keyName, 19) != 0 ? keyName : nullptr;
}

View File

@@ -1,5 +1,40 @@
#pragma once
#include "pinball.h"
#include "resource.h"
enum class Languages
{
English = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),
Russian = MAKELANGID(LANG_RUSSIAN, SUBLANG_RUSSIAN_RUSSIA),
TraditionalChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
SimplifiedChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
Polish = MAKELANGID(LANG_POLISH, SUBLANG_POLISH_POLAND),
German = MAKELANGID(LANG_GERMAN, SUBLANG_GERMAN),
Japanese = MAKELANGID(LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN),
French = MAKELANGID(LANG_FRENCH, SUBLANG_FRENCH),
Italian = MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN),
Hungarian = MAKELANGID(LANG_HUNGARIAN, SUBLANG_HUNGARIAN_HUNGARY),
Portuguese = MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE),
BrazilianPortuguese = MAKELANGID(LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN),
Czech = MAKELANGID(LANG_CZECH, SUBLANG_CZECH_CZECH_REPUBLIC),
Danish = MAKELANGID(LANG_DANISH, SUBLANG_DANISH_DENMARK),
Finnish = MAKELANGID(LANG_FINNISH, SUBLANG_FINNISH_FINLAND),
Hebrew = MAKELANGID(LANG_HEBREW, SUBLANG_HEBREW_ISRAEL),
Arabic = MAKELANGID(LANG_ARABIC, SUBLANG_ARABIC_SAUDI_ARABIA),
Greek = MAKELANGID(LANG_GREEK, SUBLANG_GREEK_GREECE),
Spanish = MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN),
Korean = MAKELANGID(LANG_KOREAN, SUBLANG_KOREAN),
Dutch = MAKELANGID(LANG_DUTCH, SUBLANG_DUTCH),
Norwegian = MAKELANGID(LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL),
Swedish = MAKELANGID(LANG_SWEDISH, SUBLANG_SWEDISH),
Turkish = MAKELANGID(LANG_TURKISH, SUBLANG_TURKISH_TURKEY),
};
struct LanguageMenuEntry
{
LPCWSTR Name;
Languages Language;
};
struct optionsStruct
{
@@ -24,12 +59,14 @@ struct optionsStruct
int Resolution;
bool UniformScaling;
bool AlternativeRender;
Languages Language;
};
class options
{
public:
static void ReadOptions();
static void init(HMENU menuHandle);
static void uninit();
static void path_init(LPCSTR regPath);
@@ -38,6 +75,8 @@ public:
static void set_int(LPCSTR optPath, LPCSTR lpValueName, int data);
static void get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength);
static void set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value);
static void get_string(LPCSTR optPath, LPCWSTR lpValueName, LPWSTR dst, LPCWSTR defaultValue, int iMaxLength);
static void set_string(LPCSTR optPath, LPCWSTR lpValueName, LPCWSTR value);
static void menu_check(UINT uIDCheckItem, int check);
static void menu_set(UINT uIDEnableItem, int enable);
static void toggle(UINT uIDCheckItem);
@@ -46,7 +85,7 @@ public:
static void keyboard();
static INT_PTR _stdcall KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static LPSTR get_vk_key_name(uint16_t vk, LPSTR keyName);
static LPWSTR get_vk_key_name(uint16_t vk, LPWSTR keyName);
static optionsStruct Options;
private:
@@ -57,4 +96,5 @@ private:
static HMENU MenuHandle;
static winhelp_entry keymap_help[18];
static short vk_list[28];
static LanguageMenuEntry LanguageMenu[Menu1_LanguageMax - Menu1_Language];
};

View File

@@ -135,6 +135,12 @@ void pb::firsttime_setup()
void pb::paint()
{
render::paint();
if (score::msg_fontp == nullptr)
{
// DrawText writes to screen directly, text gets overwritten by full vScreen blit.
pinball::InfoTextBox->Draw(true);
pinball::MissTextBox->Draw(true);
}
}
void pb::mode_change(int mode)
@@ -193,7 +199,7 @@ void pb::toggle_demo()
MainTable->Message(1024, 0.0);
mode_change(2);
pinball::MissTextBox->Clear();
auto text = pinball::get_rc_string(24, 0);
auto text = pinball::get_rc_Wstring(24, 0);
pinball::InfoTextBox->Display(text, -1.0);
}
else
@@ -272,7 +278,7 @@ int pb::frame(int time)
{
if (nudge::nudge_count > 0.5f)
{
pinball::InfoTextBox->Display(pinball::get_rc_string(25, 0), 2.0);
pinball::InfoTextBox->Display(pinball::get_rc_Wstring(25, 0), 2.0);
}
if (nudge::nudge_count > 1.0f)
MainTable->tilt(time_now);
@@ -352,7 +358,7 @@ void pb::pause_continue()
{
if (MainTable)
MainTable->Message(1008, time_now);
pinball::InfoTextBox->Display(pinball::get_rc_string(22, 0), -1.0);
pinball::InfoTextBox->Display(pinball::get_rc_Wstring(22, 0), -1.0);
midi::music_stop();
}
else
@@ -361,17 +367,17 @@ void pb::pause_continue()
MainTable->Message(1009, 0.0);
if (!demo_mode)
{
char* text;
wchar_t* text;
float textTime;
if (game_mode == 2)
{
textTime = -1.0;
text = pinball::get_rc_string(24, 0);
text = pinball::get_rc_Wstring(24, 0);
}
else
{
textTime = 5.0;
text = pinball::get_rc_string(23, 0);
text = pinball::get_rc_Wstring(23, 0);
}
pinball::InfoTextBox->Display(text, textTime);
}
@@ -496,8 +502,8 @@ void pb::keydown(int key)
ball->Acceleration.X = 0.0;
break;
case 'H':
char String1[200];
lstrcpyA(String1, pinball::get_rc_string(26, 0));
wchar_t String1[200];
lstrcpyW(String1, pinball::get_rc_Wstring(26, 0));
high_score::show_and_set_high_score_dialog(highscore_table, 1000000000, 1, String1);
break;
case 'M':
@@ -550,7 +556,7 @@ void pb::end_game()
{
int scores[4]{};
int scoreIndex[4]{};
char String1[200];
wchar_t String1[200];
mode_change(2);
int playerCount = MainTable->PlayerCount;
@@ -587,7 +593,7 @@ void pb::end_game()
int position = high_score::get_score_position(highscore_table, scores[i]);
if (position >= 0)
{
lstrcpyA(String1, pinball::get_rc_string(scoreIndex[i] + 26, 0));
lstrcpyW(String1, pinball::get_rc_Wstring(scoreIndex[i] + 26, 0));
high_score::show_and_set_high_score_dialog(highscore_table, scores[i], position, String1);
}
}

View File

@@ -8,7 +8,8 @@ int pinball::quickFlag = 0;
TTextBox* pinball::InfoTextBox;
TTextBox* pinball::MissTextBox;
char pinball::getRcBuffer[6 * 256];
int pinball::rc_string_slot = 0;
wchar_t pinball::getRcWBuffer[256 * 6];
int pinball::rc_string_slot = 0, pinball::rc_Wstring_slot = 0;
int pinball::LeftShift = -1;
int pinball::RightShift = -1;
@@ -22,6 +23,16 @@ char* pinball::get_rc_string(int uID, int a2)
return result;
}
wchar_t* pinball::get_rc_Wstring(int uID, int a2)
{
auto result = &getRcWBuffer[256 * rc_Wstring_slot];
if (!LoadStringW(winmain::hinst, uID, result, 255))
*result = 0;
if (++rc_Wstring_slot >= 6)
rc_Wstring_slot = 0;
return result;
}
int pinball::get_rc_int(int uID, int* dst)
{
char buffer[255];

View File

@@ -17,11 +17,13 @@ public:
static int LeftShift;
static char* get_rc_string(int uID, int a2);
static wchar_t* get_rc_Wstring(int uID, int a2);
static int get_rc_int(int uID, int* dst);
static void FindShiftKeys();
static void adjust_priority(int priority);
static int make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize = 0x12Cu);
private:
static char getRcBuffer[256 * 6];
static int rc_string_slot;
static wchar_t getRcWBuffer[256 * 6];
static int rc_string_slot, rc_Wstring_slot;
};

View File

@@ -241,6 +241,8 @@
#define DLG_HIGHSCORES_EditName4 604
#define DLG_HIGHSCORES_EditName5 605
#define Menu1_AlternativeRender 601
#define Menu1_Language 700
#define Menu1_LanguageMax 724
// Next default values for new objects
//

View File

@@ -47,6 +47,7 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
++memory::critical_allocation;
auto optionsRegPath = pinball::get_rc_string(165, 0);
options::path_init(optionsRegPath);
options::ReadOptions();
auto regSpaceCadet = pinball::get_rc_string(166, 0);
if (options::get_int(regSpaceCadet, "Table Version", 1) <= 1)
@@ -130,11 +131,11 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
}
iFrostUniqueMsg = RegisterWindowMessageA("PinballThemeSwitcherUniqueMsgString");
auto windowClass = pinball::get_rc_string(167, 0);
auto windowHandle = FindWindowA(windowClass, nullptr);
auto windowClass = pinball::get_rc_Wstring(167, 0);
auto windowHandle = FindWindowW(windowClass, nullptr);
if (windowHandle)
{
SendMessageA(windowHandle, iFrostUniqueMsg, 0, 0);
SendMessageW(windowHandle, iFrostUniqueMsg, 0, 0);
return 0;
}
@@ -146,28 +147,39 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
picce.dwICC = 5885;
InitCommonControlsEx(&picce);
WNDCLASSEXA wndClass{};
WNDCLASSEXW wndClass{};
wndClass.cbSize = sizeof wndClass;
wndClass.style = CS_DBLCLKS | CS_BYTEALIGNCLIENT;
wndClass.lpfnWndProc = message_handler;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = 0;
wndClass.hInstance = hInstance;
wndClass.hIcon = LoadIconA(hInstance, "ICON_1");
wndClass.hCursor = LoadCursorA(nullptr, IDC_ARROW);
wndClass.hIcon = LoadIconW(hInstance, L"ICON_1");
wndClass.hCursor = LoadCursorW(nullptr, (PWSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)16;
wndClass.lpszMenuName = "MENU_1";
wndClass.lpszMenuName = L"MENU_1";
wndClass.lpszClassName = windowClass;
auto splash = splash::splash_screen(hInstance, "splash_bitmap", "splash_bitmap");
RegisterClassExA(&wndClass);
RegisterClassExW(&wndClass);
pinball::FindShiftKeys();
options::init_resolution();
char windowName[40];
lstrcpyA(windowName, pinball::get_rc_string(38, 0));
windowHandle = CreateWindowExA(0, windowClass, windowName, WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance,
nullptr);
// Some languages use RTL layout
DWORD dwExStyle;
switch (options::Options.Language)
{
case Languages::Hebrew:
case Languages::Arabic:
dwExStyle = WS_EX_LAYOUTRTL;
break;
default:
dwExStyle = 0;
}
auto windowName = pinball::get_rc_Wstring(38, 0);
windowHandle = CreateWindowExW(dwExStyle, windowClass, windowName,
WndStyle, 0, 0, 640, 480, nullptr, nullptr, hInstance, nullptr);
hwnd_frame = windowHandle;
if (!windowHandle)
{
@@ -223,10 +235,10 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
auto dt = static_cast<float>(curTime - prevTime) * 0.001f;
if (!options::Options.AlternativeRender)
sprintf_s(buf, "Frames/sec = %02.02f", 300.0f / dt);
else
else
{
sprintf_s(buf, "Updates/sec = %02.02f Frames/sec = %02.02f",
300.0f / dt, pb::frameCounter / dt);
300.0f / dt, pb::frameCounter / dt);
pb::frameCounter = 0;
}
@@ -328,7 +340,7 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
gdrv::uninit();
DestroyWindow(hwnd_frame);
options::path_uninit();
UnregisterClassA(windowClass, hinst);
UnregisterClassW(windowClass, hinst);
if (restart)
{
@@ -387,12 +399,12 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
midi::music_stop();
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KILLFOCUS:
has_focus = 0;
gdrv::get_focus();
pb::loose_focus();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_CREATE:
{
RECT rect{};
@@ -423,18 +435,18 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
changeDisplayFg);
--memory::critical_allocation;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
case WM_MOVE:
no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_SETFOCUS:
has_focus = 1;
no_time_loss = 1;
gdrv::get_focus();
fullscrn::force_redraw();
pb::paint();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_PAINT:
{
PAINTSTRUCT paint{};
@@ -450,16 +462,16 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
bQuit = 1;
PostQuitMessage(0);
fullscrn::shutdown();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_ERASEBKGND:
break;
case WM_SIZE:
fullscrn::window_size_changed();
fullscrn::force_redraw();
pb::paint();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
default:
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
return 0;
}
@@ -468,7 +480,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
{
case WM_MENUSELECT:
if (lParam)
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
if (fullscrn::screen_mode)
fullscrn::set_menu_mode(0);
return 0;
@@ -476,10 +488,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
no_time_loss = 1;
if (fullscrn::screen_mode)
fullscrn::set_menu_mode(1);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_GETMINMAXINFO:
fullscrn::getminmaxinfo((MINMAXINFO*)lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_DISPLAYCHANGE:
options::update_resolution_menu();
if (fullscrn::displaychange())
@@ -487,10 +499,10 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
options::Options.FullScreen = 0;
options::menu_check(Menu1_Full_Screen, 0);
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KEYUP:
pb::keyup(wParamI);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_KEYDOWN:
if (!(lParam & 0x40000000))
pb::keydown(wParamI);
@@ -522,26 +534,26 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
break;
}
if (!pb::cheat_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
switch (wParam)
{
case 'H':
DispGRhistory = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case 'Y':
SetWindowTextA(hWnd, "Pinball");
DispFrameRate = DispFrameRate == 0;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case VK_F1:
pb::frame(10);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case VK_F15:
single_step = single_step == 0;
if (single_step == 0)
no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
default:
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
case WM_SYSCOMMAND:
switch (wParam & 0xFFF0)
@@ -553,17 +565,17 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
case SC_MINIMIZE:
if (!single_step)
pause();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case SC_SCREENSAVE:
fullscrn::activate(0);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
default: break;
}
end_pause();
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_INITMENU:
no_time_loss = 1;
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_COMMAND:
no_time_loss = 1;
switch (wParam)
@@ -599,9 +611,9 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd * iHwnd);
if (static_cast<int>(WinExec(cmdLine, 5u)) < 32)
{
auto caption = pinball::get_rc_string(170, 0);
auto text = pinball::get_rc_string(171, 0);
MessageBoxA(hwnd_frame, text, caption, 0x2010u);
auto caption = pinball::get_rc_Wstring(170, 0);
auto text = pinball::get_rc_Wstring(171, 0);
MessageBoxW(hwnd_frame, text, caption, 0x2010u);
}
memory::free(tmpBuf);
}
@@ -665,7 +677,11 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
default:
break;
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
if (wParam >= Menu1_Language && wParam < Menu1_LanguageMax)
options::toggle(wParamI);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_LBUTTONDOWN:
if (pb::game_mode)
{
@@ -681,7 +697,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
else
pb::keydown(options::Options.LeftFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
break;
case WM_LBUTTONUP:
@@ -693,25 +709,25 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
}
if (!pb::cheat_mode)
pb::keyup(options::Options.LeftFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_RBUTTONDOWN:
if (!pb::cheat_mode)
pb::keydown(options::Options.RightFlipperKey);
if (pb::game_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
break;
case WM_RBUTTONUP:
if (!pb::cheat_mode)
pb::keyup(options::Options.RightFlipperKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_MBUTTONDOWN:
pb::keydown(options::Options.PlungerKey);
if (pb::game_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
break;
case WM_MBUTTONUP:
pb::keyup(options::Options.PlungerKey);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_POWERBROADCAST:
if (wParam == 4 && options::Options.FullScreen)
{
@@ -719,20 +735,20 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
options::menu_check(Menu1_Full_Screen, 0);
fullscrn::set_screen_mode(options::Options.FullScreen);
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case WM_PALETTECHANGED:
InvalidateRect(hWnd, nullptr, 0);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
case MM_MCINOTIFY:
if (wParam == 1)
midi::restart_midi_seq(lParam);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
default:
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
pb::mode_countdown(-1);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
return DefWindowProcW(hWnd, Msg, wParam, lParam);
}
int winmain::ProcessWindowMessages()
@@ -769,9 +785,9 @@ void winmain::memalloc_failure()
midi::music_stop();
Sound::Close();
gdrv::uninit();
char* caption = pinball::get_rc_string(170, 0);
char* text = pinball::get_rc_string(179, 0);
MessageBoxA(nullptr, text, caption, 0x2030u);
auto caption = pinball::get_rc_Wstring(170, 0);
auto text = pinball::get_rc_Wstring(179, 0);
MessageBoxW(nullptr, text, caption, 0x2030u);
_exit(1);
}
@@ -799,14 +815,12 @@ HDC winmain::_GetDC(HWND hWnd)
int winmain::a_dialog(HINSTANCE hInstance, HWND hWnd)
{
char appName[100];
char szOtherStuff[130];
PCWSTR appName = pinball::get_rc_Wstring(38, 0);
PWSTR szOtherStuff = pinball::get_rc_Wstring(102, 0);
lstrcpyA(appName, pinball::get_rc_string(38, 0));
lstrcpyA(szOtherStuff, pinball::get_rc_string(102, 0));
strcat_s(szOtherStuff, " Decompilation version 1.1.2");
auto icon = LoadIconA(hInstance, "ICON_1");
return ShellAboutA(hWnd, appName, szOtherStuff, icon);
lstrcatW(szOtherStuff, L" Decompilation version 1.1.2");
auto icon = LoadIconW(hInstance, L"ICON_1");
return ShellAboutW(hWnd, appName, szOtherStuff, icon);
}
void winmain::end_pause()