mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use types from common.h
This commit is contained in:
parent
3d7cfa2772
commit
60603ae10a
|
@ -95,11 +95,11 @@ static bool TryClassifyAsS4(IStream * stream, ClassifiedFile * result)
|
|||
size_t dataLength = (size_t)stream->GetLength();
|
||||
uint8 * data = stream->ReadArray<uint8>(dataLength);
|
||||
stream->SetPosition(originalPosition);
|
||||
int fileTypeVersion = sawyercoding_detect_file_type(data, dataLength);
|
||||
sint32 fileTypeVersion = sawyercoding_detect_file_type(data, dataLength);
|
||||
Memory::Free(data);
|
||||
|
||||
int type = fileTypeVersion & FILE_TYPE_MASK;
|
||||
int version = fileTypeVersion & FILE_VERSION_MASK;
|
||||
sint32 type = fileTypeVersion & FILE_TYPE_MASK;
|
||||
sint32 version = fileTypeVersion & FILE_VERSION_MASK;
|
||||
|
||||
if (type == FILE_TYPE_SV4)
|
||||
{
|
||||
|
|
|
@ -52,8 +52,8 @@ constexpr uint32 UPDATE_TIME_MS = 25;
|
|||
|
||||
extern "C"
|
||||
{
|
||||
int gExitCode;
|
||||
int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
|
||||
sint32 gExitCode;
|
||||
sint32 gOpenRCT2StartupAction = STARTUP_ACTION_TITLE;
|
||||
utf8 gOpenRCT2StartupActionPath[512] = { 0 };
|
||||
utf8 gExePath[MAX_PATH];
|
||||
utf8 gCustomUserDataPath[MAX_PATH] = { 0 };
|
||||
|
|
|
@ -57,9 +57,9 @@ extern "C"
|
|||
#endif
|
||||
|
||||
/** The exit code for OpenRCT2 when it exits. */
|
||||
extern int gExitCode;
|
||||
extern sint32 gExitCode;
|
||||
|
||||
extern int gOpenRCT2StartupAction;
|
||||
extern sint32 gOpenRCT2StartupAction;
|
||||
extern utf8 gOpenRCT2StartupActionPath[512];
|
||||
extern utf8 gExePath[MAX_PATH];
|
||||
extern utf8 gCustomUserDataPath[MAX_PATH];
|
||||
|
@ -74,9 +74,9 @@ extern "C"
|
|||
#endif // DISABLE_NETWORK
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
extern int gNetworkStart;
|
||||
extern sint32 gNetworkStart;
|
||||
extern char gNetworkStartHost[128];
|
||||
extern int gNetworkStartPort;
|
||||
extern sint32 gNetworkStartPort;
|
||||
#endif
|
||||
|
||||
void openrct2_write_full_version_info(utf8 * buffer, size_t bufferSize);
|
||||
|
@ -85,7 +85,7 @@ extern "C"
|
|||
void openrct2_dispose();
|
||||
void openrct2_finish();
|
||||
|
||||
int cmdline_run(const char * * argv, int argc);
|
||||
sint32 cmdline_run(const char * * argv, sint32 argc);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
int RunOpenRCT2(int argc, char * * argv);
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
public:
|
||||
PlatformEnvironment(DIRBASE_VALUES basePaths)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (sint32 i = 0; i < 4; i++)
|
||||
{
|
||||
_basePath[i] = basePaths[i];
|
||||
}
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
#include <string>
|
||||
#include "common.h"
|
||||
|
||||
enum class DIRBASE : int
|
||||
enum class DIRBASE : sint32
|
||||
{
|
||||
RCT1, // Base directory for original RollerCoaster Tycoon 1 content.
|
||||
RCT2, // Base directory for original RollerCoaster Tycoon 2 content.
|
||||
OPENRCT2, // Base directory for OpenRCT2 installation.
|
||||
USER, // Base directory for OpenRCT2 user content.
|
||||
};
|
||||
constexpr int DIRBASE_COUNT = 4;
|
||||
constexpr sint32 DIRBASE_COUNT = 4;
|
||||
using DIRBASE_VALUES = std::string[DIRBASE_COUNT];
|
||||
|
||||
enum class DIRID
|
||||
|
|
|
@ -26,17 +26,17 @@ private:
|
|||
IAudioSource * _source = nullptr;
|
||||
SpeexResamplerState * _resampler = nullptr;
|
||||
|
||||
int _group = MIXER_GROUP_SOUND;
|
||||
sint32 _group = MIXER_GROUP_SOUND;
|
||||
double _rate = 0;
|
||||
uint64 _offset = 0;
|
||||
int _loop = 0;
|
||||
sint32 _loop = 0;
|
||||
|
||||
int _volume = 1;
|
||||
sint32 _volume = 1;
|
||||
float _volume_l = 0.f;
|
||||
float _volume_r = 0.f;
|
||||
float _oldvolume_l = 0.f;
|
||||
float _oldvolume_r = 0.f;
|
||||
int _oldvolume = 0;
|
||||
sint32 _oldvolume = 0;
|
||||
float _pan = 0;
|
||||
|
||||
bool _stopping = false;
|
||||
|
@ -80,12 +80,12 @@ public:
|
|||
_resampler = value;
|
||||
}
|
||||
|
||||
int GetGroup() const override
|
||||
sint32 GetGroup() const override
|
||||
{
|
||||
return _group;
|
||||
}
|
||||
|
||||
void SetGroup(int group) override
|
||||
void SetGroup(sint32 group) override
|
||||
{
|
||||
_group = group;
|
||||
}
|
||||
|
@ -110,24 +110,24 @@ public:
|
|||
if (_source != nullptr && offset < _source->GetLength())
|
||||
{
|
||||
AudioFormat format = _source->GetFormat();
|
||||
int samplesize = format.channels * format.BytesPerSample();
|
||||
sint32 samplesize = format.channels * format.BytesPerSample();
|
||||
_offset = (offset / samplesize) * samplesize;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int GetLoop() const override
|
||||
virtual sint32 GetLoop() const override
|
||||
{
|
||||
return _loop;
|
||||
}
|
||||
|
||||
virtual void SetLoop(int value) override
|
||||
virtual void SetLoop(sint32 value) override
|
||||
{
|
||||
_loop = value;
|
||||
}
|
||||
|
||||
int GetVolume() const override
|
||||
sint32 GetVolume() const override
|
||||
{
|
||||
return _volume;
|
||||
}
|
||||
|
@ -152,12 +152,12 @@ public:
|
|||
return _oldvolume_r;
|
||||
}
|
||||
|
||||
int GetOldVolume() const override
|
||||
sint32 GetOldVolume() const override
|
||||
{
|
||||
return _oldvolume;
|
||||
}
|
||||
|
||||
void SetVolume(int volume) override
|
||||
void SetVolume(sint32 volume) override
|
||||
{
|
||||
_volume = Math::Clamp(0, volume, SDL_MIX_MAXVOLUME);
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public:
|
|||
return !_done;
|
||||
}
|
||||
|
||||
void Play(IAudioSource * source, int loop) override
|
||||
void Play(IAudioSource * source, sint32 loop) override
|
||||
{
|
||||
_source = source;
|
||||
_loop = loop;
|
||||
|
|
|
@ -36,8 +36,8 @@ interface IAudioChannel
|
|||
virtual SpeexResamplerState * GetResampler() const abstract;
|
||||
virtual void SetResampler(SpeexResamplerState * value) abstract;
|
||||
|
||||
virtual int GetGroup() const abstract;
|
||||
virtual void SetGroup(int group) abstract;
|
||||
virtual sint32 GetGroup() const abstract;
|
||||
virtual void SetGroup(sint32 group) abstract;
|
||||
|
||||
virtual double GetRate() const abstract;
|
||||
virtual void SetRate(double rate) abstract;
|
||||
|
@ -45,16 +45,16 @@ interface IAudioChannel
|
|||
virtual uint64 GetOffset() const abstract;
|
||||
virtual bool SetOffset(uint64 offset) abstract;
|
||||
|
||||
virtual int GetLoop() const abstract;
|
||||
virtual void SetLoop(int value) abstract;
|
||||
virtual sint32 GetLoop() const abstract;
|
||||
virtual void SetLoop(sint32 value) abstract;
|
||||
|
||||
virtual int GetVolume() const abstract;
|
||||
virtual sint32 GetVolume() const abstract;
|
||||
virtual float GetVolumeL() const abstract;
|
||||
virtual float GetVolumeR() const abstract;
|
||||
virtual float GetOldVolumeL() const abstract;
|
||||
virtual float GetOldVolumeR() const abstract;
|
||||
virtual int GetOldVolume() const abstract;
|
||||
virtual void SetVolume(int volume) abstract;
|
||||
virtual sint32 GetOldVolume() const abstract;
|
||||
virtual void SetVolume(sint32 volume) abstract;
|
||||
|
||||
virtual float GetPan() const abstract;
|
||||
virtual void SetPan(float pan) abstract;
|
||||
|
@ -72,7 +72,7 @@ interface IAudioChannel
|
|||
|
||||
virtual bool IsPlaying() const abstract;
|
||||
|
||||
virtual void Play(IAudioSource * source, int loop = MIXER_LOOP_NONE) abstract;
|
||||
virtual void Play(IAudioSource * source, sint32 loop = MIXER_LOOP_NONE) abstract;
|
||||
virtual void UpdateOldVolume() abstract;
|
||||
|
||||
virtual AudioFormat GetFormat() const abstract;
|
||||
|
|
|
@ -25,16 +25,16 @@
|
|||
*/
|
||||
struct AudioFormat
|
||||
{
|
||||
int freq;
|
||||
sint32 freq;
|
||||
SDL_AudioFormat format;
|
||||
int channels;
|
||||
sint32 channels;
|
||||
|
||||
int BytesPerSample() const
|
||||
sint32 BytesPerSample() const
|
||||
{
|
||||
return (SDL_AUDIO_BITSIZE(format)) / 8;
|
||||
}
|
||||
|
||||
int GetByteRate() const
|
||||
sint32 GetByteRate() const
|
||||
{
|
||||
return BytesPerSample() * channels;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ public:
|
|||
want.format = AUDIO_S16SYS;
|
||||
want.channels = 2;
|
||||
want.samples = 1024;
|
||||
want.callback = [](void * arg, uint8 * dst, int length) -> void
|
||||
want.callback = [](void * arg, uint8 * dst, sint32 length) -> void
|
||||
{
|
||||
auto mixer = static_cast<AudioMixer *>(arg);
|
||||
mixer->GetNextAudioChunk(dst, (size_t)length);
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
SDL_UnlockAudioDevice(_deviceId);
|
||||
}
|
||||
|
||||
IAudioChannel * Play(IAudioSource * source, int loop, bool deleteondone, bool deletesourceondone) override
|
||||
IAudioChannel * Play(IAudioSource * source, sint32 loop, bool deleteondone, bool deletesourceondone) override
|
||||
{
|
||||
Lock();
|
||||
IAudioChannel * channel = AudioChannel::Create();
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
IAudioSource * source = _musicSources[pathId];
|
||||
if (source == nullptr)
|
||||
{
|
||||
const utf8 * path = get_file_path((int)pathId);
|
||||
const utf8 * path = get_file_path((sint32)pathId);
|
||||
source = AudioSource::CreateMemoryFromWAV(path, &_format);
|
||||
if (source == nullptr)
|
||||
{
|
||||
|
@ -221,12 +221,12 @@ public:
|
|||
_volume = volume;
|
||||
}
|
||||
|
||||
IAudioSource * GetSoundSource(int id) override
|
||||
IAudioSource * GetSoundSource(sint32 id) override
|
||||
{
|
||||
return _css1Sources[id];
|
||||
}
|
||||
|
||||
IAudioSource * GetMusicSource(int id) override
|
||||
IAudioSource * GetMusicSource(sint32 id) override
|
||||
{
|
||||
return _musicSources[id];
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ private:
|
|||
{
|
||||
IAudioChannel * channel = *it;
|
||||
|
||||
int group = channel->GetGroup();
|
||||
sint32 group = channel->GetGroup();
|
||||
if (group != MIXER_GROUP_SOUND || gConfigSound.sound_enabled)
|
||||
{
|
||||
MixChannel(channel, dst, length);
|
||||
|
@ -293,8 +293,8 @@ private:
|
|||
|
||||
void MixChannel(IAudioChannel * channel, uint8 * data, size_t length)
|
||||
{
|
||||
int byteRate = _format.GetByteRate();
|
||||
int numSamples = (int)(length / byteRate);
|
||||
sint32 byteRate = _format.GetByteRate();
|
||||
sint32 numSamples = (sint32)(length / byteRate);
|
||||
double rate = 1;
|
||||
if (_format.format == AUDIO_S16SYS)
|
||||
{
|
||||
|
@ -316,7 +316,7 @@ private:
|
|||
}
|
||||
|
||||
// Read raw PCM from channel
|
||||
int readSamples = (int)(numSamples * rate);
|
||||
sint32 readSamples = (sint32)(numSamples * rate);
|
||||
size_t readLength = (size_t)(readSamples / cvt.len_ratio) * byteRate;
|
||||
_channelBuffer.EnsureCapacity(readLength);
|
||||
size_t bytesRead = channel->Read(_channelBuffer.GetData(), readLength);
|
||||
|
@ -345,15 +345,15 @@ private:
|
|||
// Apply effects
|
||||
if (rate != 1)
|
||||
{
|
||||
int srcSamples = (int)(bufferLen / byteRate);
|
||||
int dstSamples = numSamples;
|
||||
sint32 srcSamples = (sint32)(bufferLen / byteRate);
|
||||
sint32 dstSamples = numSamples;
|
||||
bufferLen = ApplyResample(channel, buffer, srcSamples, dstSamples);
|
||||
buffer = _effectBuffer.GetData();
|
||||
}
|
||||
|
||||
// Apply panning and volume
|
||||
ApplyPan(channel, buffer, bufferLen, byteRate);
|
||||
int mixVolume = ApplyVolume(channel, buffer, bufferLen);
|
||||
sint32 mixVolume = ApplyVolume(channel, buffer, bufferLen);
|
||||
|
||||
// Finally mix on to destination buffer
|
||||
size_t dstLength = Math::Min(length, bufferLen);
|
||||
|
@ -366,9 +366,9 @@ private:
|
|||
* Resample the given buffer into _effectBuffer.
|
||||
* Assumes that srcBuffer is the same format as _format.
|
||||
*/
|
||||
size_t ApplyResample(IAudioChannel * channel, const void * srcBuffer, int srcSamples, int dstSamples)
|
||||
size_t ApplyResample(IAudioChannel * channel, const void * srcBuffer, sint32 srcSamples, sint32 dstSamples)
|
||||
{
|
||||
int byteRate = _format.GetByteRate();
|
||||
sint32 byteRate = _format.GetByteRate();
|
||||
|
||||
// Create resampler
|
||||
SpeexResamplerState * resampler = channel->GetResampler();
|
||||
|
@ -401,16 +401,16 @@ private:
|
|||
{
|
||||
switch (_format.format) {
|
||||
case AUDIO_S16SYS:
|
||||
EffectPanS16(channel, (sint16 *)buffer, (int)(len / sampleSize));
|
||||
EffectPanS16(channel, (sint16 *)buffer, (sint32)(len / sampleSize));
|
||||
break;
|
||||
case AUDIO_U8:
|
||||
EffectPanU8(channel, (uint8 *)buffer, (int)(len / sampleSize));
|
||||
EffectPanU8(channel, (uint8 *)buffer, (sint32)(len / sampleSize));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ApplyVolume(const IAudioChannel * channel, void * buffer, size_t len)
|
||||
sint32 ApplyVolume(const IAudioChannel * channel, void * buffer, size_t len)
|
||||
{
|
||||
float volumeAdjust = _volume;
|
||||
volumeAdjust *= (gConfigSound.master_volume / 100.0f);
|
||||
|
@ -429,21 +429,21 @@ private:
|
|||
break;
|
||||
}
|
||||
|
||||
int startVolume = (int)(channel->GetOldVolume() * volumeAdjust);
|
||||
int endVolume = (int)(channel->GetVolume() * volumeAdjust);
|
||||
sint32 startVolume = (sint32)(channel->GetOldVolume() * volumeAdjust);
|
||||
sint32 endVolume = (sint32)(channel->GetVolume() * volumeAdjust);
|
||||
if (channel->IsStopping())
|
||||
{
|
||||
endVolume = 0;
|
||||
}
|
||||
|
||||
int mixVolume = (int)(channel->GetVolume() * volumeAdjust);
|
||||
sint32 mixVolume = (sint32)(channel->GetVolume() * volumeAdjust);
|
||||
if (startVolume != endVolume)
|
||||
{
|
||||
// Set to max since we are adjusting the volume ourselves
|
||||
mixVolume = SDL_MIX_MAXVOLUME;
|
||||
|
||||
// Fade between volume levels to smooth out sound and minimize clicks from sudden volume changes
|
||||
int fadeLength = (int)len / _format.BytesPerSample();
|
||||
sint32 fadeLength = (sint32)len / _format.BytesPerSample();
|
||||
switch (_format.format) {
|
||||
case AUDIO_S16SYS:
|
||||
EffectFadeS16((sint16 *)buffer, fadeLength, startVolume, endVolume);
|
||||
|
@ -456,7 +456,7 @@ private:
|
|||
return mixVolume;
|
||||
}
|
||||
|
||||
static void EffectPanS16(const IAudioChannel * channel, sint16 * data, int length)
|
||||
static void EffectPanS16(const IAudioChannel * channel, sint16 * data, sint32 length)
|
||||
{
|
||||
const float dt = 1.0f / (length * 2);
|
||||
float volumeL = channel->GetOldVolumeL();
|
||||
|
@ -464,7 +464,7 @@ private:
|
|||
const float d_left = dt * (channel->GetVolumeL() - channel->GetOldVolumeL());
|
||||
const float d_right = dt * (channel->GetVolumeR() - channel->GetOldVolumeR());
|
||||
|
||||
for (int i = 0; i < length * 2; i += 2)
|
||||
for (sint32 i = 0; i < length * 2; i += 2)
|
||||
{
|
||||
data[i] = (sint16)(data[i] * volumeL);
|
||||
data[i + 1] = (sint16)(data[i + 1] * volumeR);
|
||||
|
@ -473,14 +473,14 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
static void EffectPanU8(const IAudioChannel * channel, uint8 * data, int length)
|
||||
static void EffectPanU8(const IAudioChannel * channel, uint8 * data, sint32 length)
|
||||
{
|
||||
float volumeL = channel->GetVolumeL();
|
||||
float volumeR = channel->GetVolumeR();
|
||||
float oldVolumeL = channel->GetOldVolumeL();
|
||||
float oldVolumeR = channel->GetOldVolumeR();
|
||||
|
||||
for (int i = 0; i < length * 2; i += 2)
|
||||
for (sint32 i = 0; i < length * 2; i += 2)
|
||||
{
|
||||
float t = (float)i / (length * 2);
|
||||
data[i] = (uint8)(data[i] * ((1.0 - t) * oldVolumeL + t * volumeL));
|
||||
|
@ -488,22 +488,22 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
static void EffectFadeS16(sint16 * data, int length, int startvolume, int endvolume)
|
||||
static void EffectFadeS16(sint16 * data, sint32 length, sint32 startvolume, sint32 endvolume)
|
||||
{
|
||||
float startvolume_f = (float)startvolume / SDL_MIX_MAXVOLUME;
|
||||
float endvolume_f = (float)endvolume / SDL_MIX_MAXVOLUME;
|
||||
for (int i = 0; i < length; i++)
|
||||
for (sint32 i = 0; i < length; i++)
|
||||
{
|
||||
float t = (float)i / length;
|
||||
data[i] = (sint16)(data[i] * ((1 - t) * startvolume_f + t * endvolume_f));
|
||||
}
|
||||
}
|
||||
|
||||
static void EffectFadeU8(uint8* data, int length, int startvolume, int endvolume)
|
||||
static void EffectFadeU8(uint8* data, sint32 length, sint32 startvolume, sint32 endvolume)
|
||||
{
|
||||
float startvolume_f = (float)startvolume / SDL_MIX_MAXVOLUME;
|
||||
float endvolume_f = (float)endvolume / SDL_MIX_MAXVOLUME;
|
||||
for (int i = 0; i < length; i++)
|
||||
for (sint32 i = 0; i < length; i++)
|
||||
{
|
||||
float t = (float)i / length;
|
||||
data[i] = (uint8)(data[i] * ((1 - t) * startvolume_f + t * endvolume_f));
|
||||
|
@ -520,7 +520,7 @@ private:
|
|||
_convertBuffer.EnsureCapacity(reqConvertBufferCapacity);
|
||||
Memory::Copy(_convertBuffer.GetData(), src, len);
|
||||
|
||||
cvt->len = (int)len;
|
||||
cvt->len = (sint32)len;
|
||||
cvt->buf = (uint8 *)_convertBuffer.GetData();
|
||||
if (SDL_ConvertAudio(cvt) >= 0)
|
||||
{
|
||||
|
@ -540,7 +540,7 @@ void Mixer_Init(const char * device)
|
|||
}
|
||||
}
|
||||
|
||||
void * Mixer_Play_Effect(size_t id, int loop, int volume, float pan, double rate, int deleteondone)
|
||||
void * Mixer_Play_Effect(size_t id, sint32 loop, sint32 volume, float pan, double rate, sint32 deleteondone)
|
||||
{
|
||||
IAudioChannel * channel = nullptr;
|
||||
if (!gOpenRCT2Headless && gConfigSound.sound_enabled)
|
||||
|
@ -553,7 +553,7 @@ void * Mixer_Play_Effect(size_t id, int loop, int volume, float pan, double rate
|
|||
{
|
||||
IAudioMixer * mixer = gMixer;
|
||||
mixer->Lock();
|
||||
IAudioSource * source = mixer->GetSoundSource((int)id);
|
||||
IAudioSource * source = mixer->GetSoundSource((sint32)id);
|
||||
channel = mixer->Play(source, loop, deleteondone != 0, false);
|
||||
if (channel != nullptr)
|
||||
{
|
||||
|
@ -575,7 +575,7 @@ void Mixer_Stop_Channel(void * channel)
|
|||
}
|
||||
}
|
||||
|
||||
void Mixer_Channel_Volume(void * channel, int volume)
|
||||
void Mixer_Channel_Volume(void * channel, sint32 volume)
|
||||
{
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
|
@ -605,7 +605,7 @@ void Mixer_Channel_Rate(void* channel, double rate)
|
|||
}
|
||||
}
|
||||
|
||||
int Mixer_Channel_IsPlaying(void * channel)
|
||||
sint32 Mixer_Channel_IsPlaying(void * channel)
|
||||
{
|
||||
bool isPlaying = false;
|
||||
if (!gOpenRCT2Headless)
|
||||
|
@ -625,9 +625,9 @@ uint64 Mixer_Channel_GetOffset(void * channel)
|
|||
return offset;
|
||||
}
|
||||
|
||||
int Mixer_Channel_SetOffset(void * channel, uint64 offset)
|
||||
sint32 Mixer_Channel_SetOffset(void * channel, uint64 offset)
|
||||
{
|
||||
int result = 0;
|
||||
sint32 result = 0;
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
result = static_cast<IAudioChannel*>(channel)->SetOffset(offset);
|
||||
|
@ -635,7 +635,7 @@ int Mixer_Channel_SetOffset(void * channel, uint64 offset)
|
|||
return result;
|
||||
}
|
||||
|
||||
void Mixer_Channel_SetGroup(void * channel, int group)
|
||||
void Mixer_Channel_SetGroup(void * channel, sint32 group)
|
||||
{
|
||||
if (!gOpenRCT2Headless)
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ void Mixer_Channel_SetGroup(void * channel, int group)
|
|||
}
|
||||
}
|
||||
|
||||
void * Mixer_Play_Music(int pathId, int loop, int streaming)
|
||||
void * Mixer_Play_Music(sint32 pathId, sint32 loop, sint32 streaming)
|
||||
{
|
||||
IAudioChannel * channel = nullptr;
|
||||
if (!gOpenRCT2Headless)
|
||||
|
|
|
@ -56,13 +56,13 @@ interface IAudioMixer
|
|||
virtual void Close() abstract;
|
||||
virtual void Lock() abstract;
|
||||
virtual void Unlock() abstract;
|
||||
virtual IAudioChannel * Play(IAudioSource * source, int loop, bool deleteondone, bool deletesourceondone) abstract;
|
||||
virtual IAudioChannel * Play(IAudioSource * source, sint32 loop, bool deleteondone, bool deletesourceondone) abstract;
|
||||
virtual void Stop(IAudioChannel * channel) abstract;
|
||||
virtual bool LoadMusic(size_t pathid) abstract;
|
||||
virtual void SetVolume(float volume) abstract;
|
||||
|
||||
virtual IAudioSource * GetSoundSource(int id) abstract;
|
||||
virtual IAudioSource * GetMusicSource(int id) abstract;
|
||||
virtual IAudioSource * GetSoundSource(sint32 id) abstract;
|
||||
virtual IAudioSource * GetMusicSource(sint32 id) abstract;
|
||||
};
|
||||
|
||||
extern "C"
|
||||
|
@ -77,21 +77,21 @@ extern "C"
|
|||
#endif
|
||||
|
||||
void Mixer_Init(const char* device);
|
||||
void* Mixer_Play_Effect(size_t id, int loop, int volume, float pan, double rate, int deleteondone);
|
||||
void* Mixer_Play_Effect(size_t id, sint32 loop, sint32 volume, float pan, double rate, sint32 deleteondone);
|
||||
void Mixer_Stop_Channel(void* channel);
|
||||
void Mixer_Channel_Volume(void* channel, int volume);
|
||||
void Mixer_Channel_Volume(void* channel, sint32 volume);
|
||||
void Mixer_Channel_Pan(void* channel, float pan);
|
||||
void Mixer_Channel_Rate(void* channel, double rate);
|
||||
int Mixer_Channel_IsPlaying(void* channel);
|
||||
sint32 Mixer_Channel_IsPlaying(void* channel);
|
||||
uint64 Mixer_Channel_GetOffset(void* channel);
|
||||
int Mixer_Channel_SetOffset(void* channel, uint64 offset);
|
||||
void Mixer_Channel_SetGroup(void* channel, int group);
|
||||
void* Mixer_Play_Music(int pathId, int loop, int streaming);
|
||||
sint32 Mixer_Channel_SetOffset(void* channel, uint64 offset);
|
||||
void Mixer_Channel_SetGroup(void* channel, sint32 group);
|
||||
void* Mixer_Play_Music(sint32 pathId, sint32 loop, sint32 streaming);
|
||||
void Mixer_SetVolume(float volume);
|
||||
|
||||
static inline int DStoMixerVolume(int volume) { return (int)(SDL_MIX_MAXVOLUME * (SDL_pow(10, (float)volume / 2000))); }
|
||||
static inline float DStoMixerPan(int pan) { return (((float)pan + -DSBPAN_LEFT) / DSBPAN_RIGHT) / 2; }
|
||||
static inline double DStoMixerRate(int frequency) { return (double)frequency / 22050; }
|
||||
static inline sint32 DStoMixerVolume(sint32 volume) { return (sint32)(SDL_MIX_MAXVOLUME * (SDL_pow(10, (float)volume / 2000))); }
|
||||
static inline float DStoMixerPan(sint32 pan) { return (((float)pan + -DSBPAN_LEFT) / DSBPAN_RIGHT) / 2; }
|
||||
static inline double DStoMixerRate(sint32 frequency) { return (double)frequency / 22050; }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
SDL_AudioCVT cvt;
|
||||
if (SDL_BuildAudioCVT(&cvt, _format.format, _format.channels, _format.freq, format->format, format->channels, format->freq) >= 0)
|
||||
{
|
||||
cvt.len = (int)_length;
|
||||
cvt.len = (sint32)_length;
|
||||
cvt.buf = new uint8[cvt.len * cvt.len_mult];
|
||||
Memory::Copy(cvt.buf, _data, _length);
|
||||
if (SDL_ConvertAudio(&cvt) >= 0)
|
||||
|
|
|
@ -26,13 +26,13 @@
|
|||
|
||||
typedef struct rct_audio_params {
|
||||
bool in_range;
|
||||
int volume;
|
||||
int pan;
|
||||
sint32 volume;
|
||||
sint32 pan;
|
||||
} rct_audio_params;
|
||||
|
||||
audio_device *gAudioDevices = NULL;
|
||||
int gAudioDeviceCount;
|
||||
int gAudioCurrentDevice = -1;
|
||||
sint32 gAudioDeviceCount;
|
||||
sint32 gAudioCurrentDevice = -1;
|
||||
void *gCrowdSoundChannel = 0;
|
||||
bool gGameSoundsOff = false;
|
||||
void *gRainSoundChannel = 0;
|
||||
|
@ -43,9 +43,9 @@ void *gTitleMusicChannel = 0;
|
|||
rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
rct_vehicle_sound_params *gVehicleSoundParamsListEnd;
|
||||
int gVolumeAdjustZoom = 0;
|
||||
sint32 gVolumeAdjustZoom = 0;
|
||||
|
||||
int _volumeAdjust[SOUND_MAXID] = {
|
||||
sint32 _volumeAdjust[SOUND_MAXID] = {
|
||||
0, // SOUND_LIFT_1
|
||||
0, // SOUND_TRACK_FRICTION_1
|
||||
0, // SOUND_LIFT_2
|
||||
|
@ -111,12 +111,12 @@ int _volumeAdjust[SOUND_MAXID] = {
|
|||
-700 // SOUND_62
|
||||
};
|
||||
|
||||
rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *location);
|
||||
rct_audio_params audio_get_params_from_location(sint32 soundId, const rct_xyz16 *location);
|
||||
void audio_stop_channel(void **channel);
|
||||
|
||||
void audio_init()
|
||||
{
|
||||
int result = SDL_Init(SDL_INIT_AUDIO);
|
||||
sint32 result = SDL_Init(SDL_INIT_AUDIO);
|
||||
if (result < 0) {
|
||||
log_error("SDL_Init %s", SDL_GetError());
|
||||
return;
|
||||
|
@ -127,7 +127,7 @@ void audio_init()
|
|||
gAudioCurrentDevice = 0;
|
||||
} else {
|
||||
Mixer_Init(gConfigSound.device);
|
||||
for (int i = 0; i < gAudioDeviceCount; i++) {
|
||||
for (sint32 i = 0; i < gAudioDeviceCount; i++) {
|
||||
if (strcmp(gAudioDevices[i].name, gConfigSound.device) == 0) {
|
||||
gAudioCurrentDevice = i;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ void audio_populate_devices()
|
|||
return;
|
||||
|
||||
audio_device *systemAudioDevices = malloc(gAudioDeviceCount * sizeof(audio_device));
|
||||
for (int i = 0; i < gAudioDeviceCount; i++) {
|
||||
for (sint32 i = 0; i < gAudioDeviceCount; i++) {
|
||||
const char *utf8Name = SDL_GetAudioDeviceName(i, SDL_FALSE);
|
||||
if (utf8Name == NULL)
|
||||
utf8Name = language_get_string(STR_OPTIONS_SOUND_VALUE_UNKNOWN);
|
||||
|
@ -170,7 +170,7 @@ void audio_populate_devices()
|
|||
free(systemAudioDevices);
|
||||
}
|
||||
|
||||
int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z)
|
||||
sint32 audio_play_sound_panned(sint32 soundId, sint32 pan, sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
if (pan == AUDIO_PLAY_AT_LOCATION)
|
||||
return audio_play_sound_at_location(soundId, x, y, z);
|
||||
|
@ -178,7 +178,7 @@ int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z)
|
|||
return audio_play_sound(soundId, 0, pan);
|
||||
}
|
||||
|
||||
int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z)
|
||||
sint32 audio_play_sound_at_location(sint32 soundId, sint16 x, sint16 y, sint16 z)
|
||||
{
|
||||
if (gGameSoundsOff)
|
||||
return 0;
|
||||
|
@ -201,9 +201,9 @@ int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z)
|
|||
* @param location The location at which the sound effect is to be played.
|
||||
* @return The audio parameters to be used when playing this sound effect.
|
||||
*/
|
||||
rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *location)
|
||||
rct_audio_params audio_get_params_from_location(sint32 soundId, const rct_xyz16 *location)
|
||||
{
|
||||
int volumeDown = 0;
|
||||
sint32 volumeDown = 0;
|
||||
rct_audio_params params;
|
||||
params.in_range = true;
|
||||
params.volume = 0;
|
||||
|
@ -239,14 +239,14 @@ rct_audio_params audio_get_params_from_location(int soundId, const rct_xyz16 *lo
|
|||
return params;
|
||||
}
|
||||
|
||||
int audio_play_sound(int soundId, int volume, int pan)
|
||||
sint32 audio_play_sound(sint32 soundId, sint32 volume, sint32 pan)
|
||||
{
|
||||
if (gGameSoundsOff)
|
||||
return 0;
|
||||
|
||||
int mixerPan = 0;
|
||||
sint32 mixerPan = 0;
|
||||
if (pan != AUDIO_PLAY_AT_CENTRE) {
|
||||
int x2 = pan << 16;
|
||||
sint32 x2 = pan << 16;
|
||||
uint16 screenWidth = max(64, gScreenWidth);
|
||||
mixerPan = ((x2 / screenWidth) - 0x8000) >> 4;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ void audio_start_title_music()
|
|||
if (gTitleMusicChannel)
|
||||
return;
|
||||
|
||||
int pathId;
|
||||
sint32 pathId;
|
||||
switch (gConfigSound.title_music) {
|
||||
case 1:
|
||||
pathId = PATH_ID_CSS50;
|
||||
|
@ -291,7 +291,7 @@ void audio_start_title_music()
|
|||
|
||||
void audio_stop_ride_music()
|
||||
{
|
||||
for (int i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
for (sint32 i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
rct_ride_music *rideMusic = &gRideMusicList[i];
|
||||
if (rideMusic->ride_id == (uint8)-1)
|
||||
continue;
|
||||
|
@ -342,10 +342,10 @@ void audio_stop_channel(void **channel)
|
|||
|
||||
void audio_init_ride_sounds_and_info()
|
||||
{
|
||||
int deviceNum = 0;
|
||||
sint32 deviceNum = 0;
|
||||
audio_init_ride_sounds(deviceNum);
|
||||
|
||||
for (int m = 0; m < countof(gRideMusicInfoList); m++) {
|
||||
for (sint32 m = 0; m < countof(gRideMusicInfoList); m++) {
|
||||
rct_ride_music_info *rideMusicInfo = gRideMusicInfoList[m];
|
||||
const utf8 *path = get_file_path(rideMusicInfo->path_id);
|
||||
SDL_RWops *file = SDL_RWFromFile(path, "rb");
|
||||
|
@ -360,17 +360,17 @@ void audio_init_ride_sounds_and_info()
|
|||
}
|
||||
}
|
||||
|
||||
void audio_init_ride_sounds(int device)
|
||||
void audio_init_ride_sounds(sint32 device)
|
||||
{
|
||||
audio_close();
|
||||
for (int i = 0; i < AUDIO_MAX_VEHICLE_SOUNDS; i++) {
|
||||
for (sint32 i = 0; i < AUDIO_MAX_VEHICLE_SOUNDS; i++) {
|
||||
rct_vehicle_sound *vehicleSound = &gVehicleSoundList[i];
|
||||
vehicleSound->id = -1;
|
||||
}
|
||||
|
||||
gAudioCurrentDevice = device;
|
||||
config_save_default();
|
||||
for (int i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
for (sint32 i = 0; i < AUDIO_MAX_RIDE_MUSIC; i++) {
|
||||
rct_ride_music *rideMusic = &gRideMusicList[i];
|
||||
rideMusic->ride_id = -1;
|
||||
}
|
||||
|
@ -414,7 +414,7 @@ void audio_stop_vehicle_sounds()
|
|||
if (gOpenRCT2Headless || gAudioCurrentDevice == -1)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < countof(gVehicleSoundList); i++) {
|
||||
for (sint32 i = 0; i < countof(gVehicleSoundList); i++) {
|
||||
rct_vehicle_sound *vehicleSound = &gVehicleSoundList[i];
|
||||
if (vehicleSound->id == 0xFFFF)
|
||||
continue;
|
||||
|
|
|
@ -161,8 +161,8 @@ typedef enum RCT2_SOUND {
|
|||
} RCT2_SOUND;
|
||||
|
||||
extern audio_device *gAudioDevices;
|
||||
extern int gAudioDeviceCount;
|
||||
extern int gAudioCurrentDevice;
|
||||
extern sint32 gAudioDeviceCount;
|
||||
extern sint32 gAudioCurrentDevice;
|
||||
extern void *gCrowdSoundChannel;
|
||||
extern bool gGameSoundsOff;
|
||||
extern void *gRainSoundChannel;
|
||||
|
@ -174,7 +174,7 @@ extern void *gTitleMusicChannel;
|
|||
extern rct_vehicle_sound gVehicleSoundList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params gVehicleSoundParamsList[AUDIO_MAX_VEHICLE_SOUNDS];
|
||||
extern rct_vehicle_sound_params *gVehicleSoundParamsListEnd;
|
||||
extern int gVolumeAdjustZoom;
|
||||
extern sint32 gVolumeAdjustZoom;
|
||||
|
||||
/**
|
||||
* Deregisters the audio device.
|
||||
|
@ -194,7 +194,7 @@ void audio_init_ride_sounds_and_info();
|
|||
* Loads the ride sounds.
|
||||
* rct2: 0x006BA9B5
|
||||
*/
|
||||
void audio_init_ride_sounds(int device);
|
||||
void audio_init_ride_sounds(sint32 device);
|
||||
/**
|
||||
* Temporarily stops playing sounds until audio_unpause_sounds() is called.
|
||||
* rct2: 0x006BABB4
|
||||
|
@ -208,7 +208,7 @@ void audio_pause_sounds();
|
|||
* sound at a position relative to the centre of the viewport.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound(int soundId, int volume, int pan);
|
||||
sint32 audio_play_sound(sint32 soundId, sint32 volume, sint32 pan);
|
||||
/**
|
||||
* Plays the specified sound at a virtual location.
|
||||
* @param soundId The sound effect to play.
|
||||
|
@ -217,7 +217,7 @@ int audio_play_sound(int soundId, int volume, int pan);
|
|||
* @param z The z coordinate of the location.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z);
|
||||
sint32 audio_play_sound_at_location(sint32 soundId, sint16 x, sint16 y, sint16 z);
|
||||
/**
|
||||
* rct2: 0x006BB76E
|
||||
* @deprecated Use audio_play_sound_at_location or audio_play_sound instead.
|
||||
|
@ -231,7 +231,7 @@ int audio_play_sound_at_location(int soundId, sint16 x, sint16 y, sint16 z);
|
|||
* @param z (bp) The z coordinate of the location.
|
||||
* @return 0 if the sound was not out of range; otherwise, soundId.
|
||||
*/
|
||||
int audio_play_sound_panned(int soundId, int pan, sint16 x, sint16 y, sint16 z);
|
||||
sint32 audio_play_sound_panned(sint32 soundId, sint32 pan, sint16 x, sint16 y, sint16 z);
|
||||
/**
|
||||
* Populates the gAudioDevices array with the available audio devices.
|
||||
*/
|
||||
|
|
|
@ -45,13 +45,13 @@ bool gCheatsDisablePlantAging = false;
|
|||
bool gCheatsEnableChainLiftOnAllTrack = false;
|
||||
bool gCheatsAllowArbitraryRideTypeChanges = false;
|
||||
|
||||
int park_rating_spinner_value;
|
||||
sint32 park_rating_spinner_value;
|
||||
|
||||
#pragma region Cheat functions
|
||||
|
||||
static void cheat_set_grass_length(int length)
|
||||
static void cheat_set_grass_length(sint32 length)
|
||||
{
|
||||
int x, y;
|
||||
sint32 x, y;
|
||||
rct_map_element *mapElement;
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
|
@ -138,7 +138,7 @@ static void cheat_remove_litter()
|
|||
|
||||
static void cheat_fix_rides()
|
||||
{
|
||||
int rideIndex;
|
||||
sint32 rideIndex;
|
||||
rct_ride *ride;
|
||||
rct_peep *mechanic;
|
||||
|
||||
|
@ -160,7 +160,7 @@ static void cheat_fix_rides()
|
|||
|
||||
static void cheat_renew_rides()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
|
||||
FOR_ALL_RIDES(i, ride)
|
||||
|
@ -175,7 +175,7 @@ static void cheat_renew_rides()
|
|||
|
||||
static void cheat_make_destructible()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
FOR_ALL_RIDES(i, ride)
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ static void cheat_make_destructible()
|
|||
|
||||
static void cheat_reset_crash_status()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
|
||||
FOR_ALL_RIDES(i, ride){
|
||||
|
@ -204,7 +204,7 @@ static void cheat_reset_crash_status()
|
|||
|
||||
static void cheat_10_minute_inspections()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
|
@ -275,9 +275,9 @@ static void cheat_clear_loan()
|
|||
game_do_command(0, GAME_COMMAND_FLAG_APPLY, 0, newLoan, GAME_COMMAND_SET_CURRENT_LOAN, 0, 0);
|
||||
}
|
||||
|
||||
static void cheat_generate_guests(int count)
|
||||
static void cheat_generate_guests(sint32 count)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
generate_new_guest();
|
||||
|
@ -285,9 +285,9 @@ static void cheat_generate_guests(int count)
|
|||
window_invalidate_by_class(WC_BOTTOM_TOOLBAR);
|
||||
}
|
||||
|
||||
static void cheat_set_guest_parameter(int parameter, int value)
|
||||
static void cheat_set_guest_parameter(sint32 parameter, sint32 value)
|
||||
{
|
||||
int spriteIndex;
|
||||
sint32 spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
FOR_ALL_GUESTS(spriteIndex, peep) {
|
||||
|
@ -328,9 +328,9 @@ static void cheat_set_guest_parameter(int parameter, int value)
|
|||
|
||||
}
|
||||
|
||||
static void cheat_give_all_guests(int object)
|
||||
static void cheat_give_all_guests(sint32 object)
|
||||
{
|
||||
int spriteIndex;
|
||||
sint32 spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
FOR_ALL_GUESTS(spriteIndex, peep) {
|
||||
|
@ -370,7 +370,7 @@ static void cheat_remove_all_guests()
|
|||
}
|
||||
}
|
||||
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
|
||||
FOR_ALL_RIDES(i, ride)
|
||||
|
@ -378,7 +378,7 @@ static void cheat_remove_all_guests()
|
|||
ride_clear_for_construction(i);
|
||||
ride_set_status(i, RIDE_STATUS_CLOSED);
|
||||
|
||||
for(int j = 0; j < 4; j++) {
|
||||
for (size_t j = 0; j < 4; j++) {
|
||||
ride->queue_length[j] = 0;
|
||||
ride->last_peep_in_queue[j] = SPRITE_INDEX_NULL;
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ static void cheat_remove_all_guests()
|
|||
|
||||
static void cheat_explode_guests()
|
||||
{
|
||||
int sprite_index;
|
||||
sint32 sprite_index;
|
||||
rct_peep *peep;
|
||||
|
||||
FOR_ALL_GUESTS(sprite_index, peep) {
|
||||
|
@ -422,9 +422,9 @@ static void cheat_set_staff_speed(uint8 value)
|
|||
|
||||
#pragma endregion
|
||||
|
||||
void game_command_cheat(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
void game_command_cheat(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
int cheat = *ecx;
|
||||
sint32 cheat = *ecx;
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
switch (cheat) {
|
||||
case CHEAT_SANDBOXMODE: gCheatsSandboxMode = *edx != 0; window_invalidate_by_class(WC_MAP); window_invalidate_by_class(WC_FOOTPATH); break;
|
||||
|
|
|
@ -108,9 +108,9 @@ enum {
|
|||
#define CHEATS_MONEY_INCREMENT MONEY(5000,00)
|
||||
#define CHEATS_TRAM_INCREMENT 250
|
||||
|
||||
extern int park_rating_spinner_value;
|
||||
extern sint32 park_rating_spinner_value;
|
||||
|
||||
void game_command_cheat(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
void game_command_cheat(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
|
||||
void cheats_reset();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C"
|
|||
|
||||
#pragma region CommandLineArgEnumerator
|
||||
|
||||
CommandLineArgEnumerator::CommandLineArgEnumerator(const char * const * arguments, int count)
|
||||
CommandLineArgEnumerator::CommandLineArgEnumerator(const char * const * arguments, sint32 count)
|
||||
{
|
||||
_arguments = arguments;
|
||||
_count = count;
|
||||
|
@ -560,7 +560,7 @@ namespace CommandLine
|
|||
|
||||
extern "C"
|
||||
{
|
||||
int cmdline_run(const char * * argv, int argc)
|
||||
sint32 cmdline_run(const char * * argv, sint32 argc)
|
||||
{
|
||||
auto argEnumerator = CommandLineArgEnumerator(argv, argc);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
uint16 GetCount() const { return _count; }
|
||||
uint16 GetIndex() const { return _index; }
|
||||
|
||||
CommandLineArgEnumerator(const char * const * arguments, int count);
|
||||
CommandLineArgEnumerator(const char * const * arguments, sint32 count);
|
||||
|
||||
void Reset();
|
||||
bool Backtrack();
|
||||
|
@ -47,7 +47,7 @@ public:
|
|||
bool TryPopString(const char * * result);
|
||||
};
|
||||
|
||||
typedef int exitcode_t;
|
||||
typedef sint32 exitcode_t;
|
||||
typedef exitcode_t (*CommandLineFunc)(CommandLineArgEnumerator *);
|
||||
|
||||
enum
|
||||
|
|
|
@ -40,9 +40,9 @@ extern "C"
|
|||
#endif // USE_BREAKPAD
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
int gNetworkStart = NETWORK_MODE_NONE;
|
||||
sint32 gNetworkStart = NETWORK_MODE_NONE;
|
||||
char gNetworkStartHost[128];
|
||||
int gNetworkStartPort = NETWORK_DEFAULT_PORT;
|
||||
sint32 gNetworkStartPort = NETWORK_DEFAULT_PORT;
|
||||
|
||||
static uint32 _port = 0;
|
||||
#endif
|
||||
|
|
|
@ -34,8 +34,8 @@ const CommandLineCommand CommandLine::ScreenshotCommands[]
|
|||
static exitcode_t HandleScreenshot(CommandLineArgEnumerator *argEnumerator)
|
||||
{
|
||||
const char * * argv = (const char * *)argEnumerator->GetArguments() + argEnumerator->GetIndex();
|
||||
int argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
||||
int result = cmdline_for_screenshot(argv, argc);
|
||||
sint32 argc = argEnumerator->GetCount() - argEnumerator->GetIndex();
|
||||
sint32 result = cmdline_for_screenshot(argv, argc);
|
||||
if (result < 0) {
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
extern "C"
|
||||
{
|
||||
int gSpriteMode = 0;
|
||||
sint32 gSpriteMode = 0;
|
||||
}
|
||||
|
||||
static const char * _mode;
|
||||
|
@ -53,8 +53,8 @@ static exitcode_t HandleSprite(CommandLineArgEnumerator *argEnumerator)
|
|||
Memory::Free(_mode);
|
||||
|
||||
const char * * argv = (const char * *)argEnumerator->GetArguments() + argEnumerator->GetIndex() - 1;
|
||||
int argc = argEnumerator->GetCount() - argEnumerator->GetIndex() + 1;
|
||||
int result = cmdline_for_sprite(argv, argc);
|
||||
sint32 argc = argEnumerator->GetCount() - argEnumerator->GetIndex() + 1;
|
||||
sint32 result = cmdline_for_sprite(argv, argc);
|
||||
if (result < 0) {
|
||||
return EXITCODE_FAIL;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define MODE_CLOSEST 1
|
||||
#define MODE_DITHERING 2
|
||||
|
||||
extern int gSpriteMode;
|
||||
extern sint32 gSpriteMode;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
|
@ -58,10 +58,10 @@ rct_sprite_file_header spriteFileHeader;
|
|||
rct_g1_element *spriteFileEntries;
|
||||
uint8 *spriteFileData;
|
||||
|
||||
static void sprite_file_load_palette(int spriteIndex)
|
||||
static void sprite_file_load_palette(sint32 spriteIndex)
|
||||
{
|
||||
rct_g1_element *g1 = &spriteFileEntries[spriteIndex];
|
||||
int numPaletteEntries = g1->width;
|
||||
sint32 numPaletteEntries = g1->width;
|
||||
uint8* src = g1->offset;
|
||||
rct_sprite_file_palette_entry *destPaletteEntry = &spriteFilePalette[g1->x_offset];
|
||||
for (; numPaletteEntries > 0; numPaletteEntries--) {
|
||||
|
@ -99,7 +99,7 @@ static bool sprite_file_open(const utf8 *path)
|
|||
}
|
||||
|
||||
if (spriteFileHeader.num_entries > 0) {
|
||||
int openEntryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element_32bit);
|
||||
sint32 openEntryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element_32bit);
|
||||
rct_g1_element_32bit * openElements = (rct_g1_element_32bit *)malloc(openEntryTableSize);
|
||||
if (openElements == NULL) {
|
||||
SDL_RWclose(file);
|
||||
|
@ -120,7 +120,7 @@ static bool sprite_file_open(const utf8 *path)
|
|||
return false;
|
||||
}
|
||||
|
||||
int entryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element);
|
||||
sint32 entryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element);
|
||||
spriteFileEntries = malloc(entryTableSize);
|
||||
for (uint32 i = 0; i < spriteFileHeader.num_entries; i++) {
|
||||
rct_g1_element_32bit * inElement = &openElements[i];
|
||||
|
@ -154,7 +154,7 @@ static bool sprite_file_save(const char *path)
|
|||
}
|
||||
|
||||
if (spriteFileHeader.num_entries > 0) {
|
||||
int saveEntryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element_32bit);
|
||||
sint32 saveEntryTableSize = spriteFileHeader.num_entries * sizeof(rct_g1_element_32bit);
|
||||
rct_g1_element_32bit * saveElements = (rct_g1_element_32bit *)malloc(saveEntryTableSize);
|
||||
if (saveElements == NULL) {
|
||||
SDL_RWclose(file);
|
||||
|
@ -197,12 +197,12 @@ static void sprite_file_close()
|
|||
SafeFree(spriteFileData);
|
||||
}
|
||||
|
||||
static bool sprite_file_export(int spriteIndex, const char *outPath)
|
||||
static bool sprite_file_export(sint32 spriteIndex, const char *outPath)
|
||||
{
|
||||
rct_g1_element *spriteHeader;
|
||||
rct_drawpixelinfo dpi;
|
||||
uint8 *pixels;
|
||||
int pixelBufferSize;
|
||||
sint32 pixelBufferSize;
|
||||
|
||||
spriteHeader = &spriteFileEntries[spriteIndex];
|
||||
pixelBufferSize = spriteHeader->width * spriteHeader->height;
|
||||
|
@ -233,7 +233,7 @@ static bool is_transparent_pixel(sint16 *colour){
|
|||
}
|
||||
|
||||
// Returns true if pixel index is an index not used for remapping
|
||||
static bool is_changable_pixel(int palette_index) {
|
||||
static bool is_changable_pixel(sint32 palette_index) {
|
||||
if (palette_index == -1)
|
||||
return true;
|
||||
if (palette_index == 0)
|
||||
|
@ -249,11 +249,11 @@ static bool is_changable_pixel(int palette_index) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static int get_closest_palette_index(sint16 *colour){
|
||||
static sint32 get_closest_palette_index(sint16 *colour){
|
||||
uint32 smallest_error = -1;
|
||||
int best_match = -1;
|
||||
sint32 best_match = -1;
|
||||
|
||||
for (int x = 0; x < 256; x++){
|
||||
for (sint32 x = 0; x < 256; x++){
|
||||
if (is_changable_pixel(x)){
|
||||
uint32 error =
|
||||
((sint16)(spriteFilePalette[x].r) - colour[0]) * ((sint16)(spriteFilePalette[x].r) - colour[0]) +
|
||||
|
@ -269,12 +269,12 @@ static int get_closest_palette_index(sint16 *colour){
|
|||
return best_match;
|
||||
}
|
||||
|
||||
static int get_palette_index(sint16 *colour)
|
||||
static sint32 get_palette_index(sint16 *colour)
|
||||
{
|
||||
if (is_transparent_pixel(colour))
|
||||
return -1;
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
for (sint32 i = 0; i < 256; i++) {
|
||||
if ((sint16)(spriteFilePalette[i].r) != colour[0]) continue;
|
||||
if ((sint16)(spriteFilePalette[i].g) != colour[1]) continue;
|
||||
if ((sint16)(spriteFilePalette[i].b) != colour[2]) continue;
|
||||
|
@ -284,7 +284,7 @@ static int get_palette_index(sint16 *colour)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **outBuffer, int *outBufferLength, int mode)
|
||||
static bool sprite_file_import(const char *path, rct_g1_element *outElement, uint8 **outBuffer, sint32 *outBufferLength, sint32 mode)
|
||||
{
|
||||
uint8 *pixels;
|
||||
uint32 width, height;
|
||||
|
@ -314,7 +314,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
|
|||
|
||||
uint8 *dst = buffer + (height * 2);
|
||||
|
||||
for (unsigned int y = 0; y < height; y++) {
|
||||
for (uint32 y = 0; y < height; y++) {
|
||||
rle_code *previousCode, *currentCode;
|
||||
|
||||
yOffsets[y] = (uint16)(dst - buffer);
|
||||
|
@ -322,11 +322,11 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
|
|||
previousCode = NULL;
|
||||
currentCode = (rle_code*)dst;
|
||||
dst += 2;
|
||||
int startX = 0;
|
||||
int npixels = 0;
|
||||
sint32 startX = 0;
|
||||
sint32 npixels = 0;
|
||||
bool pushRun = false;
|
||||
for (unsigned int x = 0; x < width; x++) {
|
||||
int paletteIndex = get_palette_index(src);
|
||||
for (uint32 x = 0; x < width; x++) {
|
||||
sint32 paletteIndex = get_palette_index(src);
|
||||
|
||||
if (mode == MODE_CLOSEST || mode == MODE_DITHERING)
|
||||
if (paletteIndex == -1 && !is_transparent_pixel(src))
|
||||
|
@ -421,7 +421,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
|
|||
free(pixels);
|
||||
free(src_orig);
|
||||
|
||||
int bufferLength = (int)(dst - buffer);
|
||||
sint32 bufferLength = (sint32)(dst - buffer);
|
||||
buffer = realloc(buffer, bufferLength);
|
||||
|
||||
outElement->offset = buffer;
|
||||
|
@ -437,7 +437,7 @@ static bool sprite_file_import(const char *path, rct_g1_element *outElement, uin
|
|||
return true;
|
||||
}
|
||||
|
||||
int cmdline_for_sprite(const char **argv, int argc)
|
||||
sint32 cmdline_for_sprite(const char **argv, sint32 argc)
|
||||
{
|
||||
gOpenRCT2Headless = true;
|
||||
if (argc == 0)
|
||||
|
@ -462,14 +462,14 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
return 1;
|
||||
} else {
|
||||
const char *spriteFilePath = argv[1];
|
||||
int spriteIndex = atoi(argv[2]);
|
||||
sint32 spriteIndex = atoi(argv[2]);
|
||||
|
||||
if (!sprite_file_open(spriteFilePath)) {
|
||||
fprintf(stderr, "Unable to open input sprite file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (spriteIndex < 0 || spriteIndex >= (int)spriteFileHeader.num_entries) {
|
||||
if (spriteIndex < 0 || spriteIndex >= (sint32)spriteFileHeader.num_entries) {
|
||||
sprite_file_close();
|
||||
fprintf(stderr, "Sprite #%d does not exist in sprite file.\n", spriteIndex);
|
||||
return -1;
|
||||
|
@ -492,7 +492,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
}
|
||||
|
||||
const char *spriteFilePath = argv[1];
|
||||
int spriteIndex = atoi(argv[2]);
|
||||
sint32 spriteIndex = atoi(argv[2]);
|
||||
const char *outputPath = argv[3];
|
||||
|
||||
if (!sprite_file_open(spriteFilePath)) {
|
||||
|
@ -500,7 +500,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (spriteIndex < 0 || spriteIndex >= (int)spriteFileHeader.num_entries) {
|
||||
if (spriteIndex < 0 || spriteIndex >= (sint32)spriteFileHeader.num_entries) {
|
||||
fprintf(stderr, "Sprite #%d does not exist in sprite file.\n", spriteIndex);
|
||||
return -1;
|
||||
}
|
||||
|
@ -533,8 +533,8 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
}
|
||||
|
||||
|
||||
int maxIndex = (int)spriteFileHeader.num_entries;
|
||||
int numbers = (int)floor(log(maxIndex));
|
||||
sint32 maxIndex = (sint32)spriteFileHeader.num_entries;
|
||||
sint32 numbers = (sint32)floor(log(maxIndex));
|
||||
|
||||
safe_strcpy(outputPath, argv[2], MAX_PATH);
|
||||
size_t pathLen = strlen(outputPath);
|
||||
|
@ -544,12 +544,12 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (int x = 0; x < numbers; x++){
|
||||
for (sint32 x = 0; x < numbers; x++){
|
||||
outputPath[pathLen + x] = '0';
|
||||
}
|
||||
safe_strcpy(outputPath + pathLen + numbers, ".png", MAX_PATH - pathLen - numbers);
|
||||
|
||||
for (int spriteIndex = 0; spriteIndex < maxIndex; spriteIndex++){
|
||||
for (sint32 spriteIndex = 0; spriteIndex < maxIndex; spriteIndex++){
|
||||
|
||||
if (spriteIndex % 100 == 99){
|
||||
// Status indicator
|
||||
|
@ -600,7 +600,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
|
||||
rct_g1_element spriteElement;
|
||||
uint8 *buffer;
|
||||
int bufferLength;
|
||||
sint32 bufferLength;
|
||||
if (!sprite_file_import(imagePath, &spriteElement, &buffer, &bufferLength, gSpriteMode))
|
||||
return -1;
|
||||
|
||||
|
@ -645,7 +645,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
sprite_file_save(spriteFilePath);
|
||||
|
||||
fprintf(stdout, "Building: %s\n", spriteFilePath);
|
||||
int i = 0;
|
||||
sint32 i = 0;
|
||||
do {
|
||||
// Create image path
|
||||
safe_strcpy(imagePath, resourcePath, MAX_PATH);
|
||||
|
@ -660,7 +660,7 @@ int cmdline_for_sprite(const char **argv, int argc)
|
|||
SDL_RWclose(file);
|
||||
rct_g1_element spriteElement;
|
||||
uint8 *buffer;
|
||||
int bufferLength;
|
||||
sint32 bufferLength;
|
||||
if (!sprite_file_import(imagePath, &spriteElement, &buffer, &bufferLength, gSpriteMode)) {
|
||||
fprintf(stderr, "Could not import image file: %s\nCanceling\n", imagePath);
|
||||
return -1;
|
||||
|
|
|
@ -22,7 +22,7 @@ extern "C"
|
|||
{
|
||||
#endif
|
||||
|
||||
int cmdline_for_sprite(const char **argv, int argc);
|
||||
sint32 cmdline_for_sprite(const char **argv, sint32 argc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ typedef uint8 colour_t;
|
|||
* e.g. in a structure initializer (or where-ever else comma expressions
|
||||
* aren't permitted).
|
||||
*/
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
|
||||
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { sint32:-!!(e); }))
|
||||
|
||||
/* &a[0] degrades to a pointer: a different type from an array */
|
||||
#define __must_be_array(a) \
|
||||
|
@ -177,7 +177,7 @@ typedef fixed32_1dp money32;
|
|||
#define MONEY32_UNDEFINED ((money32)0x80000000)
|
||||
|
||||
typedef void (EMPTY_ARGS_VOID_POINTER)();
|
||||
typedef unsigned short rct_string_id;
|
||||
typedef uint16 rct_string_id;
|
||||
|
||||
#define SafeFree(x) do { free(x); (x) = NULL; } while (0)
|
||||
|
||||
|
@ -254,48 +254,48 @@ typedef unsigned short rct_string_id;
|
|||
#pragma pack(push, 1)
|
||||
typedef struct registers {
|
||||
union {
|
||||
int eax;
|
||||
short ax;
|
||||
sint32 eax;
|
||||
sint16 ax;
|
||||
struct {
|
||||
char al;
|
||||
char ah;
|
||||
};
|
||||
};
|
||||
union {
|
||||
int ebx;
|
||||
short bx;
|
||||
sint32 ebx;
|
||||
sint16 bx;
|
||||
struct {
|
||||
char bl;
|
||||
char bh;
|
||||
};
|
||||
};
|
||||
union {
|
||||
int ecx;
|
||||
short cx;
|
||||
sint32 ecx;
|
||||
sint16 cx;
|
||||
struct {
|
||||
char cl;
|
||||
char ch;
|
||||
};
|
||||
};
|
||||
union {
|
||||
int edx;
|
||||
short dx;
|
||||
sint32 edx;
|
||||
sint16 dx;
|
||||
struct {
|
||||
char dl;
|
||||
char dh;
|
||||
};
|
||||
};
|
||||
union {
|
||||
int esi;
|
||||
short si;
|
||||
sint32 esi;
|
||||
sint16 si;
|
||||
};
|
||||
union {
|
||||
int edi;
|
||||
short di;
|
||||
sint32 edi;
|
||||
sint16 di;
|
||||
};
|
||||
union {
|
||||
int ebp;
|
||||
short bp;
|
||||
sint32 ebp;
|
||||
sint16 bp;
|
||||
};
|
||||
} registers;
|
||||
assert_struct_size(registers, 7 * 4);
|
||||
|
|
|
@ -83,7 +83,7 @@ typedef struct config_section_definition {
|
|||
void *base_address;
|
||||
const_utf8string section_name;
|
||||
config_property_definition *property_definitions;
|
||||
int property_definitions_count;
|
||||
sint32 property_definitions_count;
|
||||
} config_section_definition;
|
||||
|
||||
#pragma region Enum definitions
|
||||
|
@ -340,15 +340,15 @@ static bool config_open(const utf8string path);
|
|||
static bool config_save(const utf8string path);
|
||||
static void config_read_properties(config_section_definition **currentSection, const_utf8string line);
|
||||
static void config_save_property_value(SDL_RWops *file, uint8 type, value_union *value);
|
||||
static bool config_read_enum(void *dest, int destSize, const utf8 *key, int keySize, config_enum_definition *enumDefinitions);
|
||||
static bool config_read_enum(void *dest, sint32 destSize, const utf8 *key, sint32 keySize, config_enum_definition *enumDefinitions);
|
||||
static void config_write_enum(SDL_RWops *file, uint8 type, value_union *value, config_enum_definition *enumDefinitions);
|
||||
|
||||
static void utf8_skip_whitespace(utf8 **outch);
|
||||
static void utf8_skip_non_whitespace(utf8 **outch);
|
||||
|
||||
static int rwopsreadc(SDL_RWops *file)
|
||||
static sint32 rwopsreadc(SDL_RWops *file)
|
||||
{
|
||||
int c = 0;
|
||||
sint32 c = 0;
|
||||
if (SDL_RWread(file, &c, 1, 1) != 1)
|
||||
c = EOF;
|
||||
return c;
|
||||
|
@ -383,14 +383,14 @@ static void rwopswritenewline(SDL_RWops *file)
|
|||
}
|
||||
|
||||
static void rwopswritestresc(SDL_RWops *file, const char *str) {
|
||||
int length = 0;
|
||||
sint32 length = 0;
|
||||
for (const char *c = str; *c != '\0'; ++c) {
|
||||
if (*c == '\\') length += 2;
|
||||
else ++length;
|
||||
}
|
||||
|
||||
char *escaped = malloc(length + 1);
|
||||
int j=0;
|
||||
sint32 j=0;
|
||||
for (const char *c = str; *c != '\0'; ++c) {
|
||||
if (*c == '\\') escaped[j++] = '\\';
|
||||
escaped[j++] = *c;
|
||||
|
@ -403,7 +403,7 @@ static void rwopswritestresc(SDL_RWops *file, const char *str) {
|
|||
|
||||
void config_set_defaults()
|
||||
{
|
||||
int i, j;
|
||||
sint32 i, j;
|
||||
|
||||
for (i = 0; i < countof(_sectionDefinitions); i++) {
|
||||
config_section_definition *section = &_sectionDefinitions[i];
|
||||
|
@ -454,9 +454,9 @@ void config_set_defaults()
|
|||
|
||||
void config_release()
|
||||
{
|
||||
for (int i = 0; i < countof(_sectionDefinitions); i++) {
|
||||
for (sint32 i = 0; i < countof(_sectionDefinitions); i++) {
|
||||
config_section_definition *section = &_sectionDefinitions[i];
|
||||
for (int j = 0; j < section->property_definitions_count; j++) {
|
||||
for (sint32 j = 0; j < section->property_definitions_count; j++) {
|
||||
config_property_definition *property = §ion->property_definitions[j];
|
||||
value_union *destValue = (value_union*)((size_t)section->base_address + (size_t)property->offset);
|
||||
if (property->type == CONFIG_VALUE_TYPE_STRING) {
|
||||
|
@ -504,7 +504,7 @@ bool config_open(const utf8string path)
|
|||
utf8string lineBuffer;
|
||||
size_t lineBufferCapacity;
|
||||
size_t lineLength;
|
||||
int c;
|
||||
sint32 c;
|
||||
config_section_definition *currentSection;
|
||||
|
||||
file = SDL_RWFromFile(path, "rb");
|
||||
|
@ -549,7 +549,7 @@ bool config_open(const utf8string path)
|
|||
bool config_save(const utf8string path)
|
||||
{
|
||||
SDL_RWops *file;
|
||||
int i, j;
|
||||
sint32 i, j;
|
||||
value_union *value;
|
||||
|
||||
file = SDL_RWFromFile(path, "wb");
|
||||
|
@ -627,10 +627,10 @@ static void config_save_property_value(SDL_RWops *file, uint8 type, value_union
|
|||
}
|
||||
}
|
||||
|
||||
static bool config_get_section(const utf8string line, const utf8 **sectionName, int *sectionNameSize)
|
||||
static bool config_get_section(const utf8string line, const utf8 **sectionName, sint32 *sectionNameSize)
|
||||
{
|
||||
utf8 *ch;
|
||||
int c;
|
||||
sint32 c;
|
||||
|
||||
ch = line;
|
||||
utf8_skip_whitespace(&ch);
|
||||
|
@ -644,14 +644,14 @@ static bool config_get_section(const utf8string line, const utf8 **sectionName,
|
|||
if (c == ']') break;
|
||||
}
|
||||
|
||||
*sectionNameSize = (int)(ch - *sectionName - 1);
|
||||
*sectionNameSize = (sint32)(ch - *sectionName - 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool config_get_property_name_value(const utf8string line, utf8 **propertyName, int *propertyNameSize, utf8 **value, int *valueSize)
|
||||
static bool config_get_property_name_value(const utf8string line, utf8 **propertyName, sint32 *propertyNameSize, utf8 **value, sint32 *valueSize)
|
||||
{
|
||||
utf8 *ch, *clast;
|
||||
int c;
|
||||
sint32 c;
|
||||
bool quotes;
|
||||
|
||||
ch = line;
|
||||
|
@ -664,7 +664,7 @@ static bool config_get_property_name_value(const utf8string line, utf8 **propert
|
|||
while ((c = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
|
||||
if (isspace(c) || c == '=') {
|
||||
if (c == '=') equals = true;
|
||||
*propertyNameSize = (int)(ch - *propertyName - 1);
|
||||
*propertyNameSize = (sint32)(ch - *propertyName - 1);
|
||||
break;
|
||||
} else if (c == '#') {
|
||||
return false;
|
||||
|
@ -695,19 +695,19 @@ static bool config_get_property_name_value(const utf8string line, utf8 **propert
|
|||
if (c != ' ') clast = ch;
|
||||
}
|
||||
}
|
||||
if (!quotes) *valueSize = (int)(clast - *value);
|
||||
else *valueSize = (int)(ch - *value - 1);
|
||||
if (!quotes) *valueSize = (sint32)(clast - *value);
|
||||
else *valueSize = (sint32)(ch - *value - 1);
|
||||
if (quotes) (*valueSize)--;
|
||||
return true;
|
||||
}
|
||||
|
||||
static config_section_definition *config_get_section_def(const utf8 *name, int size)
|
||||
static config_section_definition *config_get_section_def(const utf8 *name, sint32 size)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
|
||||
for (i = 0; i < countof(_sectionDefinitions); i++) {
|
||||
const_utf8string sectionName = _sectionDefinitions[i].section_name;
|
||||
int sectionNameSize = (int)strnlen(sectionName, size);
|
||||
sint32 sectionNameSize = (sint32)strnlen(sectionName, size);
|
||||
if (sectionNameSize == size && sectionName[size] == 0 && _strnicmp(sectionName, name, size) == 0)
|
||||
return &_sectionDefinitions[i];
|
||||
}
|
||||
|
@ -715,13 +715,13 @@ static config_section_definition *config_get_section_def(const utf8 *name, int s
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static config_property_definition *config_get_property_def(config_section_definition *section, const utf8 *name, int size)
|
||||
static config_property_definition *config_get_property_def(config_section_definition *section, const utf8 *name, sint32 size)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
|
||||
for (i = 0; i < section->property_definitions_count; i++) {
|
||||
const_utf8string propertyName = section->property_definitions[i].property_name;
|
||||
int propertyNameSize = (int)strnlen(propertyName, size);
|
||||
sint32 propertyNameSize = (sint32)strnlen(propertyName, size);
|
||||
if (propertyNameSize == size && propertyName[size] == 0 && _strnicmp(propertyName, name, size) == 0)
|
||||
{
|
||||
return §ion->property_definitions[i];
|
||||
|
@ -731,10 +731,10 @@ static config_property_definition *config_get_property_def(config_section_defini
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static utf8string escape_string(const utf8 *value, int valueSize) {
|
||||
int length = 0;
|
||||
static utf8string escape_string(const utf8 *value, sint32 valueSize) {
|
||||
sint32 length = 0;
|
||||
bool backslash = false;
|
||||
for (int i=0; i < valueSize; ++i) {
|
||||
for (sint32 i=0; i < valueSize; ++i) {
|
||||
if (value[i] == '\\') {
|
||||
if (backslash) backslash = false;
|
||||
else ++length, backslash = true;
|
||||
|
@ -742,9 +742,9 @@ static utf8string escape_string(const utf8 *value, int valueSize) {
|
|||
}
|
||||
utf8string escaped = malloc(length + 1);
|
||||
|
||||
int j=0;
|
||||
sint32 j=0;
|
||||
backslash = false;
|
||||
for (int i=0; i < valueSize; ++i) {
|
||||
for (sint32 i=0; i < valueSize; ++i) {
|
||||
if (value[i] == '\\') {
|
||||
if (backslash) backslash = false;
|
||||
else escaped[j++] = value[i], backslash = true;
|
||||
|
@ -755,12 +755,12 @@ static utf8string escape_string(const utf8 *value, int valueSize) {
|
|||
return escaped;
|
||||
}
|
||||
|
||||
static void config_set_property(const config_section_definition *section, const config_property_definition *property, const utf8 *value, int valueSize)
|
||||
static void config_set_property(const config_section_definition *section, const config_property_definition *property, const utf8 *value, sint32 valueSize)
|
||||
{
|
||||
value_union *destValue = (value_union*)((size_t)section->base_address + (size_t)property->offset);
|
||||
|
||||
if (property->enum_definitions != NULL)
|
||||
if (config_read_enum(destValue, (int)_configValueTypeSize[property->type], value, valueSize, property->enum_definitions))
|
||||
if (config_read_enum(destValue, (sint32)_configValueTypeSize[property->type], value, valueSize, property->enum_definitions))
|
||||
return;
|
||||
|
||||
switch (property->type) {
|
||||
|
@ -807,13 +807,13 @@ static void config_read_properties(config_section_definition **currentSection, c
|
|||
|
||||
if (*ch == '[') {
|
||||
const utf8 *sectionName;
|
||||
int sectionNameSize;
|
||||
sint32 sectionNameSize;
|
||||
if (config_get_section(ch, §ionName, §ionNameSize))
|
||||
*currentSection = config_get_section_def(sectionName, sectionNameSize);
|
||||
} else {
|
||||
if (*currentSection != NULL) {
|
||||
utf8 *propertyName, *value;
|
||||
int propertyNameSize = 0, valueSize;
|
||||
sint32 propertyNameSize = 0, valueSize;
|
||||
if (config_get_property_name_value(ch, &propertyName, &propertyNameSize, &value, &valueSize)) {
|
||||
config_property_definition *property;
|
||||
property = config_get_property_def(*currentSection, propertyName, propertyNameSize);
|
||||
|
@ -824,7 +824,7 @@ static void config_read_properties(config_section_definition **currentSection, c
|
|||
}
|
||||
}
|
||||
|
||||
static bool config_read_enum(void *dest, int destSize, const utf8 *key, int keySize, config_enum_definition *enumDefinitions)
|
||||
static bool config_read_enum(void *dest, sint32 destSize, const utf8 *key, sint32 keySize, config_enum_definition *enumDefinitions)
|
||||
{
|
||||
while (enumDefinitions->key != NULL) {
|
||||
if (strlen(enumDefinitions->key) == (size_t)keySize && _strnicmp(enumDefinitions->key, key, keySize) == 0) {
|
||||
|
@ -898,7 +898,7 @@ static config_line *_configLines = NULL;
|
|||
*/
|
||||
static bool config_find_rct2_path(utf8 *resultPath)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
|
||||
log_verbose("searching common installation locations.");
|
||||
|
||||
|
@ -1053,7 +1053,7 @@ bool config_shortcut_keys_load()
|
|||
if (file != NULL) {
|
||||
result = SDL_RWread(file, &version, sizeof(version), 1) == 1;
|
||||
if (result && version == SHORTCUT_FILE_VERSION) {
|
||||
for (int i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
for (sint32 i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
if (SDL_RWread(file, &gShortcutKeys[i], sizeof(uint16), 1) != 1) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -302,10 +302,10 @@ protected:
|
|||
void GetDirectoryChildren(std::vector<DirectoryChild> &children, const std::string &path) override
|
||||
{
|
||||
struct dirent * * namelist;
|
||||
int count = scandir(path.c_str(), &namelist, FilterFunc, alphasort);
|
||||
sint32 count = scandir(path.c_str(), &namelist, FilterFunc, alphasort);
|
||||
if (count > 0)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
for (sint32 i = 0; i < count; i++)
|
||||
{
|
||||
const struct dirent * node = namelist[i];
|
||||
if (!String::Equals(node->d_name, ".") &&
|
||||
|
@ -321,7 +321,7 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
static int FilterFunc(const struct dirent * d)
|
||||
static sint32 FilterFunc(const struct dirent * d)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ private:
|
|||
Path::Append(path, pathSize, node->d_name);
|
||||
|
||||
struct stat statInfo;
|
||||
int statRes = stat(path, &statInfo);
|
||||
sint32 statRes = stat(path, &statInfo);
|
||||
if (statRes != -1)
|
||||
{
|
||||
result.Size = statInfo.st_size;
|
||||
|
|
|
@ -40,12 +40,12 @@ private:
|
|||
uint64 _fileSize;
|
||||
|
||||
public:
|
||||
FileStream(const std::string &path, int fileMode) :
|
||||
FileStream(const std::string &path, sint32 fileMode) :
|
||||
FileStream(path.c_str(), fileMode)
|
||||
{
|
||||
}
|
||||
|
||||
FileStream(const utf8 * path, int fileMode)
|
||||
FileStream(const utf8 * path, sint32 fileMode)
|
||||
{
|
||||
const char * mode;
|
||||
switch (fileMode) {
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
Seek(position, STREAM_SEEK_BEGIN);
|
||||
}
|
||||
|
||||
void Seek(sint64 offset, int origin) override
|
||||
void Seek(sint64 offset, sint32 origin) override
|
||||
{
|
||||
switch (origin) {
|
||||
case STREAM_SEEK_BEGIN:
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace Guard
|
|||
abort();
|
||||
#else
|
||||
// Show message box if we are not building for testing
|
||||
int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
|
||||
sint32 result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION);
|
||||
if (result == IDABORT)
|
||||
{
|
||||
#ifdef USE_BREAKPAD
|
||||
|
|
|
@ -43,7 +43,7 @@ interface IStream
|
|||
virtual uint64 GetLength() const abstract;
|
||||
virtual uint64 GetPosition() const abstract;
|
||||
virtual void SetPosition(uint64 position) abstract;
|
||||
virtual void Seek(sint64 offset, int origin) abstract;
|
||||
virtual void Seek(sint64 offset, sint32 origin) abstract;
|
||||
|
||||
virtual void Read(void * buffer, uint64 length) abstract;
|
||||
virtual void Write(const void * buffer, uint64 length) abstract;
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace Memory
|
|||
template<typename T>
|
||||
static T * Set(T * dst, uint8 value, size_t size)
|
||||
{
|
||||
return (T*)memset((void*)dst, (int)value, size);
|
||||
return (T*)memset((void*)dst, (sint32)value, size);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -99,7 +99,7 @@ void MemoryStream::SetPosition(uint64 position)
|
|||
Seek(position, STREAM_SEEK_BEGIN);
|
||||
}
|
||||
|
||||
void MemoryStream::Seek(sint64 offset, int origin)
|
||||
void MemoryStream::Seek(sint64 offset, sint32 origin)
|
||||
{
|
||||
uint64 newPosition;
|
||||
switch (origin) {
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
uint64 GetLength() const override;
|
||||
uint64 GetPosition() const override;
|
||||
void SetPosition(uint64 position) override;
|
||||
void Seek(sint64 offset, int origin) override;
|
||||
void Seek(sint64 offset, sint32 origin) override;
|
||||
|
||||
void Read(void * buffer, uint64 length) override;
|
||||
void Write(const void * buffer, uint64 length) override;
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace String
|
|||
utf8 * buffer = Memory::Allocate<utf8>(bufferSize);
|
||||
|
||||
// Start with initial buffer
|
||||
int len = vsnprintf(buffer, bufferSize, format, args);
|
||||
sint32 len = vsnprintf(buffer, bufferSize, format, args);
|
||||
if (len < 0)
|
||||
{
|
||||
Memory::Free(buffer);
|
||||
|
@ -307,7 +307,7 @@ namespace String
|
|||
|
||||
const utf8 * SkipBOM(const utf8 * buffer)
|
||||
{
|
||||
if ((unsigned char)buffer[0] == 0xEF && (unsigned char)buffer[1] == 0xBB && (unsigned char)buffer[2] == 0xBF)
|
||||
if ((uint8)buffer[0] == 0xEF && (uint8)buffer[1] == 0xBB && (uint8)buffer[2] == 0xBF)
|
||||
{
|
||||
return buffer + 3;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
Memory::Free(_buffer);
|
||||
}
|
||||
|
||||
void Append(int codepoint)
|
||||
void Append(sint32 codepoint)
|
||||
{
|
||||
Append((codepoint_t)codepoint);
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@ private:
|
|||
public:
|
||||
ZipArchive(const utf8 * path, ZIP_ACCESS access)
|
||||
{
|
||||
int zipOpenMode = ZIP_RDONLY;
|
||||
sint32 zipOpenMode = ZIP_RDONLY;
|
||||
if (access == ZIP_ACCESS_WRITE)
|
||||
{
|
||||
zipOpenMode = ZIP_CREATE;
|
||||
}
|
||||
|
||||
int error;
|
||||
sint32 error;
|
||||
_zip = zip_open(path, zipOpenMode, &error);
|
||||
if (_zip == nullptr)
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ extern "C"
|
|||
_drawingEngine->Draw();
|
||||
}
|
||||
|
||||
void drawing_engine_copy_rect(int x, int y, int width, int height, int dx, int dy)
|
||||
void drawing_engine_copy_rect(sint32 x, sint32 y, sint32 width, sint32 height, sint32 dx, sint32 dy)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void gfx_fill_rect(rct_drawpixelinfo * dpi, int left, int top, int right, int bottom, int colour)
|
||||
void gfx_fill_rect(rct_drawpixelinfo * dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, sint32 colour)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void gfx_filter_rect(rct_drawpixelinfo * dpi, int left, int top, int right, int bottom, FILTER_PALETTE_ID palette)
|
||||
void gfx_filter_rect(rct_drawpixelinfo * dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, FILTER_PALETTE_ID palette)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour)
|
||||
void gfx_draw_line(rct_drawpixelinfo *dpi, sint32 x1, sint32 y1, sint32 x2, sint32 y2, sint32 colour)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -229,7 +229,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void FASTCALL gfx_draw_sprite(rct_drawpixelinfo * dpi, int image, int x, int y, uint32 tertiary_colour)
|
||||
void FASTCALL gfx_draw_sprite(rct_drawpixelinfo * dpi, sint32 image, sint32 x, sint32 y, uint32 tertiary_colour)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void FASTCALL gfx_draw_glpyh(rct_drawpixelinfo * dpi, int image, int x, int y, uint8 * palette)
|
||||
void FASTCALL gfx_draw_glpyh(rct_drawpixelinfo * dpi, sint32 image, sint32 x, sint32 y, uint8 * palette)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void FASTCALL gfx_draw_sprite_raw_masked(rct_drawpixelinfo * dpi, int x, int y, int maskImage, int colourImage)
|
||||
void FASTCALL gfx_draw_sprite_raw_masked(rct_drawpixelinfo * dpi, sint32 x, sint32 y, sint32 maskImage, sint32 colourImage)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
void FASTCALL gfx_draw_sprite_solid(rct_drawpixelinfo * dpi, int image, int x, int y, uint8 colour)
|
||||
void FASTCALL gfx_draw_sprite_solid(rct_drawpixelinfo * dpi, sint32 image, sint32 x, sint32 y, uint8 colour)
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
@ -265,7 +265,7 @@ extern "C"
|
|||
}
|
||||
}
|
||||
|
||||
int screenshot_dump()
|
||||
sint32 screenshot_dump()
|
||||
{
|
||||
if (_drawingEngine != nullptr)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ void drawing_engine_init();
|
|||
void drawing_engine_resize();
|
||||
void drawing_engine_set_palette(SDL_Color * colours);
|
||||
void drawing_engine_draw();
|
||||
void drawing_engine_copy_rect(int x, int y, int width, int height, int dx, int dy);
|
||||
void drawing_engine_copy_rect(sint32 x, sint32 y, sint32 width, sint32 height, sint32 dx, sint32 dy);
|
||||
void drawing_engine_dispose();
|
||||
|
||||
rct_drawpixelinfo * drawing_engine_get_dpi();
|
||||
|
|
|
@ -189,14 +189,14 @@ void DrawRain(rct_drawpixelinfo * dpi, IRainDrawer * rainDrawer)
|
|||
*/
|
||||
static void DrawLightRain(IRainDrawer * rainDrawer, sint32 left, sint32 top, sint32 width, sint32 height)
|
||||
{
|
||||
int x_start = -(int)gScenarioTicks + 8;
|
||||
int y_start = (gScenarioTicks * 3) + 7;
|
||||
sint32 x_start = -(sint32)gScenarioTicks + 8;
|
||||
sint32 y_start = (gScenarioTicks * 3) + 7;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
y_start += top;
|
||||
rainDrawer->Draw(left, top, width, height, x_start, y_start);
|
||||
|
||||
x_start = -(int)gScenarioTicks + 0x18;
|
||||
x_start = -(sint32)gScenarioTicks + 0x18;
|
||||
y_start = (gScenarioTicks * 4) + 0x0D;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
|
@ -210,28 +210,28 @@ static void DrawLightRain(IRainDrawer * rainDrawer, sint32 left, sint32 top, sin
|
|||
*/
|
||||
static void DrawHeavyRain(IRainDrawer * rainDrawer, sint32 left, sint32 top, sint32 width, sint32 height)
|
||||
{
|
||||
int x_start = -(int)gScenarioTicks;
|
||||
int y_start = gScenarioTicks * 5;
|
||||
sint32 x_start = -(sint32)gScenarioTicks;
|
||||
sint32 y_start = gScenarioTicks * 5;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
y_start += top;
|
||||
rainDrawer->Draw(left, top, width, height, x_start, y_start);
|
||||
|
||||
x_start = -(int)gScenarioTicks + 0x10;
|
||||
x_start = -(sint32)gScenarioTicks + 0x10;
|
||||
y_start = (gScenarioTicks * 6) + 5;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
y_start += top;
|
||||
rainDrawer->Draw(left, top, width, height, x_start, y_start);
|
||||
|
||||
x_start = -(int)gScenarioTicks + 8;
|
||||
x_start = -(sint32)gScenarioTicks + 8;
|
||||
y_start = (gScenarioTicks * 3) + 7;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
y_start += top;
|
||||
rainDrawer->Draw(left, top, width, height, x_start, y_start);
|
||||
|
||||
x_start = -(int)gScenarioTicks + 0x18;
|
||||
x_start = -(sint32)gScenarioTicks + 0x18;
|
||||
y_start = (gScenarioTicks * 4) + 0x0D;
|
||||
y_start = -y_start;
|
||||
x_start += left;
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
#include "drawing.h"
|
||||
|
||||
// HACK These were originally passed back through registers
|
||||
int gLastDrawStringX;
|
||||
int gLastDrawStringY;
|
||||
sint32 gLastDrawStringX;
|
||||
sint32 gLastDrawStringY;
|
||||
|
||||
sint16 gCurrentFontSpriteBase;
|
||||
uint16 gCurrentFontFlags;
|
||||
|
@ -475,12 +475,12 @@ const translucent_window_palette TranslucentWindowPalettes[COLOUR_COUNT] = {
|
|||
{PALETTE_TRANSLUCENT_LIGHT_PINK, PALETTE_TRANSLUCENT_LIGHT_PINK_HIGHLIGHT, PALETTE_TRANSLUCENT_LIGHT_PINK_SHADOW},
|
||||
};
|
||||
|
||||
void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour)
|
||||
void gfx_draw_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 colour)
|
||||
{
|
||||
gfx_fill_rect(dpi, x, y, x, y, colour);
|
||||
}
|
||||
|
||||
void gfx_filter_pixel(rct_drawpixelinfo *dpi, int x, int y, FILTER_PALETTE_ID palette)
|
||||
void gfx_filter_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, FILTER_PALETTE_ID palette)
|
||||
{
|
||||
gfx_filter_rect(dpi, x, y, x, y, palette);
|
||||
}
|
||||
|
@ -491,11 +491,11 @@ void gfx_filter_pixel(rct_drawpixelinfo *dpi, int x, int y, FILTER_PALETTE_ID pa
|
|||
* a1 (ebx)
|
||||
* product (cl)
|
||||
*/
|
||||
void gfx_transpose_palette(int pal, unsigned char product)
|
||||
void gfx_transpose_palette(sint32 pal, uint8 product)
|
||||
{
|
||||
rct_g1_element g1 = g1Elements[pal];
|
||||
int width = g1.width;
|
||||
int x = g1.x_offset;
|
||||
sint32 width = g1.width;
|
||||
sint32 x = g1.x_offset;
|
||||
uint8* dest_pointer = &gGamePalette[x * 4];
|
||||
uint8* source_pointer = g1.offset;
|
||||
|
||||
|
@ -523,8 +523,8 @@ void load_palette(){
|
|||
}
|
||||
|
||||
rct_g1_element g1 = g1Elements[palette];
|
||||
int width = g1.width;
|
||||
int x = g1.x_offset;
|
||||
sint32 width = g1.width;
|
||||
sint32 x = g1.x_offset;
|
||||
uint8* dest_pointer = &gGamePalette[x * 4];
|
||||
uint8* source_pointer = g1.offset;
|
||||
|
||||
|
@ -555,7 +555,7 @@ void gfx_invalidate_screen()
|
|||
* right (dx)
|
||||
* bottom (bp)
|
||||
*/
|
||||
void window_draw_all(rct_drawpixelinfo *dpi, short left, short top, short right, short bottom)
|
||||
void window_draw_all(rct_drawpixelinfo *dpi, sint16 left, sint16 top, sint16 right, sint16 bottom)
|
||||
{
|
||||
rct_drawpixelinfo windowDPI;
|
||||
windowDPI.bits = dpi->bits + left + ((dpi->width + dpi->pitch) * top);
|
||||
|
@ -584,10 +584,10 @@ void window_draw_all(rct_drawpixelinfo *dpi, short left, short top, short right,
|
|||
* height (dx)
|
||||
* drawpixelinfo (edi)
|
||||
*/
|
||||
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, int y, int width, int height)
|
||||
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, sint32 x, sint32 y, sint32 width, sint32 height)
|
||||
{
|
||||
int right = x + width;
|
||||
int bottom = y + height;
|
||||
sint32 right = x + width;
|
||||
sint32 bottom = y + height;
|
||||
|
||||
dst->bits = src->bits;
|
||||
dst->x = src->x;
|
||||
|
@ -605,7 +605,7 @@ bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, i
|
|||
dst->bits += clippedFromLeft;
|
||||
}
|
||||
|
||||
int stickOutWidth = dst->x + dst->width - right;
|
||||
sint32 stickOutWidth = dst->x + dst->width - right;
|
||||
if (stickOutWidth > 0) {
|
||||
dst->width -= stickOutWidth;
|
||||
dst->pitch += stickOutWidth;
|
||||
|
@ -619,7 +619,7 @@ bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, i
|
|||
dst->bits += bitsPlus;
|
||||
}
|
||||
|
||||
int bp = dst->y + dst->height - bottom;
|
||||
sint32 bp = dst->y + dst->height - bottom;
|
||||
if (bp > 0) {
|
||||
dst->height -= bp;
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ assert_struct_size(rct_g1_element, 0x10);
|
|||
// Size: 0x10
|
||||
typedef struct rct_drawpixelinfo {
|
||||
uint8* bits; // 0x00
|
||||
short x; // 0x04
|
||||
short y; // 0x06
|
||||
short width; // 0x08
|
||||
short height; // 0x0A
|
||||
short pitch; // 0x0C note: this is actually (pitch - width)
|
||||
sint16 x; // 0x04
|
||||
sint16 y; // 0x06
|
||||
sint16 width; // 0x08
|
||||
sint16 height; // 0x0A
|
||||
sint16 pitch; // 0x0C note: this is actually (pitch - width)
|
||||
uint16 zoom_level; // 0x0E
|
||||
} rct_drawpixelinfo;
|
||||
#ifdef PLATFORM_32BIT
|
||||
|
@ -262,8 +262,8 @@ extern uint8 gOtherPalette[256];
|
|||
extern uint8 text_palette[];
|
||||
extern const translucent_window_palette TranslucentWindowPalettes[COLOUR_COUNT];
|
||||
|
||||
extern int gLastDrawStringX;
|
||||
extern int gLastDrawStringY;
|
||||
extern sint32 gLastDrawStringX;
|
||||
extern sint32 gLastDrawStringY;
|
||||
|
||||
extern uint32 gPickupPeepImage;
|
||||
extern sint32 gPickupPeepX;
|
||||
|
@ -285,75 +285,75 @@ extern rct_drawpixelinfo *unk_140E9A8;
|
|||
#endif
|
||||
|
||||
//
|
||||
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, int x, int y, int width, int height);
|
||||
bool clip_drawpixelinfo(rct_drawpixelinfo *dst, rct_drawpixelinfo *src, sint32 x, sint32 y, sint32 width, sint32 height);
|
||||
void gfx_set_dirty_blocks(sint16 left, sint16 top, sint16 right, sint16 bottom);
|
||||
void gfx_draw_all_dirty_blocks();
|
||||
void gfx_invalidate_screen();
|
||||
|
||||
// palette
|
||||
void gfx_transpose_palette(int pal, unsigned char product);
|
||||
void gfx_transpose_palette(sint32 pal, uint8 product);
|
||||
void load_palette();
|
||||
|
||||
// other
|
||||
void gfx_clear(rct_drawpixelinfo *dpi, uint8 paletteIndex);
|
||||
void gfx_draw_pixel(rct_drawpixelinfo *dpi, int x, int y, int colour);
|
||||
void gfx_filter_pixel(rct_drawpixelinfo *dpi, int x, int y, FILTER_PALETTE_ID palette);
|
||||
void gfx_draw_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 colour);
|
||||
void gfx_filter_pixel(rct_drawpixelinfo *dpi, sint32 x, sint32 y, FILTER_PALETTE_ID palette);
|
||||
void gfx_invalidate_pickedup_peep();
|
||||
void gfx_draw_pickedup_peep(rct_drawpixelinfo *dpi);
|
||||
|
||||
// line
|
||||
void gfx_draw_line(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour);
|
||||
void gfx_draw_line_software(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour);
|
||||
void gfx_draw_line(rct_drawpixelinfo *dpi, sint32 x1, sint32 y1, sint32 x2, sint32 y2, sint32 colour);
|
||||
void gfx_draw_line_software(rct_drawpixelinfo *dpi, sint32 x1, sint32 y1, sint32 x2, sint32 y2, sint32 colour);
|
||||
|
||||
// rect
|
||||
void gfx_fill_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, int colour);
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short right, short bottom, int colour, uint8 flags);
|
||||
void gfx_filter_rect(rct_drawpixelinfo *dpi, int left, int top, int right, int bottom, FILTER_PALETTE_ID palette);
|
||||
void gfx_fill_rect(rct_drawpixelinfo *dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, sint32 colour);
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 right, sint16 bottom, sint32 colour, uint8 flags);
|
||||
void gfx_filter_rect(rct_drawpixelinfo *dpi, sint32 left, sint32 top, sint32 right, sint32 bottom, FILTER_PALETTE_ID palette);
|
||||
|
||||
// sprite
|
||||
bool gfx_load_g1();
|
||||
bool gfx_load_g2();
|
||||
void gfx_unload_g1();
|
||||
void gfx_unload_g2();
|
||||
rct_g1_element* gfx_get_g1_element(int image_id);
|
||||
rct_g1_element* gfx_get_g1_element(sint32 image_id);
|
||||
uint32 gfx_object_allocate_images(const rct_g1_element * images, uint32 count);
|
||||
void gfx_object_free_images(uint32 baseImageId, uint32 count);
|
||||
void gfx_object_check_all_images_freed();
|
||||
void sub_68371D();
|
||||
void FASTCALL gfx_rle_sprite_to_buffer(const uint8* RESTRICT source_bits_pointer, uint8* RESTRICT dest_bits_pointer, const uint8* RESTRICT palette_pointer, const rct_drawpixelinfo * RESTRICT dpi, int image_type, int source_y_start, int height, int source_x_start, int width);
|
||||
void FASTCALL gfx_draw_sprite(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint32 tertiary_colour);
|
||||
void FASTCALL gfx_draw_glpyh(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint8 * palette);
|
||||
void FASTCALL gfx_draw_sprite_raw_masked(rct_drawpixelinfo *dpi, int x, int y, int maskImage, int colourImage);
|
||||
void FASTCALL gfx_draw_sprite_solid(rct_drawpixelinfo * dpi, int image, int x, int y, uint8 colour);
|
||||
void FASTCALL gfx_rle_sprite_to_buffer(const uint8* RESTRICT source_bits_pointer, uint8* RESTRICT dest_bits_pointer, const uint8* RESTRICT palette_pointer, const rct_drawpixelinfo * RESTRICT dpi, sint32 image_type, sint32 source_y_start, sint32 height, sint32 source_x_start, sint32 width);
|
||||
void FASTCALL gfx_draw_sprite(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint32 tertiary_colour);
|
||||
void FASTCALL gfx_draw_glpyh(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint8 * palette);
|
||||
void FASTCALL gfx_draw_sprite_raw_masked(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 maskImage, sint32 colourImage);
|
||||
void FASTCALL gfx_draw_sprite_solid(rct_drawpixelinfo * dpi, sint32 image, sint32 x, sint32 y, uint8 colour);
|
||||
|
||||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint32 tertiary_colour);
|
||||
uint8* FASTCALL gfx_draw_sprite_get_palette(int image_id, uint32 tertiary_colour);
|
||||
void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint8* palette_pointer, uint8* unknown_pointer);
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, int x, int y, int maskImage, int colourImage);
|
||||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint32 tertiary_colour);
|
||||
uint8* FASTCALL gfx_draw_sprite_get_palette(sint32 image_id, uint32 tertiary_colour);
|
||||
void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint8* palette_pointer, uint8* unknown_pointer);
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 maskImage, sint32 colourImage);
|
||||
|
||||
// string
|
||||
int clip_text(char *buffer, int width);
|
||||
int gfx_wrap_string(char* buffer, int width, int* num_lines, int* font_height);
|
||||
int gfx_get_string_width(char *buffer);
|
||||
int gfx_get_string_width_new_lined(char* buffer);
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y);
|
||||
void gfx_draw_string_left(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
void gfx_draw_string_left_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y, int width);
|
||||
int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, rct_string_id format, int colour);
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, rct_string_id format, int x, int y, int colour, void *args);
|
||||
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y, int width);
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, rct_string_id format, int colour);
|
||||
void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines, char *text);
|
||||
void gfx_draw_string_right(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y);
|
||||
int string_get_height_raw(char *buffer);
|
||||
void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int y, int width, int colour, rct_string_id format, void *args, int ticks);
|
||||
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, int colour, int x, int y, const sint8 *yOffsets, bool forceSpriteFont);
|
||||
int gfx_clip_string(char* buffer, int width);
|
||||
void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availableWidth);
|
||||
sint32 clip_text(char *buffer, sint32 width);
|
||||
sint32 gfx_wrap_string(char* buffer, sint32 width, sint32* num_lines, sint32* font_height);
|
||||
sint32 gfx_get_string_width(char *buffer);
|
||||
sint32 gfx_get_string_width_new_lined(char* buffer);
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, sint32 colour, sint32 x, sint32 y);
|
||||
void gfx_draw_string_left(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
void gfx_draw_string_left_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y, sint32 width);
|
||||
sint32 gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width, rct_string_id format, sint32 colour);
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, rct_string_id format, sint32 x, sint32 y, sint32 colour, void *args);
|
||||
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y, sint32 width);
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
sint32 gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width, rct_string_id format, sint32 colour);
|
||||
void draw_string_centred_raw(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 numLines, char *text);
|
||||
void gfx_draw_string_right(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y);
|
||||
sint32 string_get_height_raw(char *buffer);
|
||||
void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 width, sint32 colour, rct_string_id format, void *args, sint32 ticks);
|
||||
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, sint32 colour, sint32 x, sint32 y, const sint8 *yOffsets, bool forceSpriteFont);
|
||||
sint32 gfx_clip_string(char* buffer, sint32 width);
|
||||
void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, sint32 availableWidth);
|
||||
#ifndef NO_TTF
|
||||
SDL_Surface *ttf_surface_cache_get_or_add(TTF_Font *font, const utf8 *text);
|
||||
TTFFontDescriptor *ttf_get_font_from_sprite_base(uint16 spriteBase);
|
||||
|
@ -364,7 +364,7 @@ void ttf_dispose();
|
|||
|
||||
// scrolling text
|
||||
void scrolling_text_initialise_bitmaps();
|
||||
int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode);
|
||||
sint32 scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode);
|
||||
|
||||
void rct2_draw(rct_drawpixelinfo *dpi);
|
||||
|
||||
|
|
|
@ -26,30 +26,30 @@ extern "C"
|
|||
// sar eax, 0x1f (arithmetic shift right by 31)
|
||||
#define less_or_equal_zero_mask(val) (((val - 1) >> (sizeof(val) * 8 - 1)))
|
||||
|
||||
template<int image_type, int zoom_level>
|
||||
template<sint32 image_type, sint32 zoom_level>
|
||||
static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
|
||||
uint8* RESTRICT dest_bits_pointer,
|
||||
const uint8* RESTRICT palette_pointer,
|
||||
const rct_drawpixelinfo *RESTRICT dpi,
|
||||
int source_y_start,
|
||||
int height,
|
||||
int source_x_start,
|
||||
int width)
|
||||
sint32 source_y_start,
|
||||
sint32 height,
|
||||
sint32 source_x_start,
|
||||
sint32 width)
|
||||
{
|
||||
int zoom_amount = 1 << zoom_level;
|
||||
int zoom_mask = 0xFFFFFFFF << zoom_level;
|
||||
sint32 zoom_amount = 1 << zoom_level;
|
||||
sint32 zoom_mask = 0xFFFFFFFF << zoom_level;
|
||||
uint8* next_dest_pointer = dest_bits_pointer;
|
||||
|
||||
int line_width = (dpi->width >> zoom_level) + dpi->pitch;
|
||||
sint32 line_width = (dpi->width >> zoom_level) + dpi->pitch;
|
||||
|
||||
const int source_y_start_mask = less_or_equal_zero_mask(source_y_start + 1);
|
||||
const sint32 source_y_start_mask = less_or_equal_zero_mask(source_y_start + 1);
|
||||
source_y_start += zoom_amount & source_y_start_mask;
|
||||
next_dest_pointer += line_width & source_y_start_mask;
|
||||
height -= zoom_amount & source_y_start_mask;
|
||||
|
||||
//For every line in the image
|
||||
for (int i = 0; i < height; i += zoom_amount) {
|
||||
int y = source_y_start + i;
|
||||
for (sint32 i = 0; i < height; i += zoom_amount) {
|
||||
sint32 y = source_y_start + i;
|
||||
uint8 i2 = i >> zoom_level;
|
||||
|
||||
//The first part of the source pointer is a list of offsets to different lines
|
||||
|
@ -64,7 +64,7 @@ static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
|
|||
const uint8* source_pointer = next_source_pointer;
|
||||
uint8* dest_pointer = loop_dest_pointer;
|
||||
|
||||
int no_pixels = *source_pointer++;
|
||||
sint32 no_pixels = *source_pointer++;
|
||||
//gap_size is the number of non drawn pixels you require to
|
||||
//jump over on your destination
|
||||
uint8 gap_size = *source_pointer++;
|
||||
|
@ -76,16 +76,16 @@ static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
|
|||
next_source_pointer = source_pointer + no_pixels;
|
||||
|
||||
//Calculates the start point of the image
|
||||
int x_start = gap_size - source_x_start;
|
||||
const int x_diff = x_start & ~zoom_mask;
|
||||
const int x_mask = ~less_or_equal_zero_mask(x_diff);
|
||||
sint32 x_start = gap_size - source_x_start;
|
||||
const sint32 x_diff = x_start & ~zoom_mask;
|
||||
const sint32 x_mask = ~less_or_equal_zero_mask(x_diff);
|
||||
|
||||
no_pixels -= x_diff;
|
||||
x_start += ~zoom_mask & x_mask;
|
||||
source_pointer += (x_start&~zoom_mask) & x_mask;
|
||||
|
||||
// This will have -1 (0xffffffff) for (x_start <= 0), 0 otherwise
|
||||
int sign = less_or_equal_zero_mask(x_start);
|
||||
sint32 sign = less_or_equal_zero_mask(x_start);
|
||||
|
||||
dest_pointer += (x_start >> zoom_level) & ~sign;
|
||||
|
||||
|
@ -97,10 +97,10 @@ static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
|
|||
//Reset the start position to zero as we have taken into account all moves
|
||||
x_start &= ~sign;
|
||||
|
||||
int x_end = x_start + no_pixels;
|
||||
sint32 x_end = x_start + no_pixels;
|
||||
//If the end position is further out than the whole image
|
||||
//end position then we need to shorten the line again
|
||||
const int pixels_till_end = x_end - width;
|
||||
const sint32 pixels_till_end = x_end - width;
|
||||
//Shorten the line
|
||||
no_pixels -= pixels_till_end & ~(less_or_equal_zero_mask(pixels_till_end));
|
||||
|
||||
|
@ -143,17 +143,17 @@ static void FASTCALL DrawRLESprite2(const uint8* RESTRICT source_bits_pointer,
|
|||
#define DrawRLESpriteHelper2(image_type, zoom_level) \
|
||||
DrawRLESprite2<image_type, zoom_level>(source_bits_pointer, dest_bits_pointer, palette_pointer, dpi, source_y_start, height, source_x_start, width)
|
||||
|
||||
template<int image_type>
|
||||
template<sint32 image_type>
|
||||
static void FASTCALL DrawRLESprite1(const uint8* source_bits_pointer,
|
||||
uint8* dest_bits_pointer,
|
||||
const uint8* palette_pointer,
|
||||
const rct_drawpixelinfo *dpi,
|
||||
int source_y_start,
|
||||
int height,
|
||||
int source_x_start,
|
||||
int width)
|
||||
sint32 source_y_start,
|
||||
sint32 height,
|
||||
sint32 source_x_start,
|
||||
sint32 width)
|
||||
{
|
||||
int zoom_level = dpi->zoom_level;
|
||||
sint32 zoom_level = dpi->zoom_level;
|
||||
switch (zoom_level) {
|
||||
case 0: DrawRLESpriteHelper2(image_type, 0); break;
|
||||
case 1: DrawRLESpriteHelper2(image_type, 1); break;
|
||||
|
@ -177,11 +177,11 @@ extern "C"
|
|||
uint8* RESTRICT dest_bits_pointer,
|
||||
const uint8* RESTRICT palette_pointer,
|
||||
const rct_drawpixelinfo * RESTRICT dpi,
|
||||
int image_type,
|
||||
int source_y_start,
|
||||
int height,
|
||||
int source_x_start,
|
||||
int width)
|
||||
sint32 image_type,
|
||||
sint32 source_y_start,
|
||||
sint32 height,
|
||||
sint32 source_x_start,
|
||||
sint32 width)
|
||||
{
|
||||
if (image_type & IMAGE_TYPE_REMAP)
|
||||
{
|
||||
|
|
|
@ -315,7 +315,7 @@ public:
|
|||
#ifdef __ENABLE_LIGHTFX__
|
||||
const SDL_Color * lightPalette = lightfx_get_palette();
|
||||
#endif
|
||||
for (int i = 0; i < 256; i++)
|
||||
for (sint32 i = 0; i < 256; i++)
|
||||
{
|
||||
_paletteHWMapped[i] = SDL_MapRGB(_screenTextureFormat, palette[i].r, palette[i].g, palette[i].b);
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
@ -421,10 +421,10 @@ public:
|
|||
// NOTE: when zooming, there can be x, y, dx, dy combinations that go off the
|
||||
// screen; hence the checks. This code should ultimately not be called when
|
||||
// zooming because this function is specific to updating the screen on move
|
||||
int lmargin = Math::Min(x - dx, 0);
|
||||
int rmargin = Math::Min((sint32)_width - (x - dx + width), 0);
|
||||
int tmargin = Math::Min(y - dy, 0);
|
||||
int bmargin = Math::Min((sint32)_height - (y - dy + height), 0);
|
||||
sint32 lmargin = Math::Min(x - dx, 0);
|
||||
sint32 rmargin = Math::Min((sint32)_width - (x - dx + width), 0);
|
||||
sint32 tmargin = Math::Min(y - dy, 0);
|
||||
sint32 bmargin = Math::Min((sint32)_height - (y - dy + height), 0);
|
||||
x -= lmargin;
|
||||
y -= tmargin;
|
||||
width += lmargin + rmargin;
|
||||
|
@ -443,7 +443,7 @@ public:
|
|||
}
|
||||
|
||||
// Move bytes
|
||||
for (int i = 0; i < height; i++)
|
||||
for (sint32 i = 0; i < height; i++)
|
||||
{
|
||||
memmove(to, from, width);
|
||||
to += stride;
|
||||
|
@ -720,7 +720,7 @@ private:
|
|||
void CopyBitsToTexture(SDL_Texture * texture, uint8 * src, sint32 width, sint32 height, uint32 * palette)
|
||||
{
|
||||
void * pixels;
|
||||
int pitch;
|
||||
sint32 pitch;
|
||||
if (SDL_LockTexture(texture, nullptr, &pixels, &pitch) == 0)
|
||||
{
|
||||
sint32 padding = pitch - (width * 4);
|
||||
|
@ -833,11 +833,11 @@ void SoftwareDrawingContext::Clear(uint8 paletteIndex)
|
|||
{
|
||||
rct_drawpixelinfo * dpi = _dpi;
|
||||
|
||||
int w = dpi->width >> dpi->zoom_level;
|
||||
int h = dpi->height >> dpi->zoom_level;
|
||||
sint32 w = dpi->width >> dpi->zoom_level;
|
||||
sint32 h = dpi->height >> dpi->zoom_level;
|
||||
uint8 * ptr = dpi->bits;
|
||||
|
||||
for (int y = 0; y < h; y++)
|
||||
for (sint32 y = 0; y < h; y++)
|
||||
{
|
||||
Memory::Set(ptr, paletteIndex, w);
|
||||
ptr += w + dpi->pitch;
|
||||
|
@ -903,40 +903,40 @@ void SoftwareDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, si
|
|||
|
||||
uint16 crossPattern = 0;
|
||||
|
||||
int startX = left - dpi->x;
|
||||
sint32 startX = left - dpi->x;
|
||||
if (startX < 0)
|
||||
{
|
||||
crossPattern ^= startX;
|
||||
startX = 0;
|
||||
}
|
||||
|
||||
int endX = right - dpi->x + 1;
|
||||
sint32 endX = right - dpi->x + 1;
|
||||
if (endX > dpi->width)
|
||||
{
|
||||
endX = dpi->width;
|
||||
}
|
||||
|
||||
int startY = top - dpi->y;
|
||||
sint32 startY = top - dpi->y;
|
||||
if (startY < 0)
|
||||
{
|
||||
crossPattern ^= startY;
|
||||
startY = 0;
|
||||
}
|
||||
|
||||
int endY = bottom - dpi->y + 1;
|
||||
sint32 endY = bottom - dpi->y + 1;
|
||||
if (endY > dpi->height)
|
||||
{
|
||||
endY = dpi->height;
|
||||
}
|
||||
|
||||
int width = endX - startX;
|
||||
int height = endY - startY;
|
||||
sint32 width = endX - startX;
|
||||
sint32 height = endY - startY;
|
||||
|
||||
if (colour & 0x1000000)
|
||||
{
|
||||
// Cross hatching
|
||||
uint8 * dst = (startY * (dpi->width + dpi->pitch)) + startX + dpi->bits;
|
||||
for (int i = 0; i < height; i++)
|
||||
for (sint32 i = 0; i < height; i++)
|
||||
{
|
||||
uint8 * nextdst = dst + dpi->width + dpi->pitch;
|
||||
uint32 p = ror32(crossPattern, 1);
|
||||
|
@ -966,21 +966,21 @@ void SoftwareDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, si
|
|||
|
||||
// The pattern loops every 15 lines this is which
|
||||
// part the pattern is on.
|
||||
int patternY = (startY + dpi->y) % 16;
|
||||
sint32 patternY = (startY + dpi->y) % 16;
|
||||
|
||||
// The pattern loops every 15 pixels this is which
|
||||
// part the pattern is on.
|
||||
int startPatternX = (startX + dpi->x) % 16;
|
||||
int patternX = startPatternX;
|
||||
sint32 startPatternX = (startX + dpi->x) % 16;
|
||||
sint32 patternX = startPatternX;
|
||||
|
||||
const uint16 * patternsrc = Patterns[colour >> 28]; // or possibly uint8)[esi*4] ?
|
||||
|
||||
for (int numLines = height; numLines > 0; numLines--)
|
||||
for (sint32 numLines = height; numLines > 0; numLines--)
|
||||
{
|
||||
uint8 * nextdst = dst + dpi->width + dpi->pitch;
|
||||
uint16 pattern = patternsrc[patternY];
|
||||
|
||||
for (int numPixels = width; numPixels > 0; numPixels--)
|
||||
for (sint32 numPixels = width; numPixels > 0; numPixels--)
|
||||
{
|
||||
if (pattern & (1 << patternX))
|
||||
{
|
||||
|
@ -997,7 +997,7 @@ void SoftwareDrawingContext::FillRect(uint32 colour, sint32 left, sint32 top, si
|
|||
else
|
||||
{
|
||||
uint8 * dst = startY * (dpi->width + dpi->pitch) + startX + dpi->bits;
|
||||
for (int i = 0; i < height; i++)
|
||||
for (sint32 i = 0; i < height; i++)
|
||||
{
|
||||
Memory::Set(dst, colour & 0xFF, width);
|
||||
dst += dpi->width + dpi->pitch;
|
||||
|
@ -1016,32 +1016,32 @@ void SoftwareDrawingContext::FilterRect(FILTER_PALETTE_ID palette, sint32 left,
|
|||
if (bottom < dpi->y) return;
|
||||
if (top >= dpi->y + dpi->height) return;
|
||||
|
||||
int startX = left - dpi->x;
|
||||
sint32 startX = left - dpi->x;
|
||||
if (startX < 0)
|
||||
{
|
||||
startX = 0;
|
||||
}
|
||||
|
||||
int endX = right - dpi->x + 1;
|
||||
sint32 endX = right - dpi->x + 1;
|
||||
if (endX > dpi->width)
|
||||
{
|
||||
endX = dpi->width;
|
||||
}
|
||||
|
||||
int startY = top - dpi->y;
|
||||
sint32 startY = top - dpi->y;
|
||||
if (startY < 0)
|
||||
{
|
||||
startY = 0;
|
||||
}
|
||||
|
||||
int endY = bottom - dpi->y + 1;
|
||||
sint32 endY = bottom - dpi->y + 1;
|
||||
if (endY > dpi->height)
|
||||
{
|
||||
endY = dpi->height;
|
||||
}
|
||||
|
||||
int width = endX - startX;
|
||||
int height = endY - startY;
|
||||
sint32 width = endX - startX;
|
||||
sint32 height = endY - startY;
|
||||
|
||||
|
||||
//0x2000000
|
||||
|
@ -1055,10 +1055,10 @@ void SoftwareDrawingContext::FilterRect(FILTER_PALETTE_ID palette, sint32 left,
|
|||
uint8 * g1Bits = g1Element->offset;
|
||||
|
||||
// Fill the rectangle with the colours from the colour table
|
||||
for (int i = 0; i < height >> dpi->zoom_level; i++)
|
||||
for (sint32 i = 0; i < height >> dpi->zoom_level; i++)
|
||||
{
|
||||
uint8 * nextdst = dst + (dpi->width >> dpi->zoom_level) + dpi->pitch;
|
||||
for (int j = 0; j < (width >> dpi->zoom_level); j++)
|
||||
for (sint32 j = 0; j < (width >> dpi->zoom_level); j++)
|
||||
{
|
||||
*dst = g1Bits[*dst];
|
||||
dst++;
|
||||
|
|
|
@ -24,16 +24,16 @@
|
|||
// Per-instance data for images
|
||||
struct DrawImageInstance {
|
||||
vec4i clip;
|
||||
int texColourAtlas;
|
||||
sint32 texColourAtlas;
|
||||
vec4f texColourBounds;
|
||||
int texMaskAtlas;
|
||||
sint32 texMaskAtlas;
|
||||
vec4f texMaskBounds;
|
||||
int texPaletteAtlas;
|
||||
sint32 texPaletteAtlas;
|
||||
vec4f texPaletteBounds;
|
||||
int flags;
|
||||
sint32 flags;
|
||||
vec4f colour;
|
||||
vec4i bounds;
|
||||
int mask;
|
||||
sint32 mask;
|
||||
};
|
||||
|
||||
class DrawImageShader final : public OpenGLShaderProgram
|
||||
|
|
|
@ -80,7 +80,7 @@ void FillRectShader::SetFlags(uint32 flags)
|
|||
glUniform1i(uFlags, flags);
|
||||
}
|
||||
|
||||
void FillRectShader::SetColour(int index, vec4f colour)
|
||||
void FillRectShader::SetColour(sint32 index, vec4f colour)
|
||||
{
|
||||
glUniform4f(uColour[index], colour.r, colour.g, colour.b, colour.a);
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
void SetClip(sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
void SetBounds(sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
void SetFlags(uint32 flags);
|
||||
void SetColour(int index, vec4f colour);
|
||||
void SetColour(sint32 index, vec4f colour);
|
||||
void SetSourceFramebuffer(GLuint texture);
|
||||
|
||||
void Draw(sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
|
|
|
@ -307,7 +307,7 @@ public:
|
|||
|
||||
void SetPalette(SDL_Color * palette) override
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
for (sint32 i = 0; i < 256; i++)
|
||||
{
|
||||
SDL_Color colour = palette[i];
|
||||
colour.a = i == 0 ? 0 : 255;
|
||||
|
@ -371,7 +371,7 @@ public:
|
|||
framebuffer->Bind();
|
||||
void * pixels = framebuffer->GetPixels();
|
||||
|
||||
int result = screenshot_dump_png_32bpp(_width, _height, pixels);
|
||||
sint32 result = screenshot_dump_png_32bpp(_width, _height, pixels);
|
||||
Memory::Free(pixels);
|
||||
return result;
|
||||
}
|
||||
|
@ -691,7 +691,7 @@ void OpenGLDrawingContext::DrawLine(uint32 colour, sint32 x1, sint32 y1, sint32
|
|||
|
||||
void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 tertiaryColour)
|
||||
{
|
||||
int g1Id = image & 0x7FFFF;
|
||||
sint32 g1Id = image & 0x7FFFF;
|
||||
rct_g1_element * g1Element = gfx_get_g1_element(g1Id);
|
||||
|
||||
if (_dpi->zoom_level != 0)
|
||||
|
@ -726,7 +726,7 @@ void OpenGLDrawingContext::DrawSprite(uint32 image, sint32 x, sint32 y, uint32 t
|
|||
sint32 left = x + drawOffsetX;
|
||||
sint32 top = y + drawOffsetY;
|
||||
|
||||
int zoom_mask = 0xFFFFFFFF << _dpi->zoom_level;
|
||||
sint32 zoom_mask = 0xFFFFFFFF << _dpi->zoom_level;
|
||||
if (_dpi->zoom_level && g1Element->flags & G1_FLAG_RLE_COMPRESSION){
|
||||
top -= ~zoom_mask;
|
||||
}
|
||||
|
@ -880,7 +880,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uin
|
|||
{
|
||||
vec4f paletteColour = _engine->GLPalette[colour & 0xFF];
|
||||
|
||||
int g1Id = image & 0x7FFFF;
|
||||
sint32 g1Id = image & 0x7FFFF;
|
||||
rct_g1_element * g1Element = gfx_get_g1_element(g1Id);
|
||||
|
||||
auto texture = _textureCache->GetOrLoadImageTexture(image);
|
||||
|
@ -932,7 +932,7 @@ void OpenGLDrawingContext::DrawSpriteSolid(uint32 image, sint32 x, sint32 y, uin
|
|||
|
||||
void OpenGLDrawingContext::DrawGlyph(uint32 image, sint32 x, sint32 y, uint8 * palette)
|
||||
{
|
||||
int g1Id = image & 0x7FFFF;
|
||||
sint32 g1Id = image & 0x7FFFF;
|
||||
rct_g1_element * g1Element = gfx_get_g1_element(g1Id);
|
||||
|
||||
auto texture = _textureCache->GetOrLoadGlyphTexture(image, palette);
|
||||
|
|
|
@ -219,7 +219,7 @@ void * TextureCache::GetImageAsARGB(uint32 image, uint32 tertiaryColour, uint32
|
|||
return pixels32;
|
||||
}
|
||||
|
||||
CachedTextureInfo TextureCache::AllocateImage(int imageWidth, int imageHeight)
|
||||
CachedTextureInfo TextureCache::AllocateImage(sint32 imageWidth, sint32 imageHeight)
|
||||
{
|
||||
CreateAtlasesTexture();
|
||||
|
||||
|
@ -233,13 +233,13 @@ CachedTextureInfo TextureCache::AllocateImage(int imageWidth, int imageHeight)
|
|||
}
|
||||
|
||||
// If there is no such atlas, then create a new one
|
||||
if ((int) _atlases.size() >= _atlasesTextureIndicesLimit)
|
||||
if ((sint32) _atlases.size() >= _atlasesTextureIndicesLimit)
|
||||
{
|
||||
throw std::runtime_error("more texture atlases required, but device limit reached!");
|
||||
}
|
||||
|
||||
int atlasIndex = (int) _atlases.size();
|
||||
int atlasSize = (int) powf(2, (float) Atlas::CalculateImageSizeOrder(imageWidth, imageHeight));
|
||||
sint32 atlasIndex = (sint32) _atlases.size();
|
||||
sint32 atlasSize = (sint32) powf(2, (float) Atlas::CalculateImageSizeOrder(imageWidth, imageHeight));
|
||||
|
||||
#ifdef DEBUG
|
||||
log_verbose("new texture atlas #%d (size %d) allocated\n", atlasIndex, atlasSize);
|
||||
|
|
|
@ -54,11 +54,11 @@ struct GlyphId
|
|||
|
||||
// This is the maximum width and height of each atlas, basically the
|
||||
// granularity at which new atlases are allocated (2048 -> 4 MB of VRAM)
|
||||
constexpr int TEXTURE_CACHE_MAX_ATLAS_SIZE = 2048;
|
||||
constexpr sint32 TEXTURE_CACHE_MAX_ATLAS_SIZE = 2048;
|
||||
|
||||
// Pixel dimensions of smallest supported slots in texture atlases
|
||||
// Must be a power of 2!
|
||||
constexpr int TEXTURE_CACHE_SMALLEST_SLOT = 32;
|
||||
constexpr sint32 TEXTURE_CACHE_SMALLEST_SLOT = 32;
|
||||
|
||||
// Location of an image (texture atlas index, slot and normalized coordinates)
|
||||
struct CachedTextureInfo
|
||||
|
@ -76,20 +76,20 @@ class Atlas final
|
|||
{
|
||||
private:
|
||||
GLuint _index;
|
||||
int _imageSize;
|
||||
int _atlasWidth, _atlasHeight;
|
||||
sint32 _imageSize;
|
||||
sint32 _atlasWidth, _atlasHeight;
|
||||
std::vector<GLuint> _freeSlots;
|
||||
|
||||
int _cols, _rows;
|
||||
sint32 _cols, _rows;
|
||||
|
||||
public:
|
||||
Atlas(GLuint index, int imageSize)
|
||||
Atlas(GLuint index, sint32 imageSize)
|
||||
{
|
||||
_index = index;
|
||||
_imageSize = imageSize;
|
||||
}
|
||||
|
||||
void Initialise(int atlasWidth, int atlasHeight)
|
||||
void Initialise(sint32 atlasWidth, sint32 atlasHeight)
|
||||
{
|
||||
_atlasWidth = atlasWidth;
|
||||
_atlasHeight = atlasHeight;
|
||||
|
@ -104,7 +104,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
CachedTextureInfo Allocate(int actualWidth, int actualHeight)
|
||||
CachedTextureInfo Allocate(sint32 actualWidth, sint32 actualHeight)
|
||||
{
|
||||
assert(_freeSlots.size() > 0);
|
||||
|
||||
|
@ -131,35 +131,35 @@ public:
|
|||
|
||||
// Checks if specified image would be tightly packed in this atlas
|
||||
// by checking if it is within the right power of 2 range
|
||||
bool IsImageSuitable(int actualWidth, int actualHeight) const
|
||||
bool IsImageSuitable(sint32 actualWidth, sint32 actualHeight) const
|
||||
{
|
||||
int imageOrder = CalculateImageSizeOrder(actualWidth, actualHeight);
|
||||
int atlasOrder = (int) log2(_imageSize);
|
||||
sint32 imageOrder = CalculateImageSizeOrder(actualWidth, actualHeight);
|
||||
sint32 atlasOrder = (sint32) log2(_imageSize);
|
||||
|
||||
return imageOrder == atlasOrder;
|
||||
}
|
||||
|
||||
int GetFreeSlots() const
|
||||
sint32 GetFreeSlots() const
|
||||
{
|
||||
return (int) _freeSlots.size();
|
||||
return (sint32) _freeSlots.size();
|
||||
}
|
||||
|
||||
static int CalculateImageSizeOrder(int actualWidth, int actualHeight)
|
||||
static sint32 CalculateImageSizeOrder(sint32 actualWidth, sint32 actualHeight)
|
||||
{
|
||||
int actualSize = std::max(actualWidth, actualHeight);
|
||||
sint32 actualSize = std::max(actualWidth, actualHeight);
|
||||
|
||||
if (actualSize < TEXTURE_CACHE_SMALLEST_SLOT) {
|
||||
actualSize = TEXTURE_CACHE_SMALLEST_SLOT;
|
||||
}
|
||||
|
||||
return (int) ceil(log2f((float) actualSize));
|
||||
return (sint32) ceil(log2f((float) actualSize));
|
||||
}
|
||||
|
||||
private:
|
||||
vec4i GetSlotCoordinates(GLuint slot, int actualWidth, int actualHeight) const
|
||||
vec4i GetSlotCoordinates(GLuint slot, sint32 actualWidth, sint32 actualHeight) const
|
||||
{
|
||||
int row = slot / _cols;
|
||||
int col = slot % _cols;
|
||||
sint32 row = slot / _cols;
|
||||
sint32 col = slot % _cols;
|
||||
|
||||
return vec4i
|
||||
{
|
||||
|
@ -216,7 +216,7 @@ private:
|
|||
CachedTextureInfo LoadImageTexture(uint32 image);
|
||||
CachedTextureInfo LoadGlyphTexture(uint32 image, uint8 * palette);
|
||||
CachedTextureInfo LoadPaletteTexture(uint32 image, uint32 tertiaryColour, bool special);
|
||||
CachedTextureInfo AllocateImage(int imageWidth, int imageHeight);
|
||||
CachedTextureInfo AllocateImage(sint32 imageWidth, sint32 imageHeight);
|
||||
void * GetImageAsARGB(uint32 image, uint32 tertiaryColour, uint32 * outWidth, uint32 * outHeight);
|
||||
rct_drawpixelinfo * GetImageAsDPI(uint32 image, uint32 tertiaryColour);
|
||||
void * GetGlyphAsARGB(uint32 image, uint8 * palette, uint32 * outWidth, uint32 * outHeight);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "drawing.h"
|
||||
#include "font.h"
|
||||
|
||||
static const int SpriteFontLineHeight[] = { 6, 10, 10, 18 };
|
||||
static const sint32 SpriteFontLineHeight[] = { 6, 10, 10, 18 };
|
||||
|
||||
#ifdef NO_RCT2
|
||||
static uint8 _spriteFontCharacterWidths[896];
|
||||
|
@ -39,12 +39,12 @@ TTFFontSetDescriptor *gCurrentTTFFontSet;
|
|||
void font_sprite_initialise_characters()
|
||||
{
|
||||
uint8* pCharacterWidth = _spriteFontCharacterWidths;
|
||||
for (int fontSize = 0; fontSize < FONT_SIZE_COUNT; fontSize++) {
|
||||
int glyphOffset = fontSize * FONT_SPRITE_GLYPH_COUNT;
|
||||
for (sint32 fontSize = 0; fontSize < FONT_SIZE_COUNT; fontSize++) {
|
||||
sint32 glyphOffset = fontSize * FONT_SPRITE_GLYPH_COUNT;
|
||||
for (uint8 glyphIndex = 0; glyphIndex < FONT_SPRITE_GLYPH_COUNT; glyphIndex++) {
|
||||
rct_g1_element g1 = g1Elements[glyphIndex + SPR_CHAR_START + glyphOffset];
|
||||
|
||||
int width = fontSize == FONT_SIZE_BIG ? g1.width + 1 : g1.width - 1;
|
||||
sint32 width = fontSize == FONT_SIZE_BIG ? g1.width + 1 : g1.width - 1;
|
||||
if (glyphIndex >= (FORMAT_ARGUMENT_CODE_START - 32) && glyphIndex < (FORMAT_COLOUR_CODE_END - 32)) {
|
||||
width = 0;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void font_sprite_initialise_characters()
|
|||
scrolling_text_initialise_bitmaps();
|
||||
}
|
||||
|
||||
int font_sprite_get_codepoint_offset(int codepoint)
|
||||
sint32 font_sprite_get_codepoint_offset(sint32 codepoint)
|
||||
{
|
||||
switch (codepoint) {
|
||||
case FORMAT_ENDQUOTES: return 34 - 32;
|
||||
|
@ -99,17 +99,17 @@ int font_sprite_get_codepoint_offset(int codepoint)
|
|||
}
|
||||
}
|
||||
|
||||
int font_sprite_get_codepoint_width(int fontSpriteBase, int codepoint)
|
||||
sint32 font_sprite_get_codepoint_width(sint32 fontSpriteBase, sint32 codepoint)
|
||||
{
|
||||
return _spriteFontCharacterWidths[fontSpriteBase + font_sprite_get_codepoint_offset(codepoint)];
|
||||
}
|
||||
|
||||
int font_sprite_get_codepoint_sprite(int fontSpriteBase, int codepoint)
|
||||
sint32 font_sprite_get_codepoint_sprite(sint32 fontSpriteBase, sint32 codepoint)
|
||||
{
|
||||
return SPR_CHAR_START + (IMAGE_TYPE_REMAP | (fontSpriteBase + font_sprite_get_codepoint_offset(codepoint)));
|
||||
}
|
||||
|
||||
int font_get_size_from_sprite_base(uint16 spriteBase)
|
||||
sint32 font_get_size_from_sprite_base(uint16 spriteBase)
|
||||
{
|
||||
switch (spriteBase) {
|
||||
case FONT_SPRITE_BASE_TINY:
|
||||
|
@ -124,9 +124,9 @@ int font_get_size_from_sprite_base(uint16 spriteBase)
|
|||
}
|
||||
}
|
||||
|
||||
int font_get_line_height(int fontSpriteBase)
|
||||
sint32 font_get_line_height(sint32 fontSpriteBase)
|
||||
{
|
||||
int fontSize = font_get_size_from_sprite_base(fontSpriteBase);
|
||||
sint32 fontSize = font_get_size_from_sprite_base(fontSpriteBase);
|
||||
#ifndef NO_TTF
|
||||
if (gUseTrueTypeFont) {
|
||||
return gCurrentTTFFontSet->size[fontSize].line_height;
|
||||
|
@ -138,7 +138,7 @@ int font_get_line_height(int fontSpriteBase)
|
|||
#endif // NO_TTF
|
||||
}
|
||||
|
||||
int font_get_line_height_small(int fontSpriteBase)
|
||||
sint32 font_get_line_height_small(sint32 fontSpriteBase)
|
||||
{
|
||||
return font_get_line_height(fontSpriteBase) / 2;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ bool font_supports_string_sprite(const utf8 *text)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool font_supports_string_ttf(const utf8 *text, int fontSize)
|
||||
bool font_supports_string_ttf(const utf8 *text, sint32 fontSize)
|
||||
{
|
||||
#ifndef NO_TTF
|
||||
const utf8 *src = text;
|
||||
|
@ -216,7 +216,7 @@ bool font_supports_string_ttf(const utf8 *text, int fontSize)
|
|||
#endif // NO_TTF
|
||||
}
|
||||
|
||||
bool font_supports_string(const utf8 *text, int fontSize)
|
||||
bool font_supports_string(const utf8 *text, sint32 fontSize)
|
||||
{
|
||||
if (gUseTrueTypeFont) {
|
||||
return font_supports_string_ttf(text, fontSize);
|
||||
|
|
|
@ -46,10 +46,10 @@ enum {
|
|||
typedef struct TTFFontDescriptor {
|
||||
const utf8 *filename;
|
||||
const utf8 *font_name;
|
||||
int ptSize;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
int line_height;
|
||||
sint32 ptSize;
|
||||
sint32 offset_x;
|
||||
sint32 offset_y;
|
||||
sint32 line_height;
|
||||
TTF_Font *font;
|
||||
} TTFFontDescriptor;
|
||||
|
||||
|
@ -61,14 +61,14 @@ extern TTFFontSetDescriptor *gCurrentTTFFontSet;
|
|||
#endif // NO_TTF
|
||||
|
||||
void font_sprite_initialise_characters();
|
||||
int font_sprite_get_codepoint_offset(int codepoint);
|
||||
int font_sprite_get_codepoint_width(int fontSpriteBase, int codepoint);
|
||||
int font_sprite_get_codepoint_sprite(int fontSpriteBase, int codepoint);
|
||||
int font_get_size_from_sprite_base(uint16 spriteBase);
|
||||
int font_get_line_height(int fontSpriteBase);
|
||||
int font_get_line_height_small(int fontSpriteBase);
|
||||
sint32 font_sprite_get_codepoint_offset(sint32 codepoint);
|
||||
sint32 font_sprite_get_codepoint_width(sint32 fontSpriteBase, sint32 codepoint);
|
||||
sint32 font_sprite_get_codepoint_sprite(sint32 fontSpriteBase, sint32 codepoint);
|
||||
sint32 font_get_size_from_sprite_base(uint16 spriteBase);
|
||||
sint32 font_get_line_height(sint32 fontSpriteBase);
|
||||
sint32 font_get_line_height_small(sint32 fontSpriteBase);
|
||||
bool font_supports_string_sprite(const utf8 *text);
|
||||
bool font_supports_string_ttf(const utf8 *text, int fontSize);
|
||||
bool font_supports_string(const utf8 *text, int fontSize);
|
||||
bool font_supports_string_ttf(const utf8 *text, sint32 fontSize);
|
||||
bool font_supports_string(const utf8 *text, sint32 fontSize);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -124,8 +124,8 @@ void lightfx_init()
|
|||
|
||||
uint8 *parcer = _bakedLightTexture_lantern_3;
|
||||
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
for (sint32 y = 0; y < 256; y++) {
|
||||
for (sint32 x = 0; x < 256; x++) {
|
||||
*parcer = calc_light_intensity_lantern(x - 128, y - 128);
|
||||
parcer++;
|
||||
}
|
||||
|
@ -133,8 +133,8 @@ void lightfx_init()
|
|||
|
||||
parcer = _bakedLightTexture_spot_3;
|
||||
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
for (sint32 y = 0; y < 256; y++) {
|
||||
for (sint32 x = 0; x < 256; x++) {
|
||||
*parcer = calc_light_intensity_spot(x - 128, y - 128);
|
||||
parcer++;
|
||||
}
|
||||
|
@ -249,28 +249,28 @@ void lightfx_prepare_light_list()
|
|||
break;
|
||||
}
|
||||
|
||||
int mapFrontDiv = 1 << _current_view_zoom_front;
|
||||
sint32 mapFrontDiv = 1 << _current_view_zoom_front;
|
||||
static sint16 offsetPattern[26] = { 0, 0, -4, 0, 0, -3, 4, 0, 0, 3,
|
||||
-2, -1, -1, -1, 2, 1, 1, 1,
|
||||
-3, -2, -3, 2, 3, -2, 3, 2 };
|
||||
#endif //LIGHTFX_UNKNOWN_PART_1
|
||||
|
||||
if (true) {
|
||||
int totalSamplePoints = 5;
|
||||
int startSamplePoint = 1;
|
||||
int lastSampleCount = 0;
|
||||
sint32 totalSamplePoints = 5;
|
||||
sint32 startSamplePoint = 1;
|
||||
sint32 lastSampleCount = 0;
|
||||
|
||||
if ((entry->lightIDqualifier & 0xF) == LIGHTFX_LIGHT_QUALIFIER_MAP) {
|
||||
startSamplePoint = 0;
|
||||
totalSamplePoints = 1;
|
||||
}
|
||||
|
||||
for (int pat = startSamplePoint; pat < totalSamplePoints; pat++) {
|
||||
for (sint32 pat = startSamplePoint; pat < totalSamplePoints; pat++) {
|
||||
rct_xy16 mapCoord = { 0 };
|
||||
|
||||
rct_map_element *mapElement = 0;
|
||||
|
||||
int interactionType = 0;
|
||||
sint32 interactionType = 0;
|
||||
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
|
@ -306,12 +306,12 @@ void lightfx_prepare_light_list()
|
|||
//RCT2_GLOBAL(0x9AC148, uint8_t) = 0;
|
||||
//RCT2_GLOBAL(0x9AC138 + 4, int16_t) = screenX;
|
||||
//RCT2_GLOBAL(0x9AC138 + 6, int16_t) = screenY;
|
||||
//if (screenX >= 0 && screenX < (int)myviewport->width && screenY >= 0 && screenY < (int)myviewport->height)
|
||||
//if (screenX >= 0 && screenX < (sint32)myviewport->width && screenY >= 0 && screenY < (sint32)myviewport->height)
|
||||
//{
|
||||
// screenX <<= myviewport->zoom;
|
||||
// screenY <<= myviewport->zoom;
|
||||
// screenX += (int)myviewport->view_x;
|
||||
// screenY += (int)myviewport->view_y;
|
||||
// screenX += (sint32)myviewport->view_x;
|
||||
// screenY += (sint32)myviewport->view_y;
|
||||
// RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16_t) = myviewport->zoom;
|
||||
// screenX &= (0xFFFF << myviewport->zoom) & 0xFFFF;
|
||||
// screenY &= (0xFFFF << myviewport->zoom) & 0xFFFF;
|
||||
|
@ -378,7 +378,7 @@ void lightfx_prepare_light_list()
|
|||
break;
|
||||
if (_current_view_zoom_front > 0)
|
||||
break;
|
||||
int newSampleCount = lightIntensityOccluded / 900;
|
||||
sint32 newSampleCount = lightIntensityOccluded / 900;
|
||||
if (abs(newSampleCount - lastSampleCount) < 10)
|
||||
break;
|
||||
totalSamplePoints += 4;
|
||||
|
@ -575,8 +575,8 @@ void lightfx_render_lights_to_frontbuffer()
|
|||
bufWriteSkip = _pixelInfo.width - bufWriteWidth;
|
||||
|
||||
if (entry->lightIntensity == 0xFF) {
|
||||
for (int y = 0; y < bufWriteHeight; y++) {
|
||||
for (int x = 0; x < bufWriteWidth; x++) {
|
||||
for (sint32 y = 0; y < bufWriteHeight; y++) {
|
||||
for (sint32 x = 0; x < bufWriteWidth; x++) {
|
||||
*bufWriteBase = min(0xFF, *bufWriteBase + *bufReadBase);
|
||||
bufWriteBase++;
|
||||
bufReadBase++;
|
||||
|
@ -587,8 +587,8 @@ void lightfx_render_lights_to_frontbuffer()
|
|||
}
|
||||
}
|
||||
else {
|
||||
for (int y = 0; y < bufWriteHeight; y++) {
|
||||
for (int x = 0; x < bufWriteWidth; x++) {
|
||||
for (sint32 y = 0; y < bufWriteHeight; y++) {
|
||||
for (sint32 x = 0; x < bufWriteWidth; x++) {
|
||||
*bufWriteBase = min(0xFF, *bufWriteBase + (((*bufReadBase) * (1 + entry->lightIntensity)) >> 8));
|
||||
bufWriteBase++;
|
||||
bufReadBase++;
|
||||
|
@ -967,8 +967,8 @@ static uint8 lerp(uint8 a, uint8 b, float t)
|
|||
if (t <= 0) return a;
|
||||
if (t >= 1) return b;
|
||||
|
||||
int range = b - a;
|
||||
int amount = (int)(range * t);
|
||||
sint32 range = b - a;
|
||||
sint32 amount = (sint32)(range * t);
|
||||
return (uint8)(a + amount);
|
||||
}
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ void lightfx_render_to_texture(
|
|||
uint8 * lightBits = (uint8 *)lightfx_get_front_buffer();
|
||||
|
||||
void * pixels;
|
||||
int pitch;
|
||||
sint32 pitch;
|
||||
if (SDL_LockTexture(texture, NULL, &pixels, &pitch) == 0) {
|
||||
for (uint32 y = 0; y < height; y++) {
|
||||
uintptr_t dstOffset = (uintptr_t)(y * pitch);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
* Draws a horizontal line of specified colour to a buffer.
|
||||
* rct2: 0x0068474C
|
||||
*/
|
||||
static void gfx_draw_line_on_buffer(rct_drawpixelinfo *dpi, char colour, int y, int x, int no_pixels)
|
||||
static void gfx_draw_line_on_buffer(rct_drawpixelinfo *dpi, char colour, sint32 y, sint32 x, sint32 no_pixels)
|
||||
{
|
||||
y -= dpi->y;
|
||||
|
||||
|
@ -68,7 +68,7 @@ static void gfx_draw_line_on_buffer(rct_drawpixelinfo *dpi, char colour, int y,
|
|||
* y2 (dx)
|
||||
* colour (ebp)
|
||||
*/
|
||||
void gfx_draw_line_software(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int y2, int colour)
|
||||
void gfx_draw_line_software(rct_drawpixelinfo *dpi, sint32 x1, sint32 y1, sint32 x2, sint32 y2, sint32 colour)
|
||||
{
|
||||
// Check to make sure the line is within the drawing area
|
||||
if ((x1 < dpi->x) && (x2 < dpi->x)){
|
||||
|
@ -90,10 +90,10 @@ void gfx_draw_line_software(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int
|
|||
//Bresenhams algorithm
|
||||
|
||||
//If vertical plot points upwards
|
||||
int steep = abs(y2 - y1) > abs(x2 - x1);
|
||||
sint32 steep = abs(y2 - y1) > abs(x2 - x1);
|
||||
if (steep){
|
||||
int temp_y2 = y2;
|
||||
int temp_x2 = x2;
|
||||
sint32 temp_y2 = y2;
|
||||
sint32 temp_x2 = x2;
|
||||
y2 = x1;
|
||||
x2 = y1;
|
||||
y1 = temp_x2;
|
||||
|
@ -102,25 +102,25 @@ void gfx_draw_line_software(rct_drawpixelinfo *dpi, int x1, int y1, int x2, int
|
|||
|
||||
//If line is right to left swap direction
|
||||
if (x1 > x2){
|
||||
int temp_y2 = y2;
|
||||
int temp_x2 = x2;
|
||||
sint32 temp_y2 = y2;
|
||||
sint32 temp_x2 = x2;
|
||||
y2 = y1;
|
||||
x2 = x1;
|
||||
y1 = temp_y2;
|
||||
x1 = temp_x2;
|
||||
}
|
||||
|
||||
int delta_x = x2 - x1;
|
||||
int delta_y = abs(y2 - y1);
|
||||
int error = delta_x / 2;
|
||||
int y_step;
|
||||
int y = y1;
|
||||
sint32 delta_x = x2 - x1;
|
||||
sint32 delta_y = abs(y2 - y1);
|
||||
sint32 error = delta_x / 2;
|
||||
sint32 y_step;
|
||||
sint32 y = y1;
|
||||
|
||||
//Direction of step
|
||||
if (y1 < y2)y_step = 1;
|
||||
else y_step = -1;
|
||||
|
||||
for (int x = x1, x_start = x1, no_pixels = 1; x < x2; ++x,++no_pixels){
|
||||
for (sint32 x = x1, x_start = x1, no_pixels = 1; x < x2; ++x,++no_pixels){
|
||||
//Vertical lines are drawn 1 pixel at a time
|
||||
if (steep)gfx_draw_line_on_buffer(dpi, colour, x, y, 1);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
* colour (ebp)
|
||||
* flags (si)
|
||||
*/
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, short left, short top, short right, short bottom, int colour, uint8 flags)
|
||||
void gfx_fill_rect_inset(rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 right, sint16 bottom, sint32 colour, uint8 flags)
|
||||
{
|
||||
uint8 shadow, fill, hilight;
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ static rct_draw_scroll_text _drawScrollTextList[MAX_SCROLLING_TEXT_ENTRIES];
|
|||
static uint8 _characterBitmaps[224 * 8];
|
||||
static uint32 _drawSCrollNextIndex = 0;
|
||||
|
||||
void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets);
|
||||
void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets);
|
||||
void scrolling_text_set_bitmap_for_sprite(utf8 *text, sint32 scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets);
|
||||
void scrolling_text_set_bitmap_for_ttf(utf8 *text, sint32 scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets);
|
||||
|
||||
void scrolling_text_initialise_bitmaps()
|
||||
{
|
||||
|
@ -58,13 +58,13 @@ void scrolling_text_initialise_bitmaps()
|
|||
};
|
||||
|
||||
|
||||
for (int i = 0; i < 224; i++) {
|
||||
for (sint32 i = 0; i < 224; i++) {
|
||||
memset(drawingSurface, 0, sizeof(drawingSurface));
|
||||
gfx_draw_sprite_software(&dpi, SPR_CHAR_START + FONT_SPRITE_BASE_TINY + i, -1, 0, 0);
|
||||
|
||||
for (int x = 0; x < 8; x++) {
|
||||
for (sint32 x = 0; x < 8; x++) {
|
||||
uint8 val = 0;
|
||||
for (int y = 0; y < 8; y++) {
|
||||
for (sint32 y = 0; y < 8; y++) {
|
||||
val >>= 1;
|
||||
if (dpi.bits[x + y * 8] == 1) {
|
||||
val |= 0x80;
|
||||
|
@ -74,7 +74,7 @@ void scrolling_text_initialise_bitmaps()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++) {
|
||||
for (sint32 i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++) {
|
||||
rct_g1_element *g1 = &g1Elements[SPR_SCROLLING_TEXT_START + i];
|
||||
g1->offset = _drawScrollTextList[i].bitmap;
|
||||
g1->width = 64;
|
||||
|
@ -88,17 +88,17 @@ void scrolling_text_initialise_bitmaps()
|
|||
}
|
||||
}
|
||||
|
||||
static uint8 *font_sprite_get_codepoint_bitmap(int codepoint)
|
||||
static uint8 *font_sprite_get_codepoint_bitmap(sint32 codepoint)
|
||||
{
|
||||
return &_characterBitmaps[font_sprite_get_codepoint_offset(codepoint) * 8];
|
||||
}
|
||||
|
||||
|
||||
static int scrolling_text_get_matching_or_oldest(rct_string_id stringId, uint16 scroll, uint16 scrollingMode)
|
||||
static sint32 scrolling_text_get_matching_or_oldest(rct_string_id stringId, uint16 scroll, uint16 scrollingMode)
|
||||
{
|
||||
uint32 oldestId = 0xFFFFFFFF;
|
||||
int scrollIndex = -1;
|
||||
for (int i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++) {
|
||||
sint32 scrollIndex = -1;
|
||||
for (sint32 i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++) {
|
||||
rct_draw_scroll_text *scrollText = &_drawScrollTextList[i];
|
||||
if (oldestId >= scrollText->id) {
|
||||
oldestId = scrollText->id;
|
||||
|
@ -125,7 +125,7 @@ static int scrolling_text_get_matching_or_oldest(rct_string_id stringId, uint16
|
|||
|
||||
static uint8 scrolling_text_get_colour(uint32 character)
|
||||
{
|
||||
int colour = character & 0x7F;
|
||||
sint32 colour = character & 0x7F;
|
||||
if (character & COLOUR_FLAG_TRANSLUCENT) {
|
||||
return ColourMapA[colour].light;
|
||||
} else {
|
||||
|
@ -1414,7 +1414,7 @@ static const sint16* _scrollPositions[MAX_SCROLLING_TEXT_MODES] = {
|
|||
* @param scrollingMode (bp)
|
||||
* @returns ebx
|
||||
*/
|
||||
int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode)
|
||||
sint32 scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode)
|
||||
{
|
||||
assert(scrollingMode < MAX_SCROLLING_TEXT_MODES);
|
||||
|
||||
|
@ -1424,7 +1424,7 @@ int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrolling
|
|||
|
||||
_drawSCrollNextIndex++;
|
||||
|
||||
int scrollIndex = scrolling_text_get_matching_or_oldest(stringId, scroll, scrollingMode);
|
||||
sint32 scrollIndex = scrolling_text_get_matching_or_oldest(stringId, scroll, scrollingMode);
|
||||
if (scrollIndex >= SPR_SCROLLING_TEXT_START) return scrollIndex;
|
||||
|
||||
// Setup scrolling text
|
||||
|
@ -1458,7 +1458,7 @@ int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrolling
|
|||
return imageId;
|
||||
}
|
||||
|
||||
void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets)
|
||||
void scrolling_text_set_bitmap_for_sprite(utf8 *text, sint32 scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets)
|
||||
{
|
||||
uint8 characterColour = scrolling_text_get_colour(gCommonFormatArgs[7]);
|
||||
|
||||
|
@ -1482,7 +1482,7 @@ void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap,
|
|||
// If another type of control character ignore
|
||||
if (codepoint < 32) continue;
|
||||
|
||||
int characterWidth = font_sprite_get_codepoint_width(FONT_SPRITE_BASE_TINY, codepoint);
|
||||
sint32 characterWidth = font_sprite_get_codepoint_width(FONT_SPRITE_BASE_TINY, codepoint);
|
||||
uint8 *characterBitmap = font_sprite_get_codepoint_bitmap(codepoint);
|
||||
for (; characterWidth != 0; characterWidth--, characterBitmap++) {
|
||||
// Skip any none displayed columns
|
||||
|
@ -1507,7 +1507,7 @@ void scrolling_text_set_bitmap_for_sprite(utf8 *text, int scroll, uint8 *bitmap,
|
|||
}
|
||||
}
|
||||
|
||||
void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets)
|
||||
void scrolling_text_set_bitmap_for_ttf(utf8 *text, sint32 scroll, uint8 *bitmap, const sint16 *scrollPositionOffsets)
|
||||
{
|
||||
#ifndef NO_TTF
|
||||
TTFFontDescriptor *fontDesc = ttf_get_font_from_sprite_base(FONT_SPRITE_BASE_TINY);
|
||||
|
@ -1521,7 +1521,7 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, co
|
|||
|
||||
utf8 *dstCh = text;
|
||||
utf8 *ch = text;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&ch)) != 0) {
|
||||
if (utf8_is_format_code(codepoint)) {
|
||||
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) {
|
||||
|
@ -1548,9 +1548,9 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, co
|
|||
return;
|
||||
}
|
||||
|
||||
int pitch = surface->pitch;
|
||||
int width = surface->w;
|
||||
int height = surface->h;
|
||||
sint32 pitch = surface->pitch;
|
||||
sint32 width = surface->w;
|
||||
sint32 height = surface->h;
|
||||
uint8 *src = surface->pixels;
|
||||
|
||||
// Offset
|
||||
|
@ -1558,7 +1558,7 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, co
|
|||
src += 3 * pitch;
|
||||
height = min(height, 8);
|
||||
|
||||
int x = 0;
|
||||
sint32 x = 0;
|
||||
while (true) {
|
||||
// Skip any none displayed columns
|
||||
if (scroll == 0) {
|
||||
|
@ -1567,7 +1567,7 @@ void scrolling_text_set_bitmap_for_ttf(utf8 *text, int scroll, uint8 *bitmap, co
|
|||
if (scrollPosition > -1) {
|
||||
uint8 *dst = &bitmap[scrollPosition];
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
for (sint32 y = 0; y < height; y++) {
|
||||
if (src[y * pitch + x] != 0) *dst = colour;
|
||||
|
||||
// Jump to next row
|
||||
|
|
|
@ -93,7 +93,7 @@ bool gfx_load_g1()
|
|||
SDL_RWclose(file);
|
||||
|
||||
// Fix entry data offsets
|
||||
for (unsigned int i = 0; i < header.num_entries; i++)
|
||||
for (uint32 i = 0; i < header.num_entries; i++)
|
||||
g1Elements[i].offset += (uintptr_t)_g1Buffer;
|
||||
|
||||
return true;
|
||||
|
@ -144,7 +144,7 @@ bool gfx_load_g2()
|
|||
SDL_RWclose(file);
|
||||
|
||||
// Fix entry data offsets
|
||||
for (unsigned int i = 0; i < g2.header.num_entries; i++)
|
||||
for (uint32 i = 0; i < g2.header.num_entries; i++)
|
||||
g2.elements[i].offset += (uintptr_t)g2.data;
|
||||
|
||||
return true;
|
||||
|
@ -165,7 +165,7 @@ bool gfx_load_g2()
|
|||
*/
|
||||
void sub_68371D()
|
||||
{
|
||||
for (int i = 0; i < countof(fadeSprites); i++) {
|
||||
for (sint32 i = 0; i < countof(fadeSprites); i++) {
|
||||
const uint32 spriteId = fadeSprites[i];
|
||||
if (spriteId == SPR_NONE) {
|
||||
unk_9E3CE4[i] = NULL;
|
||||
|
@ -180,7 +180,7 @@ void sub_68371D()
|
|||
* image.
|
||||
* rct2: 0x0067A690
|
||||
*/
|
||||
static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unknown_pointer, uint8* source_pointer, uint8* dest_pointer, rct_g1_element* source_image, rct_drawpixelinfo *dest_dpi, int height, int width, int image_type){
|
||||
static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unknown_pointer, uint8* source_pointer, uint8* dest_pointer, rct_g1_element* source_image, rct_drawpixelinfo *dest_dpi, sint32 height, sint32 width, sint32 image_type){
|
||||
uint16 zoom_level = dest_dpi->zoom_level;
|
||||
uint8 zoom_amount = 1 << zoom_level;
|
||||
uint32 dest_line_width = (dest_dpi->width / zoom_amount) + dest_dpi->pitch;
|
||||
|
@ -194,7 +194,7 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk
|
|||
for (; height > 0; height -= zoom_amount){
|
||||
uint8* next_source_pointer = source_pointer + source_line_width;
|
||||
uint8* next_dest_pointer = dest_pointer + dest_line_width;
|
||||
for (int no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, source_pointer += zoom_amount, dest_pointer++){
|
||||
for (sint32 no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, source_pointer += zoom_amount, dest_pointer++){
|
||||
uint8 pixel = *source_pointer;
|
||||
pixel = palette_pointer[pixel];
|
||||
if (pixel){
|
||||
|
@ -217,7 +217,7 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk
|
|||
uint8* next_source_pointer = source_pointer + source_line_width;
|
||||
uint8* next_dest_pointer = dest_pointer + dest_line_width;
|
||||
|
||||
for (int no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, source_pointer += zoom_amount, dest_pointer++){
|
||||
for (sint32 no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, source_pointer += zoom_amount, dest_pointer++){
|
||||
uint8 pixel = *source_pointer;
|
||||
if (pixel){
|
||||
pixel = *dest_pointer;
|
||||
|
@ -238,7 +238,7 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk
|
|||
uint8* next_source_pointer = source_pointer + source_line_width;
|
||||
uint8* next_dest_pointer = dest_pointer + dest_line_width;
|
||||
|
||||
for (int no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, dest_pointer++, source_pointer += zoom_amount){
|
||||
for (sint32 no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, dest_pointer++, source_pointer += zoom_amount){
|
||||
*dest_pointer = *source_pointer;
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk
|
|||
uint8* next_source_pointer = source_pointer + source_line_width;
|
||||
uint8* next_dest_pointer = dest_pointer + dest_line_width;
|
||||
|
||||
for (int no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, dest_pointer++, source_pointer += zoom_amount){
|
||||
for (sint32 no_pixels = width; no_pixels > 0; no_pixels -= zoom_amount, dest_pointer++, source_pointer += zoom_amount){
|
||||
uint8 pixel = *source_pointer;
|
||||
if (pixel){
|
||||
*dest_pointer = pixel;
|
||||
|
@ -265,8 +265,8 @@ static void FASTCALL gfx_bmp_sprite_to_buffer(uint8* palette_pointer, uint8* unk
|
|||
return;
|
||||
}
|
||||
|
||||
uint8* FASTCALL gfx_draw_sprite_get_palette(int image_id, uint32 tertiary_colour) {
|
||||
int image_type = (image_id & 0xE0000000);
|
||||
uint8* FASTCALL gfx_draw_sprite_get_palette(sint32 image_id, uint32 tertiary_colour) {
|
||||
sint32 image_type = (image_id & 0xE0000000);
|
||||
if (image_type == 0)
|
||||
return NULL;
|
||||
|
||||
|
@ -320,7 +320,7 @@ uint8* FASTCALL gfx_draw_sprite_get_palette(int image_id, uint32 tertiary_colour
|
|||
* dpi (esi)
|
||||
* tertiary_colour (ebp)
|
||||
*/
|
||||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint32 tertiary_colour)
|
||||
void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint32 tertiary_colour)
|
||||
{
|
||||
uint8* palette_pointer = gfx_draw_sprite_get_palette(image_id, tertiary_colour);
|
||||
if (image_id & IMAGE_TYPE_REMAP_2_PLUS) {
|
||||
|
@ -340,10 +340,10 @@ void FASTCALL gfx_draw_sprite_software(rct_drawpixelinfo *dpi, int image_id, int
|
|||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int image_id, int x, int y, uint8* palette_pointer, uint8* unknown_pointer)
|
||||
void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, sint32 image_id, sint32 x, sint32 y, uint8* palette_pointer, uint8* unknown_pointer)
|
||||
{
|
||||
int image_element = image_id & 0x7FFFF;
|
||||
int image_type = image_id & 0xE0000000;
|
||||
sint32 image_element = image_id & 0x7FFFF;
|
||||
sint32 image_type = image_id & 0xE0000000;
|
||||
|
||||
rct_g1_element *g1_source = gfx_get_g1_element(image_element);
|
||||
|
||||
|
@ -366,8 +366,8 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
}
|
||||
|
||||
//Its used super often so we will define it to a separate variable.
|
||||
int zoom_level = dpi->zoom_level;
|
||||
int zoom_mask = 0xFFFFFFFF << zoom_level;
|
||||
sint32 zoom_level = dpi->zoom_level;
|
||||
sint32 zoom_mask = 0xFFFFFFFF << zoom_level;
|
||||
|
||||
if (zoom_level && g1_source->flags & G1_FLAG_RLE_COMPRESSION){
|
||||
x -= ~zoom_mask;
|
||||
|
@ -375,7 +375,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
}
|
||||
|
||||
//This will be the height of the drawn image
|
||||
int height = g1_source->height;
|
||||
sint32 height = g1_source->height;
|
||||
//This is the start y coordinate on the destination
|
||||
sint16 dest_start_y = y + g1_source->y_offset;
|
||||
|
||||
|
@ -388,7 +388,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
dest_start_y = (dest_start_y&zoom_mask) - dpi->y;
|
||||
}
|
||||
//This is the start y coordinate on the source
|
||||
int source_start_y = 0;
|
||||
sint32 source_start_y = 0;
|
||||
|
||||
if (dest_start_y < 0){
|
||||
//If the destination y is negative reduce the height of the
|
||||
|
@ -410,7 +410,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
}
|
||||
}
|
||||
|
||||
int dest_end_y = dest_start_y + height;
|
||||
sint32 dest_end_y = dest_start_y + height;
|
||||
|
||||
if (dest_end_y > dpi->height){
|
||||
//If the destination y is outside of the drawing
|
||||
|
@ -423,9 +423,9 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
dest_start_y >>= zoom_level;
|
||||
|
||||
//This will be the width of the drawn image
|
||||
int width = g1_source->width;
|
||||
sint32 width = g1_source->width;
|
||||
//This is the source start x coordinate
|
||||
int source_start_x = 0;
|
||||
sint32 source_start_x = 0;
|
||||
//This is the destination start x coordinate
|
||||
sint16 dest_start_x = ((x + g1_source->x_offset + ~zoom_mask)&zoom_mask) - dpi->x;
|
||||
|
||||
|
@ -448,7 +448,7 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
}
|
||||
}
|
||||
|
||||
int dest_end_x = dest_start_x + width;
|
||||
sint32 dest_end_x = dest_start_x + width;
|
||||
|
||||
if (dest_end_x > dpi->width){
|
||||
//If the destination x is outside of the drawing area
|
||||
|
@ -486,9 +486,9 @@ void FASTCALL gfx_draw_sprite_palette_set_software(rct_drawpixelinfo *dpi, int i
|
|||
*
|
||||
* rct2: 0x00681DE2
|
||||
*/
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, int x, int y, int maskImage, int colourImage)
|
||||
void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 maskImage, sint32 colourImage)
|
||||
{
|
||||
int left, top, right, bottom, width, height;
|
||||
sint32 left, top, right, bottom, width, height;
|
||||
rct_g1_element *imgMask = &g1Elements[maskImage & 0x7FFFF];
|
||||
rct_g1_element *imgColour = &g1Elements[colourImage & 0x7FFFF];
|
||||
|
||||
|
@ -517,18 +517,18 @@ void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, int x,
|
|||
if (width < 0 || height < 0)
|
||||
return;
|
||||
|
||||
int skipX = left - x;
|
||||
int skipY = top - y;
|
||||
sint32 skipX = left - x;
|
||||
sint32 skipY = top - y;
|
||||
|
||||
uint8 *maskSrc = imgMask->offset + (skipY * imgMask->width) + skipX;
|
||||
uint8 *colourSrc = imgColour->offset + (skipY * imgColour->width) + skipX;
|
||||
uint8 *dst = dpi->bits + (left - dpi->x) + ((top - dpi->y) * (dpi->width + dpi->pitch));
|
||||
|
||||
int maskWrap = imgMask->width - width;
|
||||
int colourWrap = imgColour->width - width;
|
||||
int dstWrap = ((dpi->width + dpi->pitch) - width);
|
||||
for (int yy = top; yy < bottom; yy++) {
|
||||
for (int xx = left; xx < right; xx++) {
|
||||
sint32 maskWrap = imgMask->width - width;
|
||||
sint32 colourWrap = imgColour->width - width;
|
||||
sint32 dstWrap = ((dpi->width + dpi->pitch) - width);
|
||||
for (sint32 yy = top; yy < bottom; yy++) {
|
||||
for (sint32 xx = left; xx < right; xx++) {
|
||||
uint8 colour = (*colourSrc) & (*maskSrc);
|
||||
if (colour != 0) {
|
||||
*dst = colour;
|
||||
|
@ -544,7 +544,7 @@ void FASTCALL gfx_draw_sprite_raw_masked_software(rct_drawpixelinfo *dpi, int x,
|
|||
}
|
||||
}
|
||||
|
||||
rct_g1_element *gfx_get_g1_element(int image_id) {
|
||||
rct_g1_element *gfx_get_g1_element(sint32 image_id) {
|
||||
if (image_id < SPR_G2_BEGIN) {
|
||||
return &g1Elements[image_id];
|
||||
}
|
||||
|
|
|
@ -32,8 +32,8 @@ enum {
|
|||
TEXT_DRAW_FLAG_NO_DRAW = 1u << 31
|
||||
};
|
||||
|
||||
static int ttf_get_string_width(const utf8 *text);
|
||||
static void ttf_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y);
|
||||
static sint32 ttf_get_string_width(const utf8 *text);
|
||||
static void ttf_draw_string(rct_drawpixelinfo *dpi, char *buffer, sint32 colour, sint32 x, sint32 y);
|
||||
|
||||
#ifndef NO_TTF
|
||||
static bool _ttfInitialised = false;
|
||||
|
@ -49,9 +49,9 @@ typedef struct ttf_cache_entry {
|
|||
} ttf_cache_entry;
|
||||
|
||||
static ttf_cache_entry _ttfSurfaceCache[TTF_SURFACE_CACHE_SIZE] = { 0 };
|
||||
static int _ttfSurfaceCacheCount = 0;
|
||||
static int _ttfSurfaceCacheHitCount = 0;
|
||||
static int _ttfSurfaceCacheMissCount = 0;
|
||||
static sint32 _ttfSurfaceCacheCount = 0;
|
||||
static sint32 _ttfSurfaceCacheHitCount = 0;
|
||||
static sint32 _ttfSurfaceCacheMissCount = 0;
|
||||
|
||||
typedef struct ttf_getwidth_cache_entry {
|
||||
uint32 width;
|
||||
|
@ -61,24 +61,24 @@ typedef struct ttf_getwidth_cache_entry {
|
|||
} ttf_getwidth_cache_entry;
|
||||
|
||||
static ttf_getwidth_cache_entry _ttfGetWidthCache[TTF_GETWIDTH_CACHE_SIZE] = { 0 };
|
||||
static int _ttfGetWidthCacheCount = 0;
|
||||
static int _ttfGetWidthCacheHitCount = 0;
|
||||
static int _ttfGetWidthCacheMissCount = 0;
|
||||
static sint32 _ttfGetWidthCacheCount = 0;
|
||||
static sint32 _ttfGetWidthCacheHitCount = 0;
|
||||
static sint32 _ttfGetWidthCacheMissCount = 0;
|
||||
#endif // NO_TTF
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006C23B1
|
||||
*/
|
||||
int gfx_get_string_width_new_lined(utf8 *text)
|
||||
sint32 gfx_get_string_width_new_lined(utf8 *text)
|
||||
{
|
||||
utf8 *ch = text;
|
||||
utf8 *firstCh = text;
|
||||
utf8 *nextCh;
|
||||
utf8 backup;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
int maxWidth = 0;
|
||||
sint32 maxWidth = 0;
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
|
||||
if (codepoint == FORMAT_NEWLINE || codepoint == FORMAT_NEWLINE_SMALLER) {
|
||||
backup = *nextCh;
|
||||
|
@ -100,7 +100,7 @@ int gfx_get_string_width_new_lined(utf8 *text)
|
|||
* rct2: 0x006C2321
|
||||
* buffer (esi)
|
||||
*/
|
||||
int gfx_get_string_width(char* buffer)
|
||||
sint32 gfx_get_string_width(char* buffer)
|
||||
{
|
||||
return ttf_get_string_width(buffer);
|
||||
}
|
||||
|
@ -112,9 +112,9 @@ int gfx_get_string_width(char* buffer)
|
|||
* buffer (esi)
|
||||
* width (edi)
|
||||
*/
|
||||
int gfx_clip_string(utf8 *text, int width)
|
||||
sint32 gfx_clip_string(utf8 *text, sint32 width)
|
||||
{
|
||||
int clippedWidth;
|
||||
sint32 clippedWidth;
|
||||
|
||||
if (width < 6) {
|
||||
*text = 0;
|
||||
|
@ -130,7 +130,7 @@ int gfx_clip_string(utf8 *text, int width)
|
|||
utf8 *ch = text;
|
||||
utf8 *nextCh = text;
|
||||
utf8 *clipCh = text;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
|
||||
if (utf8_is_format_code(codepoint)) {
|
||||
ch = nextCh;
|
||||
|
@ -138,21 +138,21 @@ int gfx_clip_string(utf8 *text, int width)
|
|||
continue;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) { backup[i] = nextCh[i]; };
|
||||
for (int i = 0; i < 3; i++) { nextCh[i] = '.'; }
|
||||
for (sint32 i = 0; i < 4; i++) { backup[i] = nextCh[i]; };
|
||||
for (sint32 i = 0; i < 3; i++) { nextCh[i] = '.'; }
|
||||
nextCh[3] = 0;
|
||||
|
||||
int queryWidth = gfx_get_string_width(text);
|
||||
sint32 queryWidth = gfx_get_string_width(text);
|
||||
if (queryWidth < width) {
|
||||
clipCh = nextCh;
|
||||
clippedWidth = queryWidth;
|
||||
} else {
|
||||
for (int i = 0; i < 3; i++) { clipCh[i] = '.'; }
|
||||
for (sint32 i = 0; i < 3; i++) { clipCh[i] = '.'; }
|
||||
clipCh[3] = 0;
|
||||
return clippedWidth;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) { nextCh[i] = backup[i]; };
|
||||
for (sint32 i = 0; i < 4; i++) { nextCh[i] = backup[i]; };
|
||||
ch = nextCh;
|
||||
}
|
||||
return gfx_get_string_width(text);
|
||||
|
@ -171,23 +171,23 @@ int gfx_clip_string(utf8 *text, int width)
|
|||
* num_lines (edi) - out
|
||||
* font_height (ebx) - out
|
||||
*/
|
||||
int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight)
|
||||
sint32 gfx_wrap_string(utf8 *text, sint32 width, sint32 *outNumLines, sint32 *outFontHeight)
|
||||
{
|
||||
int lineWidth = 0;
|
||||
int maxWidth = 0;
|
||||
sint32 lineWidth = 0;
|
||||
sint32 maxWidth = 0;
|
||||
*outNumLines = 0;
|
||||
|
||||
// Pointer to the start of the current word
|
||||
utf8 *currentWord = NULL;
|
||||
|
||||
// Width of line up to current word
|
||||
int currentWidth = 0;
|
||||
sint32 currentWidth = 0;
|
||||
|
||||
utf8 *ch = text;
|
||||
utf8 *firstCh = text;
|
||||
utf8 *nextCh;
|
||||
int codepoint;
|
||||
int numCharactersOnLine = 0;
|
||||
sint32 codepoint;
|
||||
sint32 numCharactersOnLine = 0;
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
|
||||
if (codepoint == ' ') {
|
||||
currentWord = ch;
|
||||
|
@ -254,7 +254,7 @@ int gfx_wrap_string(utf8 *text, int width, int *outNumLines, int *outFontHeight)
|
|||
* y (dx)
|
||||
* width (bp)
|
||||
*/
|
||||
void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, rct_string_id format, void* args, int colour, int x, int y, int width)
|
||||
void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, rct_string_id format, void* args, sint32 colour, sint32 x, sint32 y, sint32 width)
|
||||
{
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
|
@ -279,7 +279,7 @@ void gfx_draw_string_left_clipped(rct_drawpixelinfo* dpi, rct_string_id format,
|
|||
* y (dx)
|
||||
* width (bp)
|
||||
*/
|
||||
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y, int width)
|
||||
void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y, sint32 width)
|
||||
{
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
|
@ -287,7 +287,7 @@ void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id forma
|
|||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
// Clip text
|
||||
int text_width = gfx_clip_string(buffer, width);
|
||||
sint32 text_width = gfx_clip_string(buffer, width);
|
||||
|
||||
// Draw the text centred
|
||||
if (text_width <= 0xFFFF && text_width >= 0) {
|
||||
|
@ -308,13 +308,13 @@ void gfx_draw_string_centred_clipped(rct_drawpixelinfo *dpi, rct_string_id forma
|
|||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, int colour, int x, int y)
|
||||
void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
|
||||
// Measure text width
|
||||
short text_width = gfx_get_string_width(buffer);
|
||||
sint16 text_width = gfx_get_string_width(buffer);
|
||||
|
||||
// Draw the text right aligned
|
||||
x -= text_width;
|
||||
|
@ -331,7 +331,7 @@ void gfx_draw_string_right(rct_drawpixelinfo* dpi, rct_string_id format, void* a
|
|||
* colour (al)
|
||||
* args (esi)
|
||||
*/
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, rct_string_id format, int x, int y, int colour, void *args)
|
||||
void gfx_draw_string_centred(rct_drawpixelinfo *dpi, rct_string_id format, sint32 x, sint32 y, sint32 colour, void *args)
|
||||
{
|
||||
gfx_draw_string_centred_wrapped(dpi, args, x, y, INT32_MAX, format, colour);
|
||||
}
|
||||
|
@ -347,9 +347,9 @@ void gfx_draw_string_centred(rct_drawpixelinfo *dpi, rct_string_id format, int x
|
|||
* colour (al)
|
||||
* format (ebx)
|
||||
*/
|
||||
int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, rct_string_id format, int colour)
|
||||
sint32 gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width, rct_string_id format, sint32 colour)
|
||||
{
|
||||
int font_height, line_height, line_y, num_lines;
|
||||
sint32 font_height, line_height, line_y, num_lines;
|
||||
|
||||
if (gCurrentFontSpriteBase >= 0) {
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
@ -373,8 +373,8 @@ int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, i
|
|||
|
||||
gCurrentFontFlags = 0;
|
||||
|
||||
for (int line = 0; line <= num_lines; ++line) {
|
||||
int half_width = gfx_get_string_width(buffer) / 2;
|
||||
for (sint32 line = 0; line <= num_lines; ++line) {
|
||||
sint32 half_width = gfx_get_string_width(buffer) / 2;
|
||||
gfx_draw_string(dpi, buffer, TEXT_COLOUR_254, x - half_width, line_y);
|
||||
|
||||
buffer = get_string_end(buffer) + 1;
|
||||
|
@ -395,10 +395,10 @@ int gfx_draw_string_centred_wrapped(rct_drawpixelinfo *dpi, void *args, int x, i
|
|||
* format (bx)
|
||||
* colour (al)
|
||||
*/
|
||||
int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int y, int width, rct_string_id format, int colour)
|
||||
sint32 gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width, rct_string_id format, sint32 colour)
|
||||
{
|
||||
// font height might actually be something else
|
||||
int fontSpriteBase, lineHeight, lineY, numLines;
|
||||
sint32 fontSpriteBase, lineHeight, lineY, numLines;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
|
@ -412,7 +412,7 @@ int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int
|
|||
|
||||
gCurrentFontFlags = 0;
|
||||
lineY = y;
|
||||
for (int line = 0; line <= numLines; ++line) {
|
||||
for (sint32 line = 0; line <= numLines; ++line) {
|
||||
gfx_draw_string(dpi, buffer, TEXT_COLOUR_254, x, lineY);
|
||||
buffer = get_string_end(buffer) + 1;
|
||||
lineY += lineHeight;
|
||||
|
@ -430,7 +430,7 @@ int gfx_draw_string_left_wrapped(rct_drawpixelinfo *dpi, void *args, int x, int
|
|||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
void gfx_draw_string_left(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
void gfx_draw_string_left(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
char* buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
|
@ -441,12 +441,12 @@ void gfx_draw_string_left(rct_drawpixelinfo *dpi, rct_string_id format, void *ar
|
|||
/**
|
||||
* Draws text that is left aligned and vertically centred.
|
||||
*/
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
char *buffer = gCommonStringFormatBuffer;
|
||||
format_string(buffer, 256, format, args);
|
||||
int height = string_get_height_raw(buffer);
|
||||
sint32 height = string_get_height_raw(buffer);
|
||||
gfx_draw_string(dpi, buffer, colour, x, y - (height / 2));
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ void gfx_draw_string_left_centred(rct_drawpixelinfo *dpi, rct_string_id format,
|
|||
*/
|
||||
static void colour_char(uint8 colour, uint16* current_font_flags, uint8* palette_pointer) {
|
||||
|
||||
int eax;
|
||||
sint32 eax;
|
||||
|
||||
rct_g1_element g1_element = g1Elements[SPR_TEXT_PALETTE];
|
||||
eax = ((uint32*)g1_element.offset)[colour & 0xFF];
|
||||
|
@ -477,7 +477,7 @@ static void colour_char(uint8 colour, uint16* current_font_flags, uint8* palette
|
|||
*/
|
||||
static void colour_char_window(uint8 colour, uint16* current_font_flags,uint8* palette_pointer) {
|
||||
|
||||
int eax;
|
||||
sint32 eax;
|
||||
|
||||
colour = NOT_TRANSLUCENT(colour);
|
||||
eax = ColourMapA[colour].colour_11;
|
||||
|
@ -501,15 +501,15 @@ static void colour_char_window(uint8 colour, uint16* current_font_flags,uint8* p
|
|||
* x (cx)
|
||||
* y (dx)
|
||||
*/
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y)
|
||||
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
ttf_draw_string(dpi, buffer, colour, x, y);
|
||||
}
|
||||
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
void draw_string_left_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
sint32 width;
|
||||
|
||||
format_string(buffer, 128, format, args);
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
@ -520,10 +520,10 @@ void draw_string_left_underline(rct_drawpixelinfo *dpi, rct_string_id format, vo
|
|||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
||||
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
void draw_string_right_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
sint32 width;
|
||||
|
||||
format_string(buffer, 128, format, args);
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
@ -535,10 +535,10 @@ void draw_string_right_underline(rct_drawpixelinfo *dpi, rct_string_id format, v
|
|||
gfx_fill_rect(dpi, x + 1, y + 12, x + width + 1, y + 12, text_palette[2]);
|
||||
}
|
||||
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, int colour, int x, int y)
|
||||
void draw_string_centred_underline(rct_drawpixelinfo *dpi, rct_string_id format, void *args, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
char buffer[128];
|
||||
int width;
|
||||
sint32 width;
|
||||
|
||||
format_string(buffer, 128, format, args);
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
@ -560,19 +560,19 @@ void draw_string_centred_underline(rct_drawpixelinfo *dpi, rct_string_id format,
|
|||
* text : esi
|
||||
* dpi : edi
|
||||
*/
|
||||
void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines, char *text)
|
||||
void draw_string_centred_raw(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 numLines, char *text)
|
||||
{
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
gfx_draw_string(dpi, "", COLOUR_BLACK, dpi->x, dpi->y);
|
||||
gCurrentFontFlags = 0;
|
||||
|
||||
for (int i = 0; i <= numLines; i++) {
|
||||
int width = gfx_get_string_width(text);
|
||||
for (sint32 i = 0; i <= numLines; i++) {
|
||||
sint32 width = gfx_get_string_width(text);
|
||||
gfx_draw_string(dpi, text, TEXT_COLOUR_254, x - (width / 2), y);
|
||||
|
||||
const utf8 *ch = text;
|
||||
const utf8 *nextCh = 0;
|
||||
int codepoint = 0;
|
||||
sint32 codepoint = 0;
|
||||
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
|
||||
ch = nextCh;
|
||||
|
@ -583,11 +583,11 @@ void draw_string_centred_raw(rct_drawpixelinfo *dpi, int x, int y, int numLines,
|
|||
}
|
||||
}
|
||||
|
||||
int string_get_height_raw(char *buffer)
|
||||
sint32 string_get_height_raw(char *buffer)
|
||||
{
|
||||
uint16 fontBase = gCurrentFontSpriteBase;
|
||||
|
||||
int height = 0;
|
||||
sint32 height = 0;
|
||||
if (fontBase <= FONT_SPRITE_BASE_MEDIUM)
|
||||
height += 10;
|
||||
else if (fontBase == FONT_SPRITE_BASE_TINY)
|
||||
|
@ -659,9 +659,9 @@ int string_get_height_raw(char *buffer)
|
|||
* width : bp
|
||||
* ticks : ebp >> 16
|
||||
*/
|
||||
void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int y, int width, int colour, rct_string_id format, void *args, int ticks)
|
||||
void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, sint32 x, sint32 y, sint32 width, sint32 colour, rct_string_id format, void *args, sint32 ticks)
|
||||
{
|
||||
int numLines, fontSpriteBase, lineHeight, lineY;
|
||||
sint32 numLines, fontSpriteBase, lineHeight, lineY;
|
||||
utf8 *buffer = gCommonStringFormatBuffer;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
@ -673,17 +673,17 @@ void gfx_draw_string_centred_wrapped_partial(rct_drawpixelinfo *dpi, int x, int
|
|||
gfx_wrap_string(buffer, width, &numLines, &fontSpriteBase);
|
||||
lineHeight = font_get_line_height(fontSpriteBase);
|
||||
|
||||
int numCharactersDrawn = 0;
|
||||
int numCharactersToDraw = ticks;
|
||||
sint32 numCharactersDrawn = 0;
|
||||
sint32 numCharactersToDraw = ticks;
|
||||
|
||||
gCurrentFontFlags = 0;
|
||||
lineY = y - ((numLines * lineHeight) / 2);
|
||||
for (int line = 0; line <= numLines; line++) {
|
||||
int halfWidth = gfx_get_string_width(buffer) / 2;
|
||||
for (sint32 line = 0; line <= numLines; line++) {
|
||||
sint32 halfWidth = gfx_get_string_width(buffer) / 2;
|
||||
|
||||
utf8 *ch = buffer;
|
||||
utf8 *nextCh;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(ch, (const utf8**)&nextCh)) != 0) {
|
||||
if (!utf8_is_format_code(codepoint)) {
|
||||
numCharactersDrawn++;
|
||||
|
@ -730,7 +730,7 @@ static void _ttf_surface_cache_dispose(ttf_cache_entry *entry)
|
|||
|
||||
static void _ttf_surface_cache_dispose_all()
|
||||
{
|
||||
for (int i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) {
|
||||
for (sint32 i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) {
|
||||
_ttf_surface_cache_dispose(&_ttfSurfaceCache[i]);
|
||||
_ttfSurfaceCacheCount--;
|
||||
}
|
||||
|
@ -741,8 +741,8 @@ SDL_Surface *ttf_surface_cache_get_or_add(TTF_Font *font, const utf8 *text)
|
|||
ttf_cache_entry *entry;
|
||||
|
||||
uint32 hash = _ttf_surface_cache_hash(font, text);
|
||||
int index = hash % TTF_SURFACE_CACHE_SIZE;
|
||||
for (int i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) {
|
||||
sint32 index = hash % TTF_SURFACE_CACHE_SIZE;
|
||||
for (sint32 i = 0; i < TTF_SURFACE_CACHE_SIZE; i++) {
|
||||
entry = &_ttfSurfaceCache[index];
|
||||
|
||||
// Check if entry is a hit
|
||||
|
@ -796,7 +796,7 @@ static void _ttf_getwidth_cache_dispose(ttf_getwidth_cache_entry *entry)
|
|||
|
||||
static void _ttf_getwidth_cache_dispose_all()
|
||||
{
|
||||
for (int i = 0; i < TTF_GETWIDTH_CACHE_SIZE; i++) {
|
||||
for (sint32 i = 0; i < TTF_GETWIDTH_CACHE_SIZE; i++) {
|
||||
_ttf_getwidth_cache_dispose(&_ttfGetWidthCache[i]);
|
||||
_ttfGetWidthCacheCount--;
|
||||
}
|
||||
|
@ -807,8 +807,8 @@ static uint32 _ttf_getwidth_cache_get_or_add(TTF_Font *font, const utf8 *text)
|
|||
ttf_getwidth_cache_entry *entry;
|
||||
|
||||
uint32 hash = _ttf_surface_cache_hash(font, text);
|
||||
int index = hash % TTF_GETWIDTH_CACHE_SIZE;
|
||||
for (int i = 0; i < TTF_GETWIDTH_CACHE_SIZE; i++) {
|
||||
sint32 index = hash % TTF_GETWIDTH_CACHE_SIZE;
|
||||
for (sint32 i = 0; i < TTF_GETWIDTH_CACHE_SIZE; i++) {
|
||||
entry = &_ttfGetWidthCache[index];
|
||||
|
||||
// Check if entry is a hit
|
||||
|
@ -832,7 +832,7 @@ static uint32 _ttf_getwidth_cache_get_or_add(TTF_Font *font, const utf8 *text)
|
|||
entry = &_ttfGetWidthCache[index];
|
||||
_ttf_getwidth_cache_dispose(entry);
|
||||
|
||||
int width, height;
|
||||
sint32 width, height;
|
||||
TTF_SizeUTF8(font, text, &width, &height);
|
||||
|
||||
_ttfGetWidthCacheMissCount++;
|
||||
|
@ -852,7 +852,7 @@ bool ttf_initialise()
|
|||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]);
|
||||
|
||||
utf8 fontPath[MAX_PATH];
|
||||
|
@ -881,7 +881,7 @@ void ttf_dispose()
|
|||
_ttf_surface_cache_dispose_all();
|
||||
_ttf_getwidth_cache_dispose_all();
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]);
|
||||
if (fontDesc->font != NULL) {
|
||||
TTF_CloseFont(fontDesc->font);
|
||||
|
@ -907,28 +907,28 @@ void ttf_dispose() {}
|
|||
#endif // NO_TTF
|
||||
|
||||
typedef struct text_draw_info {
|
||||
int startX;
|
||||
int startY;
|
||||
int x;
|
||||
int y;
|
||||
int maxX;
|
||||
int maxY;
|
||||
int flags;
|
||||
sint32 startX;
|
||||
sint32 startY;
|
||||
sint32 x;
|
||||
sint32 y;
|
||||
sint32 maxX;
|
||||
sint32 maxY;
|
||||
sint32 flags;
|
||||
uint8 palette[8];
|
||||
uint16 font_sprite_base;
|
||||
const sint8 *y_offset;
|
||||
} text_draw_info;
|
||||
|
||||
static void ttf_draw_character_sprite(rct_drawpixelinfo *dpi, int codepoint, text_draw_info *info)
|
||||
static void ttf_draw_character_sprite(rct_drawpixelinfo *dpi, sint32 codepoint, text_draw_info *info)
|
||||
{
|
||||
int characterWidth = font_sprite_get_codepoint_width(info->font_sprite_base, codepoint);
|
||||
int sprite = font_sprite_get_codepoint_sprite(info->font_sprite_base, codepoint);
|
||||
sint32 characterWidth = font_sprite_get_codepoint_width(info->font_sprite_base, codepoint);
|
||||
sint32 sprite = font_sprite_get_codepoint_sprite(info->font_sprite_base, codepoint);
|
||||
|
||||
if (!(info->flags & TEXT_DRAW_FLAG_NO_DRAW)) {
|
||||
unk_9ABDA4 = &info->palette;
|
||||
|
||||
int x = info->x;
|
||||
int y = info->y;
|
||||
sint32 x = info->x;
|
||||
sint32 y = info->y;
|
||||
if (info->flags & TEXT_DRAW_FLAG_Y_OFFSET_EFFECT) {
|
||||
y += *info->y_offset++;
|
||||
}
|
||||
|
@ -941,7 +941,7 @@ static void ttf_draw_character_sprite(rct_drawpixelinfo *dpi, int codepoint, tex
|
|||
static void ttf_draw_string_raw_sprite(rct_drawpixelinfo *dpi, const utf8 *text, text_draw_info *info)
|
||||
{
|
||||
const utf8 *ch = text;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
while (!utf8_is_format_code(codepoint = utf8_get_next(ch, &ch))) {
|
||||
ttf_draw_character_sprite(dpi, codepoint, info);
|
||||
|
@ -975,17 +975,17 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
|||
}
|
||||
}
|
||||
|
||||
int drawX = info->x + fontDesc->offset_x;
|
||||
int drawY = info->y + fontDesc->offset_y;
|
||||
int width = surface->w;
|
||||
int height = surface->h;
|
||||
sint32 drawX = info->x + fontDesc->offset_x;
|
||||
sint32 drawY = info->y + fontDesc->offset_y;
|
||||
sint32 width = surface->w;
|
||||
sint32 height = surface->h;
|
||||
|
||||
int overflowX = (dpi->x + dpi->width) - (drawX + width);
|
||||
int overflowY = (dpi->y + dpi->height) - (drawY + height);
|
||||
sint32 overflowX = (dpi->x + dpi->width) - (drawX + width);
|
||||
sint32 overflowY = (dpi->y + dpi->height) - (drawY + height);
|
||||
if (overflowX < 0) width += overflowX;
|
||||
if (overflowY < 0) height += overflowY;
|
||||
int skipX = drawX - dpi->x;
|
||||
int skipY = drawY - dpi->y;
|
||||
sint32 skipX = drawX - dpi->x;
|
||||
sint32 skipY = drawY - dpi->y;
|
||||
info->x += width;
|
||||
|
||||
uint8 *src = surface->pixels;
|
||||
|
@ -1005,15 +1005,15 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
|||
dst += skipX;
|
||||
dst += skipY * (dpi->width + dpi->pitch);
|
||||
|
||||
int srcScanSkip = surface->pitch - width;
|
||||
int dstScanSkip = dpi->width + dpi->pitch - width;
|
||||
sint32 srcScanSkip = surface->pitch - width;
|
||||
sint32 dstScanSkip = dpi->width + dpi->pitch - width;
|
||||
uint8 *dst_orig = dst;
|
||||
uint8 *src_orig = src;
|
||||
|
||||
// Draw shadow/outline
|
||||
if (info->flags & TEXT_DRAW_FLAG_OUTLINE) {
|
||||
for (int yy = 0; yy < height - 0; yy++) {
|
||||
for (int xx = 0; xx < width - 0; xx++) {
|
||||
for (sint32 yy = 0; yy < height - 0; yy++) {
|
||||
for (sint32 xx = 0; xx < width - 0; xx++) {
|
||||
if (*src != 0) {
|
||||
*(dst + 1) = info->palette[3]; // right
|
||||
*(dst - 1) = info->palette[3]; // left
|
||||
|
@ -1031,8 +1031,8 @@ static void ttf_draw_string_raw_ttf(rct_drawpixelinfo *dpi, const utf8 *text, te
|
|||
{
|
||||
dst = dst_orig;
|
||||
src = src_orig;
|
||||
for (int yy = 0; yy < height; yy++) {
|
||||
for (int xx = 0; xx < width; xx++) {
|
||||
for (sint32 yy = 0; yy < height; yy++) {
|
||||
for (sint32 xx = 0; xx < width; xx++) {
|
||||
if (*src != 0) {
|
||||
if (info->flags & TEXT_DRAW_FLAG_INSET) {
|
||||
*(dst + width + dstScanSkip + 1) = info->palette[3];
|
||||
|
@ -1070,7 +1070,7 @@ static void ttf_draw_string_raw(rct_drawpixelinfo *dpi, const utf8 *text, text_d
|
|||
static const utf8 *ttf_process_format_code(rct_drawpixelinfo *dpi, const utf8 *text, text_draw_info *info)
|
||||
{
|
||||
const utf8 *nextCh;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
codepoint = utf8_get_next(text, &nextCh);
|
||||
switch (codepoint) {
|
||||
|
@ -1176,7 +1176,7 @@ static const utf8 *ttf_process_glyph_run(rct_drawpixelinfo *dpi, const utf8 *tex
|
|||
utf8 buffer[512];
|
||||
const utf8 *ch = text;
|
||||
const utf8 *lastCh;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
#ifndef NO_TTF
|
||||
bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF;
|
||||
|
@ -1205,7 +1205,7 @@ static void ttf_process_string(rct_drawpixelinfo *dpi, const utf8 *text, text_dr
|
|||
{
|
||||
const utf8 *ch = text;
|
||||
const utf8 *nextCh;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
#ifndef NO_TTF
|
||||
bool isTTF = info->flags & TEXT_DRAW_FLAG_TTF;
|
||||
|
@ -1227,7 +1227,7 @@ static void ttf_process_string(rct_drawpixelinfo *dpi, const utf8 *text, text_dr
|
|||
}
|
||||
}
|
||||
|
||||
static void ttf_process_initial_colour(int colour, text_draw_info *info)
|
||||
static void ttf_process_initial_colour(sint32 colour, text_draw_info *info)
|
||||
{
|
||||
if (colour != TEXT_COLOUR_254 && colour != TEXT_COLOUR_255) {
|
||||
info->flags &= ~(TEXT_DRAW_FLAG_INSET | TEXT_DRAW_FLAG_OUTLINE | TEXT_DRAW_FLAG_DARK | TEXT_DRAW_FLAG_EXTRA_DARK);
|
||||
|
@ -1279,7 +1279,7 @@ static void ttf_process_initial_colour(int colour, text_draw_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, int colour, int x, int y)
|
||||
static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, sint32 colour, sint32 x, sint32 y)
|
||||
{
|
||||
if (text == NULL) return;
|
||||
|
||||
|
@ -1307,7 +1307,7 @@ static void ttf_draw_string(rct_drawpixelinfo *dpi, char *text, int colour, int
|
|||
gLastDrawStringY = info.y;
|
||||
}
|
||||
|
||||
static int ttf_get_string_width(const utf8 *text)
|
||||
static sint32 ttf_get_string_width(const utf8 *text)
|
||||
{
|
||||
text_draw_info info;
|
||||
info.font_sprite_base = gCurrentFontSpriteBase;
|
||||
|
@ -1333,7 +1333,7 @@ static int ttf_get_string_width(const utf8 *text)
|
|||
*
|
||||
* rct2: 0x00682F28
|
||||
*/
|
||||
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, int colour, int x, int y, const sint8 *yOffsets, bool forceSpriteFont)
|
||||
void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, sint32 colour, sint32 x, sint32 y, const sint8 *yOffsets, bool forceSpriteFont)
|
||||
{
|
||||
text_draw_info info;
|
||||
info.font_sprite_base = gCurrentFontSpriteBase;
|
||||
|
@ -1364,7 +1364,7 @@ void gfx_draw_string_with_y_offsets(rct_drawpixelinfo *dpi, const utf8 *text, in
|
|||
gLastDrawStringY = info.y;
|
||||
}
|
||||
|
||||
void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availableWidth)
|
||||
void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, sint32 availableWidth)
|
||||
{
|
||||
size_t length = strlen(path);
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availab
|
|||
}
|
||||
|
||||
// Count path separators
|
||||
int path_separators = 0;
|
||||
sint32 path_separators = 0;
|
||||
for (size_t x = 0; x < length; x++) {
|
||||
if (path[x] == *PATH_SEPARATOR) {
|
||||
path_separators++;
|
||||
|
@ -1386,8 +1386,8 @@ void shorten_path(utf8 *buffer, size_t bufferSize, const utf8 *path, int availab
|
|||
safe_strcpy(buffer, "...", bufferSize);
|
||||
|
||||
// Abreviate beginning with xth separator
|
||||
int begin = -1;
|
||||
for (int x = 0; x < path_separators; x++){
|
||||
sint32 begin = -1;
|
||||
for (sint32 x = 0; x < path_separators; x++){
|
||||
do {
|
||||
begin++;
|
||||
} while (path[begin] != *PATH_SEPARATOR);
|
||||
|
|
|
@ -68,12 +68,12 @@ uint8 * gEditorSelectedObjects[OBJECT_ENTRY_GROUP_COUNT] = {
|
|||
_editorSelectedStexs,
|
||||
};
|
||||
|
||||
static void editor_convert_save_to_scenario_callback(int result, const utf8 * path);
|
||||
static void editor_convert_save_to_scenario_callback(sint32 result, const utf8 * path);
|
||||
static void set_all_land_owned();
|
||||
static int editor_load_landscape_from_sv4(const char *path);
|
||||
static int editor_load_landscape_from_sc4(const char *path);
|
||||
static sint32 editor_load_landscape_from_sv4(const char *path);
|
||||
static sint32 editor_load_landscape_from_sc4(const char *path);
|
||||
static void editor_finalise_main_view();
|
||||
static int editor_read_s6(const char *path);
|
||||
static sint32 editor_read_s6(const char *path);
|
||||
static void editor_clear_map_for_editing(bool fromSave);
|
||||
|
||||
/**
|
||||
|
@ -130,7 +130,7 @@ void editor_convert_save_to_scenario()
|
|||
gLoadSaveCallback = editor_convert_save_to_scenario_callback;
|
||||
}
|
||||
|
||||
static void editor_convert_save_to_scenario_callback(int result, const utf8 * path)
|
||||
static void editor_convert_save_to_scenario_callback(sint32 result, const utf8 * path)
|
||||
{
|
||||
if (result != MODAL_RESULT_OK) {
|
||||
return;
|
||||
|
@ -252,7 +252,7 @@ void trackmanager_load()
|
|||
*/
|
||||
static void set_all_land_owned()
|
||||
{
|
||||
int mapSize = gMapSize;
|
||||
sint32 mapSize = gMapSize;
|
||||
|
||||
game_do_command(64, 1, 64, 2, GAME_COMMAND_SET_LAND_OWNERSHIP, (mapSize - 3) * 32, (mapSize - 3) * 32);
|
||||
}
|
||||
|
@ -285,7 +285,7 @@ bool editor_load_landscape(const utf8 *path)
|
|||
*
|
||||
* rct2: 0x006A2B02
|
||||
*/
|
||||
static int editor_load_landscape_from_sv4(const char *path)
|
||||
static sint32 editor_load_landscape_from_sv4(const char *path)
|
||||
{
|
||||
rct1_load_saved_game(path);
|
||||
editor_clear_map_for_editing(true);
|
||||
|
@ -299,7 +299,7 @@ static int editor_load_landscape_from_sv4(const char *path)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int editor_load_landscape_from_sc4(const char *path)
|
||||
static sint32 editor_load_landscape_from_sc4(const char *path)
|
||||
{
|
||||
rct1_load_scenario(path);
|
||||
editor_clear_map_for_editing(false);
|
||||
|
@ -317,7 +317,7 @@ static int editor_load_landscape_from_sc4(const char *path)
|
|||
*
|
||||
* rct2: 0x006758FE
|
||||
*/
|
||||
static int editor_read_s6(const char *path)
|
||||
static sint32 editor_read_s6(const char *path)
|
||||
{
|
||||
bool loadResult = false;
|
||||
const char *extension = path_get_extension(path);
|
||||
|
@ -346,7 +346,7 @@ static void editor_clear_map_for_editing(bool fromSave)
|
|||
map_remove_all_rides();
|
||||
|
||||
//
|
||||
for (int i = 0; i < MAX_BANNERS; i++) {
|
||||
for (sint32 i = 0; i < MAX_BANNERS; i++) {
|
||||
if (gBanners[i].type == 255) {
|
||||
gBanners[i].flags &= ~BANNER_FLAG_2;
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ static void editor_clear_map_for_editing(bool fromSave)
|
|||
|
||||
//
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
user_string_free(ride->name);
|
||||
|
@ -364,7 +364,7 @@ static void editor_clear_map_for_editing(bool fromSave)
|
|||
ride_init_all();
|
||||
|
||||
//
|
||||
for (int i = 0; i < MAX_SPRITES; i++) {
|
||||
for (sint32 i = 0; i < MAX_SPRITES; i++) {
|
||||
rct_sprite *sprite = get_sprite(i);
|
||||
user_string_free(sprite->unknown.name_string_idx);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ static void editor_finalise_main_view()
|
|||
w->saved_view_y = gSavedViewY;
|
||||
gCurrentRotation = gSavedViewRotation;
|
||||
|
||||
int zoom_difference = gSavedViewZoom - viewport->zoom;
|
||||
sint32 zoom_difference = gSavedViewZoom - viewport->zoom;
|
||||
viewport->zoom = gSavedViewZoom;
|
||||
if (zoom_difference != 0) {
|
||||
if (zoom_difference >= 0) {
|
||||
|
@ -500,7 +500,7 @@ static void editor_finalise_main_view()
|
|||
*
|
||||
* rct2: 0x006AB9B8
|
||||
*/
|
||||
int editor_check_object_selection()
|
||||
sint32 editor_check_object_selection()
|
||||
{
|
||||
bool isTrackDesignerManager =
|
||||
gScreenFlags & (SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER);
|
||||
|
@ -538,13 +538,13 @@ int editor_check_object_selection()
|
|||
*/
|
||||
bool editor_check_park()
|
||||
{
|
||||
int parkSize = park_calculate_size();
|
||||
sint32 parkSize = park_calculate_size();
|
||||
if (parkSize == 0) {
|
||||
gGameCommandErrorText = STR_PARK_MUST_OWN_SOME_LAND;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
if (gParkEntranceX[i] != MAP_LOCATION_NULL)
|
||||
break;
|
||||
|
||||
|
@ -554,14 +554,14 @@ bool editor_check_park()
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
for (sint32 i = 0; i < 4; i++) {
|
||||
if (gParkEntranceX[i] == MAP_LOCATION_NULL)
|
||||
continue;
|
||||
|
||||
int x = gParkEntranceX[i];
|
||||
int y = gParkEntranceY[i];
|
||||
int z = gParkEntranceZ[i] / 8;
|
||||
int direction = gParkEntranceDirection[i] ^ 2;
|
||||
sint32 x = gParkEntranceX[i];
|
||||
sint32 y = gParkEntranceY[i];
|
||||
sint32 z = gParkEntranceZ[i] / 8;
|
||||
sint32 direction = gParkEntranceDirection[i] ^ 2;
|
||||
|
||||
switch (footpath_is_connected_to_map_edge(x, y, z, direction, 0)) {
|
||||
case FOOTPATH_SEARCH_NOT_FOUND:
|
||||
|
|
|
@ -42,8 +42,8 @@ bool editor_load_landscape(const utf8 *path);
|
|||
void editor_open_windows_for_current_step();
|
||||
|
||||
bool editor_check_park();
|
||||
int editor_check_object_selection();
|
||||
sint32 editor_check_object_selection();
|
||||
|
||||
bool editor_check_object_group_at_least_one_selected(int objectType);
|
||||
bool editor_check_object_group_at_least_one_selected(sint32 objectType);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -60,10 +60,10 @@
|
|||
uint16 gTicksSinceLastUpdate;
|
||||
uint32 gLastTickCount;
|
||||
uint8 gGamePaused = 0;
|
||||
int gGameSpeed = 1;
|
||||
sint32 gGameSpeed = 1;
|
||||
float gDayNightCycle = 0;
|
||||
bool gInUpdateCode = false;
|
||||
int gGameCommandNestLevel;
|
||||
sint32 gGameCommandNestLevel;
|
||||
bool gGameCommandIsNetworked;
|
||||
|
||||
uint8 gUnk13CA740;
|
||||
|
@ -86,16 +86,16 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
|
|||
game_command_callback_pickup_guest,
|
||||
game_command_callback_pickup_staff,
|
||||
};
|
||||
int game_command_playerid = -1;
|
||||
sint32 game_command_playerid = -1;
|
||||
|
||||
rct_string_id gGameCommandErrorTitle;
|
||||
rct_string_id gGameCommandErrorText;
|
||||
uint8 gErrorType;
|
||||
rct_string_id gErrorStringId;
|
||||
|
||||
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback)
|
||||
sint32 game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback)
|
||||
{
|
||||
for (int i = 0; i < countof(game_command_callback_table); i++ ) {
|
||||
for (sint32 i = 0; i < countof(game_command_callback_table); i++ ) {
|
||||
if (game_command_callback_table[i] == callback) {
|
||||
return i;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback)
|
|||
return 0;
|
||||
}
|
||||
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index)
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(sint32 index)
|
||||
{
|
||||
if (index < countof(game_command_callback_table)) {
|
||||
return game_command_callback_table[index];
|
||||
|
@ -162,16 +162,16 @@ void update_palette_effects()
|
|||
|
||||
if (gClimateLightningFlash == 1) {
|
||||
// change palette to lighter colour during lightning
|
||||
int palette = SPR_GAME_PALETTE_DEFAULT;
|
||||
sint32 palette = SPR_GAME_PALETTE_DEFAULT;
|
||||
|
||||
if ((intptr_t)water_type != -1) {
|
||||
palette = water_type->image_id;
|
||||
}
|
||||
rct_g1_element g1_element = g1Elements[palette];
|
||||
int xoffset = g1_element.x_offset;
|
||||
sint32 xoffset = g1_element.x_offset;
|
||||
xoffset = xoffset * 4;
|
||||
uint8 *paletteOffset = gGamePalette + xoffset;
|
||||
for (int i = 0; i < g1_element.width; i++) {
|
||||
for (sint32 i = 0; i < g1_element.width; i++) {
|
||||
paletteOffset[(i * 4) + 0] = -((0xFF - g1_element.offset[(i * 3) + 0]) / 2) - 1;
|
||||
paletteOffset[(i * 4) + 1] = -((0xFF - g1_element.offset[(i * 3) + 1]) / 2) - 1;
|
||||
paletteOffset[(i * 4) + 2] = -((0xFF - g1_element.offset[(i * 3) + 2]) / 2) - 1;
|
||||
|
@ -181,17 +181,17 @@ void update_palette_effects()
|
|||
} else {
|
||||
if (gClimateLightningFlash == 2) {
|
||||
// change palette back to normal after lightning
|
||||
int palette = SPR_GAME_PALETTE_DEFAULT;
|
||||
sint32 palette = SPR_GAME_PALETTE_DEFAULT;
|
||||
|
||||
if ((intptr_t)water_type != -1) {
|
||||
palette = water_type->image_id;
|
||||
}
|
||||
|
||||
rct_g1_element g1_element = g1Elements[palette];
|
||||
int xoffset = g1_element.x_offset;
|
||||
sint32 xoffset = g1_element.x_offset;
|
||||
xoffset = xoffset * 4;
|
||||
uint8 *paletteOffset = gGamePalette + xoffset;
|
||||
for (int i = 0; i < g1_element.width; i++) {
|
||||
for (sint32 i = 0; i < g1_element.width; i++) {
|
||||
paletteOffset[(i * 4) + 0] = g1_element.offset[(i * 3) + 0];
|
||||
paletteOffset[(i * 4) + 1] = g1_element.offset[(i * 3) + 1];
|
||||
paletteOffset[(i * 4) + 2] = g1_element.offset[(i * 3) + 2];
|
||||
|
@ -199,7 +199,7 @@ void update_palette_effects()
|
|||
}
|
||||
|
||||
// animate the water/lava/chain movement palette
|
||||
int q = 0;
|
||||
sint32 q = 0;
|
||||
if (gConfigGeneral.render_weather_gloom) {
|
||||
uint8 gloom = gClimateCurrentWeatherGloom;
|
||||
if (gloom != 0) {
|
||||
|
@ -212,15 +212,15 @@ void update_palette_effects()
|
|||
}
|
||||
uint32 j = gPaletteEffectFrame;
|
||||
j = (((uint16)((~j / 2) * 128) * 15) >> 16);
|
||||
int p = SPR_GAME_PALETTE_WATER;
|
||||
sint32 p = SPR_GAME_PALETTE_WATER;
|
||||
if ((intptr_t)water_type != -1) {
|
||||
p = water_type->var_06;
|
||||
}
|
||||
rct_g1_element g1_element = g1Elements[q + p];
|
||||
uint8* vs = &g1_element.offset[j * 3];
|
||||
uint8* vd = &gGamePalette[230 * 4];
|
||||
int n = 5;
|
||||
for (int i = 0; i < n; i++) {
|
||||
sint32 n = 5;
|
||||
for (sint32 i = 0; i < n; i++) {
|
||||
vd[0] = vs[0];
|
||||
vd[1] = vs[1];
|
||||
vd[2] = vs[2];
|
||||
|
@ -238,7 +238,7 @@ void update_palette_effects()
|
|||
g1_element = g1Elements[q + p];
|
||||
vs = &g1_element.offset[j * 3];
|
||||
n = 5;
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (sint32 i = 0; i < n; i++) {
|
||||
vd[0] = vs[0];
|
||||
vd[1] = vs[1];
|
||||
vd[2] = vs[2];
|
||||
|
@ -255,7 +255,7 @@ void update_palette_effects()
|
|||
vs = &g1_element.offset[j * 3];
|
||||
vd += 12;
|
||||
n = 3;
|
||||
for (int i = 0; i < n; i++) {
|
||||
for (sint32 i = 0; i < n; i++) {
|
||||
vd[0] = vs[0];
|
||||
vd[1] = vs[1];
|
||||
vd[2] = vs[2];
|
||||
|
@ -276,7 +276,7 @@ void update_palette_effects()
|
|||
|
||||
void game_update()
|
||||
{
|
||||
int i, numUpdates;
|
||||
sint32 i, numUpdates;
|
||||
|
||||
// 0x006E3AEC // screen_game_process_mouse_input();
|
||||
screenshot_check();
|
||||
|
@ -435,7 +435,7 @@ void game_logic_update()
|
|||
*
|
||||
* @param cost (ebp)
|
||||
*/
|
||||
static int game_check_affordability(int cost)
|
||||
static sint32 game_check_affordability(sint32 cost)
|
||||
{
|
||||
if (cost <= 0)return cost;
|
||||
if (gUnk141F568 & 0xF0) return cost;
|
||||
|
@ -454,7 +454,7 @@ static int game_check_affordability(int cost)
|
|||
* @param flags (ebx)
|
||||
* @param command (esi)
|
||||
*/
|
||||
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp)
|
||||
sint32 game_do_command(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp)
|
||||
{
|
||||
return game_do_command_p(esi, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
|
||||
}
|
||||
|
@ -466,10 +466,10 @@ int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int eb
|
|||
* @param flags (ebx)
|
||||
* @param command (esi)
|
||||
*/
|
||||
int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
sint32 game_do_command_p(sint32 command, sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp)
|
||||
{
|
||||
int cost, flags;
|
||||
int original_ebx, original_edx, original_esi, original_edi, original_ebp;
|
||||
sint32 cost, flags;
|
||||
sint32 original_ebx, original_edx, original_esi, original_edi, original_ebp;
|
||||
|
||||
*esi = command;
|
||||
original_ebx = *ebx;
|
||||
|
@ -514,7 +514,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
|
|||
|
||||
if (cost != MONEY32_UNDEFINED) {
|
||||
// Check funds
|
||||
int insufficientFunds = 0;
|
||||
sint32 insufficientFunds = 0;
|
||||
if (gGameCommandNestLevel == 1 && !(flags & GAME_COMMAND_FLAG_2) && !(flags & GAME_COMMAND_FLAG_5) && cost != 0)
|
||||
insufficientFunds = game_check_affordability(cost);
|
||||
|
||||
|
@ -631,7 +631,7 @@ bool game_is_not_paused()
|
|||
*
|
||||
* rct2: 0x00667C15
|
||||
*/
|
||||
void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
void game_pause_toggle(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp)
|
||||
{
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY)
|
||||
pause_toggle();
|
||||
|
@ -643,7 +643,7 @@ void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *ed
|
|||
*
|
||||
* rct2: 0x0066DB5F
|
||||
*/
|
||||
static void game_load_or_quit(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp)
|
||||
static void game_load_or_quit(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp)
|
||||
{
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
switch (*edx & 0xFF) {
|
||||
|
@ -720,7 +720,7 @@ void game_convert_strings_to_utf8()
|
|||
rct2_to_utf8_self(gScenarioDetails, 256);
|
||||
|
||||
// User strings
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++) {
|
||||
for (sint32 i = 0; i < MAX_USER_STRINGS; i++) {
|
||||
utf8 *userString = &gUserStrings[i * USER_STRING_MAX_LENGTH];
|
||||
|
||||
if (!str_is_null_or_empty(userString)) {
|
||||
|
@ -730,7 +730,7 @@ void game_convert_strings_to_utf8()
|
|||
}
|
||||
|
||||
// News items
|
||||
for (int i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
for (sint32 i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
rct_news_item *newsItem = news_item_get(i);
|
||||
|
||||
if (!str_is_null_or_empty(newsItem->text)) {
|
||||
|
@ -750,7 +750,7 @@ void game_convert_strings_to_rct2(rct_s6_data *s6)
|
|||
utf8_to_rct2_self(s6->scenario_description, sizeof(s6->scenario_description));
|
||||
|
||||
// User strings
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++) {
|
||||
for (sint32 i = 0; i < MAX_USER_STRINGS; i++) {
|
||||
char *userString = &s6->custom_strings[i * USER_STRING_MAX_LENGTH];
|
||||
|
||||
if (!str_is_null_or_empty(userString)) {
|
||||
|
@ -759,7 +759,7 @@ void game_convert_strings_to_rct2(rct_s6_data *s6)
|
|||
}
|
||||
|
||||
// News items
|
||||
for (int i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
for (sint32 i = 0; i < MAX_NEWS_ITEMS; i++) {
|
||||
rct_news_item *newsItem = &s6->news_items[i];
|
||||
|
||||
if (!str_is_null_or_empty(newsItem->text)) {
|
||||
|
@ -786,8 +786,8 @@ void game_fix_save_vars() {
|
|||
peep_sort();
|
||||
|
||||
// Fixes broken saves where a surface element could be null
|
||||
for (int y = 0; y < 256; y++) {
|
||||
for (int x = 0; x < 256; x++) {
|
||||
for (sint32 y = 0; y < 256; y++) {
|
||||
for (sint32 x = 0; x < 256; x++) {
|
||||
rct_map_element *mapElement = map_get_surface_element_at(x, y);
|
||||
|
||||
if (mapElement == NULL)
|
||||
|
@ -803,7 +803,7 @@ void game_fix_save_vars() {
|
|||
}
|
||||
|
||||
// Fix invalid research items
|
||||
for (int i = 0; i < 500; i++) {
|
||||
for (sint32 i = 0; i < 500; i++) {
|
||||
rct_research_item *researchItem = &gResearchItems[i];
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_SEPARATOR) continue;
|
||||
if (researchItem->entryIndex == RESEARCHED_ITEMS_END) continue;
|
||||
|
@ -965,13 +965,13 @@ void save_game_as()
|
|||
window_loadsave_open(LOADSAVETYPE_SAVE | LOADSAVETYPE_GAME, name);
|
||||
}
|
||||
|
||||
static int compare_autosave_file_paths (const void * a, const void * b ) {
|
||||
static sint32 compare_autosave_file_paths (const void * a, const void * b ) {
|
||||
return strcmp(*(char **)a, *(char **)b);
|
||||
}
|
||||
|
||||
static void limit_autosave_count(const size_t numberOfFilesToKeep)
|
||||
{
|
||||
int fileEnumHandle = 0;
|
||||
sint32 fileEnumHandle = 0;
|
||||
|
||||
size_t autosavesCount = 0;
|
||||
size_t numAutosavesToDelete = 0;
|
||||
|
@ -1121,7 +1121,7 @@ bool game_load_save_or_scenario(const utf8 * path)
|
|||
return false;
|
||||
}
|
||||
|
||||
static void game_load_or_quit_no_save_prompt_callback(int result, const utf8 * path)
|
||||
static void game_load_or_quit_no_save_prompt_callback(sint32 result, const utf8 * path)
|
||||
{
|
||||
if (result == MODAL_RESULT_OK && game_load_save_or_scenario(path)) {
|
||||
gFirstTimeSave = 0;
|
||||
|
|
|
@ -119,14 +119,14 @@ enum {
|
|||
ERROR_TYPE_FILE_LOAD = 255
|
||||
};
|
||||
|
||||
typedef void (GAME_COMMAND_POINTER)(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
typedef void (GAME_COMMAND_POINTER)(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
|
||||
typedef void (GAME_COMMAND_CALLBACK_POINTER)(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
typedef void (GAME_COMMAND_CALLBACK_POINTER)(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
|
||||
extern GAME_COMMAND_CALLBACK_POINTER* game_command_callback;
|
||||
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback);
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index);
|
||||
extern int game_command_playerid;
|
||||
sint32 game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback);
|
||||
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(sint32 index);
|
||||
extern sint32 game_command_playerid;
|
||||
|
||||
extern rct_string_id gGameCommandErrorTitle;
|
||||
extern rct_string_id gGameCommandErrorText;
|
||||
|
@ -144,10 +144,10 @@ extern uint32 gCurrentTicks;
|
|||
extern uint16 gTicksSinceLastUpdate;
|
||||
extern uint32 gLastTickCount;
|
||||
extern uint8 gGamePaused;
|
||||
extern int gGameSpeed;
|
||||
extern sint32 gGameSpeed;
|
||||
extern float gDayNightCycle;
|
||||
extern bool gInUpdateCode;
|
||||
extern int gGameCommandNestLevel;
|
||||
extern sint32 gGameCommandNestLevel;
|
||||
extern bool gGameCommandIsNetworked;
|
||||
|
||||
extern uint8 gUnk13CA740;
|
||||
|
@ -162,16 +162,16 @@ void game_logic_update();
|
|||
void reset_all_sprite_quadrant_placements();
|
||||
void update_palette_effects();
|
||||
|
||||
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
|
||||
sint32 game_do_command(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
sint32 game_do_command_p(sint32 command, sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
|
||||
void game_load_or_quit_no_save_prompt();
|
||||
bool game_load_sv6_path(const char * path);
|
||||
bool game_load_sv6(SDL_RWops* rw);
|
||||
int game_load_network(SDL_RWops* rw);
|
||||
sint32 game_load_network(SDL_RWops* rw);
|
||||
bool game_load_save(const utf8 *path);
|
||||
void game_load_init();
|
||||
void game_pause_toggle(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
|
||||
void game_pause_toggle(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *edx, sint32 *esi, sint32 *edi, sint32 *ebp);
|
||||
void pause_toggle();
|
||||
bool game_is_paused();
|
||||
bool game_is_not_paused();
|
||||
|
|
|
@ -79,41 +79,41 @@ widget_ref gCurrentToolWidget;
|
|||
|
||||
static sint16 _clickRepeatTicks;
|
||||
|
||||
static int game_get_next_input(int *x, int *y);
|
||||
static void input_widget_over(int x, int y, rct_window *w, int widgetIndex);
|
||||
static void input_widget_over_change_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex);
|
||||
static sint32 game_get_next_input(sint32 *x, sint32 *y);
|
||||
static void input_widget_over(sint32 x, sint32 y, rct_window *w, sint32 widgetIndex);
|
||||
static void input_widget_over_change_check(rct_windowclass windowClass, rct_windownumber windowNumber, sint32 widgetIndex);
|
||||
static void input_widget_over_flatbutton_invalidate();
|
||||
void process_mouse_over(int x, int y);
|
||||
void process_mouse_tool(int x, int y);
|
||||
void process_mouse_over(sint32 x, sint32 y);
|
||||
void process_mouse_tool(sint32 x, sint32 y);
|
||||
void invalidate_scroll();
|
||||
static rct_mouse_data* get_mouse_input();
|
||||
void map_element_right_click(int type, rct_map_element *mapElement, int x, int y);
|
||||
int sub_6EDE88(int x, int y, rct_map_element **mapElement, int *outX, int *outY);
|
||||
int get_next_key();
|
||||
static void game_handle_input_mouse(int x, int y, int state);
|
||||
void map_element_right_click(sint32 type, rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
sint32 sub_6EDE88(sint32 x, sint32 y, rct_map_element **mapElement, sint32 *outX, sint32 *outY);
|
||||
sint32 get_next_key();
|
||||
static void game_handle_input_mouse(sint32 x, sint32 y, sint32 state);
|
||||
void game_handle_edge_scroll();
|
||||
void game_handle_key_scroll();
|
||||
static void input_widget_left(int x, int y, rct_window *w, int widgetIndex);
|
||||
void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_window* w, rct_widget* widget);
|
||||
static void input_widget_left(sint32 x, sint32 y, rct_window *w, sint32 widgetIndex);
|
||||
void input_state_widget_pressed(sint32 x, sint32 y, sint32 state, sint32 widgetIndex, rct_window* w, rct_widget* widget);
|
||||
void sub_6ED990(uint8 cursor_id);
|
||||
static void input_window_position_continue(rct_window *w, int lastX, int lastY, int newX, int newY);
|
||||
static void input_window_position_end(rct_window *w, int x, int y);
|
||||
static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int y);
|
||||
static void input_window_resize_continue(rct_window *w, int x, int y);
|
||||
static void input_window_position_continue(rct_window *w, sint32 lastX, sint32 lastY, sint32 newX, sint32 newY);
|
||||
static void input_window_position_end(rct_window *w, sint32 x, sint32 y);
|
||||
static void input_window_resize_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
static void input_window_resize_continue(rct_window *w, sint32 x, sint32 y);
|
||||
static void input_window_resize_end();
|
||||
static void input_viewport_drag_begin(rct_window *w, int x, int y);
|
||||
static void input_viewport_drag_begin(rct_window *w, sint32 x, sint32 y);
|
||||
static void input_viewport_drag_continue();
|
||||
static void input_viewport_drag_end();
|
||||
static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y);
|
||||
static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int x, int y);
|
||||
static void input_scroll_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
static void input_scroll_continue(rct_window *w, sint32 widgetIndex, sint32 state, sint32 x, sint32 y);
|
||||
static void input_scroll_end();
|
||||
static void input_scroll_part_update_hthumb(rct_window *w, int widgetIndex, int x, int scroll_id);
|
||||
static void input_scroll_part_update_hleft(rct_window *w, int widgetIndex, int scroll_id);
|
||||
static void input_scroll_part_update_hright(rct_window *w, int widgetIndex, int scroll_id);
|
||||
static void input_scroll_part_update_vthumb(rct_window *w, int widgetIndex, int y, int scroll_id);
|
||||
static void input_scroll_part_update_vtop(rct_window *w, int widgetIndex, int scroll_id);
|
||||
static void input_scroll_part_update_vbottom(rct_window *w, int widgetIndex, int scroll_id);
|
||||
static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y);
|
||||
static void input_scroll_part_update_hthumb(rct_window *w, sint32 widgetIndex, sint32 x, sint32 scroll_id);
|
||||
static void input_scroll_part_update_hleft(rct_window *w, sint32 widgetIndex, sint32 scroll_id);
|
||||
static void input_scroll_part_update_hright(rct_window *w, sint32 widgetIndex, sint32 scroll_id);
|
||||
static void input_scroll_part_update_vthumb(rct_window *w, sint32 widgetIndex, sint32 y, sint32 scroll_id);
|
||||
static void input_scroll_part_update_vtop(rct_window *w, sint32 widgetIndex, sint32 scroll_id);
|
||||
static void input_scroll_part_update_vbottom(rct_window *w, sint32 widgetIndex, sint32 scroll_id);
|
||||
static void input_update_tooltip(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
|
||||
#pragma region Mouse input
|
||||
|
||||
|
@ -129,7 +129,7 @@ void game_handle_input()
|
|||
|
||||
sub_6EA73F();
|
||||
|
||||
int x, y, state;
|
||||
sint32 x, y, state;
|
||||
while ((state = game_get_next_input(&x, &y)) != MOUSE_STATE_RELEASED) {
|
||||
game_handle_input_mouse(x, y, state & 0xFF);
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ void game_handle_input()
|
|||
*
|
||||
* rct2: 0x006E83C7
|
||||
*/
|
||||
static int game_get_next_input(int *x, int *y)
|
||||
static sint32 game_get_next_input(sint32 *x, sint32 *y)
|
||||
{
|
||||
rct_mouse_data *input = get_mouse_input();
|
||||
if (input == NULL) {
|
||||
|
@ -188,7 +188,7 @@ static rct_mouse_data *get_mouse_input()
|
|||
*
|
||||
* rct2: 0x006E957F
|
||||
*/
|
||||
static void input_scroll_drag_begin(int x, int y, rct_window* w, rct_widget* widget, int widgetIndex)
|
||||
static void input_scroll_drag_begin(sint32 x, sint32 y, rct_window* w, rct_widget* widget, sint32 widgetIndex)
|
||||
{
|
||||
gInputState = INPUT_STATE_SCROLL_RIGHT;
|
||||
gInputDragLastX = x;
|
||||
|
@ -206,7 +206,7 @@ static void input_scroll_drag_begin(int x, int y, rct_window* w, rct_widget* wid
|
|||
* Based on (heavily changed)
|
||||
* rct2: 0x006E9E0E, 0x006E9ED0
|
||||
*/
|
||||
static void input_scroll_drag_continue(int x, int y, rct_window* w)
|
||||
static void input_scroll_drag_continue(sint32 x, sint32 y, rct_window* w)
|
||||
{
|
||||
rct_widgetindex widgetIndex = _dragWidget.widget_index;
|
||||
uint8 scrollIndex = _dragScrollIndex;
|
||||
|
@ -214,7 +214,7 @@ static void input_scroll_drag_continue(int x, int y, rct_window* w)
|
|||
rct_widget* widget = &w->widgets[widgetIndex];
|
||||
rct_scroll* scroll = &w->scrolls[scrollIndex];
|
||||
|
||||
int dx, dy;
|
||||
sint32 dx, dy;
|
||||
dx = x - gInputDragLastX;
|
||||
dy = y - gInputDragLastY;
|
||||
|
||||
|
@ -237,8 +237,8 @@ static void input_scroll_drag_continue(int x, int y, rct_window* w)
|
|||
widget_scroll_update_thumbs(w, widgetIndex);
|
||||
window_invalidate_by_number(w->classification, w->number);
|
||||
|
||||
int fixedCursorPositionX = (int) ceilf(gInputDragLastX * gConfigGeneral.window_scale);
|
||||
int fixedCursorPositionY = (int) ceilf(gInputDragLastY * gConfigGeneral.window_scale);
|
||||
sint32 fixedCursorPositionX = (sint32) ceilf(gInputDragLastX * gConfigGeneral.window_scale);
|
||||
sint32 fixedCursorPositionY = (sint32) ceilf(gInputDragLastY * gConfigGeneral.window_scale);
|
||||
|
||||
platform_set_cursor_position(fixedCursorPositionX, fixedCursorPositionY);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ static void input_scroll_drag_continue(int x, int y, rct_window* w)
|
|||
*
|
||||
* rct2: 0x006E8ACB
|
||||
*/
|
||||
static void input_scroll_right(int x, int y, int state)
|
||||
static void input_scroll_right(sint32 x, sint32 y, sint32 state)
|
||||
{
|
||||
rct_window* w = window_find_by_number(_dragWidget.window_classification, _dragWidget.window_number);
|
||||
if (w == NULL) {
|
||||
|
@ -275,11 +275,11 @@ static void input_scroll_right(int x, int y, int state)
|
|||
*
|
||||
* rct2: 0x006E8655
|
||||
*/
|
||||
static void game_handle_input_mouse(int x, int y, int state)
|
||||
static void game_handle_input_mouse(sint32 x, sint32 y, sint32 state)
|
||||
{
|
||||
rct_window *w;
|
||||
rct_widget *widget;
|
||||
int widgetIndex;
|
||||
sint32 widgetIndex;
|
||||
|
||||
// Get window and widget under cursor position
|
||||
w = window_find_from_point(x, y);
|
||||
|
@ -428,7 +428,7 @@ static void game_handle_input_mouse(int x, int y, int state)
|
|||
|
||||
#pragma region Window positioning / resizing
|
||||
|
||||
void input_window_position_begin(rct_window *w, int widgetIndex, int x, int y)
|
||||
void input_window_position_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
gInputState = INPUT_STATE_POSITIONING_WINDOW;
|
||||
gInputDragLastX = x - w->x;
|
||||
|
@ -438,15 +438,15 @@ void input_window_position_begin(rct_window *w, int widgetIndex, int x, int y)
|
|||
_dragWidget.widget_index = widgetIndex;
|
||||
}
|
||||
|
||||
static void input_window_position_continue(rct_window *w, int wdx, int wdy, int x, int y)
|
||||
static void input_window_position_continue(rct_window *w, sint32 wdx, sint32 wdy, sint32 x, sint32 y)
|
||||
{
|
||||
int snapProximity;
|
||||
sint32 snapProximity;
|
||||
|
||||
snapProximity = w->flags & WF_NO_SNAPPING ? 0 : gConfigGeneral.window_snap_proximity;
|
||||
window_move_and_snap(w, x - wdx, y - wdy, snapProximity);
|
||||
}
|
||||
|
||||
static void input_window_position_end(rct_window *w, int x, int y)
|
||||
static void input_window_position_end(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
gInputState = INPUT_STATE_NORMAL;
|
||||
gTooltipTimeout = 0;
|
||||
|
@ -454,7 +454,7 @@ static void input_window_position_end(rct_window *w, int x, int y)
|
|||
window_event_moved_call(w, x, y);
|
||||
}
|
||||
|
||||
static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int y)
|
||||
static void input_window_resize_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
gInputState = INPUT_STATE_RESIZING;
|
||||
gInputDragLastX = x;
|
||||
|
@ -466,11 +466,11 @@ static void input_window_resize_begin(rct_window *w, int widgetIndex, int x, int
|
|||
_originalWindowHeight = w->height;
|
||||
}
|
||||
|
||||
static void input_window_resize_continue(rct_window *w, int x, int y)
|
||||
static void input_window_resize_continue(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
int dx, dy, targetWidth, targetHeight;
|
||||
sint32 dx, dy, targetWidth, targetHeight;
|
||||
|
||||
if (y < (int)gScreenHeight - 2) {
|
||||
if (y < (sint32)gScreenHeight - 2) {
|
||||
dx = x - gInputDragLastX;
|
||||
dy = y - gInputDragLastY;
|
||||
targetWidth = _originalWindowWidth + dx;
|
||||
|
@ -495,7 +495,7 @@ static void input_window_resize_end()
|
|||
|
||||
#pragma region Viewport dragging
|
||||
|
||||
static void input_viewport_drag_begin(rct_window *w, int x, int y)
|
||||
static void input_viewport_drag_begin(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
w->flags &= ~WF_SCROLLING_TO_LOCATION;
|
||||
gInputState = INPUT_STATE_VIEWPORT_RIGHT;
|
||||
|
@ -510,7 +510,7 @@ static void input_viewport_drag_begin(rct_window *w, int x, int y)
|
|||
|
||||
static void input_viewport_drag_continue()
|
||||
{
|
||||
int dx, dy, newDragX, newDragY;
|
||||
sint32 dx, dy, newDragX, newDragY;
|
||||
rct_window *w;
|
||||
rct_viewport *viewport;
|
||||
|
||||
|
@ -565,7 +565,7 @@ static void input_viewport_drag_end()
|
|||
|
||||
#pragma region Scroll bars
|
||||
|
||||
static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
|
||||
static void input_scroll_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
rct_widget *widget;
|
||||
|
||||
|
@ -578,7 +578,7 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
|
|||
gTooltipCursorX = x;
|
||||
gTooltipCursorY = y;
|
||||
|
||||
int eax, ebx, scroll_area, scroll_id;
|
||||
sint32 eax, ebx, scroll_area, scroll_id;
|
||||
scroll_id = 0; // safety
|
||||
widget_scroll_get_part(w, widget, x, y, &eax, &ebx, &scroll_area, &scroll_id);
|
||||
|
||||
|
@ -593,15 +593,15 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
|
|||
rct_widget* widg = &w->widgets[widgetIndex];
|
||||
rct_scroll* scroll = &w->scrolls[scroll_id];
|
||||
|
||||
int widget_width = widg->right - widg->left - 1;
|
||||
sint32 widget_width = widg->right - widg->left - 1;
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE)
|
||||
widget_width -= 11;
|
||||
int widget_content_width = max(scroll->h_right - widget_width, 0);
|
||||
sint32 widget_content_width = max(scroll->h_right - widget_width, 0);
|
||||
|
||||
int widget_height = widg->bottom - widg->top - 1;
|
||||
sint32 widget_height = widg->bottom - widg->top - 1;
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
widget_height -= 11;
|
||||
int widget_content_height = max(scroll->v_bottom - widget_height, 0);
|
||||
sint32 widget_content_height = max(scroll->v_bottom - widget_height, 0);
|
||||
|
||||
switch (scroll_area) {
|
||||
case SCROLL_PART_HSCROLLBAR_LEFT:
|
||||
|
@ -635,11 +635,11 @@ static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y)
|
|||
window_invalidate_by_number(widgetIndex, w->classification);
|
||||
}
|
||||
|
||||
static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int x, int y)
|
||||
static void input_scroll_continue(rct_window *w, sint32 widgetIndex, sint32 state, sint32 x, sint32 y)
|
||||
{
|
||||
rct_widget *widget;
|
||||
int scroll_part, scroll_id;
|
||||
int x2, y2;
|
||||
sint32 scroll_part, scroll_id;
|
||||
sint32 x2, y2;
|
||||
|
||||
assert(w != NULL);
|
||||
|
||||
|
@ -655,14 +655,14 @@ static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int
|
|||
widget_scroll_get_part(w, widget, x, y, &x2, &y2, &scroll_part, &scroll_id);
|
||||
|
||||
if (_currentScrollArea == SCROLL_PART_HSCROLLBAR_THUMB){
|
||||
int originalTooltipCursorX = gTooltipCursorX;
|
||||
sint32 originalTooltipCursorX = gTooltipCursorX;
|
||||
gTooltipCursorX = x;
|
||||
input_scroll_part_update_hthumb(w, widgetIndex, x - originalTooltipCursorX, scroll_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentScrollArea == SCROLL_PART_VSCROLLBAR_THUMB){
|
||||
int originalTooltipCursorY = gTooltipCursorY;
|
||||
sint32 originalTooltipCursorY = gTooltipCursorY;
|
||||
gTooltipCursorY = y;
|
||||
input_scroll_part_update_vthumb(w, widgetIndex, y - originalTooltipCursorY, scroll_id);
|
||||
return;
|
||||
|
@ -706,10 +706,10 @@ static void input_scroll_end()
|
|||
*
|
||||
* rct2: 0x006E98F2
|
||||
*/
|
||||
static void input_scroll_part_update_hthumb(rct_window *w, int widgetIndex, int x, int scroll_id)
|
||||
static void input_scroll_part_update_hthumb(rct_window *w, sint32 widgetIndex, sint32 x, sint32 scroll_id)
|
||||
{
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
int newLeft;
|
||||
sint32 newLeft;
|
||||
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
newLeft = w->scrolls[scroll_id].h_right;
|
||||
|
@ -743,11 +743,11 @@ static void input_scroll_part_update_hthumb(rct_window *w, int widgetIndex, int
|
|||
*
|
||||
* rct2: 0x006E99A9
|
||||
*/
|
||||
static void input_scroll_part_update_vthumb(rct_window *w, int widgetIndex, int y, int scroll_id)
|
||||
static void input_scroll_part_update_vthumb(rct_window *w, sint32 widgetIndex, sint32 y, sint32 scroll_id)
|
||||
{
|
||||
assert(w != NULL);
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
int newTop;
|
||||
sint32 newTop;
|
||||
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
newTop = w->scrolls[scroll_id].v_bottom;
|
||||
|
@ -781,7 +781,7 @@ static void input_scroll_part_update_vthumb(rct_window *w, int widgetIndex, int
|
|||
*
|
||||
* rct2: 0x006E9A60
|
||||
*/
|
||||
static void input_scroll_part_update_hleft(rct_window *w, int widgetIndex, int scroll_id)
|
||||
static void input_scroll_part_update_hleft(rct_window *w, sint32 widgetIndex, sint32 scroll_id)
|
||||
{
|
||||
assert(w != NULL);
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
|
@ -797,14 +797,14 @@ static void input_scroll_part_update_hleft(rct_window *w, int widgetIndex, int s
|
|||
*
|
||||
* rct2: 0x006E9ABF
|
||||
*/
|
||||
static void input_scroll_part_update_hright(rct_window *w, int widgetIndex, int scroll_id)
|
||||
static void input_scroll_part_update_hright(rct_window *w, sint32 widgetIndex, sint32 scroll_id)
|
||||
{
|
||||
assert(w != NULL);
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
w->scrolls[scroll_id].flags |= HSCROLLBAR_RIGHT_PRESSED;
|
||||
w->scrolls[scroll_id].h_left += 3;
|
||||
int newLeft = widget->right - widget->left - 1;
|
||||
sint32 newLeft = widget->right - widget->left - 1;
|
||||
if (w->scrolls[scroll_id].flags & VSCROLLBAR_VISIBLE)
|
||||
newLeft -= 11;
|
||||
newLeft *= -1;
|
||||
|
@ -822,7 +822,7 @@ static void input_scroll_part_update_hright(rct_window *w, int widgetIndex, int
|
|||
*
|
||||
* rct2: 0x006E9C37
|
||||
*/
|
||||
static void input_scroll_part_update_vtop(rct_window *w, int widgetIndex, int scroll_id)
|
||||
static void input_scroll_part_update_vtop(rct_window *w, sint32 widgetIndex, sint32 scroll_id)
|
||||
{
|
||||
assert(w != NULL);
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
|
@ -838,14 +838,14 @@ static void input_scroll_part_update_vtop(rct_window *w, int widgetIndex, int sc
|
|||
*
|
||||
* rct2: 0x006E9C96
|
||||
*/
|
||||
static void input_scroll_part_update_vbottom(rct_window *w, int widgetIndex, int scroll_id)
|
||||
static void input_scroll_part_update_vbottom(rct_window *w, sint32 widgetIndex, sint32 scroll_id)
|
||||
{
|
||||
assert(w != NULL);
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
if (window_find_by_number(w->classification, w->number)) {
|
||||
w->scrolls[scroll_id].flags |= VSCROLLBAR_DOWN_PRESSED;
|
||||
w->scrolls[scroll_id].v_top += 3;
|
||||
int newTop = widget->bottom - widget->top - 1;
|
||||
sint32 newTop = widget->bottom - widget->top - 1;
|
||||
if (w->scrolls[scroll_id].flags & HSCROLLBAR_VISIBLE)
|
||||
newTop -= 11;
|
||||
newTop *= -1;
|
||||
|
@ -867,7 +867,7 @@ static void input_scroll_part_update_vbottom(rct_window *w, int widgetIndex, int
|
|||
*
|
||||
* rct2: 0x006E9253
|
||||
*/
|
||||
static void input_widget_over(int x, int y, rct_window *w, int widgetIndex)
|
||||
static void input_widget_over(sint32 x, sint32 y, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_windowclass windowClass = 255;
|
||||
rct_windownumber windowNumber = 0;
|
||||
|
@ -882,7 +882,7 @@ static void input_widget_over(int x, int y, rct_window *w, int widgetIndex)
|
|||
input_widget_over_change_check(windowClass, windowNumber, widgetIndex);
|
||||
|
||||
if (w != NULL && widgetIndex != -1 && widget->type == WWT_SCROLL) {
|
||||
int eax, ebx, scroll_part, edx;
|
||||
sint32 eax, ebx, scroll_part, edx;
|
||||
widget_scroll_get_part(w, widget, x, y, &eax, &ebx, &scroll_part, &edx);
|
||||
|
||||
if (scroll_part != SCROLL_PART_VIEW)
|
||||
|
@ -905,7 +905,7 @@ static void input_widget_over(int x, int y, rct_window *w, int widgetIndex)
|
|||
*
|
||||
* rct2: 0x006E9269
|
||||
*/
|
||||
static void input_widget_over_change_check(rct_windowclass windowClass, rct_windownumber windowNumber, int widgetIndex)
|
||||
static void input_widget_over_change_check(rct_windowclass windowClass, rct_windownumber windowNumber, sint32 widgetIndex)
|
||||
{
|
||||
// Prevents invalid widgets being clicked source of bug is elsewhere
|
||||
if (widgetIndex == -1)
|
||||
|
@ -953,7 +953,7 @@ static void input_widget_over_flatbutton_invalidate()
|
|||
*
|
||||
* rct2: 0x006E95F9
|
||||
*/
|
||||
static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
|
||||
static void input_widget_left(sint32 x, sint32 y, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_windowclass windowClass = 255;
|
||||
rct_windownumber windowNumber = 0;
|
||||
|
@ -1038,14 +1038,14 @@ static void input_widget_left(int x, int y, rct_window *w, int widgetIndex)
|
|||
*
|
||||
* rct2: 0x006ED833
|
||||
*/
|
||||
void process_mouse_over(int x, int y)
|
||||
void process_mouse_over(sint32 x, sint32 y)
|
||||
{
|
||||
rct_window* window;
|
||||
rct_window* subWindow;
|
||||
|
||||
int widgetId;
|
||||
int cursorId;
|
||||
int ebx, edi;
|
||||
sint32 widgetId;
|
||||
sint32 cursorId;
|
||||
sint32 ebx, edi;
|
||||
|
||||
cursorId = CURSOR_ARROW;
|
||||
set_map_tooltip_format_arg(0, rct_string_id, STR_NONE);
|
||||
|
@ -1103,8 +1103,8 @@ void process_mouse_over(int x, int y)
|
|||
|
||||
case WWT_SCROLL:
|
||||
{
|
||||
int output_scroll_area, scroll_id;
|
||||
int scroll_x, scroll_y;
|
||||
sint32 output_scroll_area, scroll_id;
|
||||
sint32 scroll_x, scroll_y;
|
||||
widget_scroll_get_part(window, &window->widgets[widgetId], x, y, &scroll_x, &scroll_y, &output_scroll_area, &scroll_id);
|
||||
cursorId = scroll_id;
|
||||
if (output_scroll_area != SCROLL_PART_VIEW)
|
||||
|
@ -1135,7 +1135,7 @@ void process_mouse_over(int x, int y)
|
|||
*
|
||||
* rct2: 0x006ED801
|
||||
*/
|
||||
void process_mouse_tool(int x, int y)
|
||||
void process_mouse_tool(sint32 x, sint32 y)
|
||||
{
|
||||
if (gInputFlags & INPUT_FLAG_TOOL_ACTIVE)
|
||||
{
|
||||
|
@ -1156,13 +1156,13 @@ void process_mouse_tool(int x, int y)
|
|||
*
|
||||
* rct2: 0x006E8DA7
|
||||
*/
|
||||
void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_window *w, rct_widget *widget)
|
||||
void input_state_widget_pressed(sint32 x, sint32 y, sint32 state, sint32 widgetIndex, rct_window *w, rct_widget *widget)
|
||||
{
|
||||
rct_windowclass cursor_w_class;
|
||||
rct_windownumber cursor_w_number;
|
||||
cursor_w_class = gPressedWidget.window_classification;
|
||||
cursor_w_number = gPressedWidget.window_number;
|
||||
int cursor_widgetIndex = gPressedWidget.widget_index;
|
||||
sint32 cursor_widgetIndex = gPressedWidget.widget_index;
|
||||
|
||||
rct_window *cursor_w = window_find_by_number(cursor_w_class, cursor_w_number);
|
||||
if (cursor_w == NULL) {
|
||||
|
@ -1204,7 +1204,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
|
|||
case MOUSE_STATE_RIGHT_PRESS:
|
||||
if (gInputState == INPUT_STATE_DROPDOWN_ACTIVE) {
|
||||
if (w) {
|
||||
int dropdown_index = 0;
|
||||
sint32 dropdown_index = 0;
|
||||
|
||||
if (w->classification == WC_DROPDOWN) {
|
||||
dropdown_index = dropdown_index_from_point(x, y, w);
|
||||
|
@ -1269,7 +1269,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
|
|||
if (!widget)
|
||||
break;
|
||||
|
||||
int mid_point_x = (widget->left + widget->right) / 2 + w->x;
|
||||
sint32 mid_point_x = (widget->left + widget->right) / 2 + w->x;
|
||||
audio_play_sound_panned(5, mid_point_x, 0, 0, 0);
|
||||
if (cursor_w_class != w->classification || cursor_w_number != w->number || widgetIndex != cursor_widgetIndex)
|
||||
break;
|
||||
|
@ -1300,7 +1300,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
|
|||
}
|
||||
|
||||
if (w->classification == WC_DROPDOWN){
|
||||
int dropdown_index = dropdown_index_from_point(x, y, w);
|
||||
sint32 dropdown_index = dropdown_index_from_point(x, y, w);
|
||||
if (dropdown_index == -1) {
|
||||
return;
|
||||
}
|
||||
|
@ -1363,7 +1363,7 @@ void input_state_widget_pressed(int x, int y, int state, int widgetIndex, rct_wi
|
|||
}
|
||||
}
|
||||
|
||||
static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
|
||||
static void input_update_tooltip(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (gTooltipWidget.window_classification == 255) {
|
||||
if (gTooltipCursorX == x && gTooltipCursorY == y) {
|
||||
|
@ -1404,7 +1404,7 @@ static void input_update_tooltip(rct_window *w, int widgetIndex, int x, int y)
|
|||
void title_handle_keyboard_input()
|
||||
{
|
||||
rct_window *w;
|
||||
int key;
|
||||
sint32 key;
|
||||
|
||||
if (gOpenRCT2Headless) {
|
||||
return;
|
||||
|
@ -1466,7 +1466,7 @@ void title_handle_keyboard_input()
|
|||
void game_handle_keyboard_input()
|
||||
{
|
||||
rct_window *w;
|
||||
int key;
|
||||
sint32 key;
|
||||
|
||||
if (!gConsoleOpen) {
|
||||
// Handle mouse scrolling
|
||||
|
@ -1536,9 +1536,9 @@ void game_handle_keyboard_input()
|
|||
*
|
||||
* rct2: 0x00406CD2
|
||||
*/
|
||||
int get_next_key()
|
||||
sint32 get_next_key()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
for (i = 0; i < 221; i++) {
|
||||
if (gKeysPressed[i]) {
|
||||
gKeysPressed[i] = 0;
|
||||
|
@ -1582,7 +1582,7 @@ void invalidate_scroll()
|
|||
/**
|
||||
* rct2: 0x00406C96
|
||||
*/
|
||||
void store_mouse_input(int state, int x, int y)
|
||||
void store_mouse_input(sint32 state, sint32 x, sint32 y)
|
||||
{
|
||||
uint32 writeIndex = _mouseInputQueueWriteIndex;
|
||||
uint32 nextWriteIndex = (writeIndex + 1) % countof(_mouseInputQueue);
|
||||
|
@ -1601,7 +1601,7 @@ void store_mouse_input(int state, int x, int y)
|
|||
void game_handle_edge_scroll()
|
||||
{
|
||||
rct_window *mainWindow;
|
||||
int scrollX, scrollY;
|
||||
sint32 scrollX, scrollY;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
if (mainWindow == NULL)
|
||||
|
@ -1644,7 +1644,7 @@ void game_handle_edge_scroll()
|
|||
void game_handle_key_scroll()
|
||||
{
|
||||
rct_window *mainWindow;
|
||||
int scrollX, scrollY;
|
||||
sint32 scrollX, scrollY;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
if (mainWindow == NULL)
|
||||
|
@ -1663,7 +1663,7 @@ void game_handle_key_scroll()
|
|||
scrollX = 0;
|
||||
scrollY = 0;
|
||||
|
||||
for (int shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) {
|
||||
for (sint32 shortcutId = SHORTCUT_SCROLL_MAP_UP; shortcutId <= SHORTCUT_SCROLL_MAP_RIGHT; shortcutId++) {
|
||||
uint16 shortcutKey = gShortcutKeys[shortcutId];
|
||||
uint8 scancode = shortcutKey & 0xFF;
|
||||
|
||||
|
|
|
@ -99,8 +99,8 @@ void title_handle_keyboard_input();
|
|||
void game_handle_input();
|
||||
void game_handle_keyboard_input();
|
||||
|
||||
void store_mouse_input(int state, int x, int y);
|
||||
void store_mouse_input(sint32 state, sint32 x, sint32 y);
|
||||
|
||||
void input_window_position_begin(rct_window *w, int widgetIndex, int x, int y);
|
||||
void input_window_position_begin(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -104,12 +104,12 @@ extern "C"
|
|||
Cursors::Dispose();
|
||||
}
|
||||
|
||||
int cursors_getcurrentcursor()
|
||||
sint32 cursors_getcurrentcursor()
|
||||
{
|
||||
return Cursors::GetCurrentCursor();
|
||||
}
|
||||
|
||||
void cursors_setcurrentcursor(int cursorId)
|
||||
void cursors_setcurrentcursor(sint32 cursorId)
|
||||
{
|
||||
Cursors::SetCurrentCursor((CURSOR_ID)cursorId);
|
||||
}
|
||||
|
|
|
@ -83,8 +83,8 @@ extern "C"
|
|||
|
||||
void cursors_initialise();
|
||||
void cursors_dispose();
|
||||
int cursors_getcurrentcursor();
|
||||
void cursors_setcurrentcursor(int cursorId);
|
||||
sint32 cursors_getcurrentcursor();
|
||||
void cursors_setcurrentcursor(sint32 cursorId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -537,7 +537,7 @@ namespace ThemeManager
|
|||
GetThemePath(themesPattern, sizeof(themesPattern));
|
||||
Path::Append(themesPattern, sizeof(themesPattern), "*.json");
|
||||
|
||||
int handle = platform_enumerate_files_begin(themesPattern);
|
||||
sint32 handle = platform_enumerate_files_begin(themesPattern);
|
||||
if (handle != INVALID_HANDLE)
|
||||
{
|
||||
file_info fileInfo;
|
||||
|
@ -872,7 +872,7 @@ extern "C"
|
|||
windowTheme = &desc->DefaultTheme;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (sint32 i = 0; i < 6; i++) {
|
||||
window->colours[i] = windowTheme->Colours[i];
|
||||
}
|
||||
// Some windows need to be transparent even if the colours aren't.
|
||||
|
|
|
@ -28,17 +28,17 @@ bool gChatOpen = false;
|
|||
char _chatCurrentLine[CHAT_MAX_MESSAGE_LENGTH];
|
||||
char _chatHistory[CHAT_HISTORY_SIZE][CHAT_INPUT_SIZE];
|
||||
uint32 _chatHistoryTime[CHAT_HISTORY_SIZE];
|
||||
unsigned int _chatHistoryIndex = 0;
|
||||
uint32 _chatHistoryIndex = 0;
|
||||
uint32 _chatCaretTicks = 0;
|
||||
int _chatLeft;
|
||||
int _chatTop;
|
||||
int _chatRight;
|
||||
int _chatBottom;
|
||||
int _chatWidth;
|
||||
int _chatHeight;
|
||||
sint32 _chatLeft;
|
||||
sint32 _chatTop;
|
||||
sint32 _chatRight;
|
||||
sint32 _chatBottom;
|
||||
sint32 _chatWidth;
|
||||
sint32 _chatHeight;
|
||||
|
||||
static const char* chat_history_get(unsigned int index);
|
||||
static uint32 chat_history_get_time(unsigned int index);
|
||||
static const char* chat_history_get(uint32 index);
|
||||
static uint32 chat_history_get_time(uint32 index);
|
||||
static void chat_clear_input();
|
||||
|
||||
void chat_open()
|
||||
|
@ -90,7 +90,7 @@ void chat_draw(rct_drawpixelinfo * dpi)
|
|||
char lineBuffer[CHAT_INPUT_SIZE + 10];
|
||||
char* lineCh = lineBuffer;
|
||||
char* inputLine = _chatCurrentLine;
|
||||
int inputLineHeight = 10;
|
||||
sint32 inputLineHeight = 10;
|
||||
uint8 chatBackgroundColor = theme_get_colour(WC_CHAT, 0);
|
||||
|
||||
// Draw chat window
|
||||
|
@ -98,14 +98,14 @@ void chat_draw(rct_drawpixelinfo * dpi)
|
|||
inputLineHeight = chat_string_wrapped_get_height((void*)&inputLine, _chatWidth - 10);
|
||||
_chatTop -= inputLineHeight;
|
||||
|
||||
for (int i = 0; i < CHAT_HISTORY_SIZE; i++) {
|
||||
for (sint32 i = 0; i < CHAT_HISTORY_SIZE; i++) {
|
||||
if (strlen(chat_history_get(i)) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
safe_strcpy(lineBuffer, chat_history_get(i), sizeof(lineBuffer));
|
||||
|
||||
int lineHeight = chat_string_wrapped_get_height((void*)&lineCh, _chatWidth - 10);
|
||||
sint32 lineHeight = chat_string_wrapped_get_height((void*)&lineCh, _chatWidth - 10);
|
||||
_chatTop -= (lineHeight + 5);
|
||||
}
|
||||
|
||||
|
@ -125,12 +125,12 @@ void chat_draw(rct_drawpixelinfo * dpi)
|
|||
gfx_fill_rect_inset(dpi, _chatLeft + 1, _chatBottom - inputLineHeight - 5, _chatRight - 1, _chatBottom + 4, chatBackgroundColor, INSET_RECT_FLAG_BORDER_INSET); //Textbox
|
||||
}
|
||||
|
||||
int x = _chatLeft + 5;
|
||||
int y = _chatBottom - inputLineHeight - 20;
|
||||
int stringHeight = 0;
|
||||
sint32 x = _chatLeft + 5;
|
||||
sint32 y = _chatBottom - inputLineHeight - 20;
|
||||
sint32 stringHeight = 0;
|
||||
|
||||
// Draw chat history
|
||||
for (int i = 0; i < CHAT_HISTORY_SIZE; i++, y -= stringHeight) {
|
||||
for (sint32 i = 0; i < CHAT_HISTORY_SIZE; i++, y -= stringHeight) {
|
||||
if (!gChatOpen && SDL_TICKS_PASSED(SDL_GetTicks(), chat_history_get_time(i) + 10000)) {
|
||||
break;
|
||||
}
|
||||
|
@ -161,8 +161,8 @@ void chat_draw(rct_drawpixelinfo * dpi)
|
|||
if (_chatCaretTicks < 15 && gfx_get_string_width(lineBuffer) < (_chatWidth - 10)) {
|
||||
memcpy(lineBuffer, _chatCurrentLine, gTextInput.selection_offset);
|
||||
lineBuffer[gTextInput.selection_offset] = 0;
|
||||
int caretX = x + gfx_get_string_width(lineBuffer);
|
||||
int caretY = y + 14;
|
||||
sint32 caretX = x + gfx_get_string_width(lineBuffer);
|
||||
sint32 caretY = y + 14;
|
||||
|
||||
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, 0x38);
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ void chat_draw(rct_drawpixelinfo * dpi)
|
|||
|
||||
void chat_history_add(const char *src)
|
||||
{
|
||||
int index = _chatHistoryIndex % CHAT_HISTORY_SIZE;
|
||||
sint32 index = _chatHistoryIndex % CHAT_HISTORY_SIZE;
|
||||
memset(_chatHistory[index], 0, CHAT_INPUT_SIZE);
|
||||
memcpy(_chatHistory[index], src, min(strlen(src), CHAT_INPUT_SIZE - 1));
|
||||
_chatHistoryTime[index] = SDL_GetTicks();
|
||||
|
@ -180,7 +180,7 @@ void chat_history_add(const char *src)
|
|||
network_append_chat_log(src);
|
||||
}
|
||||
|
||||
void chat_input(int c)
|
||||
void chat_input(sint32 c)
|
||||
{
|
||||
switch (c) {
|
||||
case SDL_SCANCODE_RETURN:
|
||||
|
@ -196,12 +196,12 @@ void chat_input(int c)
|
|||
}
|
||||
}
|
||||
|
||||
static const char* chat_history_get(unsigned int index)
|
||||
static const char* chat_history_get(uint32 index)
|
||||
{
|
||||
return _chatHistory[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
||||
}
|
||||
|
||||
static uint32 chat_history_get_time(unsigned int index)
|
||||
static uint32 chat_history_get_time(uint32 index)
|
||||
{
|
||||
return _chatHistoryTime[(_chatHistoryIndex + CHAT_HISTORY_SIZE - index - 1) % CHAT_HISTORY_SIZE];
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ static void chat_clear_input()
|
|||
|
||||
// This method is the same as gfx_draw_string_left_wrapped.
|
||||
// But this adjusts the initial Y coordinate depending of the number of lines.
|
||||
int chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, int x, int y, int width)
|
||||
sint32 chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width)
|
||||
{
|
||||
int fontSpriteBase, lineHeight, lineY, numLines;
|
||||
sint32 fontSpriteBase, lineHeight, lineY, numLines;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
|
@ -229,13 +229,13 @@ int chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, int x, int y, i
|
|||
|
||||
gCurrentFontFlags = 0;
|
||||
|
||||
int expectedY = y - (numLines * lineHeight);
|
||||
sint32 expectedY = y - (numLines * lineHeight);
|
||||
if (expectedY < 50) {
|
||||
return (numLines * lineHeight); //Skip drawing, return total height.
|
||||
}
|
||||
|
||||
lineY = y;
|
||||
for (int line = 0; line <= numLines; ++line) {
|
||||
for (sint32 line = 0; line <= numLines; ++line) {
|
||||
gfx_draw_string(dpi, buffer, TEXT_COLOUR_254, x, lineY - (numLines * lineHeight));
|
||||
buffer = get_string_end(buffer) + 1;
|
||||
lineY += lineHeight;
|
||||
|
@ -245,9 +245,9 @@ int chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, int x, int y, i
|
|||
|
||||
// Wrap string without drawing, useful to get the height of a wrapped string.
|
||||
// Almost the same as gfx_draw_string_left_wrapped
|
||||
int chat_string_wrapped_get_height(void *args, int width)
|
||||
sint32 chat_string_wrapped_get_height(void *args, sint32 width)
|
||||
{
|
||||
int fontSpriteBase, lineHeight, lineY, numLines;
|
||||
sint32 fontSpriteBase, lineHeight, lineY, numLines;
|
||||
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
|
@ -261,7 +261,7 @@ int chat_string_wrapped_get_height(void *args, int width)
|
|||
gCurrentFontFlags = 0;
|
||||
|
||||
lineY = 0;
|
||||
for (int line = 0; line <= numLines; ++line) {
|
||||
for (sint32 line = 0; line <= numLines; ++line) {
|
||||
buffer = get_string_end(buffer) + 1;
|
||||
lineY += lineHeight;
|
||||
}
|
||||
|
|
|
@ -36,9 +36,9 @@ void chat_update();
|
|||
void chat_draw(rct_drawpixelinfo * dpi);
|
||||
|
||||
void chat_history_add(const char *src);
|
||||
void chat_input(int c);
|
||||
void chat_input(sint32 c);
|
||||
|
||||
int chat_string_wrapped_get_height(void *args, int width);
|
||||
int chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, int x, int y, int width);
|
||||
sint32 chat_string_wrapped_get_height(void *args, sint32 width);
|
||||
sint32 chat_history_draw_string(rct_drawpixelinfo *dpi, void *args, sint32 x, sint32 y, sint32 width);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,7 +39,7 @@ enum
|
|||
void colours_init_maps()
|
||||
{
|
||||
// Get colour maps from g1
|
||||
for (int i = 0; i < 32; i++) {
|
||||
for (sint32 i = 0; i < 32; i++) {
|
||||
rct_g1_element *g1Element = &g1Elements[SPR_PALETTE_2_START + i];
|
||||
|
||||
ColourMapA[i].colour_0 = g1Element->offset[INDEX_COLOUR_0];
|
||||
|
|
|
@ -51,20 +51,20 @@
|
|||
bool gConsoleOpen = false;
|
||||
|
||||
static bool _consoleInitialised = false;
|
||||
static int _consoleLeft, _consoleTop, _consoleRight, _consoleBottom;
|
||||
static int _lastMainViewportX, _lastMainViewportY;
|
||||
static sint32 _consoleLeft, _consoleTop, _consoleRight, _consoleBottom;
|
||||
static sint32 _lastMainViewportX, _lastMainViewportY;
|
||||
static utf8 _consoleBuffer[CONSOLE_BUFFER_SIZE] = { 0 };
|
||||
static utf8 *_consoleBufferPointer = _consoleBuffer;
|
||||
static utf8 *_consoleViewBufferStart = _consoleBuffer;
|
||||
static utf8 _consoleCurrentLine[CONSOLE_INPUT_SIZE];
|
||||
static int _consoleCaretTicks;
|
||||
static sint32 _consoleCaretTicks;
|
||||
static utf8 _consolePrintfBuffer[CONSOLE_BUFFER_2_SIZE];
|
||||
static utf8 _consoleErrorBuffer[CONSOLE_BUFFER_2_SIZE];
|
||||
static int _consoleScrollPos = 0;
|
||||
static sint32 _consoleScrollPos = 0;
|
||||
|
||||
static utf8 _consoleHistory[CONSOLE_HISTORY_SIZE][CONSOLE_INPUT_SIZE];
|
||||
static int _consoleHistoryIndex = 0;
|
||||
static int _consoleHistoryCount = 0;
|
||||
static sint32 _consoleHistoryIndex = 0;
|
||||
static sint32 _consoleHistoryCount = 0;
|
||||
|
||||
static void console_invalidate();
|
||||
static void console_write_prompt();
|
||||
|
@ -72,12 +72,12 @@ static void console_update_scroll();
|
|||
static void console_clear_input();
|
||||
static void console_history_add(const utf8 *src);
|
||||
static void console_write_all_commands();
|
||||
static int console_parse_int(const utf8 *src, bool *valid);
|
||||
static sint32 console_parse_int(const utf8 *src, bool *valid);
|
||||
static double console_parse_double(const utf8 *src, bool *valid);
|
||||
|
||||
static int cc_variables(const utf8 **argv, int argc);
|
||||
static int cc_windows(const utf8 **argv, int argc);
|
||||
static int cc_help(const utf8 **argv, int argc);
|
||||
static sint32 cc_variables(const utf8 **argv, sint32 argc);
|
||||
static sint32 cc_windows(const utf8 **argv, sint32 argc);
|
||||
static sint32 cc_help(const utf8 **argv, sint32 argc);
|
||||
|
||||
static bool invalidArguments(bool *invalid, bool arguments);
|
||||
|
||||
|
@ -157,10 +157,10 @@ void console_draw(rct_drawpixelinfo *dpi)
|
|||
// Set font
|
||||
gCurrentFontSpriteBase = (gConfigInterface.console_small_font ? FONT_SPRITE_BASE_SMALL : FONT_SPRITE_BASE_MEDIUM);
|
||||
gCurrentFontFlags = 0;
|
||||
int lineHeight = font_get_line_height(gCurrentFontSpriteBase);
|
||||
sint32 lineHeight = font_get_line_height(gCurrentFontSpriteBase);
|
||||
|
||||
int lines = 0;
|
||||
int maxLines = ((_consoleBottom - 22 - _consoleTop) / lineHeight) - 1;
|
||||
sint32 lines = 0;
|
||||
sint32 maxLines = ((_consoleBottom - 22 - _consoleTop) / lineHeight) - 1;
|
||||
utf8 *ch = strchr(_consoleBuffer, 0);
|
||||
while (ch > _consoleBuffer) {
|
||||
ch--;
|
||||
|
@ -172,14 +172,14 @@ void console_draw(rct_drawpixelinfo *dpi)
|
|||
console_invalidate();
|
||||
gfx_filter_rect(dpi, _consoleLeft, _consoleTop, _consoleRight, _consoleBottom, PALETTE_TRANSLUCENT_LIGHT_BLUE_HIGHLIGHT);
|
||||
|
||||
int x = _consoleLeft + 4;
|
||||
int y = _consoleTop + 4;
|
||||
sint32 x = _consoleLeft + 4;
|
||||
sint32 y = _consoleTop + 4;
|
||||
|
||||
// Draw previous lines
|
||||
utf8 lineBuffer[2 + 256], *lineCh;
|
||||
ch = _consoleViewBufferStart;
|
||||
int currentLine = 0;
|
||||
int drawLines = 0;
|
||||
sint32 currentLine = 0;
|
||||
sint32 drawLines = 0;
|
||||
while (*ch != 0) {
|
||||
// Find line break or null terminator
|
||||
utf8 *nextLine = ch;
|
||||
|
@ -235,8 +235,8 @@ void console_draw(rct_drawpixelinfo *dpi)
|
|||
if (_consoleCaretTicks < 15) {
|
||||
memcpy(lineBuffer, _consoleCurrentLine, gTextInput.selection_offset);
|
||||
lineBuffer[gTextInput.selection_offset] = 0;
|
||||
int caretX = x + gfx_get_string_width(lineBuffer);
|
||||
int caretY = y + lineHeight;
|
||||
sint32 caretX = x + gfx_get_string_width(lineBuffer);
|
||||
sint32 caretY = y + lineHeight;
|
||||
|
||||
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, FORMAT_WHITE);
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ void console_draw(rct_drawpixelinfo *dpi)
|
|||
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, 12);
|
||||
}
|
||||
|
||||
void console_input(int c)
|
||||
void console_input(sint32 c)
|
||||
{
|
||||
switch (c) {
|
||||
case SDL_SCANCODE_ESCAPE:
|
||||
|
@ -339,9 +339,9 @@ void console_printf(const utf8 *format, ...)
|
|||
console_writeline(_consolePrintfBuffer);
|
||||
}
|
||||
|
||||
int console_parse_int(const utf8 *src, bool *valid) {
|
||||
sint32 console_parse_int(const utf8 *src, bool *valid) {
|
||||
utf8 *end;
|
||||
int value;
|
||||
sint32 value;
|
||||
value = strtol(src, &end, 10); *valid = (*end == '\0');
|
||||
return value;
|
||||
}
|
||||
|
@ -355,8 +355,8 @@ double console_parse_double(const utf8 *src, bool *valid) {
|
|||
|
||||
static void console_update_scroll()
|
||||
{
|
||||
/*int lines = 0;
|
||||
int maxLines = ((_consoleBottom - 22 - _consoleTop) / 10) - 1;
|
||||
/*sint32 lines = 0;
|
||||
sint32 maxLines = ((_consoleBottom - 22 - _consoleTop) / 10) - 1;
|
||||
char *ch = strchr(_consoleBuffer, 0);
|
||||
while (ch > _consoleBuffer && lines < maxLines) {
|
||||
ch--;
|
||||
|
@ -369,11 +369,11 @@ static void console_update_scroll()
|
|||
_consoleViewBufferStart = ch;*/
|
||||
}
|
||||
|
||||
void console_scroll(int delta)
|
||||
void console_scroll(sint32 delta)
|
||||
{
|
||||
int speed = 3;
|
||||
int lines = 0;
|
||||
int maxLines = ((_consoleBottom - 22 - _consoleTop) / 10) - 1;
|
||||
sint32 speed = 3;
|
||||
sint32 lines = 0;
|
||||
sint32 maxLines = ((_consoleBottom - 22 - _consoleTop) / 10) - 1;
|
||||
utf8 *ch = strchr(_consoleBuffer, 0);
|
||||
while (ch > _consoleBuffer) {
|
||||
ch--;
|
||||
|
@ -417,7 +417,7 @@ static void console_clear_input()
|
|||
static void console_history_add(const utf8 *src)
|
||||
{
|
||||
if (_consoleHistoryCount >= CONSOLE_HISTORY_SIZE) {
|
||||
for (int i = 0; i < _consoleHistoryCount - 1; i++)
|
||||
for (sint32 i = 0; i < _consoleHistoryCount - 1; i++)
|
||||
memcpy(_consoleHistory[i], _consoleHistory[i + 1], CONSOLE_INPUT_SIZE);
|
||||
_consoleHistoryCount--;
|
||||
}
|
||||
|
@ -425,31 +425,31 @@ static void console_history_add(const utf8 *src)
|
|||
_consoleHistoryIndex = _consoleHistoryCount;
|
||||
}
|
||||
|
||||
static int cc_clear(const utf8 **argv, int argc)
|
||||
static sint32 cc_clear(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
console_clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_hide(const utf8 **argv, int argc)
|
||||
static sint32 cc_hide(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
console_close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_echo(const utf8 **argv, int argc)
|
||||
static sint32 cc_echo(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
if (argc > 0)
|
||||
console_writeline(argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_rides(const utf8 **argv, int argc)
|
||||
static sint32 cc_rides(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
if (argc > 0) {
|
||||
if (strcmp(argv[0], "list") == 0) {
|
||||
rct_ride *ride;
|
||||
int i;
|
||||
sint32 i;
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
char name[128];
|
||||
format_string(name, 128, ride->name, &ride->name_arguments);
|
||||
|
@ -463,23 +463,23 @@ static int cc_rides(const utf8 **argv, int argc)
|
|||
}
|
||||
if (strcmp(argv[1], "type") == 0) {
|
||||
bool int_valid[3] = { 0 };
|
||||
int ride_index = console_parse_int(argv[2], &int_valid[0]);
|
||||
int type = console_parse_int(argv[3], &int_valid[1]);
|
||||
sint32 ride_index = console_parse_int(argv[2], &int_valid[0]);
|
||||
sint32 type = console_parse_int(argv[3], &int_valid[1]);
|
||||
if (!int_valid[0] || !int_valid[1]) {
|
||||
console_printf("This command expects integer arguments");
|
||||
} else if (ride_index < 0) {
|
||||
console_printf("Ride index must not be negative");
|
||||
} else {
|
||||
gGameCommandErrorTitle = STR_CANT_CHANGE_OPERATING_MODE;
|
||||
int res = game_do_command(0, (type << 8) | 1, 0, (RIDE_SETTING_RIDE_TYPE << 8) | ride_index, GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
sint32 res = game_do_command(0, (type << 8) | 1, 0, (RIDE_SETTING_RIDE_TYPE << 8) | ride_index, GAME_COMMAND_SET_RIDE_SETTING, 0, 0);
|
||||
if (res == MONEY32_UNDEFINED) {
|
||||
console_printf("That didn't work");
|
||||
}
|
||||
}
|
||||
} else if (strcmp(argv[1], "friction") == 0) {
|
||||
bool int_valid[2] = { 0 };
|
||||
int ride_index = console_parse_int(argv[2], &int_valid[0]);
|
||||
int friction = console_parse_int(argv[3], &int_valid[1]);
|
||||
sint32 ride_index = console_parse_int(argv[2], &int_valid[0]);
|
||||
sint32 friction = console_parse_int(argv[3], &int_valid[1]);
|
||||
|
||||
if (ride_index < 0) {
|
||||
console_printf("Ride index must not be negative");
|
||||
|
@ -492,7 +492,7 @@ static int cc_rides(const utf8 **argv, int argc)
|
|||
} else if (ride->type == RIDE_TYPE_NULL) {
|
||||
console_printf("No ride found with index %d",ride_index);
|
||||
} else {
|
||||
for (int i = 0; i < ride->num_vehicles; i++) {
|
||||
for (sint32 i = 0; i < ride->num_vehicles; i++) {
|
||||
uint16 vehicle_index = ride->vehicles[i];
|
||||
while (vehicle_index != SPRITE_INDEX_NULL) {
|
||||
rct_vehicle *vehicle=GET_VEHICLE(vehicle_index);
|
||||
|
@ -510,12 +510,12 @@ static int cc_rides(const utf8 **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_staff(const utf8 **argv, int argc)
|
||||
static sint32 cc_staff(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
if (argc > 0) {
|
||||
if (strcmp(argv[0], "list") == 0) {
|
||||
rct_peep *peep;
|
||||
int i;
|
||||
sint32 i;
|
||||
FOR_ALL_STAFF(i, peep) {
|
||||
char name[128];
|
||||
format_string(name, 128, peep->name_string_idx, &peep->id);
|
||||
|
@ -525,7 +525,7 @@ static int cc_staff(const utf8 **argv, int argc)
|
|||
if (argc < 4) {
|
||||
console_printf("staff set energy <staff id> <value 0-255>");
|
||||
console_printf("staff set costume <staff id> <costume id>");
|
||||
for (int i = 0; i < ENTERTAINER_COSTUME_COUNT; i++) {
|
||||
for (sint32 i = 0; i < ENTERTAINER_COSTUME_COUNT; i++) {
|
||||
char costume_name[128] = { 0 };
|
||||
rct_string_id costume = STR_STAFF_OPTION_COSTUME_PANDA + i;
|
||||
format_string(costume_name, 128, STR_DROPDOWN_MENU_LABEL, &costume);
|
||||
|
@ -536,7 +536,7 @@ static int cc_staff(const utf8 **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
if (strcmp(argv[1], "energy") == 0) {
|
||||
int int_val[3];
|
||||
sint32 int_val[3];
|
||||
bool int_valid[3] = { 0 };
|
||||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
||||
|
@ -548,7 +548,7 @@ static int cc_staff(const utf8 **argv, int argc)
|
|||
peep->energy_growth_rate = int_val[1];
|
||||
}
|
||||
} else if (strcmp(argv[1], "costume") == 0) {
|
||||
int int_val[2];
|
||||
sint32 int_val[2];
|
||||
bool int_valid[2] = { 0 };
|
||||
int_val[0] = console_parse_int(argv[2], &int_valid[0]);
|
||||
int_val[1] = console_parse_int(argv[3], &int_valid[1]);
|
||||
|
@ -568,7 +568,7 @@ static int cc_staff(const utf8 **argv, int argc)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int costume = int_val[1] | 0x80;
|
||||
sint32 costume = int_val[1] | 0x80;
|
||||
game_do_command(peep->x, (costume << 8) | 1, peep->y, int_val[0], GAME_COMMAND_SET_STAFF_ORDER, 0, 0);
|
||||
}
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ static int cc_staff(const utf8 **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_get(const utf8 **argv, int argc)
|
||||
static sint32 cc_get(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
if (argc > 0) {
|
||||
if (strcmp(argv[0], "park_rating") == 0) {
|
||||
|
@ -601,7 +601,7 @@ static int cc_get(const utf8 **argv, int argc)
|
|||
}
|
||||
else if (strcmp(argv[0], "guest_initial_happiness") == 0) {
|
||||
uint32 current_happiness = gGuestInitialHappiness;
|
||||
for (int i = 15; i <= 99; i++) {
|
||||
for (sint32 i = 15; i <= 99; i++) {
|
||||
if (i == 99) {
|
||||
console_printf("guest_initial_happiness %d%% (%d)", 15, gGuestInitialHappiness);
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ static int cc_get(const utf8 **argv, int argc)
|
|||
else if (strcmp(argv[0], "location") == 0) {
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
int interactionType;
|
||||
sint32 interactionType;
|
||||
rct_map_element *mapElement;
|
||||
rct_xy16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(w->viewport->view_width / 2, w->viewport->view_height / 2, VIEWPORT_INTERACTION_MASK_TERRAIN, &mapCoord.x, &mapCoord.y, &interactionType, &mapElement, NULL);
|
||||
|
@ -715,11 +715,11 @@ static int cc_get(const utf8 **argv, int argc)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
static int cc_set(const utf8 **argv, int argc)
|
||||
static sint32 cc_set(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
if (argc > 1) {
|
||||
int int_val[4];
|
||||
sint32 int_val[4];
|
||||
bool int_valid[4];
|
||||
double double_val[4];
|
||||
bool double_valid[4];
|
||||
|
@ -737,7 +737,7 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
}
|
||||
|
||||
if (strcmp(argv[0], "money") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
money32 money = MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100);
|
||||
money32 money = MONEY((sint32)double_val[0], ((sint32)(double_val[0] * 100)) % 100);
|
||||
bool run_get_money = true;
|
||||
if (gCashEncrypted != ENCRYPT_MONEY(money)) {
|
||||
if (game_do_command(0, GAME_COMMAND_FLAG_APPLY, CHEAT_SETMONEY, money, GAME_COMMAND_CHEAT, 0, 0) != MONEY32_UNDEFINED) {
|
||||
|
@ -769,7 +769,7 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
console_execute_silent("get max_loan");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_cash") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
gGuestInitialCash = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
|
||||
gGuestInitialCash = clamp(MONEY((sint32)double_val[0], ((sint32)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(1000, 0));
|
||||
console_execute_silent("get guest_initial_cash");
|
||||
}
|
||||
else if (strcmp(argv[0], "guest_initial_happiness") == 0 && invalidArguments(&invalidArgs, int_valid[0])) {
|
||||
|
@ -829,11 +829,11 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
console_execute_silent("get park_open");
|
||||
}
|
||||
else if (strcmp(argv[0], "land_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
gLandPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
gLandPrice = clamp(MONEY((sint32)double_val[0], ((sint32)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
console_execute_silent("get land_rights_cost");
|
||||
}
|
||||
else if (strcmp(argv[0], "construction_rights_cost") == 0 && invalidArguments(&invalidArgs, double_valid[0])) {
|
||||
gConstructionRightsPrice = clamp(MONEY((int)double_val[0], ((int)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
gConstructionRightsPrice = clamp(MONEY((sint32)double_val[0], ((sint32)(double_val[0] * 100)) % 100), MONEY(0, 0), MONEY(200, 0));
|
||||
console_execute_silent("get construction_rights_cost");
|
||||
}
|
||||
else if (strcmp(argv[0], "climate") == 0) {
|
||||
|
@ -876,9 +876,9 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
else if (strcmp(argv[0], "location") == 0 && invalidArguments(&invalidArgs, int_valid[0] && int_valid[1])) {
|
||||
rct_window *w = window_get_main();
|
||||
if (w != NULL) {
|
||||
int x = (sint16)(int_val[0] * 32 + 16);
|
||||
int y = (sint16)(int_val[1] * 32 + 16);
|
||||
int z = map_element_height(x, y);
|
||||
sint32 x = (sint16)(int_val[0] * 32 + 16);
|
||||
sint32 y = (sint16)(int_val[1] * 32 + 16);
|
||||
sint32 z = map_element_height(x, y);
|
||||
window_scroll_to_location(w, x, y, z);
|
||||
w->flags &= ~WF_SCROLLING_TO_LOCATION;
|
||||
viewport_update_position(w);
|
||||
|
@ -960,7 +960,7 @@ static int cc_set(const utf8 **argv, int argc)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
static int cc_twitch(const utf8 **argv, int argc)
|
||||
static sint32 cc_twitch(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
#ifdef DISABLE_TWITCH
|
||||
console_writeline_error("OpenRCT2 build not compiled with Twitch integeration.");
|
||||
|
@ -970,11 +970,11 @@ static int cc_twitch(const utf8 **argv, int argc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_load_object(const utf8 **argv, int argc) {
|
||||
static sint32 cc_load_object(const utf8 **argv, sint32 argc) {
|
||||
if (argc > 0) {
|
||||
char name[9] = { 0 };
|
||||
memset(name, ' ', 8);
|
||||
int i = 0;
|
||||
sint32 i = 0;
|
||||
for (const char * ch = argv[0]; *ch != '\0' && i < 8; ch++) {
|
||||
name[i++] = *ch;
|
||||
}
|
||||
|
@ -997,17 +997,17 @@ static int cc_load_object(const utf8 **argv, int argc) {
|
|||
console_writeline_error("Unable to load object.");
|
||||
return 1;
|
||||
}
|
||||
int groupIndex = object_manager_get_loaded_object_entry_index(loadedObject);
|
||||
sint32 groupIndex = object_manager_get_loaded_object_entry_index(loadedObject);
|
||||
|
||||
uint8 objectType = entry->flags & 0x0F;
|
||||
if (objectType == OBJECT_TYPE_RIDE) {
|
||||
// Automatically research the ride so it's supported by the game.
|
||||
rct_ride_entry *rideEntry;
|
||||
int rideType;
|
||||
sint32 rideType;
|
||||
|
||||
rideEntry = get_ride_entry(groupIndex);
|
||||
|
||||
for (int j = 0; j < 3; j++) {
|
||||
for (sint32 j = 0; j < 3; j++) {
|
||||
rideType = rideEntry->ride_type[j];
|
||||
if (rideType != 255)
|
||||
research_insert(true, 0x10000 | (rideType << 8) | groupIndex, rideEntry->category[0]);
|
||||
|
@ -1035,11 +1035,11 @@ static int cc_load_object(const utf8 **argv, int argc) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_object_count(const utf8 **argv, int argc) {
|
||||
static sint32 cc_object_count(const utf8 **argv, sint32 argc) {
|
||||
const utf8* object_type_names[] = { "Rides", "Small scenery", "Large scenery", "Walls", "Banners", "Paths", "Path Additions", "Scenery groups", "Park entrances", "Water" };
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (sint32 i = 0; i < 10; i++) {
|
||||
|
||||
int entryGroupIndex = 0;
|
||||
sint32 entryGroupIndex = 0;
|
||||
for (; entryGroupIndex < object_entry_group_counts[i]; entryGroupIndex++){
|
||||
if (object_entry_groups[i].chunks[entryGroupIndex] == (uint8*)-1){
|
||||
break;
|
||||
|
@ -1051,19 +1051,19 @@ static int cc_object_count(const utf8 **argv, int argc) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int cc_reset_user_strings(const utf8 **argv, int argc)
|
||||
static sint32 cc_reset_user_strings(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
reset_user_strings();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_fix_banner_count(const utf8 **argv, int argc)
|
||||
static sint32 cc_fix_banner_count(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
fix_banner_count();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_open(const utf8 **argv, int argc) {
|
||||
static sint32 cc_open(const utf8 **argv, sint32 argc) {
|
||||
if (argc > 0) {
|
||||
bool title = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) != 0;
|
||||
bool invalidTitle = false;
|
||||
|
@ -1091,7 +1091,7 @@ static int cc_open(const utf8 **argv, int argc) {
|
|||
}
|
||||
|
||||
|
||||
typedef int (*console_command_func)(const utf8 **argv, int argc);
|
||||
typedef sint32 (*console_command_func)(const utf8 **argv, sint32 argc);
|
||||
typedef struct console_command {
|
||||
utf8 *command;
|
||||
console_command_func func;
|
||||
|
@ -1167,22 +1167,22 @@ console_command console_command_table[] = {
|
|||
{ "staff", cc_staff, "Staff management.", "staff <subcommand>"},
|
||||
};
|
||||
|
||||
static int cc_windows(const utf8 **argv, int argc) {
|
||||
for (int i = 0; i < countof(console_window_table); i++)
|
||||
static sint32 cc_windows(const utf8 **argv, sint32 argc) {
|
||||
for (sint32 i = 0; i < countof(console_window_table); i++)
|
||||
console_writeline(console_window_table[i]);
|
||||
return 0;
|
||||
}
|
||||
static int cc_variables(const utf8 **argv, int argc)
|
||||
static sint32 cc_variables(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
for (int i = 0; i < countof(console_variable_table); i++)
|
||||
for (sint32 i = 0; i < countof(console_variable_table); i++)
|
||||
console_writeline(console_variable_table[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_help(const utf8 **argv, int argc)
|
||||
static sint32 cc_help(const utf8 **argv, sint32 argc)
|
||||
{
|
||||
if (argc > 0) {
|
||||
for (int i = 0; i < countof(console_command_table); i++) {
|
||||
for (sint32 i = 0; i < countof(console_command_table); i++) {
|
||||
if (strcmp(console_command_table[i].command, argv[0]) == 0) {
|
||||
console_writeline(console_command_table[i].help);
|
||||
console_printf("\nUsage: %s", console_command_table[i].usage);
|
||||
|
@ -1197,7 +1197,7 @@ static int cc_help(const utf8 **argv, int argc)
|
|||
|
||||
static void console_write_all_commands()
|
||||
{
|
||||
for (int i = 0; i < countof(console_command_table); i++)
|
||||
for (sint32 i = 0; i < countof(console_command_table); i++)
|
||||
console_writeline(console_command_table[i].command);
|
||||
}
|
||||
|
||||
|
@ -1210,8 +1210,8 @@ void console_execute(const utf8 *src)
|
|||
|
||||
void console_execute_silent(const utf8 *src)
|
||||
{
|
||||
int argc = 0;
|
||||
int argvCapacity = 8;
|
||||
sint32 argc = 0;
|
||||
sint32 argvCapacity = 8;
|
||||
utf8 **argv = malloc(argvCapacity * sizeof(utf8*));
|
||||
const utf8 *start = src;
|
||||
const utf8 *end;
|
||||
|
@ -1264,7 +1264,7 @@ void console_execute_silent(const utf8 *src)
|
|||
}
|
||||
|
||||
bool validCommand = false;
|
||||
for (int i = 0; i < countof(console_command_table); i++) {
|
||||
for (sint32 i = 0; i < countof(console_command_table); i++) {
|
||||
if (strcmp(argv[0], console_command_table[i].command) == 0) {
|
||||
console_command_table[i].func((const utf8 **)(argv + 1), argc - 1);
|
||||
validCommand = true;
|
||||
|
@ -1272,7 +1272,7 @@ void console_execute_silent(const utf8 *src)
|
|||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < argc; i++)
|
||||
for (sint32 i = 0; i < argc; i++)
|
||||
free(argv[i]);
|
||||
free(argv);
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ void console_toggle();
|
|||
void console_update();
|
||||
void console_draw(rct_drawpixelinfo *dpi);
|
||||
|
||||
void console_input(int c);
|
||||
void console_input(sint32 c);
|
||||
void console_write(const utf8 *src);
|
||||
void console_writeline(const utf8 *src);
|
||||
void console_writeline_error(const utf8 *src);
|
||||
|
@ -40,6 +40,6 @@ void console_execute_silent(const utf8 *src);
|
|||
void console_clear();
|
||||
void console_clear_line();
|
||||
void console_refresh_caret();
|
||||
void console_scroll(int delta);
|
||||
void console_scroll(sint32 delta);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include "../localisation/localisation.h"
|
||||
#include "graph.h"
|
||||
|
||||
static void graph_draw_months_uint8(rct_drawpixelinfo *dpi, uint8 *history, int count, int baseX, int baseY)
|
||||
static void graph_draw_months_uint8(rct_drawpixelinfo *dpi, uint8 *history, sint32 count, sint32 baseX, sint32 baseY)
|
||||
{
|
||||
int i, x, y, yearOver32, currentMonth, currentDay;
|
||||
sint32 i, x, y, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
|
@ -42,9 +42,9 @@ static void graph_draw_months_uint8(rct_drawpixelinfo *dpi, uint8 *history, int
|
|||
}
|
||||
}
|
||||
|
||||
static void graph_draw_line_a_uint8(rct_drawpixelinfo *dpi, uint8 *history, int count, int baseX, int baseY)
|
||||
static void graph_draw_line_a_uint8(rct_drawpixelinfo *dpi, uint8 *history, sint32 count, sint32 baseX, sint32 baseY)
|
||||
{
|
||||
int i, x, y, lastX, lastY;
|
||||
sint32 i, x, y, lastX, lastY;
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
|
@ -66,9 +66,9 @@ static void graph_draw_line_a_uint8(rct_drawpixelinfo *dpi, uint8 *history, int
|
|||
}
|
||||
}
|
||||
|
||||
static void graph_draw_line_b_uint8(rct_drawpixelinfo *dpi, uint8 *history, int count, int baseX, int baseY)
|
||||
static void graph_draw_line_b_uint8(rct_drawpixelinfo *dpi, uint8 *history, sint32 count, sint32 baseX, sint32 baseY)
|
||||
{
|
||||
int i, x, y, lastX, lastY;
|
||||
sint32 i, x, y, lastX, lastY;
|
||||
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
|
@ -89,16 +89,16 @@ static void graph_draw_line_b_uint8(rct_drawpixelinfo *dpi, uint8 *history, int
|
|||
}
|
||||
}
|
||||
|
||||
void graph_draw_uint8(rct_drawpixelinfo *dpi, uint8 *history, int count, int baseX, int baseY)
|
||||
void graph_draw_uint8(rct_drawpixelinfo *dpi, uint8 *history, sint32 count, sint32 baseX, sint32 baseY)
|
||||
{
|
||||
graph_draw_months_uint8(dpi, history, count, baseX, baseY);
|
||||
graph_draw_line_a_uint8(dpi, history, count, baseX, baseY);
|
||||
graph_draw_line_b_uint8(dpi, history, count, baseX, baseY);
|
||||
}
|
||||
|
||||
static void graph_draw_months_money32(rct_drawpixelinfo *dpi, money32 *history, int count, int baseX, int baseY)
|
||||
static void graph_draw_months_money32(rct_drawpixelinfo *dpi, money32 *history, sint32 count, sint32 baseX, sint32 baseY)
|
||||
{
|
||||
int i, x, y, yearOver32, currentMonth, currentDay;
|
||||
sint32 i, x, y, yearOver32, currentMonth, currentDay;
|
||||
|
||||
currentMonth = date_get_month(gDateMonthsElapsed);
|
||||
currentDay = gDateMonthTicks;
|
||||
|
@ -120,9 +120,9 @@ static void graph_draw_months_money32(rct_drawpixelinfo *dpi, money32 *history,
|
|||
}
|
||||
}
|
||||
|
||||
static void graph_draw_line_a_money32(rct_drawpixelinfo *dpi, money32 *history, int count, int baseX, int baseY, int modifier, int offset)
|
||||
static void graph_draw_line_a_money32(rct_drawpixelinfo *dpi, money32 *history, sint32 count, sint32 baseX, sint32 baseY, sint32 modifier, sint32 offset)
|
||||
{
|
||||
int i, x, y, lastX, lastY;
|
||||
sint32 i, x, y, lastX, lastY;
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
x = baseX;
|
||||
|
@ -144,9 +144,9 @@ static void graph_draw_line_a_money32(rct_drawpixelinfo *dpi, money32 *history,
|
|||
}
|
||||
}
|
||||
|
||||
static void graph_draw_line_b_money32(rct_drawpixelinfo *dpi, money32 *history, int count, int baseX, int baseY, int modifier, int offset)
|
||||
static void graph_draw_line_b_money32(rct_drawpixelinfo *dpi, money32 *history, sint32 count, sint32 baseX, sint32 baseY, sint32 modifier, sint32 offset)
|
||||
{
|
||||
int i, x, y, lastX, lastY;
|
||||
sint32 i, x, y, lastX, lastY;
|
||||
|
||||
lastX = -1;
|
||||
lastY = -1;
|
||||
|
@ -167,7 +167,7 @@ static void graph_draw_line_b_money32(rct_drawpixelinfo *dpi, money32 *history,
|
|||
}
|
||||
}
|
||||
|
||||
void graph_draw_money32(rct_drawpixelinfo *dpi, money32 *history, int count, int baseX, int baseY, int modifier, int offset)
|
||||
void graph_draw_money32(rct_drawpixelinfo *dpi, money32 *history, sint32 count, sint32 baseX, sint32 baseY, sint32 modifier, sint32 offset)
|
||||
{
|
||||
graph_draw_months_money32(dpi, history, count, baseX, baseY);
|
||||
graph_draw_line_a_money32(dpi, history, count, baseX, baseY, modifier, offset);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../common.h"
|
||||
#include "../drawing/drawing.h"
|
||||
|
||||
void graph_draw_uint8(rct_drawpixelinfo *dpi, uint8 *history, int count, int baseX, int baseY);
|
||||
void graph_draw_money32(rct_drawpixelinfo *dpi, money32 *history, int count, int baseX, int baseY, int modifier, int offset);
|
||||
void graph_draw_uint8(rct_drawpixelinfo *dpi, uint8 *history, sint32 count, sint32 baseX, sint32 baseY);
|
||||
void graph_draw_money32(rct_drawpixelinfo *dpi, money32 *history, sint32 count, sint32 baseX, sint32 baseY, sint32 modifier, sint32 offset);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,9 +42,9 @@ static const shortcut_action shortcut_table[SHORTCUT_COUNT];
|
|||
*
|
||||
* rct2: 0x006E3E91
|
||||
*/
|
||||
void keyboard_shortcut_set(int key)
|
||||
void keyboard_shortcut_set(sint32 key)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
|
||||
// Unmap shortcut that already uses this key
|
||||
for (i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
|
@ -61,9 +61,9 @@ void keyboard_shortcut_set(int key)
|
|||
config_shortcut_keys_save();
|
||||
}
|
||||
|
||||
static int keyboard_shortcut_get_from_key(int key)
|
||||
static sint32 keyboard_shortcut_get_from_key(sint32 key)
|
||||
{
|
||||
for (int i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
for (sint32 i = 0; i < SHORTCUT_COUNT; i++) {
|
||||
if (key == gShortcutKeys[i]) {
|
||||
return i;
|
||||
}
|
||||
|
@ -75,15 +75,15 @@ static int keyboard_shortcut_get_from_key(int key)
|
|||
*
|
||||
* rct2: 0x006E3E68
|
||||
*/
|
||||
void keyboard_shortcut_handle(int key)
|
||||
void keyboard_shortcut_handle(sint32 key)
|
||||
{
|
||||
int shortcut = keyboard_shortcut_get_from_key(key);
|
||||
sint32 shortcut = keyboard_shortcut_get_from_key(key);
|
||||
if (shortcut != -1) {
|
||||
keyboard_shortcut_handle_command(shortcut);
|
||||
}
|
||||
}
|
||||
|
||||
void keyboard_shortcut_handle_command(int shortcutIndex)
|
||||
void keyboard_shortcut_handle_command(sint32 shortcutIndex)
|
||||
{
|
||||
if (shortcutIndex >= 0 && shortcutIndex < countof(shortcut_table)) {
|
||||
shortcut_action action = shortcut_table[shortcutIndex];
|
||||
|
@ -125,7 +125,7 @@ void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutK
|
|||
|
||||
#pragma region Shortcut Commands
|
||||
|
||||
static void toggle_view_flag(int viewportFlag)
|
||||
static void toggle_view_flag(sint32 viewportFlag)
|
||||
{
|
||||
rct_window *window;
|
||||
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
/** The current shortcut being changed. */
|
||||
extern uint8 gKeyboardShortcutChangeId;
|
||||
|
||||
void keyboard_shortcut_set(int key);
|
||||
void keyboard_shortcut_handle(int key);
|
||||
void keyboard_shortcut_handle_command(int shortcutIndex);
|
||||
void keyboard_shortcut_set(sint32 key);
|
||||
void keyboard_shortcut_handle(sint32 key);
|
||||
void keyboard_shortcut_handle_command(sint32 shortcutIndex);
|
||||
void keyboard_shortcut_format_string(char *buffer, size_t size, uint16 shortcutKey);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,7 @@ uint8 gScreenshotCountdown = 0;
|
|||
*/
|
||||
void screenshot_check()
|
||||
{
|
||||
int screenshotIndex;
|
||||
sint32 screenshotIndex;
|
||||
|
||||
if (gScreenshotCountdown != 0) {
|
||||
gScreenshotCountdown--;
|
||||
|
@ -57,7 +57,7 @@ void screenshot_check()
|
|||
}
|
||||
|
||||
static void screenshot_get_rendered_palette(rct_palette* palette) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
for (sint32 i = 0; i < 256; i++) {
|
||||
const SDL_Color *renderedEntry = &gPalette[i];
|
||||
rct_palette_entry *entry = &palette->entries[i];
|
||||
|
||||
|
@ -68,7 +68,7 @@ static void screenshot_get_rendered_palette(rct_palette* palette) {
|
|||
}
|
||||
}
|
||||
|
||||
static int screenshot_get_next_path(char *path, size_t size)
|
||||
static sint32 screenshot_get_next_path(char *path, size_t size)
|
||||
{
|
||||
char screenshotPath[MAX_PATH];
|
||||
|
||||
|
@ -98,9 +98,9 @@ static int screenshot_get_next_path(char *path, size_t size)
|
|||
// might be possible when switching timezones
|
||||
// in the unlikely case that this does happen,
|
||||
// append (%d) to the filename and increment
|
||||
// this int until it doesn't overwrite any
|
||||
// this sint32 until it doesn't overwrite any
|
||||
// other file in the directory.
|
||||
int i;
|
||||
sint32 i;
|
||||
for (i = 1; i < 1000; i++) {
|
||||
// Glue together path and filename
|
||||
snprintf(path, size, "%s%s %d-%02d-%02d %02d-%02d-%02d (%d).png", screenshotPath, park_name, currentDate.year, currentDate.month, currentDate.day, currentTime.hour, currentTime.minute, currentTime.second, i);
|
||||
|
@ -114,10 +114,10 @@ static int screenshot_get_next_path(char *path, size_t size)
|
|||
return -1;
|
||||
}
|
||||
|
||||
int screenshot_dump_png(rct_drawpixelinfo *dpi)
|
||||
sint32 screenshot_dump_png(rct_drawpixelinfo *dpi)
|
||||
{
|
||||
// Get a free screenshot path
|
||||
int index;
|
||||
sint32 index;
|
||||
char path[MAX_PATH] = "";
|
||||
if ((index = screenshot_get_next_path(path, MAX_PATH)) == -1) {
|
||||
return -1;
|
||||
|
@ -133,10 +133,10 @@ int screenshot_dump_png(rct_drawpixelinfo *dpi)
|
|||
}
|
||||
}
|
||||
|
||||
int screenshot_dump_png_32bpp(sint32 width, sint32 height, const void *pixels)
|
||||
sint32 screenshot_dump_png_32bpp(sint32 width, sint32 height, const void *pixels)
|
||||
{
|
||||
// Get a free screenshot path
|
||||
int index;
|
||||
sint32 index;
|
||||
char path[MAX_PATH] = "";
|
||||
if ((index = screenshot_get_next_path(path, MAX_PATH)) == -1) {
|
||||
return -1;
|
||||
|
@ -151,18 +151,18 @@ int screenshot_dump_png_32bpp(sint32 width, sint32 height, const void *pixels)
|
|||
|
||||
void screenshot_giant()
|
||||
{
|
||||
int originalRotation = get_current_rotation();
|
||||
int originalZoom = 0;
|
||||
sint32 originalRotation = get_current_rotation();
|
||||
sint32 originalZoom = 0;
|
||||
|
||||
rct_window *mainWindow = window_get_main();
|
||||
if (mainWindow != NULL && mainWindow->viewport != NULL)
|
||||
originalZoom = mainWindow->viewport->zoom;
|
||||
|
||||
int rotation = originalRotation;
|
||||
int zoom = originalZoom;
|
||||
int mapSize = gMapSize;
|
||||
int resolutionWidth = (mapSize * 32 * 2) >> zoom;
|
||||
int resolutionHeight = (mapSize * 32 * 1) >> zoom;
|
||||
sint32 rotation = originalRotation;
|
||||
sint32 zoom = originalZoom;
|
||||
sint32 mapSize = gMapSize;
|
||||
sint32 resolutionWidth = (mapSize * 32 * 2) >> zoom;
|
||||
sint32 resolutionHeight = (mapSize * 32 * 1) >> zoom;
|
||||
|
||||
resolutionWidth += 8;
|
||||
resolutionHeight += 128;
|
||||
|
@ -177,11 +177,11 @@ void screenshot_giant()
|
|||
viewport.var_11 = 0;
|
||||
viewport.flags = 0;
|
||||
|
||||
int centreX = (mapSize / 2) * 32 + 16;
|
||||
int centreY = (mapSize / 2) * 32 + 16;
|
||||
sint32 centreX = (mapSize / 2) * 32 + 16;
|
||||
sint32 centreY = (mapSize / 2) * 32 + 16;
|
||||
|
||||
int x = 0, y = 0;
|
||||
int z = map_element_height(centreX, centreY) & 0xFFFF;
|
||||
sint32 x = 0, y = 0;
|
||||
sint32 z = map_element_height(centreX, centreY) & 0xFFFF;
|
||||
switch (rotation) {
|
||||
case 0:
|
||||
x = centreY - centreX;
|
||||
|
@ -222,7 +222,7 @@ void screenshot_giant()
|
|||
|
||||
// Get a free screenshot path
|
||||
char path[MAX_PATH];
|
||||
int index;
|
||||
sint32 index;
|
||||
if ((index = screenshot_get_next_path(path, MAX_PATH)) == -1) {
|
||||
log_error("Giant screenshot failed, unable to find a suitable destination path.");
|
||||
window_error_open(STR_SCREENSHOT_FAILED, STR_NONE);
|
||||
|
@ -242,7 +242,7 @@ void screenshot_giant()
|
|||
window_error_open(STR_SCREENSHOT_SAVED_AS, STR_NONE);
|
||||
}
|
||||
|
||||
int cmdline_for_screenshot(const char **argv, int argc)
|
||||
sint32 cmdline_for_screenshot(const char **argv, sint32 argc)
|
||||
{
|
||||
bool giantScreenshot = argc == 5 && _stricmp(argv[2], "giant") == 0;
|
||||
if (argc != 4 && argc != 8 && !giantScreenshot) {
|
||||
|
@ -254,7 +254,7 @@ int cmdline_for_screenshot(const char **argv, int argc)
|
|||
bool customLocation = false;
|
||||
bool centreMapX = false;
|
||||
bool centreMapY = false;
|
||||
int resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation = 0;
|
||||
sint32 resolutionWidth, resolutionHeight, customX = 0, customY = 0, customZoom, customRotation = 0;
|
||||
|
||||
const char *inputPath = argv[0];
|
||||
const char *outputPath = argv[1];
|
||||
|
@ -295,7 +295,7 @@ int cmdline_for_screenshot(const char **argv, int argc)
|
|||
gIntroState = INTRO_STATE_NONE;
|
||||
gScreenFlags = SCREEN_FLAGS_PLAYING;
|
||||
|
||||
int mapSize = gMapSize;
|
||||
sint32 mapSize = gMapSize;
|
||||
if (resolutionWidth == 0 || resolutionHeight == 0) {
|
||||
resolutionWidth = (mapSize * 32 * 2) >> customZoom;
|
||||
resolutionHeight = (mapSize * 32 * 1) >> customZoom;
|
||||
|
@ -320,8 +320,8 @@ int cmdline_for_screenshot(const char **argv, int argc)
|
|||
if (centreMapY)
|
||||
customY = (mapSize / 2) * 32 + 16;
|
||||
|
||||
int x = 0, y = 0;
|
||||
int z = map_element_height(customX, customY) & 0xFFFF;
|
||||
sint32 x = 0, y = 0;
|
||||
sint32 z = map_element_height(customX, customY) & 0xFFFF;
|
||||
switch (customRotation) {
|
||||
case 0:
|
||||
x = customY - customX;
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
extern uint8 gScreenshotCountdown;
|
||||
|
||||
void screenshot_check();
|
||||
int screenshot_dump();
|
||||
int screenshot_dump_png(rct_drawpixelinfo *dpi);
|
||||
int screenshot_dump_png_32bpp(sint32 width, sint32 height, const void *pixels);
|
||||
sint32 screenshot_dump();
|
||||
sint32 screenshot_dump_png(rct_drawpixelinfo *dpi);
|
||||
sint32 screenshot_dump_png_32bpp(sint32 width, sint32 height, const void *pixels);
|
||||
|
||||
void screenshot_giant();
|
||||
int cmdline_for_screenshot(const char **argv, int argc);
|
||||
sint32 cmdline_for_screenshot(const char **argv, sint32 argc);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -86,7 +86,7 @@ void viewport_init_all()
|
|||
gWindowNextSlot = g_window_list;
|
||||
|
||||
// Setting up viewports
|
||||
for (int i = 0; i < MAX_VIEWPORT_COUNT; i++) {
|
||||
for (sint32 i = 0; i < MAX_VIEWPORT_COUNT; i++) {
|
||||
g_viewport_list[i].width = 0;
|
||||
}
|
||||
|
||||
|
@ -111,8 +111,8 @@ void viewport_init_all()
|
|||
* out_x : ax
|
||||
* out_y : bx
|
||||
*/
|
||||
void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_viewport* viewport){
|
||||
int start_x = x;
|
||||
void center_2d_coordinates(sint32 x, sint32 y, sint32 z, sint32* out_x, sint32* out_y, rct_viewport* viewport){
|
||||
sint32 start_x = x;
|
||||
|
||||
rct_xyz16 coord_3d = {
|
||||
.x = x,
|
||||
|
@ -152,10 +152,10 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view
|
|||
* flags: edx top most 2 bits 0b_X1 for zoom clear see below for 2nd bit.
|
||||
* w: esi
|
||||
*/
|
||||
void viewport_create(rct_window *w, int x, int y, int width, int height, int zoom, int center_x, int center_y, int center_z, char flags, sint16 sprite)
|
||||
void viewport_create(rct_window *w, sint32 x, sint32 y, sint32 width, sint32 height, sint32 zoom, sint32 center_x, sint32 center_y, sint32 center_z, char flags, sint16 sprite)
|
||||
{
|
||||
rct_viewport* viewport = NULL;
|
||||
for (int i = 0; i < MAX_VIEWPORT_COUNT; i++) {
|
||||
for (sint32 i = 0; i < MAX_VIEWPORT_COUNT; i++) {
|
||||
if (g_viewport_list[i].width == 0) {
|
||||
viewport = &g_viewport_list[i];
|
||||
break;
|
||||
|
@ -195,7 +195,7 @@ void viewport_create(rct_window *w, int x, int y, int width, int height, int zoo
|
|||
w->viewport_target_sprite = SPR_NONE;
|
||||
}
|
||||
|
||||
int view_x, view_y;
|
||||
sint32 view_x, view_y;
|
||||
center_2d_coordinates(center_x, center_y, center_z, &view_x, &view_y, viewport);
|
||||
|
||||
w->saved_view_x = view_x;
|
||||
|
@ -229,7 +229,7 @@ void sub_689174(sint16* x, sint16* y, sint16 *z)
|
|||
|
||||
uint32 rotation = get_current_rotation();
|
||||
rct_xy16 pos;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (sint32 i = 0; i < 6; i++) {
|
||||
pos = viewport_coord_to_map_coord(start_x, start_y, height);
|
||||
height = map_element_height((0xFFFF) & pos.x, (0xFFFF) & pos.y);
|
||||
|
||||
|
@ -237,8 +237,8 @@ void sub_689174(sint16* x, sint16* y, sint16 *z)
|
|||
// of the map. This can happen when the height is larger than the map size.
|
||||
sint16 max = gMapSizeMinus2;
|
||||
if (pos.x > max && pos.y > max) {
|
||||
int x_corr[] = { -1, 1, 1, -1 };
|
||||
int y_corr[] = { -1, -1, 1, 1 };
|
||||
sint32 x_corr[] = { -1, 1, 1, -1 };
|
||||
sint32 y_corr[] = { -1, -1, 1, 1 };
|
||||
pos.x += x_corr[rotation] * height;
|
||||
pos.y += y_corr[rotation] * height;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ void sub_689174(sint16* x, sint16* y, sint16 *z)
|
|||
*z = height;
|
||||
}
|
||||
|
||||
static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport *viewport, int x, int y)
|
||||
static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport *viewport, sint32 x, sint32 y)
|
||||
{
|
||||
// sub-divide by intersecting windows
|
||||
if (window < gWindowNextSlot)
|
||||
|
@ -372,7 +372,7 @@ static void sub_6E7FF3(rct_drawpixelinfo *dpi, rct_window *window, rct_viewport
|
|||
static void viewport_shift_pixels(rct_drawpixelinfo *dpi, rct_window* w, rct_viewport* viewport, sint16 x_diff, sint16 y_diff)
|
||||
{
|
||||
rct_window* orignal_w = w;
|
||||
int left = 0, right = 0, top = 0, bottom = 0;
|
||||
sint32 left = 0, right = 0, top = 0, bottom = 0;
|
||||
|
||||
for (; w < gWindowNextSlot; w++){
|
||||
if (!(w->flags & WF_TRANSPARENT)) continue;
|
||||
|
@ -422,10 +422,10 @@ static void viewport_move(sint16 x, sint16 y, rct_window* w, rct_viewport* viewp
|
|||
if ((!x_diff) && (!y_diff))return;
|
||||
|
||||
if (w->flags & WF_7){
|
||||
int left = max(viewport->x, 0);
|
||||
int top = max(viewport->y, 0);
|
||||
int right = min(viewport->x + viewport->width, gScreenWidth);
|
||||
int bottom = min(viewport->y + viewport->height, gScreenHeight);
|
||||
sint32 left = max(viewport->x, 0);
|
||||
sint32 top = max(viewport->y, 0);
|
||||
sint32 right = min(viewport->x + viewport->width, gScreenWidth);
|
||||
sint32 bottom = min(viewport->y + viewport->height, gScreenHeight);
|
||||
|
||||
if (left >= right) return;
|
||||
if (top >= bottom) return;
|
||||
|
@ -447,7 +447,7 @@ static void viewport_move(sint16 x, sint16 y, rct_window* w, rct_viewport* viewp
|
|||
viewport->x = 0;
|
||||
}
|
||||
|
||||
int eax = viewport->x + viewport->width - gScreenWidth;
|
||||
sint32 eax = viewport->x + viewport->width - gScreenWidth;
|
||||
if (eax > 0){
|
||||
viewport->width -= eax;
|
||||
viewport->view_width -= eax * zoom;
|
||||
|
@ -485,19 +485,19 @@ static void viewport_move(sint16 x, sint16 y, rct_window* w, rct_viewport* viewp
|
|||
}
|
||||
|
||||
//rct2: 0x006E7A15
|
||||
static void viewport_set_underground_flag(int underground, rct_window* window, rct_viewport* viewport)
|
||||
static void viewport_set_underground_flag(sint32 underground, rct_window* window, rct_viewport* viewport)
|
||||
{
|
||||
if (window->classification != WC_MAIN_WINDOW)
|
||||
{
|
||||
if (!underground)
|
||||
{
|
||||
int bit = viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
sint32 bit = viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
viewport->flags &= ~VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
if (!bit) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
int bit = viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
sint32 bit = viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
viewport->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
if (bit) return;
|
||||
}
|
||||
|
@ -530,12 +530,12 @@ void viewport_update_position(rct_window *window)
|
|||
viewport_set_underground_flag(0, window, viewport);
|
||||
|
||||
//Clamp to the map minimum value
|
||||
int at_map_edge_x = 0;
|
||||
sint32 at_map_edge_x = 0;
|
||||
if (x < MAP_MINIMUM_X_Y){
|
||||
x = MAP_MINIMUM_X_Y;
|
||||
at_map_edge_x = 1;
|
||||
}
|
||||
int at_map_edge_y = 0;
|
||||
sint32 at_map_edge_y = 0;
|
||||
if (y < MAP_MINIMUM_X_Y){
|
||||
y = MAP_MINIMUM_X_Y;
|
||||
at_map_edge_y = 1;
|
||||
|
@ -554,8 +554,8 @@ void viewport_update_position(rct_window *window)
|
|||
if (at_map_edge_x || at_map_edge_y) {
|
||||
// The &0xFFFF is to prevent the sign extension messing the
|
||||
// function up.
|
||||
int zz = map_element_height(x & 0xFFFF, y & 0xFFFF);
|
||||
int _2d_x, _2d_y;
|
||||
sint32 zz = map_element_height(x & 0xFFFF, y & 0xFFFF);
|
||||
sint32 _2d_x, _2d_y;
|
||||
center_2d_coordinates(x, y, zz, &_2d_x, &_2d_y, viewport);
|
||||
|
||||
if (at_map_edge_x)
|
||||
|
@ -604,12 +604,12 @@ void viewport_update_sprite_follow(rct_window *window)
|
|||
if (window->viewport_target_sprite != -1 && window->viewport){
|
||||
rct_sprite* sprite = get_sprite(window->viewport_target_sprite);
|
||||
|
||||
int height = (map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF) - 16;
|
||||
int underground = sprite->unknown.z < height;
|
||||
sint32 height = (map_element_height(0xFFFF & sprite->unknown.x, 0xFFFF & sprite->unknown.y) & 0xFFFF) - 16;
|
||||
sint32 underground = sprite->unknown.z < height;
|
||||
|
||||
viewport_set_underground_flag(underground, window, window->viewport);
|
||||
|
||||
int center_x, center_y;
|
||||
sint32 center_x, center_y;
|
||||
center_2d_coordinates(sprite->unknown.x, sprite->unknown.y, sprite->unknown.z, ¢er_x, ¢er_y, window->viewport);
|
||||
|
||||
viewport_move(center_x, center_y, window, window->viewport);
|
||||
|
@ -626,7 +626,7 @@ void viewport_update_sprite_follow(rct_window *window)
|
|||
* edi: dpi
|
||||
* ebp: bottom
|
||||
*/
|
||||
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, int top, int right, int bottom)
|
||||
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
{
|
||||
if (right <= viewport->x) return;
|
||||
if (bottom <= viewport->y) return;
|
||||
|
@ -634,7 +634,7 @@ void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, i
|
|||
if (top >= viewport->y + viewport->height)return;
|
||||
|
||||
#ifdef DEBUG_SHOW_DIRTY_BOX
|
||||
int l = left, t = top, r = right, b = bottom;
|
||||
sint32 l = left, t = top, r = right, b = bottom;
|
||||
#endif
|
||||
|
||||
left = max(left - viewport->x, 0);
|
||||
|
@ -773,15 +773,15 @@ static void viewport_paint_weather_gloom(rct_drawpixelinfo * dpi)
|
|||
*
|
||||
* rct2: 0x0068958D
|
||||
*/
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction)
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, sint32 *direction)
|
||||
{
|
||||
screen_get_map_xy(*x, *y, x, y, NULL);
|
||||
if (*x == MAP_LOCATION_NULL)
|
||||
return;
|
||||
|
||||
int my_direction;
|
||||
int dist_from_center_x = abs(*x % 32);
|
||||
int dist_from_center_y = abs(*y % 32);
|
||||
sint32 my_direction;
|
||||
sint32 dist_from_center_x = abs(*x % 32);
|
||||
sint32 dist_from_center_y = abs(*y % 32);
|
||||
if (dist_from_center_x > 8 && dist_from_center_x < 24 &&
|
||||
dist_from_center_y > 8 && dist_from_center_y < 24) {
|
||||
my_direction = 4;
|
||||
|
@ -816,7 +816,7 @@ rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16
|
|||
return ret;
|
||||
}
|
||||
|
||||
rct_xy16 viewport_coord_to_map_coord(int x, int y, int z)
|
||||
rct_xy16 viewport_coord_to_map_coord(sint32 x, sint32 y, sint32 z)
|
||||
{
|
||||
rct_xy16 ret = { 0 };
|
||||
switch (get_current_rotation()) {
|
||||
|
@ -1050,12 +1050,12 @@ static bool sub_679236_679662_679B0D_679FF1(uint32 ebx, rct_g1_element *image, u
|
|||
/**
|
||||
* rct2: 0x0067933B, 0x00679788, 0x00679C4A, 0x0067A117
|
||||
*/
|
||||
static bool sub_67933B_679788_679C4A_67A117(uint8 *esi, sint16 x_start_point, sint16 y_start_point, int round) {
|
||||
static bool sub_67933B_679788_679C4A_67A117(uint8 *esi, sint16 x_start_point, sint16 y_start_point, sint32 round) {
|
||||
const uint8 *ebx = esi + ((uint16 *) esi)[y_start_point];
|
||||
|
||||
uint8 last_data_line = 0;
|
||||
while (!last_data_line) {
|
||||
int no_pixels = *ebx++;
|
||||
sint32 no_pixels = *ebx++;
|
||||
uint8 gap_size = *ebx++;
|
||||
|
||||
last_data_line = no_pixels & 0x80;
|
||||
|
@ -1084,7 +1084,7 @@ static bool sub_67933B_679788_679C4A_67A117(uint8 *esi, sint16 x_start_point, si
|
|||
}
|
||||
}
|
||||
|
||||
int x_start = gap_size - x_start_point;
|
||||
sint32 x_start = gap_size - x_start_point;
|
||||
if (x_start <= 0) {
|
||||
no_pixels += x_start;
|
||||
if (no_pixels <= 0) {
|
||||
|
@ -1125,7 +1125,7 @@ static bool sub_67933B_679788_679C4A_67A117(uint8 *esi, sint16 x_start_point, si
|
|||
* @param y (dx)
|
||||
* @return value originally stored in 0x00141F569
|
||||
*/
|
||||
static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
||||
static bool sub_679074(rct_drawpixelinfo *dpi, sint32 imageId, sint16 x, sint16 y)
|
||||
{
|
||||
rct_g1_element *image = gfx_get_g1_element(imageId & 0x7FFFF);
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
|||
}
|
||||
}
|
||||
|
||||
int round = 1 << dpi->zoom_level;
|
||||
sint32 round = 1 << dpi->zoom_level;
|
||||
|
||||
if (image->flags & G1_FLAG_RLE_COMPRESSION) {
|
||||
y -= (round - 1);
|
||||
|
@ -1247,12 +1247,12 @@ static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
|||
}
|
||||
|
||||
// The code below is untested.
|
||||
int total_no_pixels = image->width * image->height;
|
||||
sint32 total_no_pixels = image->width * image->height;
|
||||
uint8 *source_pointer = image->offset;
|
||||
uint8 *new_source_pointer_start = malloc(total_no_pixels);
|
||||
uint8 *new_source_pointer = (*&new_source_pointer_start);// 0x9E3D28;
|
||||
intptr_t ebx1;
|
||||
int ecx;
|
||||
sint32 ecx;
|
||||
while (total_no_pixels > 0) {
|
||||
sint8 no_pixels = *source_pointer;
|
||||
if (no_pixels >= 0) {
|
||||
|
@ -1266,7 +1266,7 @@ static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
|||
ecx = no_pixels;
|
||||
no_pixels &= 0x7;
|
||||
ecx >>= 3;//SAR
|
||||
uintptr_t eax = ((int) no_pixels) << 8;
|
||||
uintptr_t eax = ((sint32) no_pixels) << 8;
|
||||
ecx = -ecx;//Odd
|
||||
eax = (eax & 0xFF00) + *(source_pointer + 1);
|
||||
total_no_pixels -= ecx;
|
||||
|
@ -1291,16 +1291,16 @@ static bool sub_679074(rct_drawpixelinfo *dpi, int imageId, sint16 x, sint16 y)
|
|||
*
|
||||
* rct2: 0x00679023
|
||||
*/
|
||||
static bool sub_679023(rct_drawpixelinfo *dpi, int imageId, int x, int y)
|
||||
static bool sub_679023(rct_drawpixelinfo *dpi, sint32 imageId, sint32 x, sint32 y)
|
||||
{
|
||||
imageId &= 0xBFFFFFFF;
|
||||
if (imageId & 0x20000000) {
|
||||
gUnkEDF81C = 0x20000000;
|
||||
int index = (imageId >> 19) & 0x7F;
|
||||
sint32 index = (imageId >> 19) & 0x7F;
|
||||
if (imageId & 0x80000000) {
|
||||
index &= 0x1F;
|
||||
}
|
||||
int g1Index = palette_to_g1_offset[index];
|
||||
sint32 g1Index = palette_to_g1_offset[index];
|
||||
unk_9ABDA4 = g1Elements[g1Index].offset;
|
||||
} else {
|
||||
gUnkEDF81C = 0;
|
||||
|
@ -1352,7 +1352,7 @@ static void sub_68862C(rct_drawpixelinfo * dpi, paint_struct * ps)
|
|||
* mapElement: edx
|
||||
* viewport: edi
|
||||
*/
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x, sint16 *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport)
|
||||
void get_map_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 flags, sint16 *x, sint16 *y, sint32 *interactionType, rct_map_element **mapElement, rct_viewport **viewport)
|
||||
{
|
||||
_unk9AC154 = flags & 0xFFFF;
|
||||
_unk9AC148 = 0;
|
||||
|
@ -1360,14 +1360,14 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x
|
|||
if (window != NULL && window->viewport != NULL)
|
||||
{
|
||||
rct_viewport* myviewport = window->viewport;
|
||||
screenX -= (int)myviewport->x;
|
||||
screenY -= (int)myviewport->y;
|
||||
if (screenX >= 0 && screenX < (int)myviewport->width && screenY >= 0 && screenY < (int)myviewport->height)
|
||||
screenX -= (sint32)myviewport->x;
|
||||
screenY -= (sint32)myviewport->y;
|
||||
if (screenX >= 0 && screenX < (sint32)myviewport->width && screenY >= 0 && screenY < (sint32)myviewport->height)
|
||||
{
|
||||
screenX <<= myviewport->zoom;
|
||||
screenY <<= myviewport->zoom;
|
||||
screenX += (int)myviewport->view_x;
|
||||
screenY += (int)myviewport->view_y;
|
||||
screenX += (sint32)myviewport->view_x;
|
||||
screenY += (sint32)myviewport->view_y;
|
||||
_viewportDpi1.zoom_level = myviewport->zoom;
|
||||
screenX &= (0xFFFF << myviewport->zoom) & 0xFFFF;
|
||||
screenY &= (0xFFFF << myviewport->zoom) & 0xFFFF;
|
||||
|
@ -1395,7 +1395,7 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x
|
|||
/**
|
||||
* Left, top, right and bottom represent 2D map coordinates at zoom 0.
|
||||
*/
|
||||
void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom)
|
||||
void viewport_invalidate(rct_viewport *viewport, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
{
|
||||
// if unknown viewport visibility, use the containing window to discover the status
|
||||
if (viewport->visibility == VC_UNKNOWN)
|
||||
|
@ -1414,10 +1414,10 @@ void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, i
|
|||
|
||||
if (viewport->visibility == VC_COVERED) return;
|
||||
|
||||
int viewportLeft = viewport->view_x;
|
||||
int viewportTop = viewport->view_y;
|
||||
int viewportRight = viewport->view_x + viewport->view_width;
|
||||
int viewportBottom = viewport->view_y + viewport->view_height;
|
||||
sint32 viewportLeft = viewport->view_x;
|
||||
sint32 viewportTop = viewport->view_y;
|
||||
sint32 viewportRight = viewport->view_x + viewport->view_width;
|
||||
sint32 viewportBottom = viewport->view_y + viewport->view_height;
|
||||
if (right > viewportLeft && bottom > viewportTop) {
|
||||
left = max(left, viewportLeft);
|
||||
top = max(top, viewportTop);
|
||||
|
@ -1441,7 +1441,7 @@ void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, i
|
|||
}
|
||||
}
|
||||
|
||||
static rct_viewport *viewport_find_from_point(int screenX, int screenY)
|
||||
static rct_viewport *viewport_find_from_point(sint32 screenX, sint32 screenY)
|
||||
{
|
||||
rct_window *w = window_find_from_point(screenX, screenY);
|
||||
if (w == NULL)
|
||||
|
@ -1471,9 +1471,9 @@ static rct_viewport *viewport_find_from_point(int screenX, int screenY)
|
|||
* map_element: edx ?
|
||||
* viewport: edi
|
||||
*/
|
||||
void screen_get_map_xy(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewport **viewport) {
|
||||
void screen_get_map_xy(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, rct_viewport **viewport) {
|
||||
sint16 my_x, my_y;
|
||||
int interactionType;
|
||||
sint32 interactionType;
|
||||
rct_viewport *myViewport;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN, &my_x, &my_y, &interactionType, NULL, &myViewport);
|
||||
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE) {
|
||||
|
@ -1484,8 +1484,8 @@ void screen_get_map_xy(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewp
|
|||
rct_xy16 start_vp_pos = screen_coord_to_viewport_coord(myViewport, screenX, screenY);
|
||||
rct_xy16 map_pos = { my_x + 16, my_y + 16 };
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
int z = map_element_height(map_pos.x, map_pos.y);
|
||||
for (sint32 i = 0; i < 5; i++) {
|
||||
sint32 z = map_element_height(map_pos.x, map_pos.y);
|
||||
map_pos = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z);
|
||||
map_pos.x = clamp(my_x, map_pos.x, my_x + 31);
|
||||
map_pos.y = clamp(my_y, map_pos.y, my_y + 31);
|
||||
|
|
|
@ -75,9 +75,9 @@ enum {
|
|||
};
|
||||
|
||||
typedef struct viewport_interaction_info {
|
||||
int type;
|
||||
int x;
|
||||
int y;
|
||||
sint32 type;
|
||||
sint32 x;
|
||||
sint32 y;
|
||||
union {
|
||||
rct_map_element *mapElement;
|
||||
rct_sprite *sprite;
|
||||
|
@ -115,19 +115,19 @@ extern uint32 gCurrentViewportFlags;
|
|||
#endif
|
||||
|
||||
void viewport_init_all();
|
||||
void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_viewport* viewport);
|
||||
void viewport_create(rct_window *w, int x, int y, int width, int height, int zoom, int center_x, int center_y, int center_z, char flags, sint16 sprite);
|
||||
void center_2d_coordinates(sint32 x, sint32 y, sint32 z, sint32* out_x, sint32* out_y, rct_viewport* viewport);
|
||||
void viewport_create(rct_window *w, sint32 x, sint32 y, sint32 width, sint32 height, sint32 zoom, sint32 center_x, sint32 center_y, sint32 center_z, char flags, sint16 sprite);
|
||||
void viewport_update_pointers();
|
||||
void viewport_update_position(rct_window *window);
|
||||
void viewport_update_sprite_follow(rct_window *window);
|
||||
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, int left, int top, int right, int bottom);
|
||||
void viewport_render(rct_drawpixelinfo *dpi, rct_viewport *viewport, sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, sint16 left, sint16 top, sint16 right, sint16 bottom);
|
||||
|
||||
void sub_689174(sint16* x, sint16* y, sint16 *z);
|
||||
|
||||
rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16 y);
|
||||
rct_xy16 viewport_coord_to_map_coord(int x, int y, int z);
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction);
|
||||
rct_xy16 viewport_coord_to_map_coord(sint32 x, sint32 y, sint32 z);
|
||||
void screen_pos_to_map_pos(sint16 *x, sint16 *y, sint32 *direction);
|
||||
|
||||
void show_gridlines();
|
||||
void hide_gridlines();
|
||||
|
@ -137,23 +137,23 @@ void show_construction_rights();
|
|||
void hide_construction_rights();
|
||||
void viewport_set_visibility(uint8 mode);
|
||||
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x, sint16 *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport);
|
||||
void get_map_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 flags, sint16 *x, sint16 *y, sint32 *interactionType, rct_map_element **mapElement, rct_viewport **viewport);
|
||||
|
||||
int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *info);
|
||||
int viewport_interaction_left_over(int x, int y);
|
||||
int viewport_interaction_left_click(int x, int y);
|
||||
int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info);
|
||||
int viewport_interaction_right_over(int x, int y);
|
||||
int viewport_interaction_right_click(int x, int y);
|
||||
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement);
|
||||
sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interaction_info *info);
|
||||
sint32 viewport_interaction_left_over(sint32 x, sint32 y);
|
||||
sint32 viewport_interaction_left_click(sint32 x, sint32 y);
|
||||
sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interaction_info *info);
|
||||
sint32 viewport_interaction_right_over(sint32 x, sint32 y);
|
||||
sint32 viewport_interaction_right_click(sint32 x, sint32 y);
|
||||
void sub_68A15E(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, sint32 *direction, rct_map_element **mapElement);
|
||||
|
||||
void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, int x, int y);
|
||||
void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
|
||||
void sub_68B2B7(int x, int y);
|
||||
void sub_68B2B7(sint32 x, sint32 y);
|
||||
|
||||
void viewport_invalidate(rct_viewport *viewport, int left, int top, int right, int bottom);
|
||||
void viewport_invalidate(rct_viewport *viewport, sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
|
||||
void screen_get_map_xy(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewport **viewport);
|
||||
void screen_get_map_xy(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, rct_viewport **viewport);
|
||||
void screen_get_map_xy_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY);
|
||||
void screen_get_map_xy_quadrant(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *quadrant);
|
||||
void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *quadrant);
|
||||
|
|
|
@ -30,18 +30,18 @@
|
|||
#include "../world/sprite.h"
|
||||
#include "viewport.h"
|
||||
|
||||
static void viewport_interaction_remove_scenery(rct_map_element *mapElement, int x, int y);
|
||||
static void viewport_interaction_remove_footpath(rct_map_element *mapElement, int x, int y);
|
||||
static void viewport_interaction_remove_footpath_item(rct_map_element *mapElement, int x, int y);
|
||||
static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, int x, int y);
|
||||
static void viewport_interaction_remove_large_scenery(rct_map_element *mapElement, int x, int y);
|
||||
static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDistance);
|
||||
static void viewport_interaction_remove_scenery(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
static void viewport_interaction_remove_footpath(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
static void viewport_interaction_remove_footpath_item(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
static void viewport_interaction_remove_large_scenery(rct_map_element *mapElement, sint32 x, sint32 y);
|
||||
static rct_peep *viewport_interaction_get_closest_peep(sint32 x, sint32 y, sint32 maxDistance);
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED9D0
|
||||
*/
|
||||
int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *info)
|
||||
sint32 viewport_interaction_get_item_left(sint32 x, sint32 y, viewport_interaction_info *info)
|
||||
{
|
||||
rct_map_element *mapElement;
|
||||
rct_sprite *sprite;
|
||||
|
@ -104,7 +104,7 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *
|
|||
return info->type;
|
||||
}
|
||||
|
||||
int viewport_interaction_left_over(int x, int y)
|
||||
sint32 viewport_interaction_left_over(sint32 x, sint32 y)
|
||||
{
|
||||
viewport_interaction_info info;
|
||||
|
||||
|
@ -118,7 +118,7 @@ int viewport_interaction_left_over(int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
int viewport_interaction_left_click(int x, int y)
|
||||
sint32 viewport_interaction_left_click(sint32 x, sint32 y)
|
||||
{
|
||||
viewport_interaction_info info;
|
||||
|
||||
|
@ -160,13 +160,13 @@ int viewport_interaction_left_click(int x, int y)
|
|||
*
|
||||
* rct2: 0x006EDE88
|
||||
*/
|
||||
int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info *info)
|
||||
sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interaction_info *info)
|
||||
{
|
||||
rct_map_element *mapElement;
|
||||
rct_scenery_entry *sceneryEntry;
|
||||
rct_banner *banner;
|
||||
rct_ride *ride;
|
||||
int i, stationIndex;
|
||||
sint32 i, stationIndex;
|
||||
|
||||
// No click input for title screen or track manager
|
||||
if (gScreenFlags & (SCREEN_FLAGS_TITLE_DEMO | SCREEN_FLAGS_TRACK_MANAGER))
|
||||
|
@ -339,7 +339,7 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info
|
|||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
}
|
||||
|
||||
int viewport_interaction_right_over(int x, int y)
|
||||
sint32 viewport_interaction_right_over(sint32 x, sint32 y)
|
||||
{
|
||||
viewport_interaction_info info;
|
||||
|
||||
|
@ -350,7 +350,7 @@ int viewport_interaction_right_over(int x, int y)
|
|||
*
|
||||
* rct2: 0x006E8A62
|
||||
*/
|
||||
int viewport_interaction_right_click(int x, int y)
|
||||
sint32 viewport_interaction_right_click(sint32 x, sint32 y)
|
||||
{
|
||||
rct_xy_element mapElement;
|
||||
viewport_interaction_info info;
|
||||
|
@ -399,7 +399,7 @@ int viewport_interaction_right_click(int x, int y)
|
|||
*
|
||||
* rct2: 0x006E08D2
|
||||
*/
|
||||
static void viewport_interaction_remove_scenery(rct_map_element *mapElement, int x, int y)
|
||||
static void viewport_interaction_remove_scenery(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
|
||||
game_do_command(
|
||||
|
@ -417,9 +417,9 @@ static void viewport_interaction_remove_scenery(rct_map_element *mapElement, int
|
|||
*
|
||||
* rct2: 0x006A614A
|
||||
*/
|
||||
static void viewport_interaction_remove_footpath(rct_map_element *mapElement, int x, int y)
|
||||
static void viewport_interaction_remove_footpath(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
int z;
|
||||
sint32 z;
|
||||
rct_window *w;
|
||||
rct_map_element *mapElement2;
|
||||
|
||||
|
@ -443,9 +443,9 @@ static void viewport_interaction_remove_footpath(rct_map_element *mapElement, in
|
|||
*
|
||||
* rct2: 0x006A61AB
|
||||
*/
|
||||
static void viewport_interaction_remove_footpath_item(rct_map_element *mapElement, int x, int y)
|
||||
static void viewport_interaction_remove_footpath_item(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
int type;
|
||||
sint32 type;
|
||||
|
||||
type = mapElement->properties.path.type >> 4;
|
||||
if (mapElement->type & 1)
|
||||
|
@ -467,9 +467,9 @@ static void viewport_interaction_remove_footpath_item(rct_map_element *mapElemen
|
|||
*
|
||||
* rct2: 0x00666C0E
|
||||
*/
|
||||
void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, int x, int y)
|
||||
void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
int rotation = (mapElement->type + 1) & 3;
|
||||
sint32 rotation = (mapElement->type + 1) & 3;
|
||||
switch (mapElement->properties.entrance.index & 0x0F) {
|
||||
case 1:
|
||||
x += TileDirectionDelta[rotation].x;
|
||||
|
@ -488,7 +488,7 @@ void viewport_interaction_remove_park_entrance(rct_map_element *mapElement, int
|
|||
*
|
||||
* rct2: 0x006E57A9
|
||||
*/
|
||||
static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, int x, int y)
|
||||
static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
rct_scenery_entry *sceneryEntry = get_wall_entry(mapElement->properties.fence.type);
|
||||
if (sceneryEntry->wall.var_0D != 0xFF){
|
||||
|
@ -511,12 +511,12 @@ static void viewport_interaction_remove_park_wall(rct_map_element *mapElement, i
|
|||
*
|
||||
* rct2: 0x006B88DC
|
||||
*/
|
||||
static void viewport_interaction_remove_large_scenery(rct_map_element *mapElement, int x, int y)
|
||||
static void viewport_interaction_remove_large_scenery(rct_map_element *mapElement, sint32 x, sint32 y)
|
||||
{
|
||||
rct_scenery_entry *sceneryEntry = get_large_scenery_entry(mapElement->properties.scenerymultiple.type & MAP_ELEMENT_LARGE_TYPE_MASK);
|
||||
|
||||
if (sceneryEntry->large_scenery.var_11 != 0xFF){
|
||||
int id = (mapElement->type & 0xC0) |
|
||||
sint32 id = (mapElement->type & 0xC0) |
|
||||
((mapElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
|
||||
((mapElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
|
||||
window_sign_open(id);
|
||||
|
@ -534,9 +534,9 @@ static void viewport_interaction_remove_large_scenery(rct_map_element *mapElemen
|
|||
}
|
||||
}
|
||||
|
||||
static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDistance)
|
||||
static rct_peep *viewport_interaction_get_closest_peep(sint32 x, sint32 y, sint32 maxDistance)
|
||||
{
|
||||
int distance, closestDistance;
|
||||
sint32 distance, closestDistance;
|
||||
uint16 spriteIndex;
|
||||
rct_window *w;
|
||||
rct_viewport *viewport;
|
||||
|
@ -578,10 +578,10 @@ static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDist
|
|||
*
|
||||
* rct2: 0x0068A15E
|
||||
*/
|
||||
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement)
|
||||
void sub_68A15E(sint32 screenX, sint32 screenY, sint16 *x, sint16 *y, sint32 *direction, rct_map_element **mapElement)
|
||||
{
|
||||
sint16 my_x, my_y;
|
||||
int interactionType;
|
||||
sint32 interactionType;
|
||||
rct_map_element *myMapElement;
|
||||
rct_viewport *viewport;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER, &my_x, &my_y, &interactionType, &myMapElement, &viewport);
|
||||
|
@ -599,7 +599,7 @@ void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rc
|
|||
rct_xy16 start_vp_pos = screen_coord_to_viewport_coord(viewport, screenX, screenY);
|
||||
rct_xy16 map_pos = { my_x + 16, my_y + 16 };
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (sint32 i = 0; i < 5; i++) {
|
||||
sint16 z = originalZ;
|
||||
if (interactionType != VIEWPORT_INTERACTION_ITEM_WATER) {
|
||||
z = map_element_height(map_pos.x, map_pos.y);
|
||||
|
@ -610,9 +610,9 @@ void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rc
|
|||
}
|
||||
|
||||
// Determine to which edge the cursor is closest
|
||||
int myDirection;
|
||||
int mod_x = map_pos.x & 0x1F;
|
||||
int mod_y = map_pos.y & 0x1F;
|
||||
sint32 myDirection;
|
||||
sint32 mod_x = map_pos.x & 0x1F;
|
||||
sint32 mod_y = map_pos.y & 0x1F;
|
||||
if (mod_x < mod_y) {
|
||||
if (mod_x + mod_y < 32) {
|
||||
myDirection = 0;
|
||||
|
|
|
@ -25,40 +25,40 @@
|
|||
|
||||
#include <math.h>
|
||||
|
||||
static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour);
|
||||
static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour);
|
||||
static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, sint32 l, sint32 t, sint32 r, sint32 b, sint32 colour);
|
||||
static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, sint32 l, sint32 t, sint32 r, sint32 b, sint32 colour);
|
||||
static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006EAF26
|
||||
*/
|
||||
void widget_scroll_update_thumbs(rct_window *w, int widget_index)
|
||||
void widget_scroll_update_thumbs(rct_window *w, sint32 widget_index)
|
||||
{
|
||||
rct_widget *widget = &w->widgets[widget_index];
|
||||
rct_scroll* scroll = &w->scrolls[window_get_scroll_data_index(w, widget_index)];
|
||||
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE) {
|
||||
int view_size = widget->right - widget->left - 21;
|
||||
sint32 view_size = widget->right - widget->left - 21;
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE)
|
||||
view_size -= 11;
|
||||
int x = scroll->h_left * view_size;
|
||||
sint32 x = scroll->h_left * view_size;
|
||||
if (scroll->h_right != 0)
|
||||
x /= scroll->h_right;
|
||||
scroll->h_thumb_left = x + 11;
|
||||
|
@ -82,10 +82,10 @@ void widget_scroll_update_thumbs(rct_window *w, int widget_index)
|
|||
}
|
||||
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE) {
|
||||
int view_size = widget->bottom - widget->top - 21;
|
||||
sint32 view_size = widget->bottom - widget->top - 21;
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
view_size -= 11;
|
||||
int y = scroll->v_top * view_size;
|
||||
sint32 y = scroll->v_top * view_size;
|
||||
if (scroll->v_bottom != 0)
|
||||
y /= scroll->v_bottom;
|
||||
scroll->v_thumb_top = y + 11;
|
||||
|
@ -114,7 +114,7 @@ void widget_scroll_update_thumbs(rct_window *w, int widget_index)
|
|||
*
|
||||
* rct2: 0x006EB2A8
|
||||
*/
|
||||
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
switch (w->widgets[widgetIndex].type) {
|
||||
case WWT_FRAME:
|
||||
|
@ -182,16 +182,16 @@ void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
|||
*
|
||||
* rct2: 0x006EB6CE
|
||||
*/
|
||||
static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
//
|
||||
uint8 press = ((w->flags & WF_10) ? INSET_RECT_FLAG_FILL_MID_LIGHT : 0);
|
||||
|
@ -218,16 +218,16 @@ static void widget_frame_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
|
|||
*
|
||||
* rct2: 0x006EB765
|
||||
*/
|
||||
static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -251,16 +251,16 @@ static void widget_resize_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
*
|
||||
* rct2: 0x006EB8E5
|
||||
*/
|
||||
static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Check if the button is pressed down
|
||||
uint8 press = widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex) ? INSET_RECT_FLAG_BORDER_INSET : 0;
|
||||
|
@ -284,7 +284,7 @@ static void widget_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
*
|
||||
* rct2: 0x006EB806
|
||||
*/
|
||||
static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
@ -308,8 +308,8 @@ static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetInd
|
|||
}
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
|
||||
// Get the colour and disabled image
|
||||
uint8 colour = w->colours[widget->colour] & 0x7F;
|
||||
|
@ -323,7 +323,7 @@ static void widget_tab_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetInd
|
|||
*
|
||||
* rct2: 0x006EB861
|
||||
*/
|
||||
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (!widget_is_disabled(w, widgetIndex) && widget_is_highlighted(w, widgetIndex)) {
|
||||
widget_button_draw(dpi, w, widgetIndex);
|
||||
|
@ -334,10 +334,10 @@ static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int w
|
|||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -362,16 +362,16 @@ static void widget_flat_button_draw(rct_drawpixelinfo *dpi, rct_window *w, int w
|
|||
*
|
||||
* rct2: 0x006EBBEB
|
||||
*/
|
||||
static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -388,7 +388,7 @@ static void widget_text_button(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
*
|
||||
* rct2: 0x006EBC41
|
||||
*/
|
||||
static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
@ -399,8 +399,8 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge
|
|||
// colour = 2;
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
|
||||
rct_string_id stringId = widget->text;
|
||||
if (stringId == STR_NONE)
|
||||
|
@ -442,7 +442,7 @@ static void widget_text_unknown(rct_drawpixelinfo *dpi, rct_window *w, int widge
|
|||
*
|
||||
* rct2: 0x006EBD52
|
||||
*/
|
||||
static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
@ -451,9 +451,9 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
|||
uint8 colour = w->colours[widget->colour];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
|
||||
// TODO: -2 seems odd
|
||||
if (widget->text == (rct_string_id)-2 || widget->text == STR_NONE)
|
||||
|
@ -468,16 +468,16 @@ static void widget_text(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
|||
*
|
||||
* rct2: 0x006EBD1F
|
||||
*/
|
||||
static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -490,21 +490,21 @@ static void widget_text_inset(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
|
|||
*
|
||||
* rct2: 0x006EC1A6
|
||||
*/
|
||||
static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left + 5;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left + 5;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
||||
int press = 0;
|
||||
sint32 press = 0;
|
||||
if (widget_is_pressed(w, widgetIndex) || widget_is_active_tool(w, widgetIndex))
|
||||
press |= INSET_RECT_FLAG_BORDER_INSET;
|
||||
|
||||
|
@ -519,17 +519,17 @@ static void widget_text_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIn
|
|||
*
|
||||
* rct2: 0x006EB535
|
||||
*/
|
||||
static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left + 5;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
int textRight = l;
|
||||
sint32 l = w->x + widget->left + 5;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
sint32 textRight = l;
|
||||
|
||||
// Text
|
||||
if (widget->text != STR_NONE) {
|
||||
|
@ -575,16 +575,16 @@ static void widget_groupbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
|||
*
|
||||
* rct2: 0x006EB2F9
|
||||
*/
|
||||
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -607,7 +607,7 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge
|
|||
|
||||
l = widget->left + w->x + 2;
|
||||
t = widget->top + w->y + 1;
|
||||
int width = widget->right - widget->left - 4;
|
||||
sint32 width = widget->right - widget->left - 4;
|
||||
if ((widget + 1)->type == WWT_CLOSEBOX) {
|
||||
width -= 10;
|
||||
if ((widget + 2)->type == WWT_CLOSEBOX)
|
||||
|
@ -621,16 +621,16 @@ static void widget_caption_draw(rct_drawpixelinfo *dpi, rct_window *w, int widge
|
|||
*
|
||||
* rct2: 0x006EBB85
|
||||
*/
|
||||
static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Check if the button is pressed down
|
||||
uint8 press = 0;
|
||||
|
@ -661,16 +661,16 @@ static void widget_closebox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
|||
*
|
||||
* rct2: 0x006EBAD9
|
||||
*/
|
||||
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int b = w->y + widget->bottom;
|
||||
int yMid = (b + t) / 2;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
sint32 yMid = (b + t) / 2;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -701,18 +701,18 @@ static void widget_checkbox_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
|||
*
|
||||
* rct2: 0x006EBD96
|
||||
*/
|
||||
static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
int scrollIndex = window_get_scroll_data_index(w, widgetIndex);
|
||||
sint32 scrollIndex = window_get_scroll_data_index(w, widgetIndex);
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
rct_scroll* scroll = &w->scrolls[scrollIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -749,10 +749,10 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
rct_drawpixelinfo scroll_dpi = *dpi;
|
||||
|
||||
// Clip the scroll dpi against the outer dpi
|
||||
int cl = max(dpi->x, l);
|
||||
int ct = max(dpi->y, t);
|
||||
int cr = min(dpi->x + dpi->width, r);
|
||||
int cb = min(dpi->y + dpi->height, b);
|
||||
sint32 cl = max(dpi->x, l);
|
||||
sint32 ct = max(dpi->y, t);
|
||||
sint32 cr = min(dpi->x + dpi->width, r);
|
||||
sint32 cb = min(dpi->y + dpi->height, b);
|
||||
|
||||
// Set the respective dpi attributes
|
||||
scroll_dpi.x = cl - l + scroll->h_left;
|
||||
|
@ -768,7 +768,7 @@ static void widget_scroll_draw(rct_drawpixelinfo *dpi, rct_window *w, int widget
|
|||
window_event_scroll_paint_call(w, &scroll_dpi, scrollIndex);
|
||||
}
|
||||
|
||||
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)
|
||||
static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, sint32 l, sint32 t, sint32 r, sint32 b, sint32 colour)
|
||||
{
|
||||
colour &= 0x7F;
|
||||
// Trough
|
||||
|
@ -794,7 +794,7 @@ static void widget_hscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, i
|
|||
gfx_draw_string(dpi, (char*)BlackRightArrowString, COLOUR_BLACK, r - 6, t);
|
||||
}
|
||||
|
||||
static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, int l, int t, int r, int b, int colour)
|
||||
static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, sint32 l, sint32 t, sint32 r, sint32 b, sint32 colour)
|
||||
{
|
||||
colour &= 0x7F;
|
||||
// Trough
|
||||
|
@ -824,19 +824,19 @@ static void widget_vscrollbar_draw(rct_drawpixelinfo *dpi, rct_scroll *scroll, i
|
|||
*
|
||||
* rct2: 0x006EB951
|
||||
*/
|
||||
static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Get the image
|
||||
int image = widget->image;
|
||||
sint32 image = widget->image;
|
||||
if (image == SPR_NONE)
|
||||
return;
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = NOT_TRANSLUCENT(w->colours[widget->colour]);
|
||||
|
@ -869,17 +869,17 @@ static void widget_draw_image(rct_drawpixelinfo *dpi, rct_window *w, int widgetI
|
|||
}
|
||||
}
|
||||
|
||||
int widget_is_enabled(rct_window *w, int widgetIndex)
|
||||
sint32 widget_is_enabled(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
return (w->enabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int widget_is_disabled(rct_window *w, int widgetIndex)
|
||||
sint32 widget_is_disabled(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
return (w->disabled_widgets & (1LL << widgetIndex)) ? 1 : 0;
|
||||
}
|
||||
|
||||
int widget_is_pressed(rct_window *w, int widgetIndex)
|
||||
sint32 widget_is_pressed(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (w->pressed_widgets & (1LL << widgetIndex)) {
|
||||
return 1;
|
||||
|
@ -894,7 +894,7 @@ int widget_is_pressed(rct_window *w, int widgetIndex)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int widget_is_highlighted(rct_window *w, int widgetIndex)
|
||||
sint32 widget_is_highlighted(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (gHoverWidget.window_classification != w->classification) return 0;
|
||||
if (gHoverWidget.window_number != w->number) return 0;
|
||||
|
@ -902,7 +902,7 @@ int widget_is_highlighted(rct_window *w, int widgetIndex)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int widget_is_active_tool(rct_window *w, int widgetIndex)
|
||||
sint32 widget_is_active_tool(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (!(gInputFlags & INPUT_FLAG_TOOL_ACTIVE))
|
||||
return 0;
|
||||
|
@ -926,7 +926,7 @@ int widget_is_active_tool(rct_window *w, int widgetIndex)
|
|||
* esi: w
|
||||
* edi: widget
|
||||
*/
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int *output_x, int *output_y, int *output_scroll_area, int *scroll_id)
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget *widget, sint32 x, sint32 y, sint32 *output_x, sint32 *output_y, sint32 *output_scroll_area, sint32 *scroll_id)
|
||||
{
|
||||
rct_widget* iterator = w->widgets;
|
||||
*scroll_id = 0;
|
||||
|
@ -942,9 +942,9 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
if ((w->scrolls[*scroll_id].flags & HSCROLLBAR_VISIBLE) && y >= (w->y + widget->bottom - 11))
|
||||
{
|
||||
//horizon scrollbar
|
||||
int rightOffset = 0;
|
||||
int iteratorLeft = widget->left + w->x + 10;
|
||||
int iteratorRight = widget->right + w->x - 10;
|
||||
sint32 rightOffset = 0;
|
||||
sint32 iteratorLeft = widget->left + w->x + 10;
|
||||
sint32 iteratorRight = widget->right + w->x - 10;
|
||||
if (w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE)
|
||||
{
|
||||
rightOffset = 11;
|
||||
|
@ -977,9 +977,9 @@ void widget_scroll_get_part(rct_window *w, rct_widget *widget, int x, int y, int
|
|||
else if ((w->scrolls[*scroll_id].flags & VSCROLLBAR_VISIBLE) && (x >= w->x + widget->right - 11))
|
||||
{
|
||||
//vertical scrollbar
|
||||
int bottomOffset = 0;
|
||||
int iteratorTop = widget->top + w->y + 10;
|
||||
int iteratorBottom = widget->bottom + w->y;
|
||||
sint32 bottomOffset = 0;
|
||||
sint32 iteratorTop = widget->top + w->y + 10;
|
||||
sint32 iteratorBottom = widget->bottom + w->y;
|
||||
if (w->scrolls[*scroll_id].flags & HSCROLLBAR_VISIBLE)
|
||||
{
|
||||
bottomOffset = 11;
|
||||
|
@ -1041,7 +1041,7 @@ void widget_set_enabled(rct_window *w, uint64 widgetIndex, bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
void widget_set_checkbox_value(rct_window *w, int widgetIndex, int value)
|
||||
void widget_set_checkbox_value(rct_window *w, sint32 widgetIndex, sint32 value)
|
||||
{
|
||||
if (value)
|
||||
w->pressed_widgets |= (1ULL << widgetIndex);
|
||||
|
@ -1049,20 +1049,20 @@ void widget_set_checkbox_value(rct_window *w, int widgetIndex, int value)
|
|||
w->pressed_widgets &= ~(1ULL << widgetIndex);
|
||||
}
|
||||
|
||||
static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex)
|
||||
static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
int no_lines = 0;
|
||||
int font_height = 0;
|
||||
sint32 no_lines = 0;
|
||||
sint32 font_height = 0;
|
||||
char wrapped_string[512];
|
||||
|
||||
// Get the widget
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
|
||||
// Resolve the absolute ltrb
|
||||
int l = w->x + widget->left;
|
||||
int t = w->y + widget->top;
|
||||
int r = w->x + widget->right;
|
||||
int b = w->y + widget->bottom;
|
||||
sint32 l = w->x + widget->left;
|
||||
sint32 t = w->y + widget->top;
|
||||
sint32 r = w->x + widget->right;
|
||||
sint32 b = w->y + widget->bottom;
|
||||
|
||||
// Get the colour
|
||||
uint8 colour = w->colours[widget->colour];
|
||||
|
@ -1103,9 +1103,9 @@ static void widget_text_box_draw(rct_drawpixelinfo *dpi, rct_window *w, int widg
|
|||
// Make a copy of the string for measuring the width.
|
||||
char temp_string[512] = { 0 };
|
||||
memcpy(temp_string, wrapped_string, min(string_length, gTextInput.selection_offset));
|
||||
int cur_x = l + gfx_get_string_width(temp_string) + 3;
|
||||
sint32 cur_x = l + gfx_get_string_width(temp_string) + 3;
|
||||
|
||||
int width = 6;
|
||||
sint32 width = 6;
|
||||
if ((uint32)gTextInput.selection_offset < strlen(gTextBoxInput)){
|
||||
// Make a new 1 character wide string for measuring the width
|
||||
// of the character that the cursor is under.
|
||||
|
|
|
@ -57,17 +57,17 @@ enum {
|
|||
SCROLL_BOTH = SCROLL_HORIZONTAL | SCROLL_VERTICAL
|
||||
};
|
||||
|
||||
void widget_scroll_update_thumbs(rct_window *w, int widget_index);
|
||||
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, int widgetIndex);
|
||||
void widget_scroll_update_thumbs(rct_window *w, sint32 widget_index);
|
||||
void widget_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 widgetIndex);
|
||||
|
||||
int widget_is_enabled(rct_window *w, int widgetIndex);
|
||||
int widget_is_disabled(rct_window *w, int widgetIndex);
|
||||
int widget_is_pressed(rct_window *w, int widgetIndex);
|
||||
int widget_is_highlighted(rct_window *w, int widgetIndex);
|
||||
int widget_is_active_tool(rct_window *w, int widgetIndex);
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget* widget, int x, int y, int *output_x, int *output_y, int *output_scroll_area, int *scroll_id);
|
||||
sint32 widget_is_enabled(rct_window *w, sint32 widgetIndex);
|
||||
sint32 widget_is_disabled(rct_window *w, sint32 widgetIndex);
|
||||
sint32 widget_is_pressed(rct_window *w, sint32 widgetIndex);
|
||||
sint32 widget_is_highlighted(rct_window *w, sint32 widgetIndex);
|
||||
sint32 widget_is_active_tool(rct_window *w, sint32 widgetIndex);
|
||||
void widget_scroll_get_part(rct_window *w, rct_widget* widget, sint32 x, sint32 y, sint32 *output_x, sint32 *output_y, sint32 *output_scroll_area, sint32 *scroll_id);
|
||||
|
||||
void widget_set_enabled(rct_window *w, uint64 widgetIndex, bool enabled);
|
||||
void widget_set_checkbox_value(rct_window *w, int widgetIndex, int value);
|
||||
void widget_set_checkbox_value(rct_window *w, sint32 widgetIndex, sint32 value);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -42,8 +42,8 @@ rct_window * gWindowAudioExclusive;
|
|||
uint16 TextInputDescriptionArgs[4];
|
||||
widget_identifier gCurrentTextBox = { { 255, 0 }, 0 };
|
||||
char gTextBoxInput[512] = { 0 };
|
||||
int gMaxTextBoxInputLength = 0;
|
||||
int gTextBoxFrameNo = 0;
|
||||
sint32 gMaxTextBoxInputLength = 0;
|
||||
sint32 gTextBoxFrameNo = 0;
|
||||
bool gUsingWidgetTextBox = 0;
|
||||
|
||||
uint16 gWindowUpdateTicks;
|
||||
|
@ -74,27 +74,27 @@ float window_scroll_locations[][2] = {
|
|||
{0.125f, 0.125f},
|
||||
};
|
||||
|
||||
static bool sub_6EA95D(int x, int y, int width, int height);
|
||||
static bool sub_6EA95D(sint32 x, sint32 y, sint32 width, sint32 height);
|
||||
static void window_all_wheel_input();
|
||||
static int window_draw_split(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom);
|
||||
static void window_draw_single(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom);
|
||||
static sint32 window_draw_split(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
static void window_draw_single(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
|
||||
static int window_get_widget_index(rct_window *w, rct_widget *widget)
|
||||
static sint32 window_get_widget_index(rct_window *w, rct_widget *widget)
|
||||
{
|
||||
int i = 0;
|
||||
sint32 i = 0;
|
||||
for (rct_widget *widget2 = w->widgets; widget2->type != WWT_LAST; widget2++, i++)
|
||||
if (widget == widget2)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int window_get_scroll_index(rct_window *w, int targetWidgetIndex)
|
||||
static sint32 window_get_scroll_index(rct_window *w, sint32 targetWidgetIndex)
|
||||
{
|
||||
if (w->widgets[targetWidgetIndex].type != WWT_SCROLL)
|
||||
return -1;
|
||||
|
||||
int scrollIndex = 0;
|
||||
int widgetIndex = 0;
|
||||
sint32 scrollIndex = 0;
|
||||
sint32 widgetIndex = 0;
|
||||
for (rct_widget *widget = w->widgets; widget->type != WWT_LAST; widget++, widgetIndex++) {
|
||||
if (widgetIndex == targetWidgetIndex)
|
||||
break;
|
||||
|
@ -105,12 +105,12 @@ static int window_get_scroll_index(rct_window *w, int targetWidgetIndex)
|
|||
return scrollIndex;
|
||||
}
|
||||
|
||||
static int window_get_scroll_index_from_widget(rct_window *w, rct_widget *widget)
|
||||
static sint32 window_get_scroll_index_from_widget(rct_window *w, rct_widget *widget)
|
||||
{
|
||||
if (widget->type != WWT_SCROLL)
|
||||
return -1;
|
||||
|
||||
int scrollIndex = 0;
|
||||
sint32 scrollIndex = 0;
|
||||
for (rct_widget *widget2 = w->widgets; widget2->type != WWT_LAST; widget2++) {
|
||||
if (widget2 == widget)
|
||||
break;
|
||||
|
@ -121,7 +121,7 @@ static int window_get_scroll_index_from_widget(rct_window *w, rct_widget *widget
|
|||
return scrollIndex;
|
||||
}
|
||||
|
||||
static rct_widget *window_get_scroll_widget(rct_window *w, int scrollIndex)
|
||||
static rct_widget *window_get_scroll_widget(rct_window *w, sint32 scrollIndex)
|
||||
{
|
||||
for (rct_widget *widget = w->widgets; widget->type != WWT_LAST; widget++) {
|
||||
if (widget->type != WWT_SCROLL)
|
||||
|
@ -187,20 +187,20 @@ void window_update_all()
|
|||
*
|
||||
* rct2: 0x006E78E3
|
||||
*/
|
||||
static void window_scroll_wheel_input(rct_window *w, int scrollIndex, int wheel)
|
||||
static void window_scroll_wheel_input(rct_window *w, sint32 scrollIndex, sint32 wheel)
|
||||
{
|
||||
rct_scroll *scroll = &w->scrolls[scrollIndex];
|
||||
rct_widget *widget = window_get_scroll_widget(w, scrollIndex);
|
||||
int widgetIndex = window_get_widget_index(w, widget);
|
||||
sint32 widgetIndex = window_get_widget_index(w, widget);
|
||||
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE) {
|
||||
int size = widget->bottom - widget->top - 1;
|
||||
sint32 size = widget->bottom - widget->top - 1;
|
||||
if (scroll->flags & HSCROLLBAR_VISIBLE)
|
||||
size -= 11;
|
||||
size = max(0, scroll->v_bottom - size);
|
||||
scroll->v_top = min(max(0, scroll->v_top + wheel), size);
|
||||
} else {
|
||||
int size = widget->right - widget->left - 1;
|
||||
sint32 size = widget->right - widget->left - 1;
|
||||
if (scroll->flags & VSCROLLBAR_VISIBLE)
|
||||
size -= 11;
|
||||
size = max(0, scroll->h_right - size);
|
||||
|
@ -215,9 +215,9 @@ static void window_scroll_wheel_input(rct_window *w, int scrollIndex, int wheel)
|
|||
*
|
||||
* rct2: 0x006E793B
|
||||
*/
|
||||
static int window_wheel_input(rct_window *w, int wheel)
|
||||
static sint32 window_wheel_input(rct_window *w, sint32 wheel)
|
||||
{
|
||||
int i = 0;
|
||||
sint32 i = 0;
|
||||
for (rct_widget *widget = w->widgets; widget->type != WWT_LAST; widget++) {
|
||||
if (widget->type != WWT_SCROLL)
|
||||
continue;
|
||||
|
@ -238,7 +238,7 @@ static int window_wheel_input(rct_window *w, int wheel)
|
|||
*
|
||||
* rct2: 0x006E79FB
|
||||
*/
|
||||
static void window_viewport_wheel_input(rct_window *w, int wheel)
|
||||
static void window_viewport_wheel_input(rct_window *w, sint32 wheel)
|
||||
{
|
||||
if (gScreenFlags & 9)
|
||||
return;
|
||||
|
@ -249,13 +249,13 @@ static void window_viewport_wheel_input(rct_window *w, int wheel)
|
|||
window_zoom_out(w, true);
|
||||
}
|
||||
|
||||
static bool window_other_wheel_input(rct_window *w, int widgetIndex, int wheel)
|
||||
static bool window_other_wheel_input(rct_window *w, sint32 widgetIndex, sint32 wheel)
|
||||
{
|
||||
// HACK: Until we have a new window system that allows us to add new events like mouse wheel easily,
|
||||
// this selective approach will have to do.
|
||||
|
||||
// Allow mouse wheel scrolling to increment or decrement the land tool size for various windows
|
||||
int previewWidgetIndex;
|
||||
sint32 previewWidgetIndex;
|
||||
switch (w->classification) {
|
||||
case WC_WATER:
|
||||
case WC_CLEAR_SCENERY:
|
||||
|
@ -274,7 +274,7 @@ static bool window_other_wheel_input(rct_window *w, int widgetIndex, int wheel)
|
|||
|
||||
// Preview / Increment / Decrement
|
||||
if (widgetIndex >= previewWidgetIndex && widgetIndex < previewWidgetIndex + 3) {
|
||||
int buttonWidgetIndex = wheel < 0 ? previewWidgetIndex + 2 : previewWidgetIndex + 1;
|
||||
sint32 buttonWidgetIndex = wheel < 0 ? previewWidgetIndex + 2 : previewWidgetIndex + 1;
|
||||
window_event_mouse_up_call(w, buttonWidgetIndex);
|
||||
return true;
|
||||
}
|
||||
|
@ -289,8 +289,8 @@ static bool window_other_wheel_input(rct_window *w, int widgetIndex, int wheel)
|
|||
static void window_all_wheel_input()
|
||||
{
|
||||
// Get wheel value
|
||||
int raw = gCursorState.wheel;
|
||||
int wheel = 0;
|
||||
sint32 raw = gCursorState.wheel;
|
||||
sint32 wheel = 0;
|
||||
while (1) {
|
||||
raw -= 120;
|
||||
if (raw < 0)
|
||||
|
@ -321,11 +321,11 @@ static void window_all_wheel_input()
|
|||
}
|
||||
|
||||
// Check scroll view, cursor is over
|
||||
int widgetIndex = window_find_widget_from_point(w, gCursorState.x, gCursorState.y);
|
||||
sint32 widgetIndex = window_find_widget_from_point(w, gCursorState.x, gCursorState.y);
|
||||
if (widgetIndex != -1) {
|
||||
rct_widget *widget = &w->widgets[widgetIndex];
|
||||
if (widget->type == WWT_SCROLL) {
|
||||
int scrollIndex = window_get_scroll_index(w, widgetIndex);
|
||||
sint32 scrollIndex = window_get_scroll_index(w, widgetIndex);
|
||||
rct_scroll *scroll = &w->scrolls[scrollIndex];
|
||||
if (scroll->flags & (HSCROLLBAR_VISIBLE | VSCROLLBAR_VISIBLE)) {
|
||||
window_scroll_wheel_input(w, window_get_scroll_index(w, widgetIndex), wheel);
|
||||
|
@ -345,9 +345,9 @@ static void window_all_wheel_input()
|
|||
}
|
||||
}
|
||||
|
||||
static void window_close_surplus(int cap, sint8 avoid_classification)
|
||||
static void window_close_surplus(sint32 cap, sint8 avoid_classification)
|
||||
{
|
||||
int count, i, diff;
|
||||
sint32 count, i, diff;
|
||||
//find the amount of windows that are currently open
|
||||
count = WINDOW_LIMIT_MAX;
|
||||
for (i = 0; i < WINDOW_LIMIT_MAX; i++) {
|
||||
|
@ -376,10 +376,10 @@ static void window_close_surplus(int cap, sint8 avoid_classification)
|
|||
/*
|
||||
* Changes the maximum amount of windows allowed
|
||||
*/
|
||||
void window_set_window_limit(int value)
|
||||
void window_set_window_limit(sint32 value)
|
||||
{
|
||||
int prev = gConfigGeneral.window_limit;
|
||||
int val = clamp(value, WINDOW_LIMIT_MIN, WINDOW_LIMIT_MAX);
|
||||
sint32 prev = gConfigGeneral.window_limit;
|
||||
sint32 val = clamp(value, WINDOW_LIMIT_MIN, WINDOW_LIMIT_MAX);
|
||||
gConfigGeneral.window_limit = val;
|
||||
config_save_default();
|
||||
// Checks if value decreases and then closes surplus
|
||||
|
@ -401,7 +401,7 @@ void window_set_window_limit(int value)
|
|||
* @param flags (ch)
|
||||
* @param class (cl)
|
||||
*/
|
||||
rct_window *window_create(int x, int y, int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
rct_window *window_create(sint32 x, sint32 y, sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
// Check if there are any window slots left
|
||||
// include WINDOW_LIMIT_RESERVED for items such as the main viewport and toolbars to not appear to be counted.
|
||||
|
@ -486,11 +486,11 @@ rct_window *window_create(int x, int y, int width, int height, rct_window_event_
|
|||
* @param width (bx)
|
||||
* @param height (cx)
|
||||
*/
|
||||
static bool sub_6EA8EC(int x, int y, int width, int height)
|
||||
static bool sub_6EA8EC(sint32 x, sint32 y, sint32 width, sint32 height)
|
||||
{
|
||||
uint16 screenWidth = gScreenWidth;
|
||||
uint16 screenHeight = gScreenHeight;
|
||||
int unk;
|
||||
sint32 unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
if (x < unk) return false;
|
||||
|
@ -511,7 +511,7 @@ static bool sub_6EA8EC(int x, int y, int width, int height)
|
|||
* @param width (bx)
|
||||
* @param height (cx)
|
||||
*/
|
||||
static bool sub_6EA934(int x, int y, int width, int height)
|
||||
static bool sub_6EA934(sint32 x, sint32 y, sint32 width, sint32 height)
|
||||
{
|
||||
if (x < 0) return false;
|
||||
if (y < 28) return false;
|
||||
|
@ -529,7 +529,7 @@ static bool sub_6EA934(int x, int y, int width, int height)
|
|||
* @param width (bx)
|
||||
* @param height (cx)
|
||||
*/
|
||||
static bool sub_6EA95D(int x, int y, int width, int height)
|
||||
static bool sub_6EA95D(sint32 x, sint32 y, sint32 width, sint32 height)
|
||||
{
|
||||
for (rct_window *w = g_window_list; w < RCT2_LAST_WINDOW; w++) {
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
|
@ -555,7 +555,7 @@ static bool sub_6EA95D(int x, int y, int width, int height)
|
|||
* @param flags (ch)
|
||||
* @param class (cl)
|
||||
*/
|
||||
rct_window *window_create_auto_pos(int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
rct_window *window_create_auto_pos(sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
uint16 screenWidth = gScreenWidth;
|
||||
uint16 screenHeight = gScreenHeight;
|
||||
|
@ -569,10 +569,10 @@ rct_window *window_create_auto_pos(int width, int height, rct_window_event_list
|
|||
// if (w != NULL) {
|
||||
// if (w->x > -60 && w->x < gScreenWidth - 20) {
|
||||
// if (w->y < gScreenHeight - 20) {
|
||||
// int x = w->x;
|
||||
// sint32 x = w->x;
|
||||
// if (w->x + width > gScreenWidth)
|
||||
// x = gScreenWidth - 20 - width;
|
||||
// int y = w->y;
|
||||
// sint32 y = w->y;
|
||||
// return window_create(x + 10, y + 10, width, height, event_handlers, cls, flags);
|
||||
// }
|
||||
// }
|
||||
|
@ -580,8 +580,8 @@ rct_window *window_create_auto_pos(int width, int height, rct_window_event_list
|
|||
// }
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
int x = 0;
|
||||
int y = 30;
|
||||
sint32 x = 0;
|
||||
sint32 y = 30;
|
||||
if (sub_6EA934(x, y, width, height)) goto foundSpace;
|
||||
|
||||
x = screenWidth - width;
|
||||
|
@ -677,9 +677,9 @@ foundSpace:
|
|||
return window_create(x, y, width, height, event_handlers, cls, flags);
|
||||
}
|
||||
|
||||
rct_window *window_create_centred(int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
rct_window *window_create_centred(sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags)
|
||||
{
|
||||
int x, y;
|
||||
sint32 x, y;
|
||||
|
||||
x = (gScreenWidth - width) / 2;
|
||||
y = max(28, (gScreenHeight - height) / 2);
|
||||
|
@ -694,7 +694,7 @@ rct_window *window_create_centred(int width, int height, rct_window_event_list *
|
|||
*/
|
||||
void window_close(rct_window* window)
|
||||
{
|
||||
int num_windows;
|
||||
sint32 num_windows;
|
||||
|
||||
if (window == NULL)
|
||||
return;
|
||||
|
@ -721,7 +721,7 @@ void window_close(rct_window* window)
|
|||
|
||||
// Remove window from list and reshift all windows
|
||||
RCT2_NEW_WINDOW--;
|
||||
num_windows = (int)(RCT2_NEW_WINDOW - window);
|
||||
num_windows = (sint32)(RCT2_NEW_WINDOW - window);
|
||||
if (num_windows > 0)
|
||||
memmove(window, window + 1, num_windows * sizeof(rct_window));
|
||||
|
||||
|
@ -856,10 +856,10 @@ void window_close_all_except_class(rct_windowclass cls)
|
|||
*
|
||||
* rct2: 0x006EA845
|
||||
*/
|
||||
rct_window *window_find_from_point(int x, int y)
|
||||
rct_window *window_find_from_point(sint32 x, sint32 y)
|
||||
{
|
||||
rct_window *w;
|
||||
int widget_index;
|
||||
sint32 widget_index;
|
||||
|
||||
for (w = RCT2_LAST_WINDOW; w >= g_window_list; w--) {
|
||||
if (x < w->x || x >= w->x + w->width || y < w->y || y >= w->y + w->height)
|
||||
|
@ -885,14 +885,14 @@ rct_window *window_find_from_point(int x, int y)
|
|||
* returns widget_index (edx)
|
||||
* EDI NEEDS TO BE SET TO w->widgets[widget_index] AFTER
|
||||
*/
|
||||
int window_find_widget_from_point(rct_window *w, int x, int y)
|
||||
sint32 window_find_widget_from_point(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
// Invalidate the window
|
||||
window_event_invalidate_call(w);
|
||||
|
||||
// Find the widget at point x, y
|
||||
int widget_index = -1;
|
||||
for (int i = 0;; i++) {
|
||||
sint32 widget_index = -1;
|
||||
for (sint32 i = 0;; i++) {
|
||||
rct_widget *widget = &w->widgets[i];
|
||||
if (widget->type == WWT_LAST) {
|
||||
break;
|
||||
|
@ -971,13 +971,13 @@ void window_invalidate_all()
|
|||
* Invalidates the specified widget of a window.
|
||||
* rct2: 0x006EC402
|
||||
*/
|
||||
void widget_invalidate(rct_window *w, int widgetIndex)
|
||||
void widget_invalidate(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_widget* widget;
|
||||
|
||||
assert(w != NULL);
|
||||
#if DEBUG
|
||||
for (int i = 0; i <= widgetIndex; i++) {
|
||||
for (sint32 i = 0; i <= widgetIndex; i++) {
|
||||
assert(w->widgets[i].type != WWT_LAST);
|
||||
}
|
||||
#endif
|
||||
|
@ -992,7 +992,7 @@ void widget_invalidate(rct_window *w, int widgetIndex)
|
|||
/**
|
||||
* Invalidates the specified widget of all windows that match the specified window class.
|
||||
*/
|
||||
void widget_invalidate_by_class(rct_windowclass cls, int widgetIndex)
|
||||
void widget_invalidate_by_class(rct_windowclass cls, sint32 widgetIndex)
|
||||
{
|
||||
rct_window* w;
|
||||
|
||||
|
@ -1008,7 +1008,7 @@ void widget_invalidate_by_class(rct_windowclass cls, int widgetIndex)
|
|||
* @param cls (al) with bit 15 set
|
||||
* @param number (bx)
|
||||
*/
|
||||
void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, int widgetIndex)
|
||||
void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, sint32 widgetIndex)
|
||||
{
|
||||
rct_window* w;
|
||||
|
||||
|
@ -1027,8 +1027,8 @@ void window_init_scroll_widgets(rct_window *w)
|
|||
{
|
||||
rct_widget* widget;
|
||||
rct_scroll* scroll;
|
||||
int widget_index, scroll_index;
|
||||
int width, height;
|
||||
sint32 widget_index, scroll_index;
|
||||
sint32 width, height;
|
||||
|
||||
widget_index = 0;
|
||||
scroll_index = 0;
|
||||
|
@ -1068,7 +1068,7 @@ void window_init_scroll_widgets(rct_window *w)
|
|||
*/
|
||||
void window_update_scroll_widgets(rct_window *w)
|
||||
{
|
||||
int widgetIndex, scrollIndex, width, height, scrollPositionChanged;
|
||||
sint32 widgetIndex, scrollIndex, width, height, scrollPositionChanged;
|
||||
rct_scroll *scroll;
|
||||
rct_widget *widget;
|
||||
|
||||
|
@ -1111,9 +1111,9 @@ void window_update_scroll_widgets(rct_window *w)
|
|||
}
|
||||
}
|
||||
|
||||
int window_get_scroll_data_index(rct_window *w, int widget_index)
|
||||
sint32 window_get_scroll_data_index(rct_window *w, sint32 widget_index)
|
||||
{
|
||||
int i, result;
|
||||
sint32 i, result;
|
||||
|
||||
result = 0;
|
||||
assert(w != NULL);
|
||||
|
@ -1150,7 +1150,7 @@ rct_window *window_bring_to_front(rct_window *w)
|
|||
}
|
||||
|
||||
if (w->x + w->width < 20) {
|
||||
int i = 20 - w->x;
|
||||
sint32 i = 20 - w->x;
|
||||
w->x += i;
|
||||
if (w->viewport != NULL)
|
||||
w->viewport->x += i;
|
||||
|
@ -1231,7 +1231,7 @@ void window_push_others_right(rct_window* window)
|
|||
*/
|
||||
void window_push_others_below(rct_window *w1)
|
||||
{
|
||||
int push_amount;
|
||||
sint32 push_amount;
|
||||
rct_window* w2;
|
||||
|
||||
// Enumerate through all other windows
|
||||
|
@ -1289,7 +1289,7 @@ rct_window *window_get_main()
|
|||
*/
|
||||
void window_scroll_to_viewport(rct_window *w)
|
||||
{
|
||||
int x, y, z;
|
||||
sint32 x, y, z;
|
||||
rct_window *mainWindow;
|
||||
assert(w != NULL);
|
||||
// In original checked to make sure x and y were not -1 as well.
|
||||
|
@ -1320,7 +1320,7 @@ void window_scroll_to_viewport(rct_window *w)
|
|||
* @param y (ecx)
|
||||
* @param z (edx)
|
||||
*/
|
||||
void window_scroll_to_location(rct_window *w, int x, int y, int z)
|
||||
void window_scroll_to_location(rct_window *w, sint32 x, sint32 y, sint32 z)
|
||||
{
|
||||
rct_xyz16 location_3d = {
|
||||
.x = x,
|
||||
|
@ -1345,9 +1345,9 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
|
|||
|
||||
rct_xy16 map_coordinate = coordinate_3d_to_2d(&location_3d, get_current_rotation());
|
||||
|
||||
int i = 0;
|
||||
sint32 i = 0;
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
|
||||
int found = 0;
|
||||
sint32 found = 0;
|
||||
while (!found) {
|
||||
sint16 x2 = w->viewport->x + (sint16)(w->viewport->width * window_scroll_locations[i][0]);
|
||||
sint16 y2 = w->viewport->y + (sint16)(w->viewport->height * window_scroll_locations[i][1]);
|
||||
|
@ -1405,7 +1405,7 @@ static void sub_688956()
|
|||
* 1: clockwise
|
||||
* -1: anti-clockwise
|
||||
*/
|
||||
void window_rotate_camera(rct_window *w, int direction)
|
||||
void window_rotate_camera(rct_window *w, sint32 direction)
|
||||
{
|
||||
rct_viewport *viewport = w->viewport;
|
||||
if (viewport == NULL)
|
||||
|
@ -1433,7 +1433,7 @@ void window_rotate_camera(rct_window *w, int direction)
|
|||
|
||||
gCurrentRotation = (get_current_rotation() + direction) & 3;
|
||||
|
||||
int new_x, new_y;
|
||||
sint32 new_x, new_y;
|
||||
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
|
||||
|
||||
w->saved_view_x = new_x;
|
||||
|
@ -1450,19 +1450,19 @@ void window_rotate_camera(rct_window *w, int direction)
|
|||
void window_viewport_get_map_coords_by_cursor(rct_window *w, sint16 *map_x, sint16 *map_y, sint16 *offset_x, sint16 *offset_y)
|
||||
{
|
||||
// Get mouse position to offset against.
|
||||
int mouse_x, mouse_y;
|
||||
sint32 mouse_x, mouse_y;
|
||||
platform_get_cursor_position_scaled(&mouse_x, &mouse_y);
|
||||
|
||||
// Compute map coordinate by mouse position.
|
||||
get_map_coordinates_from_pos(mouse_x, mouse_y, VIEWPORT_INTERACTION_MASK_NONE, map_x, map_y, NULL, NULL, NULL);
|
||||
|
||||
// Get viewport coordinates centring around the tile.
|
||||
int base_height = map_element_height(*map_x, *map_y);
|
||||
int dest_x, dest_y;
|
||||
sint32 base_height = map_element_height(*map_x, *map_y);
|
||||
sint32 dest_x, dest_y;
|
||||
center_2d_coordinates(*map_x, *map_y, base_height, &dest_x, &dest_y, w->viewport);
|
||||
|
||||
// Rebase mouse position onto centre of window, and compensate for zoom level.
|
||||
int rebased_x = ((w->width >> 1) - mouse_x) * (1 << w->viewport->zoom),
|
||||
sint32 rebased_x = ((w->width >> 1) - mouse_x) * (1 << w->viewport->zoom),
|
||||
rebased_y = ((w->height >> 1) - mouse_y) * (1 << w->viewport->zoom);
|
||||
|
||||
// Compute cursor offset relative to tile.
|
||||
|
@ -1473,16 +1473,16 @@ void window_viewport_get_map_coords_by_cursor(rct_window *w, sint16 *map_x, sint
|
|||
void window_viewport_centre_tile_around_cursor(rct_window *w, sint16 map_x, sint16 map_y, sint16 offset_x, sint16 offset_y)
|
||||
{
|
||||
// Get viewport coordinates centring around the tile.
|
||||
int dest_x, dest_y;
|
||||
int base_height = map_element_height(map_x, map_y);
|
||||
sint32 dest_x, dest_y;
|
||||
sint32 base_height = map_element_height(map_x, map_y);
|
||||
center_2d_coordinates(map_x, map_y, base_height, &dest_x, &dest_y, w->viewport);
|
||||
|
||||
// Get mouse position to offset against.
|
||||
int mouse_x, mouse_y;
|
||||
sint32 mouse_x, mouse_y;
|
||||
platform_get_cursor_position_scaled(&mouse_x, &mouse_y);
|
||||
|
||||
// Rebase mouse position onto centre of window, and compensate for zoom level.
|
||||
int rebased_x = ((w->width >> 1) - mouse_x) * (1 << w->viewport->zoom),
|
||||
sint32 rebased_x = ((w->width >> 1) - mouse_x) * (1 << w->viewport->zoom),
|
||||
rebased_y = ((w->height >> 1) - mouse_y) * (1 << w->viewport->zoom);
|
||||
|
||||
// Apply offset to the viewport.
|
||||
|
@ -1490,7 +1490,7 @@ void window_viewport_centre_tile_around_cursor(rct_window *w, sint16 map_x, sint
|
|||
w->saved_view_y = dest_y + rebased_y + (offset_y / (1 << w->viewport->zoom));
|
||||
}
|
||||
|
||||
void window_zoom_set(rct_window *w, int zoomLevel, bool atCursor)
|
||||
void window_zoom_set(rct_window *w, sint32 zoomLevel, bool atCursor)
|
||||
{
|
||||
rct_viewport* v = w->viewport;
|
||||
|
||||
|
@ -1574,7 +1574,7 @@ void main_window_zoom(bool zoomIn, bool atCursor) {
|
|||
* right (dx)
|
||||
* bottom (bp)
|
||||
*/
|
||||
void window_draw(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom)
|
||||
void window_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
{
|
||||
if (!window_is_visible(w)) return;
|
||||
|
||||
|
@ -1603,7 +1603,7 @@ void window_draw(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int r
|
|||
* Splits a drawing of a window into regions that can be seen and are not hidden
|
||||
* by other opaque overlapping windows.
|
||||
*/
|
||||
static int window_draw_split(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom)
|
||||
static sint32 window_draw_split(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
{
|
||||
rct_window* topwindow;
|
||||
|
||||
|
@ -1644,14 +1644,14 @@ static int window_draw_split(rct_drawpixelinfo *dpi, rct_window *w, int left, in
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void window_draw_single(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom)
|
||||
static void window_draw_single(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom)
|
||||
{
|
||||
// Copy dpi so we can crop it
|
||||
rct_drawpixelinfo copy = *dpi;
|
||||
dpi = ©
|
||||
|
||||
// Clamp left to 0
|
||||
int overflow = left - dpi->x;
|
||||
sint32 overflow = left - dpi->x;
|
||||
if (overflow > 0) {
|
||||
dpi->x += overflow;
|
||||
dpi->width -= overflow;
|
||||
|
@ -1711,7 +1711,7 @@ static void window_draw_single(rct_drawpixelinfo *dpi, rct_window *w, int left,
|
|||
void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
{
|
||||
rct_widget *widget;
|
||||
int widgetIndex;
|
||||
sint32 widgetIndex;
|
||||
|
||||
if ((w->flags & WF_TRANSPARENT) && !(w->flags & WF_NO_BACKGROUND))
|
||||
gfx_filter_rect(dpi, w->x, w->y, w->x + w->width - 1, w->y + w->height - 1, PALETTE_51);
|
||||
|
@ -1747,12 +1747,12 @@ void window_draw_viewport(rct_drawpixelinfo *dpi, rct_window *w)
|
|||
viewport_render(dpi, w->viewport, dpi->x, dpi->y, dpi->x + dpi->width, dpi->y + dpi->height);
|
||||
}
|
||||
|
||||
void window_set_position(rct_window *w, int x, int y)
|
||||
void window_set_position(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
window_move_position(w, x - w->x, y - w->y);
|
||||
}
|
||||
|
||||
void window_move_position(rct_window *w, int dx, int dy)
|
||||
void window_move_position(rct_window *w, sint32 dx, sint32 dy)
|
||||
{
|
||||
if (dx == 0 && dy == 0)
|
||||
return;
|
||||
|
@ -1772,9 +1772,9 @@ void window_move_position(rct_window *w, int dx, int dy)
|
|||
window_invalidate(w);
|
||||
}
|
||||
|
||||
void window_resize(rct_window *w, int dw, int dh)
|
||||
void window_resize(rct_window *w, sint32 dw, sint32 dh)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
if (dw == 0 && dh == 0)
|
||||
return;
|
||||
|
||||
|
@ -1799,7 +1799,7 @@ void window_resize(rct_window *w, int dw, int dh)
|
|||
window_invalidate(w);
|
||||
}
|
||||
|
||||
void window_set_resize(rct_window *w, int minWidth, int minHeight, int maxWidth, int maxHeight)
|
||||
void window_set_resize(rct_window *w, sint32 minWidth, sint32 minHeight, sint32 maxWidth, sint32 maxHeight)
|
||||
{
|
||||
w->min_width = minWidth;
|
||||
w->min_height = minHeight;
|
||||
|
@ -1807,8 +1807,8 @@ void window_set_resize(rct_window *w, int minWidth, int minHeight, int maxWidth,
|
|||
w->max_height = maxHeight;
|
||||
|
||||
// Clamp width and height to minimum and maximum
|
||||
int width = clamp(minWidth, w->width, maxWidth);
|
||||
int height = clamp(minHeight, w->height, maxHeight);
|
||||
sint32 width = clamp(minWidth, w->width, maxWidth);
|
||||
sint32 height = clamp(minHeight, w->height, maxHeight);
|
||||
|
||||
// Resize window if size has changed
|
||||
if (w->width != width || w->height != height) {
|
||||
|
@ -1827,7 +1827,7 @@ void window_set_resize(rct_window *w, int minWidth, int minHeight, int maxWidth,
|
|||
* @param widgetIndex (dx)
|
||||
* @param w (esi)
|
||||
*/
|
||||
int tool_set(rct_window *w, int widgetIndex, int tool)
|
||||
sint32 tool_set(rct_window *w, sint32 widgetIndex, sint32 tool)
|
||||
{
|
||||
if (gInputFlags & INPUT_FLAG_TOOL_ACTIVE) {
|
||||
if (
|
||||
|
@ -1891,7 +1891,7 @@ void window_event_close_call(rct_window *w)
|
|||
w->event_handlers->close(w);
|
||||
}
|
||||
|
||||
void window_event_mouse_up_call(rct_window *w, int widgetIndex)
|
||||
void window_event_mouse_up_call(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->mouse_up != NULL)
|
||||
w->event_handlers->mouse_up(w, widgetIndex);
|
||||
|
@ -1903,13 +1903,13 @@ void window_event_resize_call(rct_window *w)
|
|||
w->event_handlers->resize(w);
|
||||
}
|
||||
|
||||
void window_event_mouse_down_call(rct_window *w, int widgetIndex)
|
||||
void window_event_mouse_down_call(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->mouse_down != NULL)
|
||||
w->event_handlers->mouse_down(widgetIndex, w, &w->widgets[widgetIndex]);
|
||||
}
|
||||
|
||||
void window_event_dropdown_call(rct_window *w, int widgetIndex, int dropdownIndex)
|
||||
void window_event_dropdown_call(rct_window *w, sint32 widgetIndex, sint32 dropdownIndex)
|
||||
{
|
||||
if (w->event_handlers->dropdown != NULL)
|
||||
w->event_handlers->dropdown(w, widgetIndex, dropdownIndex);
|
||||
|
@ -1939,31 +1939,31 @@ void window_event_unknown_08_call(rct_window *w)
|
|||
w->event_handlers->unknown_08(w);
|
||||
}
|
||||
|
||||
void window_event_tool_update_call(rct_window *w, int widgetIndex, int x, int y)
|
||||
void window_event_tool_update_call(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_update != NULL)
|
||||
w->event_handlers->tool_update(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_down_call(rct_window *w, int widgetIndex, int x, int y)
|
||||
void window_event_tool_down_call(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_down != NULL)
|
||||
w->event_handlers->tool_down(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_drag_call(rct_window *w, int widgetIndex, int x, int y)
|
||||
void window_event_tool_drag_call(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_drag != NULL)
|
||||
w->event_handlers->tool_drag(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_up_call(rct_window *w, int widgetIndex, int x, int y)
|
||||
void window_event_tool_up_call(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->tool_up != NULL)
|
||||
w->event_handlers->tool_up(w, widgetIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_tool_abort_call(rct_window *w, int widgetIndex)
|
||||
void window_event_tool_abort_call(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
if (w->event_handlers->tool_abort != NULL)
|
||||
w->event_handlers->tool_abort(w, widgetIndex);
|
||||
|
@ -1975,32 +1975,32 @@ void window_event_unknown_0E_call(rct_window *w)
|
|||
w->event_handlers->unknown_0E(w);
|
||||
}
|
||||
|
||||
void window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height)
|
||||
void window_get_scroll_size(rct_window *w, sint32 scrollIndex, sint32 *width, sint32 *height)
|
||||
{
|
||||
if (w->event_handlers->get_scroll_size != NULL) {
|
||||
w->event_handlers->get_scroll_size(w, scrollIndex, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void window_event_scroll_mousedown_call(rct_window *w, int scrollIndex, int x, int y)
|
||||
void window_event_scroll_mousedown_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mousedown != NULL)
|
||||
w->event_handlers->scroll_mousedown(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mousedrag_call(rct_window *w, int scrollIndex, int x, int y)
|
||||
void window_event_scroll_mousedrag_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mousedrag != NULL)
|
||||
w->event_handlers->scroll_mousedrag(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_scroll_mouseover_call(rct_window *w, int scrollIndex, int x, int y)
|
||||
void window_event_scroll_mouseover_call(rct_window *w, sint32 scrollIndex, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->scroll_mouseover != NULL)
|
||||
w->event_handlers->scroll_mouseover(w, scrollIndex, x, y);
|
||||
}
|
||||
|
||||
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text)
|
||||
void window_event_textinput_call(rct_window *w, sint32 widgetIndex, char *text)
|
||||
{
|
||||
if (w->event_handlers->text_input != NULL)
|
||||
w->event_handlers->text_input(w, widgetIndex, text);
|
||||
|
@ -2012,13 +2012,13 @@ void window_event_unknown_14_call(rct_window *w)
|
|||
w->event_handlers->unknown_14(w);
|
||||
}
|
||||
|
||||
void window_event_unknown_15_call(rct_window *w, int scrollIndex, int scrollAreaType)
|
||||
void window_event_unknown_15_call(rct_window *w, sint32 scrollIndex, sint32 scrollAreaType)
|
||||
{
|
||||
if (w->event_handlers->unknown_15 != NULL)
|
||||
w->event_handlers->unknown_15(w, scrollIndex, scrollAreaType);
|
||||
}
|
||||
|
||||
rct_string_id window_event_tooltip_call(rct_window *w, int widgetIndex)
|
||||
rct_string_id window_event_tooltip_call(rct_window *w, sint32 widgetIndex)
|
||||
{
|
||||
rct_string_id result = 0;
|
||||
if (w->event_handlers->tooltip != NULL)
|
||||
|
@ -2026,15 +2026,15 @@ rct_string_id window_event_tooltip_call(rct_window *w, int widgetIndex)
|
|||
return result;
|
||||
}
|
||||
|
||||
int window_event_cursor_call(rct_window *w, int widgetIndex, int x, int y)
|
||||
sint32 window_event_cursor_call(rct_window *w, sint32 widgetIndex, sint32 x, sint32 y)
|
||||
{
|
||||
int cursorId = CURSOR_ARROW;
|
||||
sint32 cursorId = CURSOR_ARROW;
|
||||
if (w->event_handlers->cursor != NULL)
|
||||
w->event_handlers->cursor(w, widgetIndex, x, y, &cursorId);
|
||||
return cursorId;
|
||||
}
|
||||
|
||||
void window_event_moved_call(rct_window *w, int x, int y)
|
||||
void window_event_moved_call(rct_window *w, sint32 x, sint32 y)
|
||||
{
|
||||
if (w->event_handlers->moved != NULL)
|
||||
w->event_handlers->moved(w, x, y);
|
||||
|
@ -2052,7 +2052,7 @@ void window_event_paint_call(rct_window *w, rct_drawpixelinfo *dpi)
|
|||
w->event_handlers->paint(w, dpi);
|
||||
}
|
||||
|
||||
void window_event_scroll_paint_call(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex)
|
||||
void window_event_scroll_paint_call(rct_window *w, rct_drawpixelinfo *dpi, sint32 scrollIndex)
|
||||
{
|
||||
if (w->event_handlers->scroll_paint != NULL)
|
||||
w->event_handlers->scroll_paint(w, dpi, scrollIndex);
|
||||
|
@ -2063,7 +2063,7 @@ void window_event_scroll_paint_call(rct_window *w, rct_drawpixelinfo *dpi, int s
|
|||
* the two locations.
|
||||
* rct2: New function not from rct2
|
||||
*/
|
||||
void window_bubble_list_item(rct_window* w, int item_position){
|
||||
void window_bubble_list_item(rct_window* w, sint32 item_position){
|
||||
char swap = w->list_item_positions[item_position];
|
||||
w->list_item_positions[item_position] = w->list_item_positions[item_position + 1];
|
||||
w->list_item_positions[item_position + 1] = swap;
|
||||
|
@ -2075,8 +2075,8 @@ void window_bubble_list_item(rct_window* w, int item_position){
|
|||
* Called after a window resize to move windows if they
|
||||
* are going to be out of sight.
|
||||
*/
|
||||
void window_relocate_windows(int width, int height){
|
||||
int new_location = 8;
|
||||
void window_relocate_windows(sint32 width, sint32 height){
|
||||
sint32 new_location = 8;
|
||||
for (rct_window* w = g_window_list; w < RCT2_NEW_WINDOW; w++){
|
||||
|
||||
// Work out if the window requires moving
|
||||
|
@ -2088,8 +2088,8 @@ void window_relocate_windows(int width, int height){
|
|||
}
|
||||
|
||||
// Calculate the new locations
|
||||
int x = w->x;
|
||||
int y = w->y;
|
||||
sint32 x = w->x;
|
||||
sint32 y = w->y;
|
||||
w->x = new_location;
|
||||
w->y = new_location + 28;
|
||||
|
||||
|
@ -2107,7 +2107,7 @@ void window_relocate_windows(int width, int height){
|
|||
/**
|
||||
* rct2: 0x0066B905
|
||||
*/
|
||||
void window_resize_gui(int width, int height)
|
||||
void window_resize_gui(sint32 width, sint32 height)
|
||||
{
|
||||
if (gScreenFlags & 0xE){
|
||||
window_resize_gui_scenario_editor(width, height);
|
||||
|
@ -2162,7 +2162,7 @@ void window_resize_gui(int width, int height)
|
|||
/**
|
||||
* rct2: 0x0066F0DD
|
||||
*/
|
||||
void window_resize_gui_scenario_editor(int width, int height)
|
||||
void window_resize_gui_scenario_editor(sint32 width, sint32 height)
|
||||
{
|
||||
rct_window* mainWind = window_get_main();
|
||||
if (mainWind) {
|
||||
|
@ -2195,8 +2195,8 @@ void window_resize_gui_scenario_editor(int width, int height)
|
|||
/* Based on rct2: 0x6987ED and another version from window_park */
|
||||
void window_align_tabs(rct_window *w, uint8 start_tab_id, uint8 end_tab_id)
|
||||
{
|
||||
int i, x = w->widgets[start_tab_id].left;
|
||||
int tab_width = w->widgets[start_tab_id].right - w->widgets[start_tab_id].left;
|
||||
sint32 i, x = w->widgets[start_tab_id].left;
|
||||
sint32 tab_width = w->widgets[start_tab_id].right - w->widgets[start_tab_id].left;
|
||||
|
||||
for (i = start_tab_id; i <= end_tab_id; i++) {
|
||||
if (!(w->disabled_widgets & (1LL << i))) {
|
||||
|
@ -2225,7 +2225,7 @@ void window_close_construction_windows()
|
|||
*/
|
||||
static void window_invalidate_pressed_image_buttons(rct_window *w)
|
||||
{
|
||||
int widgetIndex;
|
||||
sint32 widgetIndex;
|
||||
rct_widget *widget;
|
||||
|
||||
widgetIndex = 0;
|
||||
|
@ -2286,9 +2286,9 @@ void window_update_viewport_ride_music()
|
|||
}
|
||||
}
|
||||
|
||||
static void window_snap_left(rct_window *w, int proximity)
|
||||
static void window_snap_left(rct_window *w, sint32 proximity)
|
||||
{
|
||||
int right, rightMost, wLeftProximity, wRightProximity, wBottom;
|
||||
sint32 right, rightMost, wLeftProximity, wRightProximity, wBottom;
|
||||
rct_window *mainWindow, *w2;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
|
@ -2319,9 +2319,9 @@ static void window_snap_left(rct_window *w, int proximity)
|
|||
w->x = rightMost;
|
||||
}
|
||||
|
||||
static void window_snap_top(rct_window *w, int proximity)
|
||||
static void window_snap_top(rct_window *w, sint32 proximity)
|
||||
{
|
||||
int bottom, bottomMost, wTopProximity, wBottomProximity, wRight;
|
||||
sint32 bottom, bottomMost, wTopProximity, wBottomProximity, wRight;
|
||||
rct_window *mainWindow, *w2;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
|
@ -2352,9 +2352,9 @@ static void window_snap_top(rct_window *w, int proximity)
|
|||
w->y = bottomMost;
|
||||
}
|
||||
|
||||
static void window_snap_right(rct_window *w, int proximity)
|
||||
static void window_snap_right(rct_window *w, sint32 proximity)
|
||||
{
|
||||
int leftMost, wLeftProximity, wRightProximity, wRight, wBottom, screenWidth;
|
||||
sint32 leftMost, wLeftProximity, wRightProximity, wRight, wBottom, screenWidth;
|
||||
rct_window *mainWindow, *w2;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
|
@ -2385,9 +2385,9 @@ static void window_snap_right(rct_window *w, int proximity)
|
|||
w->x = leftMost - w->width;
|
||||
}
|
||||
|
||||
static void window_snap_bottom(rct_window *w, int proximity)
|
||||
static void window_snap_bottom(rct_window *w, sint32 proximity)
|
||||
{
|
||||
int topMost, wTopProximity, wBottomProximity, wRight, wBottom, screenHeight;
|
||||
sint32 topMost, wTopProximity, wBottomProximity, wRight, wBottom, screenHeight;
|
||||
rct_window *mainWindow, *w2;
|
||||
|
||||
mainWindow = window_get_main();
|
||||
|
@ -2418,10 +2418,10 @@ static void window_snap_bottom(rct_window *w, int proximity)
|
|||
w->y = topMost - w->height;
|
||||
}
|
||||
|
||||
void window_move_and_snap(rct_window *w, int newWindowX, int newWindowY, int snapProximity)
|
||||
void window_move_and_snap(rct_window *w, sint32 newWindowX, sint32 newWindowY, sint32 snapProximity)
|
||||
{
|
||||
int originalX = w->x;
|
||||
int originalY = w->y;
|
||||
sint32 originalX = w->x;
|
||||
sint32 originalY = w->y;
|
||||
|
||||
newWindowY = clamp(29, newWindowY, gScreenHeight - 34);
|
||||
|
||||
|
@ -2446,7 +2446,7 @@ void window_move_and_snap(rct_window *w, int newWindowX, int newWindowY, int sna
|
|||
window_set_position(w, newWindowX, newWindowY);
|
||||
}
|
||||
|
||||
int window_can_resize(rct_window *w)
|
||||
sint32 window_can_resize(rct_window *w)
|
||||
{
|
||||
return (w->flags & WF_RESIZABLE) && (w->min_width != w->max_width || w->min_height != w->max_height);
|
||||
}
|
||||
|
@ -2460,7 +2460,7 @@ void textinput_cancel()
|
|||
window_close_by_class(WC_TEXTINPUT);
|
||||
}
|
||||
|
||||
void window_start_textbox(rct_window *call_w, int call_widget, rct_string_id existing_text, char * existing_args, int maxLength)
|
||||
void window_start_textbox(rct_window *call_w, sint32 call_widget, rct_string_id existing_text, char * existing_args, sint32 maxLength)
|
||||
{
|
||||
if (gUsingWidgetTextBox)
|
||||
window_cancel_textbox();
|
||||
|
|
|
@ -36,8 +36,8 @@ struct TitleSequence;
|
|||
|
||||
extern uint16 TextInputDescriptionArgs[4];
|
||||
extern char gTextBoxInput[512];
|
||||
extern int gMaxTextBoxInputLength;
|
||||
extern int gTextBoxFrameNo;
|
||||
extern sint32 gMaxTextBoxInputLength;
|
||||
extern sint32 gTextBoxFrameNo;
|
||||
extern bool gUsingWidgetTextBox;
|
||||
|
||||
typedef void wndproc(struct rct_window*, union rct_window_event*);
|
||||
|
@ -53,7 +53,7 @@ typedef struct window_identifier {
|
|||
|
||||
typedef struct widget_identifier {
|
||||
window_identifier window;
|
||||
int widget_index;
|
||||
sint32 widget_index;
|
||||
} widget_identifier;
|
||||
|
||||
extern widget_identifier gCurrentTextBox;
|
||||
|
@ -148,33 +148,33 @@ enum{
|
|||
|
||||
typedef struct rct_window_event_list {
|
||||
void (*close)(struct rct_window*);
|
||||
void (*mouse_up)(struct rct_window*, int);
|
||||
void (*mouse_up)(struct rct_window*, sint32);
|
||||
void (*resize)(struct rct_window*);
|
||||
void (*mouse_down)(int, struct rct_window*, rct_widget*);
|
||||
void (*dropdown)(struct rct_window*, int, int);
|
||||
void (*mouse_down)(sint32, struct rct_window*, rct_widget*);
|
||||
void (*dropdown)(struct rct_window*, sint32, sint32);
|
||||
void (*unknown_05)(struct rct_window*);
|
||||
void (*update)(struct rct_window*);
|
||||
void (*unknown_07)(struct rct_window*);
|
||||
void (*unknown_08)(struct rct_window*);
|
||||
void (*tool_update)(struct rct_window*, int, int, int);
|
||||
void (*tool_down)(struct rct_window*, int, int, int);
|
||||
void (*tool_drag)(struct rct_window*, int, int, int);
|
||||
void (*tool_up)(struct rct_window*, int, int, int);
|
||||
void (*tool_abort)(struct rct_window*, int);
|
||||
void (*tool_update)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*tool_down)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*tool_drag)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*tool_up)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*tool_abort)(struct rct_window*, sint32);
|
||||
void (*unknown_0E)(struct rct_window*);
|
||||
void (*get_scroll_size)(struct rct_window*, int, int*, int*);
|
||||
void (*scroll_mousedown)(struct rct_window*, int, int, int);
|
||||
void (*scroll_mousedrag)(struct rct_window*, int, int, int);
|
||||
void (*scroll_mouseover)(struct rct_window*, int, int, int);
|
||||
void (*text_input)(struct rct_window*, int, char*);
|
||||
void (*get_scroll_size)(struct rct_window*, sint32, sint32*, sint32*);
|
||||
void (*scroll_mousedown)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*scroll_mousedrag)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*scroll_mouseover)(struct rct_window*, sint32, sint32, sint32);
|
||||
void (*text_input)(struct rct_window*, sint32, char*);
|
||||
void (*unknown_14)(struct rct_window*);
|
||||
void (*unknown_15)(struct rct_window*, int, int);
|
||||
void (*tooltip)(struct rct_window*, int, rct_string_id*);
|
||||
void (*cursor)(struct rct_window*, int, int, int, int*);
|
||||
void (*moved)(struct rct_window*, int, int);
|
||||
void (*unknown_15)(struct rct_window*, sint32, sint32);
|
||||
void (*tooltip)(struct rct_window*, sint32, rct_string_id*);
|
||||
void (*cursor)(struct rct_window*, sint32, sint32, sint32, sint32*);
|
||||
void (*moved)(struct rct_window*, sint32, sint32);
|
||||
void (*invalidate)(struct rct_window*);
|
||||
void (*paint)(struct rct_window*, rct_drawpixelinfo*);
|
||||
void (*scroll_paint)(struct rct_window*, rct_drawpixelinfo*, int);
|
||||
void (*scroll_paint)(struct rct_window*, rct_drawpixelinfo*, sint32);
|
||||
} rct_window_event_list;
|
||||
|
||||
typedef struct campaign_variables {
|
||||
|
@ -526,8 +526,8 @@ enum GUEST_LIST_FILTER_TYPE
|
|||
GLFT_GUESTS_THINKING_X,
|
||||
};
|
||||
|
||||
typedef void (*modal_callback)(int result);
|
||||
typedef void (*loadsave_callback)(int result, const utf8 * path);
|
||||
typedef void (*modal_callback)(sint32 result);
|
||||
typedef void (*loadsave_callback)(sint32 result, const utf8 * path);
|
||||
typedef void (*scenarioselect_callback)(const utf8 *path);
|
||||
|
||||
extern loadsave_callback gLoadSaveCallback;
|
||||
|
@ -560,11 +560,11 @@ void window_dispatch_update_all();
|
|||
void window_update_all_viewports();
|
||||
void window_update_all();
|
||||
|
||||
void window_set_window_limit(int value);
|
||||
void window_set_window_limit(sint32 value);
|
||||
|
||||
rct_window *window_create(int x, int y, int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_auto_pos(int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_centred(int width, int height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create(sint32 x, sint32 y, sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_auto_pos(sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
rct_window *window_create_centred(sint32 width, sint32 height, rct_window_event_list *event_handlers, rct_windowclass cls, uint16 flags);
|
||||
void window_close(rct_window *window);
|
||||
void window_close_by_class(rct_windowclass cls);
|
||||
void window_close_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
|
@ -573,18 +573,18 @@ void window_close_all();
|
|||
void window_close_all_except_class(rct_windowclass cls);
|
||||
rct_window *window_find_by_class(rct_windowclass cls);
|
||||
rct_window *window_find_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
rct_window *window_find_from_point(int x, int y);
|
||||
int window_find_widget_from_point(rct_window *w, int x, int y);
|
||||
rct_window *window_find_from_point(sint32 x, sint32 y);
|
||||
sint32 window_find_widget_from_point(rct_window *w, sint32 x, sint32 y);
|
||||
void window_invalidate(rct_window *window);
|
||||
void window_invalidate_by_class(rct_windowclass cls);
|
||||
void window_invalidate_by_number(rct_windowclass cls, rct_windownumber number);
|
||||
void window_invalidate_all();
|
||||
void widget_invalidate(rct_window *w, int widgetIndex);
|
||||
void widget_invalidate_by_class(rct_windowclass cls, int widgetIndex);
|
||||
void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, int widgetIndex);
|
||||
void widget_invalidate(rct_window *w, sint32 widgetIndex);
|
||||
void widget_invalidate_by_class(rct_windowclass cls, sint32 widgetIndex);
|
||||
void widget_invalidate_by_number(rct_windowclass cls, rct_windownumber number, sint32 widgetIndex);
|
||||
void window_init_scroll_widgets(rct_window *w);
|
||||
void window_update_scroll_widgets(rct_window *w);
|
||||
int window_get_scroll_data_index(rct_window *w, int widget_index);
|
||||
sint32 window_get_scroll_data_index(rct_window *w, sint32 widget_index);
|
||||
|
||||
rct_window *window_bring_to_front(rct_window *w);
|
||||
rct_window *window_bring_to_front_by_class(rct_windowclass cls);
|
||||
|
@ -596,29 +596,29 @@ void window_push_others_below(rct_window *w1);
|
|||
rct_window *window_get_main();
|
||||
|
||||
void window_scroll_to_viewport(rct_window *w);
|
||||
void window_scroll_to_location(rct_window *w, int x, int y, int z);
|
||||
void window_rotate_camera(rct_window *w, int direction);
|
||||
void window_scroll_to_location(rct_window *w, sint32 x, sint32 y, sint32 z);
|
||||
void window_rotate_camera(rct_window *w, sint32 direction);
|
||||
void window_viewport_get_map_coords_by_cursor(rct_window *w, sint16 *map_x, sint16 *map_y, sint16 *offset_x, sint16 *offset_y);
|
||||
void window_viewport_centre_tile_around_cursor(rct_window *w, sint16 map_x, sint16 map_y, sint16 offset_x, sint16 offset_y);
|
||||
void window_zoom_set(rct_window *w, int zoomLevel, bool atCursor);
|
||||
void window_zoom_set(rct_window *w, sint32 zoomLevel, bool atCursor);
|
||||
void window_zoom_in(rct_window *w, bool atCursor);
|
||||
void window_zoom_out(rct_window *w, bool atCursor);
|
||||
void main_window_zoom(bool zoomIn, bool atCursor);
|
||||
|
||||
void window_show_textinput(rct_window *w, int widgetIndex, uint16 title, uint16 text, int value);
|
||||
void window_text_input_key(rct_window* w, int key);
|
||||
void window_show_textinput(rct_window *w, sint32 widgetIndex, uint16 title, uint16 text, sint32 value);
|
||||
void window_text_input_key(rct_window* w, sint32 key);
|
||||
|
||||
void window_draw_all(rct_drawpixelinfo *dpi, short left, short top, short right, short bottom);
|
||||
void window_draw(rct_drawpixelinfo *dpi, rct_window *w, int left, int top, int right, int bottom);
|
||||
void window_draw_all(rct_drawpixelinfo *dpi, sint16 left, sint16 top, sint16 right, sint16 bottom);
|
||||
void window_draw(rct_drawpixelinfo *dpi, rct_window *w, sint32 left, sint32 top, sint32 right, sint32 bottom);
|
||||
void window_draw_widgets(rct_window *w, rct_drawpixelinfo *dpi);
|
||||
void window_draw_viewport(rct_drawpixelinfo *dpi, rct_window *w);
|
||||
|
||||
void window_set_position(rct_window *w, int x, int y);
|
||||
void window_move_position(rct_window *w, int dx, int dy);
|
||||
void window_resize(rct_window *w, int dw, int dh);
|
||||
void window_set_resize(rct_window *w, int minWidth, int minHeight, int maxWidth, int maxHeight);
|
||||
void window_set_position(rct_window *w, sint32 x, sint32 y);
|
||||
void window_move_position(rct_window *w, sint32 dx, sint32 dy);
|
||||
void window_resize(rct_window *w, sint32 dw, sint32 dh);
|
||||
void window_set_resize(rct_window *w, sint32 minWidth, sint32 minHeight, sint32 maxWidth, sint32 maxHeight);
|
||||
|
||||
int tool_set(rct_window *w, int widgetIndex, int tool);
|
||||
sint32 tool_set(rct_window *w, sint32 widgetIndex, sint32 tool);
|
||||
void tool_cancel();
|
||||
|
||||
void window_close_construction_windows();
|
||||
|
@ -627,9 +627,9 @@ void window_update_viewport_ride_music();
|
|||
|
||||
// Open window functions
|
||||
void window_main_open();
|
||||
void window_relocate_windows(int width, int height);
|
||||
void window_resize_gui(int width, int height);
|
||||
void window_resize_gui_scenario_editor(int width, int height);
|
||||
void window_relocate_windows(sint32 width, sint32 height);
|
||||
void window_resize_gui(sint32 width, sint32 height);
|
||||
void window_resize_gui_scenario_editor(sint32 width, sint32 height);
|
||||
void window_top_toolbar_open();
|
||||
void window_game_bottom_toolbar_open();
|
||||
void window_game_bottom_toolbar_invalidate_news_item();
|
||||
|
@ -649,11 +649,11 @@ void window_water_open();
|
|||
void window_land_rights_open();
|
||||
void window_staff_list_open();
|
||||
void window_guest_list_open();
|
||||
void window_guest_list_open_with_filter(int type, int index);
|
||||
void window_guest_list_open_with_filter(sint32 type, sint32 index);
|
||||
void window_map_open();
|
||||
void window_options_open();
|
||||
void window_shortcut_keys_open();
|
||||
void window_shortcut_change_open(int selected_key);
|
||||
void window_shortcut_change_open(sint32 selected_key);
|
||||
void window_guest_open(rct_peep* peep);
|
||||
rct_window *window_staff_open(rct_peep* peep);
|
||||
void window_staff_fire_prompt_open(rct_peep* peep);
|
||||
|
@ -665,18 +665,18 @@ void window_park_rating_open();
|
|||
void window_finances_open();
|
||||
void window_finances_research_open();
|
||||
void window_new_campaign_open(sint16 campaignType);
|
||||
rct_window *window_ride_main_open(int rideIndex);
|
||||
rct_window *window_ride_open_station(int rideIndex, int stationIndex);
|
||||
rct_window *window_ride_main_open(sint32 rideIndex);
|
||||
rct_window *window_ride_open_station(sint32 rideIndex, sint32 stationIndex);
|
||||
rct_window *window_ride_open_track(rct_map_element *mapElement);
|
||||
rct_window *window_ride_open_vehicle(rct_vehicle *vehicle);
|
||||
void window_ride_demolish_prompt_open(int rideIndex);
|
||||
void window_ride_demolish_prompt_open(sint32 rideIndex);
|
||||
void window_ride_construct(rct_window *w);
|
||||
void window_ride_list_open();
|
||||
rct_window *window_ride_construction_open();
|
||||
rct_window *window_maze_construction_open();
|
||||
void ride_construction_toolupdate_entrance_exit(int screenX, int screenY);
|
||||
void ride_construction_toolupdate_construct(int screenX, int screenY);
|
||||
void ride_construction_tooldown_construct(int screenX, int screenY);
|
||||
void ride_construction_toolupdate_entrance_exit(sint32 screenX, sint32 screenY);
|
||||
void ride_construction_toolupdate_construct(sint32 screenX, sint32 screenY);
|
||||
void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY);
|
||||
|
||||
void custom_currency_window_open();
|
||||
|
||||
|
@ -699,8 +699,8 @@ void window_server_list_open();
|
|||
void window_server_start_open();
|
||||
|
||||
void window_research_open();
|
||||
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, int baseWidgetIndex);
|
||||
void window_research_funding_page_paint(rct_window *w, rct_drawpixelinfo *dpi, int baseWidgetIndex);
|
||||
void window_research_development_page_paint(rct_window *w, rct_drawpixelinfo *dpi, sint32 baseWidgetIndex);
|
||||
void window_research_funding_page_paint(rct_window *w, rct_drawpixelinfo *dpi, sint32 baseWidgetIndex);
|
||||
|
||||
void window_scenery_open();
|
||||
void window_music_credits_open();
|
||||
|
@ -708,14 +708,14 @@ void window_publisher_credits_open();
|
|||
void window_track_manage_open(struct track_design_file_ref *tdFileRef);
|
||||
void window_viewport_open();
|
||||
void window_themes_open();
|
||||
void window_title_editor_open(int tab);
|
||||
void window_title_command_editor_open(struct TitleSequence * sequence, int command, bool insert);
|
||||
void window_title_editor_open(sint32 tab);
|
||||
void window_title_command_editor_open(struct TitleSequence * sequence, sint32 command, bool insert);
|
||||
void window_tile_inspector_open();
|
||||
void window_tile_inspector_clear_clipboard();
|
||||
void window_text_input_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uintptr_t existing_args, int maxLength);
|
||||
void window_text_input_raw_open(rct_window* call_w, int call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, int maxLength);
|
||||
void window_text_input_open(rct_window* call_w, sint32 call_widget, rct_string_id title, rct_string_id description, rct_string_id existing_text, uintptr_t existing_args, sint32 maxLength);
|
||||
void window_text_input_raw_open(rct_window* call_w, sint32 call_widget, rct_string_id title, rct_string_id description, utf8string existing_text, sint32 maxLength);
|
||||
rct_window *window_mapgen_open();
|
||||
rct_window *window_loadsave_open(int type, char *defaultName);
|
||||
rct_window *window_loadsave_open(sint32 type, char *defaultName);
|
||||
rct_window *window_changelog_open();
|
||||
void window_debug_paint_open();
|
||||
|
||||
|
@ -728,7 +728,7 @@ void window_editor_objective_options_open();
|
|||
|
||||
void window_guest_list_init_vars_a();
|
||||
void window_guest_list_init_vars_b();
|
||||
void window_bubble_list_item(rct_window* w, int item_position);
|
||||
void window_bubble_list_item(rct_window* w, sint32 item_position);
|
||||
|
||||
void window_align_tabs( rct_window *w, uint8 start_tab_id, uint8 end_tab_id );
|
||||
|
||||
|
@ -739,45 +739,45 @@ void window_map_tooltip_update_visibility();
|
|||
|
||||
void window_staff_list_init_vars();
|
||||
|
||||
void game_command_callback_pickup_guest(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
void game_command_callback_pickup_staff(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||
void game_command_callback_pickup_guest(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
void game_command_callback_pickup_staff(sint32 eax, sint32 ebx, sint32 ecx, sint32 edx, sint32 esi, sint32 edi, sint32 ebp);
|
||||
|
||||
void window_event_close_call(rct_window* w);
|
||||
void window_event_mouse_up_call(rct_window* w, int widgetIndex);
|
||||
void window_event_mouse_up_call(rct_window* w, sint32 widgetIndex);
|
||||
void window_event_resize_call(rct_window* w);
|
||||
void window_event_mouse_down_call(rct_window *w, int widgetIndex);
|
||||
void window_event_dropdown_call(rct_window* w, int widgetIndex, int dropdownIndex);
|
||||
void window_event_mouse_down_call(rct_window *w, sint32 widgetIndex);
|
||||
void window_event_dropdown_call(rct_window* w, sint32 widgetIndex, sint32 dropdownIndex);
|
||||
void window_event_unknown_05_call(rct_window* w);
|
||||
void window_event_update_call(rct_window *w);
|
||||
void window_event_unknown_07_call(rct_window* w);
|
||||
void window_event_unknown_08_call(rct_window* w);
|
||||
void window_event_tool_update_call(rct_window* w, int widgetIndex, int x, int y);
|
||||
void window_event_tool_down_call(rct_window* w, int widgetIndex, int x, int y);
|
||||
void window_event_tool_drag_call(rct_window* w, int widgetIndex, int x, int y);
|
||||
void window_event_tool_up_call(rct_window* w, int widgetIndex, int x, int y);
|
||||
void window_event_tool_abort_call(rct_window* w, int widgetIndex);
|
||||
void window_event_tool_update_call(rct_window* w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
void window_event_tool_down_call(rct_window* w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
void window_event_tool_drag_call(rct_window* w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
void window_event_tool_up_call(rct_window* w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
void window_event_tool_abort_call(rct_window* w, sint32 widgetIndex);
|
||||
void window_event_unknown_0E_call(rct_window* w);
|
||||
void window_get_scroll_size(rct_window *w, int scrollIndex, int *width, int *height);
|
||||
void window_event_scroll_mousedown_call(rct_window* w, int scrollIndex, int x, int y);
|
||||
void window_event_scroll_mousedrag_call(rct_window* w, int scrollIndex, int x, int y);
|
||||
void window_event_scroll_mouseover_call(rct_window* w, int scrollIndex, int x, int y);
|
||||
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text);
|
||||
void window_get_scroll_size(rct_window *w, sint32 scrollIndex, sint32 *width, sint32 *height);
|
||||
void window_event_scroll_mousedown_call(rct_window* w, sint32 scrollIndex, sint32 x, sint32 y);
|
||||
void window_event_scroll_mousedrag_call(rct_window* w, sint32 scrollIndex, sint32 x, sint32 y);
|
||||
void window_event_scroll_mouseover_call(rct_window* w, sint32 scrollIndex, sint32 x, sint32 y);
|
||||
void window_event_textinput_call(rct_window *w, sint32 widgetIndex, char *text);
|
||||
void window_event_unknown_14_call(rct_window* w);
|
||||
void window_event_unknown_15_call(rct_window* w, int scrollIndex, int scrollAreaType);
|
||||
rct_string_id window_event_tooltip_call(rct_window* w, int widgetIndex);
|
||||
int window_event_cursor_call(rct_window* w, int widgetIndex, int x, int y);
|
||||
void window_event_moved_call(rct_window* w, int x, int y);
|
||||
void window_event_unknown_15_call(rct_window* w, sint32 scrollIndex, sint32 scrollAreaType);
|
||||
rct_string_id window_event_tooltip_call(rct_window* w, sint32 widgetIndex);
|
||||
sint32 window_event_cursor_call(rct_window* w, sint32 widgetIndex, sint32 x, sint32 y);
|
||||
void window_event_moved_call(rct_window* w, sint32 x, sint32 y);
|
||||
void window_event_invalidate_call(rct_window* w);
|
||||
void window_event_paint_call(rct_window* w, rct_drawpixelinfo *dpi);
|
||||
void window_event_scroll_paint_call(rct_window* w, rct_drawpixelinfo *dpi, int scrollIndex);
|
||||
void window_event_scroll_paint_call(rct_window* w, rct_drawpixelinfo *dpi, sint32 scrollIndex);
|
||||
|
||||
void sub_6EA73F();
|
||||
void textinput_cancel();
|
||||
|
||||
void window_move_and_snap(rct_window *w, int newWindowX, int newWindowY, int snapProximity);
|
||||
int window_can_resize(rct_window *w);
|
||||
void window_move_and_snap(rct_window *w, sint32 newWindowX, sint32 newWindowY, sint32 snapProximity);
|
||||
sint32 window_can_resize(rct_window *w);
|
||||
|
||||
void window_start_textbox(rct_window *call_w, int call_widget, rct_string_id existing_text, char *existing_args, int maxLength);
|
||||
void window_start_textbox(rct_window *call_w, sint32 call_widget, rct_string_id existing_text, char *existing_args, sint32 maxLength);
|
||||
void window_cancel_textbox();
|
||||
void window_update_textbox_caret();
|
||||
void window_update_textbox();
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
uint8 gIntroState;
|
||||
|
||||
// Used mainly for timing but also for Y coordinate and fading.
|
||||
static int _introStateCounter;
|
||||
static sint32 _introStateCounter;
|
||||
|
||||
static void *_soundChannel = NULL;
|
||||
static bool _chainLiftFinished;
|
||||
|
@ -161,7 +161,7 @@ void intro_update()
|
|||
|
||||
void intro_draw(rct_drawpixelinfo *dpi)
|
||||
{
|
||||
int screenWidth = gScreenWidth;
|
||||
sint32 screenWidth = gScreenWidth;
|
||||
|
||||
switch (gIntroState) {
|
||||
case INTRO_STATE_DISCLAIMER_1:
|
||||
|
|
|
@ -37,10 +37,10 @@ constexpr uint64 MAX_OBJECT_OVERRIDES = 4096;
|
|||
constexpr uint64 MAX_SCENARIO_OVERRIDES = 4096;
|
||||
|
||||
constexpr rct_string_id ObjectOverrideBase = 0x6000;
|
||||
constexpr int ObjectOverrideMaxStringCount = 4;
|
||||
constexpr sint32 ObjectOverrideMaxStringCount = 4;
|
||||
|
||||
constexpr rct_string_id ScenarioOverrideBase = 0x7000;
|
||||
constexpr int ScenarioOverrideMaxStringCount = 3;
|
||||
constexpr sint32 ScenarioOverrideMaxStringCount = 3;
|
||||
|
||||
struct ObjectOverride
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ public:
|
|||
}
|
||||
for (size_t i = 0; i < _objectOverrides.size(); i++)
|
||||
{
|
||||
for (int j = 0; j < ObjectOverrideMaxStringCount; j++)
|
||||
for (sint32 j = 0; j < ObjectOverrideMaxStringCount; j++)
|
||||
{
|
||||
const utf8 * * strPtr = &(_objectOverrides[i].strings[j]);
|
||||
if (*strPtr != nullptr)
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
}
|
||||
for (size_t i = 0; i < _scenarioOverrides.size(); i++)
|
||||
{
|
||||
for (int j = 0; j < ScenarioOverrideMaxStringCount; j++)
|
||||
for (sint32 j = 0; j < ScenarioOverrideMaxStringCount; j++)
|
||||
{
|
||||
const utf8 **strPtr = &(_scenarioOverrides[i].strings[j]);
|
||||
if (*strPtr != nullptr)
|
||||
|
@ -205,9 +205,9 @@ public:
|
|||
{
|
||||
if (stringId >= ScenarioOverrideBase)
|
||||
{
|
||||
int offset = stringId - ScenarioOverrideBase;
|
||||
int ooIndex = offset / ScenarioOverrideMaxStringCount;
|
||||
int ooStringIndex = offset % ScenarioOverrideMaxStringCount;
|
||||
sint32 offset = stringId - ScenarioOverrideBase;
|
||||
sint32 ooIndex = offset / ScenarioOverrideMaxStringCount;
|
||||
sint32 ooStringIndex = offset % ScenarioOverrideMaxStringCount;
|
||||
|
||||
if (_scenarioOverrides.size() > (size_t)ooIndex)
|
||||
{
|
||||
|
@ -220,9 +220,9 @@ public:
|
|||
}
|
||||
else if (stringId >= ObjectOverrideBase)
|
||||
{
|
||||
int offset = stringId - ObjectOverrideBase;
|
||||
int ooIndex = offset / ObjectOverrideMaxStringCount;
|
||||
int ooStringIndex = offset % ObjectOverrideMaxStringCount;
|
||||
sint32 offset = stringId - ObjectOverrideBase;
|
||||
sint32 ooIndex = offset / ObjectOverrideMaxStringCount;
|
||||
sint32 ooStringIndex = offset % ObjectOverrideMaxStringCount;
|
||||
|
||||
if (_objectOverrides.size() > (size_t)ooIndex)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ public:
|
|||
Guard::ArgumentNotNull(objectIdentifier);
|
||||
Guard::Assert(index < ObjectOverrideMaxStringCount);
|
||||
|
||||
int ooIndex = 0;
|
||||
sint32 ooIndex = 0;
|
||||
for (const ObjectOverride &objectOverride : _objectOverrides)
|
||||
{
|
||||
if (strncmp(objectOverride.name, objectIdentifier, 8) == 0)
|
||||
|
@ -273,7 +273,7 @@ public:
|
|||
Guard::ArgumentNotNull(scenarioFilename);
|
||||
Guard::Assert(index < ScenarioOverrideMaxStringCount);
|
||||
|
||||
int ooIndex = 0;
|
||||
sint32 ooIndex = 0;
|
||||
for (const ScenarioOverride &scenarioOverride : _scenarioOverrides)
|
||||
{
|
||||
if (String::Equals(scenarioOverride.filename.c_str(), scenarioFilename, true))
|
||||
|
@ -558,7 +558,7 @@ public:
|
|||
// Validate identifier
|
||||
const utf8 * identifier = sb.GetBuffer();
|
||||
|
||||
int stringId;
|
||||
sint32 stringId;
|
||||
if (_currentGroup == nullptr)
|
||||
{
|
||||
if (sscanf(identifier, "STR_%4d", &stringId) != 1)
|
||||
|
@ -598,7 +598,7 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
sb.Append((int)token);
|
||||
sb.Append((sint32)token);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -672,7 +672,7 @@ public:
|
|||
// Handle explicit byte values
|
||||
if (*token == 0)
|
||||
{
|
||||
int number;
|
||||
sint32 number;
|
||||
if (sscanf(tokenName, "%d", &number) == 1)
|
||||
{
|
||||
*token = Math::Clamp(0, number, 255);
|
||||
|
|
|
@ -25,9 +25,9 @@ static const encoding_convert_entry GB2312ToUnicodeTable[7445];
|
|||
static const encoding_convert_entry Big5ToUnicodeTable[13710];
|
||||
static const encoding_convert_entry RCT2ToUnicodeTable[256];
|
||||
|
||||
int rct2_to_utf8(utf8 *dst, const char *src)
|
||||
sint32 rct2_to_utf8(utf8 *dst, const char *src)
|
||||
{
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
|
||||
utf8 *start = dst;
|
||||
const char *ch = src;
|
||||
|
@ -47,14 +47,14 @@ int rct2_to_utf8(utf8 *dst, const char *src)
|
|||
dst = utf8_write_codepoint(dst, codepoint);
|
||||
}
|
||||
dst = utf8_write_codepoint(dst, 0);
|
||||
return (int)(dst - start);
|
||||
return (sint32)(dst - start);
|
||||
}
|
||||
|
||||
int utf8_to_rct2(char *dst, const utf8 *src)
|
||||
sint32 utf8_to_rct2(char *dst, const utf8 *src)
|
||||
{
|
||||
char *start = dst;
|
||||
const utf8 *ch = src;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
|
||||
codepoint = encoding_convert_unicode_to_rct2(codepoint);
|
||||
if (codepoint < 256) {
|
||||
|
@ -66,10 +66,10 @@ int utf8_to_rct2(char *dst, const utf8 *src)
|
|||
}
|
||||
}
|
||||
*dst++ = 0;
|
||||
return (int)(dst - start);
|
||||
return (sint32)(dst - start);
|
||||
}
|
||||
|
||||
static int encoding_search_compare(const void *pKey, const void *pEntry)
|
||||
static sint32 encoding_search_compare(const void *pKey, const void *pEntry)
|
||||
{
|
||||
uint16 key = *((uint16*)pKey);
|
||||
encoding_convert_entry *entry = (encoding_convert_entry*)pEntry;
|
||||
|
@ -78,7 +78,7 @@ static int encoding_search_compare(const void *pKey, const void *pEntry)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_convert_entry *table, int count)
|
||||
static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_convert_entry *table, sint32 count)
|
||||
{
|
||||
encoding_convert_entry *entry = bsearch(&code, table, count, sizeof(encoding_convert_entry), encoding_search_compare);
|
||||
if (entry == NULL) return code;
|
||||
|
@ -88,7 +88,7 @@ static wchar_t encoding_convert_x_to_unicode(wchar_t code, const encoding_conver
|
|||
wchar_t encoding_convert_unicode_to_rct2(wchar_t unicode)
|
||||
{
|
||||
// Can't do a binary search as its sorted by RCT2 code, not unicode
|
||||
for (int i = 0; i < countof(RCT2ToUnicodeTable); i++) {
|
||||
for (sint32 i = 0; i < countof(RCT2ToUnicodeTable); i++) {
|
||||
if (RCT2ToUnicodeTable[i].unicode == unicode) return RCT2ToUnicodeTable[i].code;
|
||||
}
|
||||
return unicode;
|
||||
|
|
|
@ -55,7 +55,7 @@ typedef enum {
|
|||
typedef struct currency_descriptor {
|
||||
char isoCode[4];
|
||||
// Rate is relative to 0.10 GBP
|
||||
int rate;
|
||||
sint32 rate;
|
||||
uint8 affix_unicode;
|
||||
utf8 symbol_unicode[CURRENCY_SYMBOL_MAX_SIZE];
|
||||
uint8 affix_ascii;
|
||||
|
|
|
@ -41,17 +41,17 @@ const rct_string_id DateFormatStringFormatIds[] = {
|
|||
|
||||
openrct_timeofday gRealTimeOfDay;
|
||||
|
||||
int date_get_month(int months)
|
||||
sint32 date_get_month(sint32 months)
|
||||
{
|
||||
return months % MONTH_COUNT;
|
||||
}
|
||||
|
||||
int date_get_year(int months)
|
||||
sint32 date_get_year(sint32 months)
|
||||
{
|
||||
return months / MONTH_COUNT;
|
||||
}
|
||||
|
||||
int date_get_total_months(int month, int year)
|
||||
sint32 date_get_total_months(sint32 month, sint32 year)
|
||||
{
|
||||
return (year - 1) * MONTH_COUNT + month;
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ extern uint16 gDateMonthsElapsed;
|
|||
|
||||
extern openrct_timeofday gRealTimeOfDay;
|
||||
|
||||
int date_get_month(int months);
|
||||
int date_get_year(int months);
|
||||
int date_get_total_months(int month, int year);
|
||||
sint32 date_get_month(sint32 months);
|
||||
sint32 date_get_year(sint32 months);
|
||||
sint32 date_get_total_months(sint32 month, sint32 year);
|
||||
void date_reset();
|
||||
void date_update_real_time_of_day();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ format_code_token format_code_tokens[] = {
|
|||
|
||||
uint32 format_get_code(const char *token)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
for (i = 0; i < countof(format_code_tokens); i++)
|
||||
if (_strcmpi(token, format_code_tokens[i].token) == 0)
|
||||
return format_code_tokens[i].code;
|
||||
|
@ -111,14 +111,14 @@ uint32 format_get_code(const char *token)
|
|||
|
||||
const char *format_get_token(uint32 code)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
for (i = 0; i < countof(format_code_tokens); i++)
|
||||
if (code == format_code_tokens[i].code)
|
||||
return format_code_tokens[i].token;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool utf8_should_use_sprite_for_codepoint(int codepoint)
|
||||
bool utf8_should_use_sprite_for_codepoint(sint32 codepoint)
|
||||
{
|
||||
switch (codepoint) {
|
||||
case FORMAT_UP:
|
||||
|
|
|
@ -28,7 +28,7 @@ extern "C" {
|
|||
|
||||
#include "localisation.h"
|
||||
|
||||
int gCurrentLanguage = LANGUAGE_UNDEFINED;
|
||||
sint32 gCurrentLanguage = LANGUAGE_UNDEFINED;
|
||||
bool gUseTrueTypeFont = false;
|
||||
|
||||
static ILanguagePack * _languageFallback = nullptr;
|
||||
|
@ -44,7 +44,7 @@ void utf8_remove_format_codes(utf8 * text, bool allowcolours)
|
|||
{
|
||||
const utf8 * ch = text;
|
||||
utf8 * dstCh = text;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = String::GetNextCodepoint(ch, &ch)) != 0)
|
||||
{
|
||||
if (!utf8_is_format_code(codepoint) || (allowcolours && utf8_is_colour_code(codepoint)))
|
||||
|
@ -87,7 +87,7 @@ static utf8 * GetLanguagePath(utf8 * buffer, size_t bufferSize, uint32 languageI
|
|||
return buffer;
|
||||
}
|
||||
|
||||
bool language_open(int id)
|
||||
bool language_open(sint32 id)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
|
||||
|
@ -128,7 +128,7 @@ void language_close_all()
|
|||
constexpr rct_string_id NONSTEX_BASE_STRING_ID = 3463;
|
||||
constexpr uint16 MAX_OBJECT_CACHED_STRINGS = 2048;
|
||||
|
||||
static wchar_t convert_specific_language_character_to_unicode(int languageId, wchar_t codepoint)
|
||||
static wchar_t convert_specific_language_character_to_unicode(sint32 languageId, wchar_t codepoint)
|
||||
{
|
||||
switch (languageId) {
|
||||
case RCT2_LANGUAGE_ID_KOREAN:
|
||||
|
@ -142,7 +142,7 @@ static wchar_t convert_specific_language_character_to_unicode(int languageId, wc
|
|||
}
|
||||
}
|
||||
|
||||
static utf8 * convert_multibyte_charset(const char * src, size_t srcMaxSize, int languageId)
|
||||
static utf8 * convert_multibyte_charset(const char * src, size_t srcMaxSize, sint32 languageId)
|
||||
{
|
||||
constexpr char CODEPOINT_DOUBLEBYTE = (char)(uint8)0xFF;
|
||||
|
||||
|
@ -174,7 +174,7 @@ static utf8 * convert_multibyte_charset(const char * src, size_t srcMaxSize, int
|
|||
return sb.StealString();
|
||||
}
|
||||
|
||||
static bool rct2_language_is_multibyte_charset(int languageId)
|
||||
static bool rct2_language_is_multibyte_charset(sint32 languageId)
|
||||
{
|
||||
switch (languageId) {
|
||||
case RCT2_LANGUAGE_ID_KOREAN:
|
||||
|
@ -187,7 +187,7 @@ static bool rct2_language_is_multibyte_charset(int languageId)
|
|||
}
|
||||
}
|
||||
|
||||
utf8 *rct2_language_string_to_utf8(const char *src, size_t srcSize, int languageId)
|
||||
utf8 *rct2_language_string_to_utf8(const char *src, size_t srcSize, sint32 languageId)
|
||||
{
|
||||
if (rct2_language_is_multibyte_charset(languageId))
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ typedef struct language_descriptor {
|
|||
|
||||
extern const language_descriptor LanguagesDescriptors[LANGUAGE_COUNT];
|
||||
|
||||
extern int gCurrentLanguage;
|
||||
extern sint32 gCurrentLanguage;
|
||||
extern bool gUseTrueTypeFont;
|
||||
|
||||
extern const utf8 BlackUpArrowString[];
|
||||
|
@ -70,20 +70,20 @@ extern const utf8 BlackRightArrowString[];
|
|||
extern const utf8 CheckBoxMarkString[];
|
||||
|
||||
const char *language_get_string(rct_string_id id);
|
||||
bool language_open(int id);
|
||||
bool language_open(sint32 id);
|
||||
void language_close_all();
|
||||
|
||||
uint32 utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr);
|
||||
utf8 *utf8_write_codepoint(utf8 *dst, uint32 codepoint);
|
||||
int utf8_insert_codepoint(utf8 *dst, uint32 codepoint);
|
||||
sint32 utf8_insert_codepoint(utf8 *dst, uint32 codepoint);
|
||||
bool utf8_is_codepoint_start(const utf8 *text);
|
||||
void utf8_remove_format_codes(utf8 *text, bool allowcolours);
|
||||
int utf8_get_codepoint_length(int codepoint);
|
||||
int utf8_length(const utf8 *text);
|
||||
sint32 utf8_get_codepoint_length(sint32 codepoint);
|
||||
sint32 utf8_length(const utf8 *text);
|
||||
wchar_t *utf8_to_widechar(const utf8 *src);
|
||||
utf8 *widechar_to_utf8(const wchar_t *src);
|
||||
|
||||
utf8 *rct2_language_string_to_utf8(const char *src, size_t srcSize, int languageId);
|
||||
utf8 *rct2_language_string_to_utf8(const char *src, size_t srcSize, sint32 languageId);
|
||||
bool language_get_localised_scenario_strings(const utf8 *scenarioFilename, rct_string_id *outStringIds);
|
||||
rct_string_id language_allocate_object_string(const utf8 * target);
|
||||
void language_free_object_string(rct_string_id stringId);
|
||||
|
|
|
@ -363,9 +363,9 @@ static void format_append_string_n(char **dest, size_t *size, const utf8 *string
|
|||
}
|
||||
}
|
||||
|
||||
static void format_integer(char **dest, size_t *size, long long value)
|
||||
static void format_integer(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
int digit;
|
||||
sint32 digit;
|
||||
char *nbegin, *nend, *ncur;
|
||||
char tmp;
|
||||
|
||||
|
@ -419,9 +419,9 @@ static void format_integer(char **dest, size_t *size, long long value)
|
|||
}
|
||||
}
|
||||
|
||||
static void format_comma_separated_integer(char **dest, size_t *size, long long value)
|
||||
static void format_comma_separated_integer(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
int digit, groupIndex;
|
||||
sint32 digit, groupIndex;
|
||||
char *nbegin, *nend, *ncur;
|
||||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
|
@ -502,15 +502,15 @@ static void format_comma_separated_integer(char **dest, size_t *size, long long
|
|||
}
|
||||
}
|
||||
|
||||
static void format_comma_separated_fixed_1dp(char **dest, size_t *size, long long value)
|
||||
static void format_comma_separated_fixed_1dp(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
int digit, groupIndex;
|
||||
sint32 digit, groupIndex;
|
||||
char *nbegin, *nend, *ncur;
|
||||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
const char *decimalMark = language_get_string(STR_LOCALE_DECIMAL_POINT);
|
||||
const char *ch = NULL;
|
||||
int zeroNeeded = 1;
|
||||
sint32 zeroNeeded = 1;
|
||||
|
||||
if ((*size) == 0) return;
|
||||
|
||||
|
@ -595,15 +595,15 @@ static void format_comma_separated_fixed_1dp(char **dest, size_t *size, long lon
|
|||
}
|
||||
}
|
||||
|
||||
static void format_comma_separated_fixed_2dp(char **dest, size_t *size, long long value)
|
||||
static void format_comma_separated_fixed_2dp(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
int digit, groupIndex;
|
||||
sint32 digit, groupIndex;
|
||||
char *nbegin, *nend, *ncur;
|
||||
char tmp;
|
||||
const char *commaMark = language_get_string(STR_LOCALE_THOUSANDS_SEPARATOR);
|
||||
const char *decimalMark = language_get_string(STR_LOCALE_DECIMAL_POINT);
|
||||
const char *ch = NULL;
|
||||
int zeroNeeded = 1;
|
||||
sint32 zeroNeeded = 1;
|
||||
|
||||
if ((*size) == 0) return;
|
||||
|
||||
|
@ -694,7 +694,7 @@ static void format_comma_separated_fixed_2dp(char **dest, size_t *size, long lon
|
|||
}
|
||||
}
|
||||
|
||||
static void format_currency(char **dest, size_t *size, long long value)
|
||||
static void format_currency(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
if ((*size) == 0) return;
|
||||
|
||||
|
@ -732,13 +732,13 @@ static void format_currency(char **dest, size_t *size, long long value)
|
|||
format_append_string(dest, size, symbol);
|
||||
}
|
||||
|
||||
static void format_currency_2dp(char **dest, size_t *size, long long value)
|
||||
static void format_currency_2dp(char **dest, size_t *size, sint64 value)
|
||||
{
|
||||
if ((*size) == 0) return;
|
||||
|
||||
const currency_descriptor *currencyDesc = &CurrencyDescriptors[gConfigGeneral.currency_format];
|
||||
|
||||
int rate = currencyDesc->rate;
|
||||
sint32 rate = currencyDesc->rate;
|
||||
value *= rate;
|
||||
|
||||
// Negative sign
|
||||
|
@ -828,7 +828,7 @@ static void format_duration(char **dest, size_t *size, uint16 value)
|
|||
uint16 args[] = { minutes, seconds };
|
||||
uint16 *argsRef = &args[1];
|
||||
|
||||
int minuteIndex = 0;
|
||||
sint32 minuteIndex = 0;
|
||||
if (minutes > 0) {
|
||||
minuteIndex = 1;
|
||||
if (minutes != 1) {
|
||||
|
@ -838,7 +838,7 @@ static void format_duration(char **dest, size_t *size, uint16 value)
|
|||
argsRef--;
|
||||
}
|
||||
|
||||
int secondsIndex = 0;
|
||||
sint32 secondsIndex = 0;
|
||||
if (seconds != 1) {
|
||||
secondsIndex = 1;
|
||||
}
|
||||
|
@ -861,7 +861,7 @@ static void format_realtime(char **dest, size_t *size, uint16 value)
|
|||
uint16 args[] = { hours, minutes };
|
||||
uint16 *argsRef = &args[1];
|
||||
|
||||
int hourIndex = 0;
|
||||
sint32 hourIndex = 0;
|
||||
if (hours > 0) {
|
||||
hourIndex = 1;
|
||||
if (hours != 1) {
|
||||
|
@ -871,7 +871,7 @@ static void format_realtime(char **dest, size_t *size, uint16 value)
|
|||
argsRef--;
|
||||
}
|
||||
|
||||
int minuteIndex = 0;
|
||||
sint32 minuteIndex = 0;
|
||||
if (minutes != 1) {
|
||||
minuteIndex = 1;
|
||||
}
|
||||
|
@ -881,7 +881,7 @@ static void format_realtime(char **dest, size_t *size, uint16 value)
|
|||
format_string_part(dest, size, stringId, (char**)&argsRef);
|
||||
}
|
||||
|
||||
static void format_string_code(unsigned int format_code, char **dest, size_t *size, char **args)
|
||||
static void format_string_code(uint32 format_code, char **dest, size_t *size, char **args)
|
||||
{
|
||||
intptr_t value;
|
||||
|
||||
|
@ -978,7 +978,7 @@ static void format_string_code(unsigned int format_code, char **dest, size_t *si
|
|||
value = *((uint16*)*args);
|
||||
*args += 2;
|
||||
|
||||
format_append_string(dest, size, language_get_string(DateGameMonthNames[date_get_month((int)value)]));
|
||||
format_append_string(dest, size, language_get_string(DateGameMonthNames[date_get_month((sint32)value)]));
|
||||
break;
|
||||
case FORMAT_VELOCITY:
|
||||
// Pop argument
|
||||
|
@ -1038,7 +1038,7 @@ static void format_string_part_from_raw(utf8 **dest, size_t *size, const utf8 *s
|
|||
#endif
|
||||
|
||||
while (*size > 1) {
|
||||
unsigned int code = utf8_get_next(src, &src);
|
||||
uint32 code = utf8_get_next(src, &src);
|
||||
if (code < ' ') {
|
||||
if (code == 0) {
|
||||
break;
|
||||
|
@ -1320,11 +1320,11 @@ utf8 *win1252_to_utf8_alloc(const char *src, size_t srcMaxSize)
|
|||
size_t stringLength = strnlen(src, srcMaxSize);
|
||||
size_t reservedSpace = (stringLength * 4) + 1;
|
||||
utf8 *result = malloc(reservedSpace);
|
||||
int actualSpace = win1252_to_utf8(result, src, stringLength, reservedSpace);
|
||||
sint32 actualSpace = win1252_to_utf8(result, src, stringLength, reservedSpace);
|
||||
return (utf8*)realloc(result, actualSpace);
|
||||
}
|
||||
|
||||
int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t maxBufferLength)
|
||||
sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t maxBufferLength)
|
||||
{
|
||||
#ifdef __WINDOWS__
|
||||
utf16 stackBuffer[256];
|
||||
|
@ -1339,8 +1339,8 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t ma
|
|||
intermediateBuffer = heapBuffer;
|
||||
}
|
||||
}
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, intermediateBuffer, (int)bufferCount);
|
||||
int result = WideCharToMultiByte(CP_UTF8, 0, intermediateBuffer, -1, dst, (int)maxBufferLength, NULL, NULL);
|
||||
MultiByteToWideChar(CP_ACP, 0, src, -1, intermediateBuffer, (sint32)bufferCount);
|
||||
sint32 result = WideCharToMultiByte(CP_UTF8, 0, intermediateBuffer, -1, dst, (sint32)maxBufferLength, NULL, NULL);
|
||||
|
||||
free(heapBuffer);
|
||||
#else
|
||||
|
@ -1352,7 +1352,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t ma
|
|||
iconv_t cd = iconv_open(to_charset, from_charset);
|
||||
if ((iconv_t)-1 == cd)
|
||||
{
|
||||
int error = errno;
|
||||
sint32 error = errno;
|
||||
switch (error)
|
||||
{
|
||||
case EINVAL:
|
||||
|
@ -1368,7 +1368,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t ma
|
|||
size_t conversion_result = iconv(cd, &buffer_conv, &srcLength, &outBuf, &obl);
|
||||
if (conversion_result == (size_t)-1)
|
||||
{
|
||||
int error = errno;
|
||||
sint32 error = errno;
|
||||
switch (error)
|
||||
{
|
||||
case EILSEQ:
|
||||
|
@ -1384,7 +1384,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t ma
|
|||
log_error("Unknown error encountered, errno = %d", error);
|
||||
}
|
||||
}
|
||||
int close_result = iconv_close(cd);
|
||||
sint32 close_result = iconv_close(cd);
|
||||
if (close_result == -1)
|
||||
{
|
||||
log_error("Failed to close iconv, errno = %d", errno);
|
||||
|
@ -1392,7 +1392,7 @@ int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t ma
|
|||
size_t byte_diff = maxBufferLength - obl + 1;
|
||||
dst[byte_diff - 1] = '\0';
|
||||
//log_warning("converted %s of size %d, %d", dst, byte_diff, strlen(dst));
|
||||
int result = byte_diff;
|
||||
sint32 result = byte_diff;
|
||||
free(buffer_orig);
|
||||
#endif // __WINDOWS__
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "string_ids.h"
|
||||
#include "../management/marketing.h"
|
||||
|
||||
bool utf8_is_format_code(int codepoint);
|
||||
bool utf8_is_colour_code(int codepoint);
|
||||
bool utf8_should_use_sprite_for_codepoint(int codepoint);
|
||||
int utf8_get_format_code_arg_length(int codepoint);
|
||||
bool utf8_is_format_code(sint32 codepoint);
|
||||
bool utf8_is_colour_code(sint32 codepoint);
|
||||
bool utf8_should_use_sprite_for_codepoint(sint32 codepoint);
|
||||
sint32 utf8_get_format_code_arg_length(sint32 codepoint);
|
||||
void utf8_remove_formatting(utf8* string, bool allowColours);
|
||||
|
||||
void format_string(char *dest, size_t size, rct_string_id format, void *args);
|
||||
|
@ -36,21 +36,21 @@ void format_string_to_upper(char *dest, size_t size, rct_string_id format, void
|
|||
void generate_string_file();
|
||||
utf8 *get_string_end(const utf8 *text);
|
||||
size_t get_string_size(const utf8 *text);
|
||||
int get_string_length(const utf8 *text);
|
||||
sint32 get_string_length(const utf8 *text);
|
||||
|
||||
money32 string_to_money(char * string_to_monetise);
|
||||
void money_to_string(money32 amount, char * buffer_to_put_value_to, size_t buffer_len);
|
||||
|
||||
void user_string_clear_all();
|
||||
rct_string_id user_string_allocate(int base, const utf8 *text);
|
||||
rct_string_id user_string_allocate(sint32 base, const utf8 *text);
|
||||
void user_string_free(rct_string_id id);
|
||||
bool is_user_string_id(rct_string_id stringId);
|
||||
|
||||
utf8 *win1252_to_utf8_alloc(const char *src, size_t srcMaxSize);
|
||||
int win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t maxBufferLength);
|
||||
sint32 win1252_to_utf8(utf8string dst, const char *src, size_t srcLength, size_t maxBufferLength);
|
||||
|
||||
int rct2_to_utf8(utf8 *dst, const char *src);
|
||||
int utf8_to_rct2(char *dst, const utf8 *src);
|
||||
sint32 rct2_to_utf8(utf8 *dst, const char *src);
|
||||
sint32 utf8_to_rct2(char *dst, const utf8 *src);
|
||||
wchar_t encoding_convert_rct2_to_unicode(wchar_t rct2str);
|
||||
wchar_t encoding_convert_unicode_to_rct2(wchar_t unicode);
|
||||
wchar_t encoding_convert_gb2312_to_unicode(wchar_t gb2312);
|
||||
|
|
|
@ -37,9 +37,9 @@ void user_string_clear_all()
|
|||
*
|
||||
* rct2: 0x006C421D
|
||||
*/
|
||||
rct_string_id user_string_allocate(int base, const utf8 *text)
|
||||
rct_string_id user_string_allocate(sint32 base, const utf8 *text)
|
||||
{
|
||||
int highBits = (base & 0x7F) << 9;
|
||||
sint32 highBits = (base & 0x7F) << 9;
|
||||
bool allowDuplicates = base & 0x80;
|
||||
|
||||
if (!allowDuplicates && user_string_exists(text)) {
|
||||
|
@ -48,7 +48,7 @@ rct_string_id user_string_allocate(int base, const utf8 *text)
|
|||
}
|
||||
|
||||
char *userString = gUserStrings;
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
for (sint32 i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
if (userString[0] != 0)
|
||||
continue;
|
||||
|
||||
|
@ -75,7 +75,7 @@ void user_string_free(rct_string_id id)
|
|||
static bool user_string_exists(const utf8 *text)
|
||||
{
|
||||
char *userString = gUserStrings;
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
for (sint32 i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
if (userString[0] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -94,7 +94,7 @@ void reset_user_strings()
|
|||
{
|
||||
char *userString = gUserStrings;
|
||||
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
for (sint32 i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
userString[0] = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
uint32 utf8_get_next(const utf8 *char_ptr, const utf8 **nextchar_ptr)
|
||||
{
|
||||
int result;
|
||||
int numBytes;
|
||||
sint32 result;
|
||||
sint32 numBytes;
|
||||
|
||||
if (!(char_ptr[0] & 0x80)) {
|
||||
result = char_ptr[0];
|
||||
|
@ -72,9 +72,9 @@ utf8 *utf8_write_codepoint(utf8 *dst, uint32 codepoint)
|
|||
* Inserts the given codepoint at the given address, shifting all characters after along.
|
||||
* @returns the size of the inserted codepoint.
|
||||
*/
|
||||
int utf8_insert_codepoint(utf8 *dst, uint32 codepoint)
|
||||
sint32 utf8_insert_codepoint(utf8 *dst, uint32 codepoint)
|
||||
{
|
||||
int shift = utf8_get_codepoint_length(codepoint);
|
||||
sint32 shift = utf8_get_codepoint_length(codepoint);
|
||||
utf8 *endPoint = get_string_end(dst);
|
||||
memmove(dst + shift, dst, endPoint - dst + 1);
|
||||
utf8_write_codepoint(dst, codepoint);
|
||||
|
@ -88,7 +88,7 @@ bool utf8_is_codepoint_start(const utf8 *text)
|
|||
return false;
|
||||
}
|
||||
|
||||
int utf8_get_codepoint_length(int codepoint)
|
||||
sint32 utf8_get_codepoint_length(sint32 codepoint)
|
||||
{
|
||||
if (codepoint <= 0x7F) {
|
||||
return 1;
|
||||
|
@ -105,12 +105,12 @@ int utf8_get_codepoint_length(int codepoint)
|
|||
* Gets the number of characters / codepoints in a UTF-8 string (not necessarily 1:1 with bytes and not including null
|
||||
* terminator).
|
||||
*/
|
||||
int utf8_length(const utf8 *text)
|
||||
sint32 utf8_length(const utf8 *text)
|
||||
{
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
const utf8 *ch = text;
|
||||
|
||||
int count = 0;
|
||||
sint32 count = 0;
|
||||
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
|
||||
count++;
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ wchar_t *utf8_to_widechar(const utf8 *src)
|
|||
wchar_t *dst = result;
|
||||
|
||||
const utf8 *ch = src;
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
|
||||
if ((uint32)codepoint > 0xFFFF) {
|
||||
*dst++ = '?';
|
||||
|
@ -156,11 +156,11 @@ utf8 *widechar_to_utf8(const wchar_t *src)
|
|||
*/
|
||||
utf8 *get_string_end(const utf8 *text)
|
||||
{
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
const utf8 *ch = text;
|
||||
|
||||
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
|
||||
int argLength = utf8_get_format_code_arg_length(codepoint);
|
||||
sint32 argLength = utf8_get_format_code_arg_length(codepoint);
|
||||
ch += argLength;
|
||||
}
|
||||
return (utf8*)(ch - 1);
|
||||
|
@ -177,12 +177,12 @@ size_t get_string_size(const utf8 *text)
|
|||
/**
|
||||
* Return the number of visible characters (excludes format codes) in the given UTF-8 string.
|
||||
*/
|
||||
int get_string_length(const utf8 *text)
|
||||
sint32 get_string_length(const utf8 *text)
|
||||
{
|
||||
int codepoint;
|
||||
sint32 codepoint;
|
||||
const utf8 *ch = text;
|
||||
|
||||
int count = 0;
|
||||
sint32 count = 0;
|
||||
while ((codepoint = utf8_get_next(ch, &ch)) != 0) {
|
||||
if (utf8_is_format_code(codepoint)) {
|
||||
ch += utf8_get_format_code_arg_length(codepoint);
|
||||
|
@ -193,7 +193,7 @@ int get_string_length(const utf8 *text)
|
|||
return count;
|
||||
}
|
||||
|
||||
int utf8_get_format_code_arg_length(int codepoint)
|
||||
sint32 utf8_get_format_code_arg_length(sint32 codepoint)
|
||||
{
|
||||
switch (codepoint) {
|
||||
case FORMAT_MOVE_X:
|
||||
|
@ -226,7 +226,7 @@ void utf8_remove_formatting(utf8* string, bool allowColours) {
|
|||
}
|
||||
}
|
||||
|
||||
bool utf8_is_format_code(int codepoint)
|
||||
bool utf8_is_format_code(sint32 codepoint)
|
||||
{
|
||||
if (codepoint < 32) return true;
|
||||
if (codepoint >= FORMAT_ARGUMENT_CODE_START && codepoint <= FORMAT_ARGUMENT_CODE_END) return true;
|
||||
|
@ -235,7 +235,7 @@ bool utf8_is_format_code(int codepoint)
|
|||
return false;
|
||||
}
|
||||
|
||||
bool utf8_is_colour_code(int codepoint)
|
||||
bool utf8_is_colour_code(sint32 codepoint)
|
||||
{
|
||||
if (codepoint >= FORMAT_COLOUR_CODE_START && codepoint <= FORMAT_COLOUR_CODE_END) return true;
|
||||
return false;
|
||||
|
|
|
@ -69,7 +69,7 @@ static const rct_string_id AwardNewsStrings[] = {
|
|||
|
||||
rct_award gCurrentAwards[MAX_AWARDS];
|
||||
|
||||
bool award_is_positive(int type)
|
||||
bool award_is_positive(sint32 type)
|
||||
{
|
||||
return AwardPositiveMap[type];
|
||||
}
|
||||
|
@ -77,11 +77,11 @@ bool award_is_positive(int type)
|
|||
#pragma region Award checks
|
||||
|
||||
/** More than 1/16 of the total guests must be thinking untidy thoughts. */
|
||||
static int award_is_deserved_most_untidy(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_untidy(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
int negativeCount;
|
||||
sint32 negativeCount;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_BEAUTIFUL))
|
||||
return 0;
|
||||
|
@ -110,12 +110,12 @@ static int award_is_deserved_most_untidy(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** More than 1/64 of the total guests must be thinking tidy thoughts and less than 6 guests thinking untidy thoughts. */
|
||||
static int award_is_deserved_most_tidy(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_tidy(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
int positiveCount;
|
||||
int negativeCount;
|
||||
sint32 positiveCount;
|
||||
sint32 negativeCount;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
return 0;
|
||||
|
@ -146,9 +146,9 @@ static int award_is_deserved_most_tidy(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** At least 6 open roller coasters. */
|
||||
static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_rollercoasters(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, rollerCoasters;
|
||||
sint32 i, rollerCoasters;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideType;
|
||||
|
||||
|
@ -171,7 +171,7 @@ static int award_is_deserved_best_rollercoasters(int awardType, int activeAwardT
|
|||
}
|
||||
|
||||
/** Entrance fee is 0.10 less than half of the total ride value. */
|
||||
static int award_is_deserved_best_value(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_value(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_WORST_VALUE))
|
||||
return 0;
|
||||
|
@ -187,12 +187,12 @@ static int award_is_deserved_best_value(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** More than 1/128 of the total guests must be thinking scenic thoughts and less than 16 untidy thoughts. */
|
||||
static int award_is_deserved_most_beautiful(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_beautiful(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
int positiveCount;
|
||||
int negativeCount;
|
||||
sint32 positiveCount;
|
||||
sint32 negativeCount;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
return 0;
|
||||
|
@ -223,7 +223,7 @@ static int award_is_deserved_most_beautiful(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** Entrance fee is more than total ride value. */
|
||||
static int award_is_deserved_worse_value(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_worse_value(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
|
||||
return 0;
|
||||
|
@ -239,9 +239,9 @@ static int award_is_deserved_worse_value(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** No more than 2 people who think the vandalism is bad and no crashes. */
|
||||
static int award_is_deserved_safest(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_safest(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, peepsWhoDislikeVandalism;
|
||||
sint32 i, peepsWhoDislikeVandalism;
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
rct_ride *ride;
|
||||
|
@ -266,12 +266,12 @@ static int award_is_deserved_safest(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** All staff types, at least 20 staff, one staff per 32 peeps. */
|
||||
static int award_is_deserved_best_staff(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_staff(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
int peepCount, staffCount;
|
||||
int staffTypeFlags;
|
||||
sint32 peepCount, staffCount;
|
||||
sint32 staffTypeFlags;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_UNTIDY))
|
||||
return 0;
|
||||
|
@ -293,9 +293,9 @@ static int award_is_deserved_best_staff(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** At least 7 shops, 4 unique, one shop per 128 guests and no more than 12 hungry guests. */
|
||||
static int award_is_deserved_best_food(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_food(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, hungryPeeps, shops, uniqueShops;
|
||||
sint32 i, hungryPeeps, shops, uniqueShops;
|
||||
uint64 shopTypes;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideType;
|
||||
|
@ -342,9 +342,9 @@ static int award_is_deserved_best_food(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** No more than 2 unique shops, less than one shop per 256 guests and more than 15 hungry guests. */
|
||||
static int award_is_deserved_worst_food(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_worst_food(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, hungryPeeps, shops, uniqueShops;
|
||||
sint32 i, hungryPeeps, shops, uniqueShops;
|
||||
uint64 shopTypes;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideType;
|
||||
|
@ -391,9 +391,9 @@ static int award_is_deserved_worst_food(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** At least 4 restrooms, 1 restroom per 128 guests and no more than 16 guests who think they need the restroom. */
|
||||
static int award_is_deserved_best_restrooms(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_restrooms(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
unsigned int i, numRestrooms, guestsWhoNeedRestroom;
|
||||
uint32 i, numRestrooms, guestsWhoNeedRestroom;
|
||||
rct_ride *ride;
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
@ -426,9 +426,9 @@ static int award_is_deserved_best_restrooms(int awardType, int activeAwardTypes)
|
|||
}
|
||||
|
||||
/** More than half of the rides have satisfaction <= 6 and park rating <= 650. */
|
||||
static int award_is_deserved_most_disappointing(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_disappointing(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
unsigned int i, countedRides, disappointingRides;
|
||||
uint32 i, countedRides, disappointingRides;
|
||||
rct_ride *ride;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_BEST_VALUE))
|
||||
|
@ -456,9 +456,9 @@ static int award_is_deserved_most_disappointing(int awardType, int activeAwardTy
|
|||
}
|
||||
|
||||
/** At least 6 open water rides. */
|
||||
static int award_is_deserved_best_water_rides(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_water_rides(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, waterRides;
|
||||
sint32 i, waterRides;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideType;
|
||||
|
||||
|
@ -481,9 +481,9 @@ static int award_is_deserved_best_water_rides(int awardType, int activeAwardType
|
|||
}
|
||||
|
||||
/** At least 6 custom designed rides. */
|
||||
static int award_is_deserved_best_custom_designed_rides(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_custom_designed_rides(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, customDesignedRides;
|
||||
sint32 i, customDesignedRides;
|
||||
rct_ride *ride;
|
||||
|
||||
if (activeAwardTypes & (1 << PARK_AWARD_MOST_DISAPPOINTING))
|
||||
|
@ -508,9 +508,9 @@ static int award_is_deserved_best_custom_designed_rides(int awardType, int activ
|
|||
|
||||
/** At least 5 colourful rides and more than half of the rides are colourful. */
|
||||
const uint8 dazzling_ride_colours[] = { 5, 14, 20, 30 };
|
||||
static int award_is_deserved_most_dazzling_ride_colours(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_dazzling_ride_colours(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, j, countedRides, colourfulRides;
|
||||
sint32 i, j, countedRides, colourfulRides;
|
||||
rct_ride *ride;
|
||||
uint8 mainTrackColour;
|
||||
|
||||
|
@ -538,9 +538,9 @@ static int award_is_deserved_most_dazzling_ride_colours(int awardType, int activ
|
|||
}
|
||||
|
||||
/** At least 10 peeps and more than 1/64 of total guests are lost or can't find something. */
|
||||
static int award_is_deserved_most_confusing_layout(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_most_confusing_layout(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
unsigned int peepsCounted, peepsLost;
|
||||
uint32 peepsCounted, peepsLost;
|
||||
uint16 spriteIndex;
|
||||
rct_peep *peep;
|
||||
|
||||
|
@ -559,9 +559,9 @@ static int award_is_deserved_most_confusing_layout(int awardType, int activeAwar
|
|||
}
|
||||
|
||||
/** At least 10 open gentle rides. */
|
||||
static int award_is_deserved_best_gentle_rides(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved_best_gentle_rides(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
int i, gentleRides;
|
||||
sint32 i, gentleRides;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideType;
|
||||
|
||||
|
@ -583,7 +583,7 @@ static int award_is_deserved_best_gentle_rides(int awardType, int activeAwardTyp
|
|||
return (gentleRides >= 10);
|
||||
}
|
||||
|
||||
typedef int (*award_deserved_check)(int, int);
|
||||
typedef sint32 (*award_deserved_check)(sint32, sint32);
|
||||
|
||||
award_deserved_check _awardChecks[] = {
|
||||
award_is_deserved_most_untidy,
|
||||
|
@ -605,7 +605,7 @@ award_deserved_check _awardChecks[] = {
|
|||
award_is_deserved_best_gentle_rides
|
||||
};
|
||||
|
||||
static int award_is_deserved(int awardType, int activeAwardTypes)
|
||||
static sint32 award_is_deserved(sint32 awardType, sint32 activeAwardTypes)
|
||||
{
|
||||
return _awardChecks[awardType](awardType, activeAwardTypes);
|
||||
}
|
||||
|
@ -614,7 +614,7 @@ static int award_is_deserved(int awardType, int activeAwardTypes)
|
|||
|
||||
void award_reset()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
for (i = 0; i < MAX_AWARDS; i++)
|
||||
gCurrentAwards[i].time = 0;
|
||||
}
|
||||
|
@ -628,9 +628,9 @@ void award_update_all()
|
|||
// Only add new awards if park is open
|
||||
if (gParkFlags & PARK_FLAGS_PARK_OPEN) {
|
||||
// Set active award types as flags
|
||||
int activeAwardTypes = 0;
|
||||
int freeAwardEntryIndex = -1;
|
||||
for (int i = 0; i < MAX_AWARDS; i++) {
|
||||
sint32 activeAwardTypes = 0;
|
||||
sint32 freeAwardEntryIndex = -1;
|
||||
for (sint32 i = 0; i < MAX_AWARDS; i++) {
|
||||
if (gCurrentAwards[i].time != 0)
|
||||
activeAwardTypes |= (1 << gCurrentAwards[i].type);
|
||||
else if (freeAwardEntryIndex == -1)
|
||||
|
@ -640,7 +640,7 @@ void award_update_all()
|
|||
// Check if there was a free award entry
|
||||
if (freeAwardEntryIndex != -1) {
|
||||
// Get a random award type not already active
|
||||
int awardType;
|
||||
sint32 awardType;
|
||||
do {
|
||||
awardType = (((scenario_rand() & 0xFF) * 17) >> 8) & 0xFF;
|
||||
} while (activeAwardTypes & (1 << awardType));
|
||||
|
@ -659,7 +659,7 @@ void award_update_all()
|
|||
}
|
||||
|
||||
// Decrease award times
|
||||
for (int i = 0; i < MAX_AWARDS; i++)
|
||||
for (sint32 i = 0; i < MAX_AWARDS; i++)
|
||||
if (gCurrentAwards[i].time != 0)
|
||||
if (--gCurrentAwards[i].time == 0)
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
|
|
|
@ -52,7 +52,7 @@ enum {
|
|||
|
||||
extern rct_award gCurrentAwards[MAX_AWARDS];
|
||||
|
||||
bool award_is_positive(int type);
|
||||
bool award_is_positive(sint32 type);
|
||||
void award_reset();
|
||||
void award_update_all();
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ const money32 research_cost_table[4] = {
|
|||
MONEY(400,00) // Maximum funding
|
||||
};
|
||||
|
||||
int dword_988E60[] = { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0 };
|
||||
sint32 dword_988E60[] = { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0 };
|
||||
|
||||
money32 gInitialCash;
|
||||
money32 gCashEncrypted;
|
||||
|
@ -139,7 +139,7 @@ void finance_pay_interest()
|
|||
*/
|
||||
void finance_pay_ride_upkeep()
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride* ride;
|
||||
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
|
@ -165,7 +165,7 @@ void finance_pay_ride_upkeep()
|
|||
|
||||
void finance_reset_history()
|
||||
{
|
||||
for (int i = 0; i < 128; i++) {
|
||||
for (sint32 i = 0; i < 128; i++) {
|
||||
gCashHistory[i] = MONEY32_UNDEFINED;
|
||||
gWeeklyProfitHistory[i] = MONEY32_UNDEFINED;
|
||||
gParkValueHistory[i] = MONEY32_UNDEFINED;
|
||||
|
@ -237,7 +237,7 @@ void finance_update_daily_profit()
|
|||
|
||||
// Ride costs
|
||||
rct_ride *ride;
|
||||
int i;
|
||||
sint32 i;
|
||||
FOR_ALL_RIDES(i, ride) {
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->upkeep_cost != -1) {
|
||||
current_profit -= 2 * ride->upkeep_cost;
|
||||
|
@ -286,7 +286,7 @@ money32 finance_get_current_cash()
|
|||
*
|
||||
* rct2: 0x0069DFB3
|
||||
*/
|
||||
void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
void game_command_set_current_loan(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
money32 money, loanDifference, currentLoan;
|
||||
money32 newLoan = *edx;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "../common.h"
|
||||
|
||||
typedef int rct_expenditure_type;
|
||||
typedef sint32 rct_expenditure_type;
|
||||
|
||||
enum {
|
||||
RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION,
|
||||
|
@ -84,7 +84,7 @@ money32 finance_get_initial_cash();
|
|||
money32 finance_get_current_loan();
|
||||
money32 finance_get_maximum_loan();
|
||||
money32 finance_get_current_cash();
|
||||
void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp);
|
||||
void game_command_set_current_loan(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp);
|
||||
|
||||
money32 finance_get_last_month_shop_profit();
|
||||
|
||||
|
|
|
@ -34,14 +34,14 @@ const money16 AdvertisingCampaignPricePerWeek[] = {
|
|||
MONEY(200,00) // RIDE
|
||||
};
|
||||
|
||||
static const int AdvertisingCampaignGuestGenerationProbabilities[] = { 400, 300, 200, 200, 250, 200 };
|
||||
static const sint32 AdvertisingCampaignGuestGenerationProbabilities[] = { 400, 300, 200, 200, 250, 200 };
|
||||
|
||||
uint8 gMarketingCampaignDaysLeft[20];
|
||||
uint8 gMarketingCampaignRideIndex[22];
|
||||
|
||||
int marketing_get_campaign_guest_generation_probability(int campaign)
|
||||
sint32 marketing_get_campaign_guest_generation_probability(sint32 campaign)
|
||||
{
|
||||
int probability = AdvertisingCampaignGuestGenerationProbabilities[campaign];
|
||||
sint32 probability = AdvertisingCampaignGuestGenerationProbabilities[campaign];
|
||||
rct_ride *ride;
|
||||
|
||||
// Lower probability of guest generation if price was already low
|
||||
|
@ -70,11 +70,11 @@ int marketing_get_campaign_guest_generation_probability(int campaign)
|
|||
*/
|
||||
void marketing_update()
|
||||
{
|
||||
for (int campaign = 0; campaign < ADVERTISING_CAMPAIGN_COUNT; campaign++) {
|
||||
for (sint32 campaign = 0; campaign < ADVERTISING_CAMPAIGN_COUNT; campaign++) {
|
||||
if (gCheatsNeverendingMarketing)
|
||||
continue;
|
||||
|
||||
int active = (gMarketingCampaignDaysLeft[campaign] & CAMPAIGN_ACTIVE_FLAG) != 0;
|
||||
sint32 active = (gMarketingCampaignDaysLeft[campaign] & CAMPAIGN_ACTIVE_FLAG) != 0;
|
||||
if (gMarketingCampaignDaysLeft[campaign] == 0)
|
||||
continue;
|
||||
|
||||
|
@ -89,7 +89,7 @@ void marketing_update()
|
|||
if (--gMarketingCampaignDaysLeft[campaign] != 0)
|
||||
continue;
|
||||
|
||||
int campaignItem = gMarketingCampaignRideIndex[campaign];
|
||||
sint32 campaignItem = gMarketingCampaignRideIndex[campaign];
|
||||
|
||||
// This sets the string parameters for the marketing types that have an argument.
|
||||
if (campaign == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign == ADVERTISING_CAMPAIGN_RIDE) {
|
||||
|
@ -106,7 +106,7 @@ void marketing_update()
|
|||
}
|
||||
}
|
||||
|
||||
void marketing_set_guest_campaign(rct_peep *peep, int campaign)
|
||||
void marketing_set_guest_campaign(rct_peep *peep, sint32 campaign)
|
||||
{
|
||||
switch (campaign) {
|
||||
case ADVERTISING_CAMPAIGN_PARK_ENTRY_FREE:
|
||||
|
@ -138,7 +138,7 @@ void marketing_set_guest_campaign(rct_peep *peep, int campaign)
|
|||
}
|
||||
}
|
||||
|
||||
void marketing_start_campaign(int type, int rideOrItem, int numWeeks)
|
||||
void marketing_start_campaign(sint32 type, sint32 rideOrItem, sint32 numWeeks)
|
||||
{
|
||||
gGameCommandErrorTitle = STR_CANT_START_MARKETING_CAMPAIGN;
|
||||
game_do_command(0, (numWeeks << 8) | GAME_COMMAND_FLAG_APPLY, 0, (rideOrItem << 8) | type, GAME_COMMAND_START_MARKETING_CAMPAIGN, 0, 0);
|
||||
|
@ -148,11 +148,11 @@ void marketing_start_campaign(int type, int rideOrItem, int numWeeks)
|
|||
*
|
||||
* rct2: 0x0069E73C
|
||||
*/
|
||||
void game_command_start_campaign(int* eax, int* ebx, int* ecx, int* edx, int* esi, int* edi, int* ebp)
|
||||
void game_command_start_campaign(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx, sint32* esi, sint32* edi, sint32* ebp)
|
||||
{
|
||||
int type = *edx & 0xFF;
|
||||
int rideOrItem = (*edx >> 8) & 0xFF;
|
||||
int numWeeks = (*ebx >> 8) & 0xFF;
|
||||
sint32 type = *edx & 0xFF;
|
||||
sint32 rideOrItem = (*edx >> 8) & 0xFF;
|
||||
sint32 numWeeks = (*ebx >> 8) & 0xFF;
|
||||
|
||||
if (type < 0 || type >= countof(AdvertisingCampaignPricePerWeek))
|
||||
{
|
||||
|
@ -178,9 +178,9 @@ void game_command_start_campaign(int* eax, int* ebx, int* ecx, int* edx, int* es
|
|||
*ebx = numWeeks * AdvertisingCampaignPricePerWeek[type];
|
||||
}
|
||||
|
||||
bool marketing_is_campaign_type_applicable(int campaignType)
|
||||
bool marketing_is_campaign_type_applicable(sint32 campaignType)
|
||||
{
|
||||
int i;
|
||||
sint32 i;
|
||||
rct_ride *ride;
|
||||
rct_ride_entry *rideEntry;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue