mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
parent
3c2fff9d07
commit
d0c1ac60b6
@ -303,7 +303,7 @@ void TPinballTable::tilt(float time)
|
|||||||
{
|
{
|
||||||
pinball::InfoTextBox->Clear();
|
pinball::InfoTextBox->Clear();
|
||||||
pinball::MissTextBox->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);
|
loader::play_sound(SoundIndex3);
|
||||||
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
|
TiltTimeoutTimer = timer::set(30.0, this, tilt_timeout);
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ void TPinballTable::port_draw()
|
|||||||
|
|
||||||
int TPinballTable::Message(int code, float value)
|
int TPinballTable::Message(int code, float value)
|
||||||
{
|
{
|
||||||
LPSTR rc_text;
|
LPWSTR rc_text;
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case 1000:
|
case 1000:
|
||||||
@ -382,9 +382,9 @@ int TPinballTable::Message(int code, float value)
|
|||||||
LightGroup->Message(20, 0.0);
|
LightGroup->Message(20, 0.0);
|
||||||
Plunger->Message(1016, 0.0);
|
Plunger->Message(1016, 0.0);
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
rc_text = pinball::get_rc_string(30, 0);
|
rc_text = pinball::get_rc_Wstring(30, 0);
|
||||||
else
|
else
|
||||||
rc_text = pinball::get_rc_string(26, 0);
|
rc_text = pinball::get_rc_Wstring(26, 0);
|
||||||
pinball::InfoTextBox->Display(rc_text, -1.0);
|
pinball::InfoTextBox->Display(rc_text, -1.0);
|
||||||
if (Demo)
|
if (Demo)
|
||||||
Demo->Message(1014, 0.0);
|
Demo->Message(1014, 0.0);
|
||||||
@ -477,11 +477,11 @@ int TPinballTable::Message(int code, float value)
|
|||||||
{
|
{
|
||||||
if (PlayerCount <= 1)
|
if (PlayerCount <= 1)
|
||||||
{
|
{
|
||||||
char* textboxText;
|
wchar_t* textboxText;
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
textboxText = pinball::get_rc_string(30, 0);
|
textboxText = pinball::get_rc_Wstring(30, 0);
|
||||||
else
|
else
|
||||||
textboxText = pinball::get_rc_string(26, 0);
|
textboxText = pinball::get_rc_Wstring(26, 0);
|
||||||
pinball::InfoTextBox->Display(textboxText, -1.0);
|
pinball::InfoTextBox->Display(textboxText, -1.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -518,32 +518,32 @@ int TPinballTable::Message(int code, float value)
|
|||||||
ComponentList->Get(i)->Message(1020, static_cast<float>(nextPlayer));
|
ComponentList->Get(i)->Message(1020, static_cast<float>(nextPlayer));
|
||||||
}
|
}
|
||||||
|
|
||||||
char* textboxText = nullptr;
|
wchar_t* textboxText = nullptr;
|
||||||
switch (nextPlayer)
|
switch (nextPlayer)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
textboxText = pinball::get_rc_string(30, 0);
|
textboxText = pinball::get_rc_Wstring(30, 0);
|
||||||
else
|
else
|
||||||
textboxText = pinball::get_rc_string(26, 0);
|
textboxText = pinball::get_rc_Wstring(26, 0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
textboxText = pinball::get_rc_string(31, 0);
|
textboxText = pinball::get_rc_Wstring(31, 0);
|
||||||
else
|
else
|
||||||
textboxText = pinball::get_rc_string(27, 0);
|
textboxText = pinball::get_rc_Wstring(27, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
textboxText = pinball::get_rc_string(32, 0);
|
textboxText = pinball::get_rc_Wstring(32, 0);
|
||||||
else
|
else
|
||||||
textboxText = pinball::get_rc_string(28, 0);
|
textboxText = pinball::get_rc_Wstring(28, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (Demo->ActiveFlag)
|
if (Demo->ActiveFlag)
|
||||||
textboxText = pinball::get_rc_string(33, 0);
|
textboxText = pinball::get_rc_Wstring(33, 0);
|
||||||
else
|
else
|
||||||
textboxText = pinball::get_rc_string(29, 0);
|
textboxText = pinball::get_rc_Wstring(29, 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -560,7 +560,7 @@ int TPinballTable::Message(int code, float value)
|
|||||||
case 1022:
|
case 1022:
|
||||||
loader::play_sound(SoundIndex2);
|
loader::play_sound(SoundIndex2);
|
||||||
pinball::MissTextBox->Clear();
|
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);
|
EndGameTimeoutTimer = timer::set(3.0, this, EndGame_timeout);
|
||||||
break;
|
break;
|
||||||
case 1024:
|
case 1024:
|
||||||
@ -615,7 +615,7 @@ void TPinballTable::EndGame_timeout(int timerId, void* caller)
|
|||||||
if (table->Demo)
|
if (table->Demo)
|
||||||
table->Demo->Message(1022, 0.0);
|
table->Demo->Message(1022, 0.0);
|
||||||
control::handler(67, pinball::MissTextBox);
|
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)
|
void TPinballTable::LightShow_timeout(int timerId, void* caller)
|
||||||
|
@ -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)
|
if (!text)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Message1 && !strcmp(text, Message2->Text))
|
if (Message1 && !lstrcmpW(text, Message2->Text))
|
||||||
{
|
{
|
||||||
Message2->Refresh(time);
|
Message2->Refresh(time);
|
||||||
if (Message2 == Message1)
|
if (Message2 == Message1)
|
||||||
@ -223,7 +223,7 @@ void TTextBox::Draw()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
auto totalWidth = 0;
|
auto totalWidth = 0;
|
||||||
char* textEndSpace = nullptr;
|
wchar_t* textEndSpace = nullptr;
|
||||||
auto textEnd = text;
|
auto textEnd = text;
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -21,7 +21,7 @@ public:
|
|||||||
~TTextBox() override;
|
~TTextBox() override;
|
||||||
int Message(int code, float value) override;
|
int Message(int code, float value) override;
|
||||||
void Clear();
|
void Clear();
|
||||||
void Display(const char* text, float time);
|
void Display(const wchar_t* text, float time);
|
||||||
void Draw();
|
void Draw();
|
||||||
|
|
||||||
static void TimerExpired(int timerId, void* tb);
|
static void TimerExpired(int timerId, void* tb);
|
||||||
|
@ -3,17 +3,17 @@
|
|||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "pb.h"
|
#include "pb.h"
|
||||||
|
|
||||||
TTextBoxMessage::TTextBoxMessage(const char* text, float time)
|
TTextBoxMessage::TTextBoxMessage(const wchar_t* text, float time)
|
||||||
{
|
{
|
||||||
NextMessage = nullptr;
|
NextMessage = nullptr;
|
||||||
Time = time;
|
Time = time;
|
||||||
EndTicks = pb::time_ticks + static_cast<int>(time * 1000.0f);
|
EndTicks = pb::time_ticks + static_cast<int>(time * 1000.0f);
|
||||||
if (text)
|
if (text)
|
||||||
{
|
{
|
||||||
const auto textLen = strlen(text) + 1;
|
const auto textLen = lstrlenW(text) + 1;
|
||||||
Text = memory::allocate(textLen);
|
Text = memory::allocate<wchar_t>(textLen);
|
||||||
if (Text)
|
if (Text)
|
||||||
strcpy_s(Text, textLen, text);
|
lstrcpynW(Text, text, textLen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Text = nullptr;
|
Text = nullptr;
|
||||||
|
@ -3,11 +3,11 @@ class TTextBoxMessage
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TTextBoxMessage* NextMessage;
|
TTextBoxMessage* NextMessage;
|
||||||
char* Text;
|
wchar_t* Text;
|
||||||
float Time;
|
float Time;
|
||||||
int EndTicks;
|
int EndTicks;
|
||||||
|
|
||||||
TTextBoxMessage(const char* text, float time);
|
TTextBoxMessage(const wchar_t* text, float time);
|
||||||
~TTextBoxMessage();
|
~TTextBoxMessage();
|
||||||
float TimeLeft() const;
|
float TimeLeft() const;
|
||||||
void Refresh(float time);
|
void Refresh(float time);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -6,7 +6,6 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "pinball.h"
|
#include "pinball.h"
|
||||||
#include "winmain.h"
|
#include "winmain.h"
|
||||||
#include <string>
|
|
||||||
|
|
||||||
HPALETTE gdrv::palette_handle = nullptr;
|
HPALETTE gdrv::palette_handle = nullptr;
|
||||||
HINSTANCE gdrv::hinst;
|
HINSTANCE gdrv::hinst;
|
||||||
@ -415,7 +414,7 @@ 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)
|
void gdrv::grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width, int height)
|
||||||
{
|
{
|
||||||
// Original font was 16 points, used with lowest table resolution
|
// Original font was 16 points, used with lowest table resolution
|
||||||
static const int fontSizes[3] =
|
static const int fontSizes[3] =
|
||||||
@ -447,7 +446,7 @@ void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width,
|
|||||||
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
|
sscanf_s(fontColor, "%d %d %d", &grtext_red, &grtext_green, &grtext_blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string font;
|
const char* font;
|
||||||
switch (options::Options.Language)
|
switch (options::Options.Language)
|
||||||
{
|
{
|
||||||
case Languages::TraditionalChinese:
|
case Languages::TraditionalChinese:
|
||||||
@ -460,16 +459,15 @@ void gdrv::grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width,
|
|||||||
font = "Arial";
|
font = "Arial";
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFAULT_CHARSET in unicode build.
|
|
||||||
// Default font does not scale well
|
// Default font does not scale well
|
||||||
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
auto hNewFont = CreateFont(fontSize, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
|
||||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
||||||
DEFAULT_PITCH | FF_SWISS, font.c_str());
|
DEFAULT_PITCH | FF_SWISS, font);
|
||||||
HFONT hOldFont = static_cast<HFONT>(SelectObject(dc, hNewFont));
|
HFONT hOldFont = static_cast<HFONT>(SelectObject(dc, hNewFont));
|
||||||
int prevMode = SetBkMode(dc, TRANSPARENT);
|
int prevMode = SetBkMode(dc, TRANSPARENT);
|
||||||
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
|
COLORREF color = SetTextColor(dc, grtext_red | grtext_green << 8 | grtext_blue << 16);
|
||||||
|
|
||||||
DrawTextA(dc, text, lstrlenA(text), &rc, DT_NOPREFIX | DT_WORDBREAK);
|
DrawTextW(dc, text, lstrlenW(text), &rc, DT_NOPREFIX | DT_WORDBREAK);
|
||||||
|
|
||||||
SelectObject(dc, hOldFont);
|
SelectObject(dc, hOldFont);
|
||||||
DeleteObject(hNewFont);
|
DeleteObject(hNewFont);
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
int srcXOff, int srcYOff);
|
int srcXOff, int srcYOff);
|
||||||
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
|
static void copy_bitmap_w_transparency(gdrv_bitmap8* dstBmp, int width, int height, int xOff, int yOff,
|
||||||
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
|
gdrv_bitmap8* srcBmp, int srcXOff, int srcYOff);
|
||||||
static void grtext_draw_ttext_in_box(LPCSTR text, int xOff, int yOff, int width, int height);
|
static void grtext_draw_ttext_in_box(LPCWSTR text, int xOff, int yOff, int width, int height);
|
||||||
private:
|
private:
|
||||||
/*COLORONCOLOR or HALFTONE*/
|
/*COLORONCOLOR or HALFTONE*/
|
||||||
static const int stretchMode = COLORONCOLOR;
|
static const int stretchMode = COLORONCOLOR;
|
||||||
|
@ -193,7 +193,7 @@ void pb::toggle_demo()
|
|||||||
MainTable->Message(1024, 0.0);
|
MainTable->Message(1024, 0.0);
|
||||||
mode_change(2);
|
mode_change(2);
|
||||||
pinball::MissTextBox->Clear();
|
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);
|
pinball::InfoTextBox->Display(text, -1.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -272,7 +272,7 @@ int pb::frame(int time)
|
|||||||
{
|
{
|
||||||
if (nudge::nudge_count > 0.5f)
|
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)
|
if (nudge::nudge_count > 1.0f)
|
||||||
MainTable->tilt(time_now);
|
MainTable->tilt(time_now);
|
||||||
@ -352,7 +352,7 @@ void pb::pause_continue()
|
|||||||
{
|
{
|
||||||
if (MainTable)
|
if (MainTable)
|
||||||
MainTable->Message(1008, time_now);
|
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();
|
midi::music_stop();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -361,17 +361,17 @@ void pb::pause_continue()
|
|||||||
MainTable->Message(1009, 0.0);
|
MainTable->Message(1009, 0.0);
|
||||||
if (!demo_mode)
|
if (!demo_mode)
|
||||||
{
|
{
|
||||||
char* text;
|
wchar_t* text;
|
||||||
float textTime;
|
float textTime;
|
||||||
if (game_mode == 2)
|
if (game_mode == 2)
|
||||||
{
|
{
|
||||||
textTime = -1.0;
|
textTime = -1.0;
|
||||||
text = pinball::get_rc_string(24, 0);
|
text = pinball::get_rc_Wstring(24, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
textTime = 5.0;
|
textTime = 5.0;
|
||||||
text = pinball::get_rc_string(23, 0);
|
text = pinball::get_rc_Wstring(23, 0);
|
||||||
}
|
}
|
||||||
pinball::InfoTextBox->Display(text, textTime);
|
pinball::InfoTextBox->Display(text, textTime);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,8 @@ int pinball::quickFlag = 0;
|
|||||||
TTextBox* pinball::InfoTextBox;
|
TTextBox* pinball::InfoTextBox;
|
||||||
TTextBox* pinball::MissTextBox;
|
TTextBox* pinball::MissTextBox;
|
||||||
char pinball::getRcBuffer[6 * 256];
|
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::LeftShift = -1;
|
||||||
int pinball::RightShift = -1;
|
int pinball::RightShift = -1;
|
||||||
|
|
||||||
@ -22,6 +23,16 @@ char* pinball::get_rc_string(int uID, int a2)
|
|||||||
return result;
|
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)
|
int pinball::get_rc_int(int uID, int* dst)
|
||||||
{
|
{
|
||||||
char buffer[255];
|
char buffer[255];
|
||||||
|
@ -17,11 +17,13 @@ public:
|
|||||||
static int LeftShift;
|
static int LeftShift;
|
||||||
|
|
||||||
static char* get_rc_string(int uID, int a2);
|
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 int get_rc_int(int uID, int* dst);
|
||||||
static void FindShiftKeys();
|
static void FindShiftKeys();
|
||||||
static void adjust_priority(int priority);
|
static void adjust_priority(int priority);
|
||||||
static int make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize = 0x12Cu);
|
static int make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize = 0x12Cu);
|
||||||
private:
|
private:
|
||||||
static char getRcBuffer[256 * 6];
|
static char getRcBuffer[256 * 6];
|
||||||
static int rc_string_slot;
|
static wchar_t getRcWBuffer[256 * 6];
|
||||||
|
static int rc_string_slot, rc_Wstring_slot;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user