Fixed x64 build warnings.

Replaced __intN with intN_t.
Some cleanup.
This commit is contained in:
Muzychenko Andrey 2021-02-16 19:03:45 +03:00
parent 5c3e9fea4c
commit 55984fbb08
29 changed files with 201 additions and 199 deletions

View File

@ -147,7 +147,7 @@ void Sound::Close()
}
}
void Sound::PlaySound(MIXWAVE* wavePtr, int minChannel, int maxChannel, unsigned int dwFlags, __int16 loops)
void Sound::PlaySound(MIXWAVE* wavePtr, int minChannel, int maxChannel, unsigned int dwFlags, int16_t loops)
{
MIXPLAYPARAMS mixParams{};

View File

@ -10,7 +10,7 @@ public:
static void Activate();
static void Deactivate();
static void Close();
static void PlaySound(MIXWAVE* wavePtr, int minChannel, int maxChannel, unsigned int dwFlags, __int16 loops);
static void PlaySound(MIXWAVE* wavePtr, int minChannel, int maxChannel, unsigned int dwFlags, int16_t loops);
static MIXWAVE* LoadWaveFile(LPCSTR lpName);
static void FreeSound(MIXWAVE* wave);
static void Flush(int channelFrom, int channelTo);

View File

@ -30,7 +30,7 @@ int main()
gdrv::DibSetUsage(dib, 0, 1);
auto d = objlist_class<void>(2, 4);
for (int i = 0; i < 100; i++)
for (size_t i = 0; i < 100; i++)
{
d.Add((void*)i);
}

View File

@ -100,7 +100,7 @@ void TDemo::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
ball->Position.Y = nextPosition->Y;
ball->RayMaxDistance -= coef;
switch (reinterpret_cast<int>(edge->WallValue))
switch (reinterpret_cast<size_t>(edge->WallValue))
{
case 1400:
if (!FlipLeftTimer && !FlipLeftFlag)

View File

@ -19,7 +19,7 @@ void TEdgeSegment::port_draw()
}
TEdgeSegment* TEdgeSegment::install_wall(float* floatArr, TCollisionComponent* collComp, char* activeFlagPtr,
unsigned int collisionGroup, float offset, int wallValue)
unsigned int collisionGroup, float offset, size_t wallValue)
{
vector_type center{}, start{}, end{}, prevCenter{}, vec1{}, vec2{}, dstVec{};
TEdgeSegment* edge = nullptr;

View File

@ -28,5 +28,5 @@ public:
virtual float FindCollisionDistance(ray_type* ray) = 0;
static TEdgeSegment* install_wall(float* floatArr, TCollisionComponent* collComp, char* activeFlagPtr,
unsigned int collisionGroup, float offset, int wallValue);
unsigned int collisionGroup, float offset, size_t wallValue);
};

View File

@ -19,7 +19,7 @@ TLightGroup::TLightGroup(TPinballTable* table, int groupIndex) : TPinballCompone
{
int count;
Timer1TimeDefault = *loader::query_float_attribute(groupIndex, 0, 903);
__int16* groupIndArr = loader::query_iattribute(groupIndex, 1027, &count);
int16_t* groupIndArr = loader::query_iattribute(groupIndex, 1027, &count);
for (int index = 0; index < count; ++groupIndArr)
{
auto comp = dynamic_cast<TLight*>(table->find_component(*groupIndArr));

View File

@ -28,8 +28,8 @@ public:
void* operator new(size_t Size);
void operator delete(void* p);
__int8 UnusedBaseFlag;
__int8 ActiveFlag;
char UnusedBaseFlag;
char ActiveFlag;
int MessageField;
char* GroupName;
int Unknown4;

View File

@ -9,8 +9,8 @@ CHANNELNODE WaveMix::channel_nodes[MAXQUEUEDWAVES];
CHANNELNODE* WaveMix::free_channel_nodes;
unsigned char WaveMix::volume_table[11][256];
int WaveMix::debug_flag;
void (*WaveMix::cmixit_ptr)(unsigned __int8* lpDest, unsigned __int8** rgWaveSrc, volume_struct* volume, int iNumWaves,
unsigned __int16 length);
void (*WaveMix::cmixit_ptr)(uint8_t* lpDest, uint8_t** rgWaveSrc, volume_struct* volume, int iNumWaves,
uint16_t length);
HMODULE WaveMix::HModule;
PCMWAVEFORMAT WaveMix::gpFormat = {{1u, 1u, 11025u, 11025u, 1u}, 8u};
char WaveMix::string_buffer[256] = "WaveMix V 2.3 by Angel M. Diaz, Jr. (c) Microsoft 1993-1995";
@ -670,7 +670,7 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
memcpy(&channel->PlayParams, lpMixPlayParams, sizeof channel->PlayParams);
channel->lpMixWave = channel->PlayParams.lpMixWave;
channel->dwNumSamples = channel->PlayParams.lpMixWave->wh.dwBufferLength;
auto lpData = (unsigned __int8*)channel->PlayParams.lpMixWave->wh.lpData;
auto lpData = (uint8_t*)channel->PlayParams.lpMixWave->wh.lpData;
channel->lpPos = lpData;
channel->lpEnd = &lpData[channel->dwNumSamples - globals->PCM.wf.nBlockAlign];
channel->PlayParams.iChannel = iChannel;
@ -781,9 +781,8 @@ int WaveMix::Play(MIXPLAYPARAMS* lpMixPlayParams)
if (curChannel->PlayParams.wLoops == 0xFFFF)
curChannel->dwEndPos = -1;
else
curChannel->dwEndPos = curChannel->dwStartPos + curChannel->dwNumSamples * (curChannel
->PlayParams.wLoops + 1) -
globals2->PCM.wf.nBlockAlign;
curChannel->dwEndPos = curChannel->dwStartPos + curChannel->dwNumSamples * (curChannel->PlayParams.
wLoops + 1) - globals2->PCM.wf.nBlockAlign;
}
if (!remixFlag || !globals2->pfnRemix(wavePosition, nullptr))
@ -1098,18 +1097,18 @@ int WaveMix::ReadRegistryForAppSpecificConfigs(MIXCONFIG* lpConfig)
lpConfig->WaveBlockLen = static_cast<short>(ReadRegistryInt(phkResult, "WaveBlockLen", 0));
lpConfig->CmixPtrDefaultFlag = 1;
if ((dwFlags & 0x20) == 0)
lpConfig->ResetMixDefaultFlag = static_cast<unsigned __int16>(ReadRegistryInt(phkResult, "Remix", 1)) != 2;
lpConfig->ResetMixDefaultFlag = static_cast<uint16_t>(ReadRegistryInt(phkResult, "Remix", 1)) != 2;
if ((dwFlags & 0x40) == 0)
{
int defaultGoodWavePos = DefaultGoodWavePos(lpConfig->wDeviceID);
lpConfig->GoodWavePos = static_cast<unsigned __int16>(ReadRegistryInt(
lpConfig->GoodWavePos = static_cast<uint16_t>(ReadRegistryInt(
phkResult, "GoodWavePos", defaultGoodWavePos)) != 0;
}
if ((dwFlags & 0x100) == 0)
lpConfig->ShowDebugDialogs = static_cast<short>(ReadRegistryInt(phkResult, "ShowDebugDialogs", 0));
if ((dwFlags & 0x200) == 0)
{
int defaultPauseBlocks = DefaultPauseBlocks(static_cast<unsigned __int16>(lpConfig->WaveBlockCount));
int defaultPauseBlocks = DefaultPauseBlocks(static_cast<uint16_t>(lpConfig->WaveBlockCount));
lpConfig->PauseBlocks = static_cast<short>(ReadRegistryInt(phkResult, "PauseBlocks", defaultPauseBlocks));
}
lpConfig->dwFlags = 1023;
@ -1153,7 +1152,7 @@ int WaveMix::DefaultGoodWavePos(unsigned uDeviceID)
int WaveMix::DefaultPauseBlocks(int waveBlocks)
{
int result;
if (GetVersion() < 0x80000000 || static_cast<unsigned __int8>(GetVersion()) < 4u)
if (GetVersion() < 0x80000000 || static_cast<uint8_t>(GetVersion()) < 4u)
result = waveBlocks;
else
result = 0;
@ -1723,7 +1722,7 @@ DWORD WaveMix::AddFactor(DWORD a1, DWORD a2)
dialog_template* WaveMix::MakeSettingsDlgTemplate()
{
auto size = 0u;
size_t size = 0u;
dialog_template* temp = MakeDlgTemplate(&size, 0x80C80080, 0, 0, 212, 132, L"WavMix32 Settings (Ver %X.%X Static)");
temp = AddDlgControl(&size, temp, 128, 65537, 1, 155, 5, 50, 14, L"&Ok");
temp = AddDlgControl(&size, temp, 128, 0x10000, 2, 155, 25, 50, 14, L"&Cancel");
@ -1745,7 +1744,7 @@ dialog_template* WaveMix::MakeSettingsDlgTemplate()
return AddDlgControl(&size, temp, 128, 65539, 1004, 55, 117, 75, 10, L"Good Get Position");
}
dialog_template* WaveMix::MakeDlgTemplate(unsigned* totalSize, unsigned style, short x, short y, short cx, short cy,
dialog_template* WaveMix::MakeDlgTemplate(size_t* totalSize, unsigned style, short x, short y, short cx, short cy,
const wchar_t* String)
{
auto dlgSize = 2 * wcslen(String) + 24;
@ -1769,7 +1768,7 @@ dialog_template* WaveMix::MakeDlgTemplate(unsigned* totalSize, unsigned style, s
return dlgTemplate;
}
dialog_template* WaveMix::AddDlgControl(unsigned* totalSize, dialog_template* dlgTemplate, short idClass,
dialog_template* WaveMix::AddDlgControl(size_t* totalSize, dialog_template* dlgTemplate, short idClass,
unsigned style, WORD id, short x, short y, short cx, short cy,
const wchar_t* String)
{
@ -1782,7 +1781,7 @@ dialog_template* WaveMix::AddDlgControl(unsigned* totalSize, dialog_template* dl
*totalSize = *totalSize - (*totalSize & 3) + 4;
GlobalUnlock(GlobalHandle(dlgTemplate2));
unsigned int newSize = *totalSize;
auto newSize = *totalSize;
HGLOBAL hGlobal = GlobalReAlloc(GlobalHandle(dlgTemplate2), newSize, 0x42u);
dlgTemplate2 = static_cast<dialog_template*>(GlobalLock(hGlobal));
if (dlgTemplate2)
@ -1813,7 +1812,7 @@ void WaveMix::DestroySettingsDlgTemplate(LPCVOID pMem)
}
}
int WaveMix::Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig)
int WaveMix::Settings_OnInitDialog(HWND hWnd, WPARAM wParam, MIXCONFIG* lpMixconfig)
{
tagWAVEOUTCAPSA pwoc{};
CHAR String[256];
@ -1878,7 +1877,7 @@ int WaveMix::Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig
return 1;
}
int WaveMix::Settings_OnCommand(HWND hWnd, int command, int lParam, int wParam)
int WaveMix::Settings_OnCommand(HWND hWnd, int command, LPARAM lParam, int wParam)
{
auto userData = reinterpret_cast<MIXCONFIG*>(GetWindowLongPtrA(hWnd, -21));
if (command == 1)
@ -1937,9 +1936,9 @@ const char* WaveMix::GetOperatingSystemPrefix()
{
if (GetVersion() < 0x80000000)
return "WinNT:";
if (GetVersion() >= 0x80000000 && static_cast<unsigned __int8>(GetVersion()) >= 4u)
if (GetVersion() >= 0x80000000 && static_cast<uint8_t>(GetVersion()) >= 4u)
return "Win95:";
if (GetVersion() >= 0x80000000 && static_cast<unsigned __int8>(GetVersion()) < 4u)
if (GetVersion() >= 0x80000000 && static_cast<uint8_t>(GetVersion()) < 4u)
return "Win31:";
return "OS_X"; /*The next big thing: waveOut on OSX*/
}
@ -1977,7 +1976,7 @@ void WaveMix::SaveConfigSettings(unsigned dwFlags)
}
if ((dwFlags & 2) != 0)
{
wsprintfA(string_buffer, "%d", static_cast<unsigned __int16>(11 * (Globals->PCM.wf.nSamplesPerSec / 0x2B11)));
wsprintfA(string_buffer, "%d", static_cast<uint16_t>(11 * (Globals->PCM.wf.nSamplesPerSec / 0x2B11)));
WritePrivateProfileStringA(Globals->szDevicePName, "SamplesPerSec", string_buffer, FileName);
}
if ((dwFlags & 4) != 0)
@ -2213,14 +2212,14 @@ HPSTR WaveMix::BitsPerSampleAlign(HPSTR lpInData, WORD nInBPS, WORD nOutBPS, DWO
{
if (nInBPS / 8u <= nOutBPS / 8u)
{
auto dst = static_cast<__int16*>(dataBuf);
auto dst = static_cast<int16_t*>(dataBuf);
for (auto src = lpInData; dwNumSamples; --dwNumSamples)
*dst++ = static_cast<short>((*src++ - 128) * 256);
}
else
{
auto dst = static_cast<char*>(dataBuf);
for (auto src = reinterpret_cast<__int16*>(lpInData); dwNumSamples; --dwNumSamples)
for (auto src = reinterpret_cast<int16_t*>(lpInData); dwNumSamples; --dwNumSamples)
{
*dst++ = static_cast<char>(*src++ / 256 + 128);
}
@ -2288,8 +2287,8 @@ HPSTR WaveMix::ChannelAlign(HPSTR lpInData, WORD nInChannels, WORD nOutChannels,
}
else
{
auto src = reinterpret_cast<__int16*>(lpInData);
auto dst = reinterpret_cast<__int16*>(dataBuf);
auto src = reinterpret_cast<int16_t*>(lpInData);
auto dst = reinterpret_cast<int16_t*>(dataBuf);
for (; dwNumSamples; --dwNumSamples, src += 2)
{
*dst++ = static_cast<short>((src[0] + src[1]) / 2);
@ -2394,7 +2393,7 @@ void WaveMix::AvgSample(HPSTR lpOutData, HPSTR lpInData, unsigned nSkip, int nBy
auto average = 0;
for (auto avgIndex = nSkip; avgIndex; --avgIndex)
{
average += static_cast<unsigned __int8>(*src) - 128;
average += static_cast<uint8_t>(*src) - 128;
src += nChannels;
}
*dst++ = static_cast<char>(average / nSkip + 128);
@ -2402,8 +2401,8 @@ void WaveMix::AvgSample(HPSTR lpOutData, HPSTR lpInData, unsigned nSkip, int nBy
}
else
{
auto src = reinterpret_cast<__int16*>(lpInData);
auto dst = reinterpret_cast<__int16*>(lpOutData);
auto src = reinterpret_cast<int16_t*>(lpInData);
auto dst = reinterpret_cast<int16_t*>(lpOutData);
for (auto channelIndex = nChannels; channelIndex; --channelIndex)
{
auto curSrc = src++;
@ -2422,8 +2421,8 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
{
if (nBytesPerSample == 1)
{
auto src = reinterpret_cast<unsigned __int8*>(lpInData);
auto dst = reinterpret_cast<unsigned __int8*>(lpOutData);
auto src = reinterpret_cast<uint8_t*>(lpInData);
auto dst = reinterpret_cast<uint8_t*>(lpOutData);
for (auto channelIndex = nChannels; channelIndex; --channelIndex)
{
auto sample = *src;
@ -2442,8 +2441,8 @@ void WaveMix::RepSample(HPSTR lpOutData, HPSTR lpInData, unsigned nRep, int nByt
}
else
{
auto src = reinterpret_cast<__int16*>(lpInData);
auto dst = reinterpret_cast<__int16*>(lpOutData);
auto src = reinterpret_cast<int16_t*>(lpInData);
auto dst = reinterpret_cast<int16_t*>(lpOutData);
for (auto channelIndex2 = nChannels; channelIndex2; channelIndex2--)
{
auto sample = *src;
@ -2534,8 +2533,8 @@ void WaveMix::ResetWavePosIfNoChannelData()
}
}
void WaveMix::cmixit(unsigned __int8* lpDest, unsigned __int8** rgWaveSrc, volume_struct* volumeArr, int iNumWaves,
unsigned __int16 length)
void WaveMix::cmixit(uint8_t* lpDest, uint8_t** rgWaveSrc, volume_struct* volumeArr, int iNumWaves,
uint16_t length)
{
if (!length)
return;
@ -2614,9 +2613,9 @@ LRESULT WaveMix::WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
INT_PTR WaveMix::SettingsDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
if (Msg == WM_INITDIALOG)
return Settings_OnInitDialog(hWnd, wParam, (MIXCONFIG*)lParam);
return Settings_OnInitDialog(hWnd, wParam, reinterpret_cast<MIXCONFIG*>(lParam));
if (Msg != WM_COMMAND)
return 0;
Settings_OnCommand(hWnd, static_cast<unsigned __int16>(wParam), lParam, HIWORD(wParam));
Settings_OnCommand(hWnd, LOWORD(wParam), lParam, HIWORD(wParam));
return 1;
}

View File

@ -1,5 +1,6 @@
#pragma once
/* flag values for play params */
#define WMIX_QUEUEWAVE 0x00
#define WMIX_CLEARQUEUE 0x01
@ -15,8 +16,8 @@ struct GLOBALS;
struct volume_struct
{
unsigned __int16 L;
unsigned __int16 R;
uint16_t L;
uint16_t R;
};
@ -59,14 +60,14 @@ struct MIXCONFIG
DWORD dwFlags;
WORD wChannels;
WORD wSamplingRate;
unsigned __int16 WaveBlockCount;
unsigned __int16 WaveBlockLen;
__int16 CmixPtrDefaultFlag;
unsigned __int16 ResetMixDefaultFlag;
unsigned __int16 GoodWavePos;
unsigned __int16 wDeviceID;
unsigned __int16 PauseBlocks;
__int16 ShowDebugDialogs;
uint16_t WaveBlockCount;
uint16_t WaveBlockLen;
int16_t CmixPtrDefaultFlag;
uint16_t ResetMixDefaultFlag;
uint16_t GoodWavePos;
uint16_t wDeviceID;
uint16_t PauseBlocks;
int16_t ShowDebugDialogs;
HKEY RegistryKey;
};
@ -88,14 +89,14 @@ struct PLAYQUEUE
struct GLOBALS
{
WORD wMagic1;
__int16 unknown0;
int16_t unknown0;
HWND hWndApp;
int unknown2;
HWAVEOUT hWaveOut;
int fActive;
int SettingsDialogActiveFlag;
unsigned int wDeviceID;
char szDevicePName[96];
char szDevicePName[96];
WAVEOUTCAPSA WaveoutCaps;
volume_struct DefaultVolume;
volume_struct ChannelVolume[MAXCHANNELS];
@ -112,13 +113,13 @@ struct GLOBALS
DWORD dwBaseTime;
int fGoodGetPos;
DWORD dwWaveOutPos;
void (*CmixPtr)(unsigned __int8* lpDest, unsigned __int8** rgWaveSrc, volume_struct* volume, int iNumWaves,
unsigned __int16 length);
void (*CmixPtr)(uint8_t* lpDest, uint8_t** rgWaveSrc, volume_struct* volume, int iNumWaves,
uint16_t length);
int (* pfnRemix)(DWORD, CHANNELNODE*);
DWORD (* pfnSampleAdjust)(DWORD, DWORD);
CHANNELNODE* pWaitList;
__int16 wMagic2;
__int16 unknown112;
int16_t wMagic2;
int16_t unknown112;
};
struct dialog_template
@ -182,16 +183,16 @@ private:
static DWORD SubFactor(DWORD a1, DWORD a2);
static DWORD AddFactor(DWORD a1, DWORD a2);
static dialog_template* MakeSettingsDlgTemplate();
static dialog_template* MakeDlgTemplate(unsigned* totalSize, unsigned style, __int16 x, __int16 y, __int16 cx,
__int16 cy,
static dialog_template* MakeDlgTemplate(size_t* totalSize, unsigned style, int16_t x, int16_t y, int16_t cx,
int16_t cy,
const wchar_t* String);
static dialog_template* AddDlgControl(unsigned int* totalSize, dialog_template* dlgTemplate, __int16 idClass,
static dialog_template* AddDlgControl(size_t* totalSize, dialog_template* dlgTemplate, int16_t idClass,
unsigned style,
WORD id, __int16 x, __int16 y, __int16 cx, __int16 cy,
WORD id, int16_t x, int16_t y, int16_t cx, int16_t cy,
const wchar_t* String);
static void DestroySettingsDlgTemplate(LPCVOID pMem);
static int Settings_OnInitDialog(HWND hWnd, int wParam, MIXCONFIG* lpMixconfig);
static int Settings_OnCommand(HWND hWnd, int command, int lParam, int wParam);
static int Settings_OnInitDialog(HWND hWnd, WPARAM wParam, MIXCONFIG* lpMixconfig);
static int Settings_OnCommand(HWND hWnd, int command, LPARAM lParam, int wParam);
static int ReadRegistryToGetMachineSpecificInfSection(unsigned wDeviceId, LPSTR lpString1, int maxLength);
static const char* GetOperatingSystemPrefix();
static unsigned int FigureOutDMABufferSize(unsigned int waveBlockLen, PCMWAVEFORMAT* pcm);
@ -215,8 +216,8 @@ private:
static int HasCurrentOutputFormat(MIXWAVE* lpMixWave);
static CHANNELNODE* GetChannelNode();
static void ResetWavePosIfNoChannelData();
static void cmixit(unsigned __int8* lpDest, unsigned __int8** rgWaveSrc, volume_struct* volumeArr, int iNumWaves,
unsigned __int16 length);
static void cmixit(uint8_t* lpDest, uint8_t** rgWaveSrc, volume_struct* volumeArr, int iNumWaves,
uint16_t length);
static LRESULT __stdcall WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
static INT_PTR __stdcall SettingsDlgProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam);
@ -226,8 +227,8 @@ private:
static CHANNELNODE* free_channel_nodes;
static unsigned char volume_table[11][256];
static int debug_flag;
static void (*cmixit_ptr)(unsigned __int8* lpDest, unsigned __int8** rgWaveSrc, volume_struct* volume,
int iNumWaves, unsigned __int16 length);
static void (*cmixit_ptr)(uint8_t* lpDest, uint8_t** rgWaveSrc, volume_struct* volume,
int iNumWaves, uint16_t length);
static HMODULE HModule;
static GLOBALS *Globals, *GlobalsActive;
static PCMWAVEFORMAT gpFormat;

View File

@ -1922,7 +1922,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
}
case 64:
{
auto score = reinterpret_cast<int>(caller);
auto score = reinterpret_cast<size_t>(caller);
if (score)
{
sprintf_s(Buffer, pinball::get_rc_string(82, 0), score);
@ -2230,7 +2230,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
case 4:
{
control_hyper_lights_tag.Component->Message(0, 0.0);
auto addedScore = TableG->AddScore(caller->get_scoring(4));
size_t addedScore = TableG->AddScore(caller->get_scoring(4));
GravityWellKickoutControl(64, reinterpret_cast<TPinballComponent*>(addedScore));
break;
}

View File

@ -316,36 +316,32 @@ void fullscrn::activate(int flag)
}
}
void fullscrn::fillRect(int right, int bottom)
void fullscrn::fillRect(int right, int bottom, int left, int top)
{
// Weird reg usage, should be zero
int v2 = 0;
int v3 = 0;
RECT rc;
HGDIOBJ brush = CreateSolidBrush(0);
auto brush = CreateSolidBrush(0);
if (brush)
{
HDC dc = winmain::_GetDC(hWnd);
HGDIOBJ brushHandle = SelectObject(dc, brush);
auto dc = winmain::_GetDC(hWnd);
auto prevBrush = SelectObject(dc, brush);
if (dc)
{
rc.right = right + v2 + 1;
rc.bottom = bottom + v3 + 1;
rc.left = v2;
rc.top = v3;
FillRect(dc, &rc, static_cast<HBRUSH>(brush));
rc.right = left + right + 1;
rc.bottom = top + bottom + 1;
rc.left = left;
rc.top = top;
FillRect(dc, &rc, brush);
ReleaseDC(hWnd, dc);
}
SelectObject(dc, brushHandle);
SelectObject(dc, prevBrush);
DeleteObject(brush);
}
}
unsigned fullscrn::convert_mouse_pos(unsigned int mouseXY)
{
unsigned __int16 x = mouseXY & 0xffFF - render::vscreen.XPosition;
unsigned __int16 y = (mouseXY >> 16) - render::vscreen.YPosition;
uint16_t x = mouseXY & 0xffFF - render::vscreen.XPosition;
uint16_t y = (mouseXY >> 16) - render::vscreen.YPosition;
return x | y << 16;
}
@ -369,7 +365,7 @@ void fullscrn::paint()
if (fullscrn_flag1 & 1)
{
menuHeight = GetSystemMetrics(SM_CYMENU);
fillRect(WindowRect1.right - 1, menuHeight);
fillRect(WindowRect1.right - 1, menuHeight, 0, 0);
}
}
else
@ -378,7 +374,7 @@ void fullscrn::paint()
menuHeight = GetSystemMetrics(SM_CYMENU);
else
menuHeight = 0;
fillRect(WindowRect1.right, menuHeight + WindowRect1.bottom);
fillRect(WindowRect1.right, menuHeight + WindowRect1.bottom, 0, 0);
}
}
render::paint();
@ -430,8 +426,8 @@ int fullscrn::get_max_supported_resolution()
int fullscrn::get_screen_resolution()
{
auto height = static_cast<unsigned __int16>(GetSystemMetrics(SM_CYSCREEN));
return static_cast<unsigned __int16>(GetSystemMetrics(SM_CXSCREEN)) | (height << 16);
auto height = static_cast<uint16_t>(GetSystemMetrics(SM_CYSCREEN));
return static_cast<uint16_t>(GetSystemMetrics(SM_CXSCREEN)) | (height << 16);
}
void fullscrn::window_size_changed()

View File

@ -8,11 +8,11 @@
struct resolution_info
{
__int16 ScreenWidth;
__int16 ScreenHeight;
__int16 TableWidth;
__int16 TableHeight;
__int16 ResolutionMenuId;
int16_t ScreenWidth;
int16_t ScreenHeight;
int16_t TableWidth;
int16_t TableHeight;
int16_t ResolutionMenuId;
};
class fullscrn
@ -62,5 +62,5 @@ private :
static int setWindowFlagsDisDlg();
static int enableFullscreen();
static int disableFullscreen();
static void fillRect(int right, int bottom);
static void fillRect(int right, int bottom, int left, int top);
};

View File

@ -40,7 +40,7 @@ void gdrv::get_focus()
}
BITMAPINFO* gdrv::DibCreate(__int16 bpp, int width, int height)
BITMAPINFO* gdrv::DibCreate(int16_t bpp, int width, int height)
{
auto sizeBytes = height * (width * bpp / 8 + 3 & 0xFFFFFFFC);
auto buf = GlobalAlloc(GHND, sizeBytes + sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));

View File

@ -45,7 +45,7 @@ public:
static int init(HINSTANCE hInst, HWND hWnd);
static int uninit();
static void get_focus();
static BITMAPINFO* DibCreate(__int16 bpp, int width, int height);
static BITMAPINFO* DibCreate(int16_t bpp, int width, int height);
static void DibSetUsage(BITMAPINFO* dib, HPALETTE hpal, int someFlag);
static int create_bitmap_dib(gdrv_bitmap8* bmp, int width, int height);
static int create_bitmap(gdrv_bitmap8* bmp, int width, int height);

View File

@ -89,7 +89,7 @@ void loader::loadfrom(datFileStruct* datFile)
for (auto groupIndex = 0; groupIndex < datFile->NumberOfGroups; ++groupIndex)
{
auto value = reinterpret_cast<__int16*>(partman::field(datFile, groupIndex, datFieldTypes::ShortValue));
auto value = reinterpret_cast<int16_t*>(partman::field(datFile, groupIndex, datFieldTypes::ShortValue));
if (value && *value == 202)
{
if (sound_count < 65)
@ -116,7 +116,7 @@ void loader::unload()
int loader::get_sound_id(int groupIndex)
{
__int16 soundIndex = 1;
int16_t soundIndex = 1;
if (sound_count <= 1)
{
error(25, 26);
@ -139,7 +139,7 @@ int loader::get_sound_id(int groupIndex)
sound_list[soundIndex].Duration = 0.0;
if (soundGroupId > 0 && !pinball::quickFlag)
{
auto value = reinterpret_cast<__int16*>(partman::field(loader_table, soundGroupId,
auto value = reinterpret_cast<int16_t*>(partman::field(loader_table, soundGroupId,
datFieldTypes::ShortValue));
if (value && *value == 202)
{
@ -173,7 +173,7 @@ short loader::query_visual_states(int groupIndex)
short result;
if (groupIndex < 0)
return error(0, 17);
auto shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortArray));
auto shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortArray));
if (shortArr && *shortArr == 100)
result = shortArr[1];
else
@ -192,7 +192,7 @@ char* loader::query_name(int groupIndex)
return partman::field(loader_table, groupIndex, datFieldTypes::GroupName);
}
__int16* loader::query_iattribute(int groupIndex, int firstValue, int* arraySize)
int16_t* loader::query_iattribute(int groupIndex, int firstValue, int* arraySize)
{
if (groupIndex < 0)
{
@ -202,7 +202,7 @@ __int16* loader::query_iattribute(int groupIndex, int firstValue, int* arraySize
for (auto skipIndex = 0;; ++skipIndex)
{
auto shortArr = reinterpret_cast<__int16*>(partman::field_nth(loader_table, groupIndex,
auto shortArr = reinterpret_cast<int16_t*>(partman::field_nth(loader_table, groupIndex,
datFieldTypes::ShortArray, skipIndex));
if (!shortArr)
break;
@ -239,7 +239,7 @@ float* loader::query_float_attribute(int groupIndex, int groupIndexOffset, int f
skipIndex));
if (!floatArr)
break;
if (static_cast<__int16>(floor(*floatArr)) == firstValue)
if (static_cast<int16_t>(floor(*floatArr)) == firstValue)
return floatArr + 1;
}
@ -268,7 +268,7 @@ float loader::query_float_attribute(int groupIndex, int groupIndexOffset, int fi
datFieldTypes::FloatArray, skipIndex));
if (!floatArr)
break;
if (static_cast<__int16>(floor(*floatArr)) == firstValue)
if (static_cast<int16_t>(floor(*floatArr)) == firstValue)
return floatArr[1];
}
@ -282,7 +282,7 @@ int loader::material(int groupIndex, visualStruct* visual)
{
if (groupIndex < 0)
return error(0, 21);
auto shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
auto shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
if (!shortArr)
return error(1, 21);
if (*shortArr != 300)
@ -326,7 +326,7 @@ int loader::state_id(int groupIndex, int groupIndexOffset)
auto visualState = query_visual_states(groupIndex);
if (visualState <= 0)
return error(12, 24);
auto shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
auto shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
if (!shortArr)
return error(1, 24);
if (*shortArr != 200)
@ -337,7 +337,7 @@ int loader::state_id(int groupIndex, int groupIndexOffset)
return groupIndex;
groupIndex += groupIndexOffset;
shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
if (!shortArr)
return error(1, 24);
if (*shortArr != 201)
@ -349,7 +349,7 @@ int loader::kicker(int groupIndex, visualKickerStruct* kicker)
{
if (groupIndex < 0)
return error(0, 20);
auto shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
auto shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, groupIndex, datFieldTypes::ShortValue));
if (!shortArr)
return error(1, 20);
if (*shortArr != 400)
@ -417,7 +417,7 @@ int loader::query_visual(int groupIndex, int groupIndexOffset, visualStruct* vis
visual->ZMap->ZPtr2 = visual->ZMap->ZPtr1;
}
auto shortArr = reinterpret_cast<__int16*>(partman::field(loader_table, stateId, datFieldTypes::ShortArray));
auto shortArr = reinterpret_cast<int16_t*>(partman::field(loader_table, stateId, datFieldTypes::ShortArray));
if (shortArr)
{
unsigned int shortArrSize = partman::field_size(loader_table, stateId, datFieldTypes::ShortArray);

View File

@ -66,7 +66,7 @@ public:
static char* query_name(int groupIndex);
static float* query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue);
static float query_float_attribute(int groupIndex, int groupIndexOffset, int firstValue, float defVal);
static __int16* query_iattribute(int groupIndex, int firstValue, int* arraySize);
static int16_t* query_iattribute(int groupIndex, int firstValue, int* arraySize);
static float play_sound(int soundIndex);
static datFileStruct* loader_table;
private:

View File

@ -61,7 +61,7 @@ int midi::music_init(HWND hwnd)
return midi_seq1_open;
}
MCIERROR midi::restart_midi_seq(int param)
MCIERROR midi::restart_midi_seq(LPARAM param)
{
if (pb::FullTiltMode)
{

View File

@ -55,7 +55,7 @@ public:
static MCIERROR play_pb_theme(int flag);
static MCIERROR music_stop();
static int music_init(HWND hwnd);
static MCIERROR restart_midi_seq(int param);
static MCIERROR restart_midi_seq(LPARAM param);
static void music_shutdown();
private:
static tagMCI_OPEN_PARMSA mci_open_info;

View File

@ -195,72 +195,74 @@ void options::path_free()
int options::get_int(LPCSTR optPath, LPCSTR lpValueName, int defaultValue)
{
DWORD dwDisposition;
HKEY hKey;
HKEY result = (HKEY)defaultValue, Data = (HKEY)defaultValue;
auto result = defaultValue;
if (!OptionsRegPath)
return defaultValue;
LPCSTR regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, 0xF003Fu, nullptr, &result, &dwDisposition))
return result;
auto regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
{
optPath = (LPCSTR)4;
RegQueryValueExA(result, lpValueName, nullptr, nullptr, (LPBYTE)&Data, (LPDWORD)&optPath);
RegCloseKey(result);
DWORD bufferSize = 4;
RegQueryValueExA(hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(&result), &bufferSize);
RegCloseKey(hKey);
}
path_free();
return (int)Data;
return result;
}
void options::set_int(LPCSTR optPath, LPCSTR lpValueName, int data)
{
DWORD dwDisposition;
HKEY hKey;
if (OptionsRegPath)
if (!OptionsRegPath)
return;
auto regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
{
const CHAR* regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, 0xF003Fu, nullptr, (PHKEY)&optPath,
&dwDisposition))
{
RegSetValueExA((HKEY)optPath, lpValueName, 0, 4u, (const BYTE*)&data, 4u);
RegCloseKey((HKEY)optPath);
}
path_free();
RegSetValueExA(hKey, lpValueName, 0, 4u, reinterpret_cast<LPBYTE>(&data), 4u);
RegCloseKey(hKey);
}
path_free();
}
void options::get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR lpString1, LPCSTR lpString2, int iMaxLength)
void options::get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength)
{
const CHAR* v5 = (const CHAR*)iMaxLength;
lstrcpynA(lpString1, lpString2, iMaxLength);
if (OptionsRegPath)
DWORD dwDisposition;
HKEY hKey;
lstrcpynA(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))
{
const CHAR* regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, 0xF003Fu, nullptr, (PHKEY)&iMaxLength,
(LPDWORD)&optPath))
{
lpString2 = v5;
RegQueryValueExA((HKEY)iMaxLength, lpValueName, nullptr, nullptr, (LPBYTE)lpString1, (LPDWORD)&lpString2);
RegCloseKey((HKEY)iMaxLength);
}
path_free();
DWORD bufferSize = iMaxLength;
RegQueryValueExA(hKey, lpValueName, nullptr, nullptr, reinterpret_cast<LPBYTE>(dst), &bufferSize);
RegCloseKey(hKey);
}
path_free();
}
void options::set_string(LPCSTR optPath, LPCSTR lpValueName, LPCSTR value)
{
DWORD dwDisposition;
HKEY hKey;
if (OptionsRegPath)
if (!OptionsRegPath)
return;
auto regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, KEY_ALL_ACCESS, nullptr, &hKey, &dwDisposition))
{
const CHAR* regPath = path(optPath);
if (!RegCreateKeyExA(HKEY_CURRENT_USER, regPath, 0, nullptr, 0, 0xF003Fu, nullptr, (PHKEY)&optPath,
&dwDisposition))
{
int v4 = lstrlenA(value);
RegSetValueExA((HKEY)optPath, lpValueName, 0, 1u, (const BYTE*)value, v4 + 1);
RegCloseKey((HKEY)optPath);
}
path_free();
RegSetValueExA(hKey, lpValueName, 0, 1u, LPBYTE(value), lstrlenA(value) + 1);
RegCloseKey(hKey);
}
path_free();
}
@ -408,7 +410,7 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
{
short vk = *vkPtr;
auto vk2And = vk & 0x4000;
auto vkChar = static_cast<unsigned __int8>(vk);
auto vkChar = static_cast<uint8_t>(vk);
unsigned short maxVk;
if (vk2And)
@ -487,17 +489,17 @@ 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperL, CB_GETITEMDATA, ind, 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_FlipperR, CB_GETITEMDATA, ind, 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_Plunger, CB_GETITEMDATA, ind, 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpLeft, CB_GETITEMDATA, ind, 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpRight, CB_GETITEMDATA, ind, 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] = SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0);
keyBindings[5] = static_cast<int>(SendDlgItemMessageA(hDlg, KEYMAPPER_BumpBottom, CB_GETITEMDATA, ind, 0));
auto sameKeyBound = 0;
auto index = 1;
@ -569,7 +571,7 @@ INT_PTR _stdcall options::KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPAR
}
LPSTR options::get_vk_key_name(unsigned __int16 vk, LPSTR keyName)
LPSTR options::get_vk_key_name(uint16_t vk, LPSTR keyName)
{
LONG scanCode = MapVirtualKeyA(vk, MAPVK_VK_TO_VSC) << 16;
if (vk >= 0x21u && vk <= 0x2Eu)

View File

@ -35,7 +35,7 @@ public:
static void path_uninit();
static int get_int(LPCSTR optPath, LPCSTR lpValueName, int defaultValue);
static void set_int(LPCSTR optPath, LPCSTR lpValueName, int data);
static void get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR lpString1, LPCSTR lpString2, int iMaxLength);
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 menu_check(UINT uIDCheckItem, int check);
static void menu_set(UINT uIDEnableItem, int enable);
@ -45,7 +45,7 @@ public:
static void keyboard();
static INT_PTR _stdcall KeyMapDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
static LPSTR get_vk_key_name(unsigned __int16 vk, LPSTR keyName);
static LPSTR get_vk_key_name(uint16_t vk, LPSTR keyName);
static optionsStruct Options;
private:

View File

@ -1,6 +1,6 @@
#pragma once
enum class datFieldTypes : __int16
enum class datFieldTypes : int16_t
{
ShortValue = 0,
//, does not have the 32bits size value, but a 16bits value(see above).
@ -57,7 +57,7 @@ struct datEntryData
struct datGroupData
{
__int16 EntryCount;
int16_t EntryCount;
datEntryData Entries[1];
};
@ -73,10 +73,10 @@ struct datFileStruct
struct dat8BitBmpHeader
{
char Resolution;
__int16 Width;
__int16 Height;
__int16 XPosition;
__int16 YPosition;
int16_t Width;
int16_t Height;
int16_t XPosition;
int16_t YPosition;
int Size;
bmp8Flags Flags;
@ -94,12 +94,12 @@ static_assert(sizeof(dat8BitBmpHeader) == 14, "Wrong size of dat8BitBmpHeader");
#pragma pack(push, 1)
struct __declspec(align(1)) dat16BitBmpHeader
{
__int16 Width;
__int16 Height;
__int16 Stride;
int16_t Width;
int16_t Height;
int16_t Stride;
int Unknown0;
__int16 Unknown1_0;
__int16 Unknown1_1;
int16_t Unknown1_0;
int16_t Unknown1_1;
};
#pragma pack(pop)

View File

@ -480,7 +480,7 @@ void pb::keydown(int key)
break;
case 'M':
char buffer[20];
sprintf_s(buffer, "%ld", memory::use_total);
sprintf_s(buffer, "%zu", memory::use_total);
MessageBoxA(winmain::hwnd_frame, buffer, "Mem:", 0x2000u);
break;
case 'R':

View File

@ -16,6 +16,7 @@
#include <cmath>
#include <CommCtrl.h>
#include <htmlhelp.h>
#include <cstdint>
#include <type_traits> /*For control template*/
//#include <cstdlib>

View File

@ -17,7 +17,7 @@ struct render_sprite_type_struct
zmap_header_type* ZMap;
char UnknownFlag;
VisualType VisualType;
__int16 Depth;
int16_t Depth;
rectangle_type BmpRectCopy;
int ZMapOffestY;
int ZMapOffestX;

View File

@ -27,7 +27,7 @@ scoreStruct* score::create(LPCSTR fieldName, gdrv_bitmap8* renderBgBmp)
/*Full tilt: score box dimensions index is offset by resolution*/
auto dimensionsId = partman::record_labeled(pb::record_table, fieldName) + fullscrn::GetResolution();
auto dimensions = reinterpret_cast<__int16*>(partman::field(loader::loader_table, dimensionsId,
auto dimensions = reinterpret_cast<int16_t*>(partman::field(loader::loader_table, dimensionsId,
datFieldTypes::ShortArray));
if (!dimensions)
{
@ -76,7 +76,7 @@ void score::load_msg_font_3DPB(LPCSTR lpName)
if (!resGlobal)
return;
auto rcData = static_cast<__int16*>(LockResource(resGlobal));
auto rcData = static_cast<int16_t*>(LockResource(resGlobal));
auto fontp = memory::allocate<score_msg_font_type>();
msg_fontp = fontp;
@ -163,7 +163,7 @@ void score::load_msg_font_FT(LPCSTR lpName)
return;
memset(msg_fontp, 0, sizeof(score_msg_font_type));
auto gapArray = reinterpret_cast<__int16*>(partman::field(pb::record_table, groupIndex, datFieldTypes::ShortArray));
auto gapArray = reinterpret_cast<int16_t*>(partman::field(pb::record_table, groupIndex, datFieldTypes::ShortArray));
if (gapArray)
msg_fontp->GapWidth = gapArray[fullscrn::GetResolution()];
else
@ -249,8 +249,7 @@ void score::update(scoreStruct* score)
if (score->Score >= 0)
{
_ltoa_s(score->Score, scoreBuf, 10);
int len = strlen(scoreBuf);
for (int index = len - 1; index >= 0; index--)
for (ptrdiff_t index = strlen(scoreBuf) - 1; index >= 0; index--)
{
unsigned char curChar = scoreBuf[index];
curChar -= '0';

View File

@ -343,6 +343,8 @@ int winmain::WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
int wParamI = static_cast<int>(wParam);
if (Msg == iFrostUniqueMsg)
{
if (IsIconic(hWnd))
@ -478,11 +480,11 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
}
return DefWindowProcA(hWnd, Msg, wParam, lParam);
case WM_KEYUP:
pb::keyup(wParam);
pb::keyup(wParamI);
return DefWindowProcA(hWnd, Msg, wParam, lParam);
case WM_KEYDOWN:
if (!(lParam & 0x40000000))
pb::keydown(wParam);
pb::keydown(wParamI);
switch (wParam)
{
case VK_ESCAPE:
@ -507,6 +509,8 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
pause();
options::keyboard();
break;
default:
break;
}
if (!pb::cheat_mode)
return DefWindowProcA(hWnd, Msg, wParam, lParam);
@ -578,7 +582,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
auto iHwnd = reinterpret_cast<size_t>(hwnd_frame);
sprintf_s(
cmdLine,
"%s %s%lX %s%lX",
"%s %s%zX %s%zX",
tmpBuf,
"select=",
iHwnd,
@ -598,7 +602,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
case Menu1_2Players:
case Menu1_3Players:
case Menu1_4Players:
options::toggle(wParam);
options::toggle(wParamI);
new_game();
break;
case Menu1_MaximumResolution:
@ -606,7 +610,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
case Menu1_800x600:
case Menu1_1024x768:
case Menu1_WindowUniformScale:
options::toggle(wParam);
options::toggle(wParamI);
break;
case Menu1_Help_Topics:
if (!single_step)
@ -621,7 +625,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
case Menu1_Music:
if (!single_step)
pause();
options::toggle(wParam);
options::toggle(wParamI);
break;
case Menu1_Player_Controls:
case 204: // Second controls button?
@ -659,7 +663,7 @@ LRESULT CALLBACK winmain::message_handler(HWND hWnd, UINT Msg, WPARAM wParam, LP
{
mouse_down = 1;
mouse_hsave = SetCursor(nullptr);
auto mouseXY = fullscrn::convert_mouse_pos(lParam);
auto mouseXY = fullscrn::convert_mouse_pos(static_cast<unsigned>(lParam));
last_mouse_x = mouseXY & 0xffFFu;
last_mouse_y = mouseXY >> 16;
SetCapture(hWnd);
@ -733,7 +737,7 @@ int winmain::ProcessWindowMessages()
DispatchMessageA(&Msg);
if (Msg.message == 18)
{
return_value = Msg.wParam;
return_value = static_cast<int>(Msg.wParam);
return 0;
}
}
@ -744,7 +748,7 @@ int winmain::ProcessWindowMessages()
DispatchMessageA(&Msg);
if (Msg.message == 18)
{
return_value = Msg.wParam;
return_value = static_cast<int>(Msg.wParam);
return 0;
}
return 1;

View File

@ -36,7 +36,7 @@ int zdrv::destroy_zmap(zmap_header_type* zmap)
return 0;
}
void zdrv::fill(zmap_header_type* zmap, int width, int height, int xOff, int yOff, unsigned __int16 fillWord)
void zdrv::fill(zmap_header_type* zmap, int width, int height, int xOff, int yOff, uint16_t fillWord)
{
auto dstPtr = &zmap->ZPtr1[zmap->Stride * (zmap->Height - height - yOff) + xOff];
for (int y = height; y > 0; --y)
@ -92,7 +92,7 @@ void zdrv::paint(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOff, in
void zdrv::paint_flat(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOff, int dstBmpYOff,
zmap_header_type* zMap, int dstZMapXOff, int dstZMapYOff, gdrv_bitmap8* srcBmp, int srcBmpXOff,
int srcBmpYOff, unsigned __int16 depth)
int srcBmpYOff, uint16_t depth)
{
int dstHeightAbs = abs(dstBmp->Height);
int srcHeightAbs = abs(srcBmp->Height);

View File

@ -6,9 +6,9 @@ struct zmap_header_type
int Width;
int Height;
int Stride;
unsigned __int16* ZPtr1;
unsigned __int16* ZPtr2;
unsigned __int16 ZBuffer[1];
uint16_t* ZPtr1;
uint16_t* ZPtr2;
uint16_t ZBuffer[1];
};
class zdrv
@ -17,13 +17,13 @@ public:
static int pad(int width);
static int create_zmap(zmap_header_type* zmap, int width, int height);
static int destroy_zmap(zmap_header_type* zmap);
static void fill(zmap_header_type* zmap, int width, int height, int xOff, int yOff, unsigned __int16 fillWord);
static void fill(zmap_header_type* zmap, int width, int height, int xOff, int yOff, uint16_t fillWord);
static void paint(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOff, int dstBmpYOff,
zmap_header_type* dstZMap, int dstZMapXOff, int dstZMapYOff, gdrv_bitmap8* srcBmp, int srcBmpXOff,
int srcBmpYOff, zmap_header_type* srcZMap, int srcZMapXOff, int srcZMapYOff);
static void paint_flat(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOff, int dstBmpYOff,
zmap_header_type* zMap, int dstZMapXOff, int dstZMapYOff, gdrv_bitmap8* srcBmp,
int srcBmpXOff, int srcBmpYOff, unsigned __int16 depth);
int srcBmpXOff, int srcBmpYOff, uint16_t depth);
static void paint_spliced_bmp(int xPos, int yPos, gdrv_bitmap8* dstBmp, zmap_header_type* dstZmap,
gdrv_bitmap8* srcBmp);
};