SpaceCadetPinball/SpaceCadetPinball/pinball.cpp

48 lines
1.0 KiB
C++
Raw Normal View History

2020-10-25 15:17:26 +01:00
#include "pch.h"
#include "pinball.h"
#include "translations.h"
#include "winmain.h"
2020-10-25 15:17:26 +01:00
int LoadStringAlt(Msg uID, LPSTR lpBuffer, int cchBufferMax)
{
const char* text = translations::GetTranslation(uID);
strncpy(lpBuffer, text, cchBufferMax);
return 1;
}
2020-10-25 15:17:26 +01:00
int pinball::quickFlag = 0;
2020-11-04 14:22:52 +01:00
TTextBox* pinball::InfoTextBox;
TTextBox* pinball::MissTextBox;
char pinball::getRcBuffer[6 * 256];
int pinball::rc_string_slot = 0;
2020-11-06 14:56:32 +01:00
int pinball::LeftShift = -1;
int pinball::RightShift = -1;
std::string pinball::BasePath;
2020-11-04 14:22:52 +01:00
char* pinball::get_rc_string(Msg uID)
2020-11-04 14:22:52 +01:00
{
char* result = &getRcBuffer[256 * rc_string_slot];
if (!LoadStringAlt(uID, &getRcBuffer[256 * rc_string_slot], 255))
2020-11-04 14:22:52 +01:00
*result = 0;
2020-11-04 14:22:52 +01:00
if (++rc_string_slot >= 6)
rc_string_slot = 0;
return result;
}
2020-11-06 14:56:32 +01:00
int pinball::get_rc_int(Msg uID, int* dst)
2020-11-06 14:56:32 +01:00
{
char buffer[255];
int result = LoadStringAlt(uID, buffer, 255);
2020-11-06 14:56:32 +01:00
if (!result)
return result;
*dst = atoi(buffer);
return 1;
}
std::string pinball::make_path_name(const std::string& fileName)
{
return BasePath + fileName;
}