Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -26,7 +26,7 @@ StitchedTexture *StitchedTexture::create(const wstring &name)
StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) : name(name)
{
// 4J Initialisers
source = NULL;
source = nullptr;
rotated = false;
x = 0;
y = 0;
@@ -40,9 +40,9 @@ StitchedTexture::StitchedTexture(const wstring &name, const wstring &filename) :
heightTranslation = 0.0f;
frame = 0;
subFrame = 0;
frameOverride = NULL;
frameOverride = nullptr;
flags = 0;
frames = NULL;
frames = nullptr;
m_fileName = filename;
}
@@ -94,10 +94,10 @@ void StitchedTexture::init(Texture *source, vector<Texture *> *frames, int x, in
float marginX = 0.0f; //0.01f / source->getWidth();
float marginY = 0.0f; //0.01f / source->getHeight();
this->u0 = x / (float) source->getWidth() + marginX;
this->u1 = (x + width) / (float) source->getWidth() - marginX;
this->v0 = y / (float) source->getHeight() + marginY;
this->v1 = (y + height) / (float) source->getHeight() - marginY;
this->u0 = x / static_cast<float>(source->getWidth()) + marginX;
this->u1 = (x + width) / static_cast<float>(source->getWidth()) - marginX;
this->v0 = y / static_cast<float>(source->getHeight()) + marginY;
this->v1 = (y + height) / static_cast<float>(source->getHeight()) - marginY;
#ifndef _CONTENT_PACKAGE
bool addBreakpoint = false;
@@ -112,8 +112,8 @@ void StitchedTexture::init(Texture *source, vector<Texture *> *frames, int x, in
}
#endif
this->widthTranslation = width / (float) SharedConstants::WORLD_RESOLUTION;
this->heightTranslation = height / (float) SharedConstants::WORLD_RESOLUTION;
this->widthTranslation = width / static_cast<float>(SharedConstants::WORLD_RESOLUTION);
this->heightTranslation = height / static_cast<float>(SharedConstants::WORLD_RESOLUTION);
}
void StitchedTexture::replaceWith(StitchedTexture *texture)
@@ -156,7 +156,7 @@ float StitchedTexture::getU1(bool adjust/*=false*/) const
float StitchedTexture::getU(double offset, bool adjust/*=false*/) const
{
float diff = getU1(adjust) - getU0(adjust);
return getU0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION));
return getU0(adjust) + (diff * (static_cast<float>(offset) / SharedConstants::WORLD_RESOLUTION));
}
float StitchedTexture::getV0(bool adjust/*=false*/) const
@@ -172,7 +172,7 @@ float StitchedTexture::getV1(bool adjust/*=false*/) const
float StitchedTexture::getV(double offset, bool adjust/*=false*/) const
{
float diff = getV1(adjust) - getV0(adjust);
return getV0(adjust) + (diff * ((float) offset / SharedConstants::WORLD_RESOLUTION));
return getV0(adjust) + (diff * (static_cast<float>(offset) / SharedConstants::WORLD_RESOLUTION));
}
wstring StitchedTexture::getName() const
@@ -192,7 +192,7 @@ int StitchedTexture::getSourceHeight() const
void StitchedTexture::cycleFrames()
{
if (frameOverride != NULL)
if (frameOverride != nullptr)
{
pair<int, int> current = frameOverride->at(frame);
subFrame++;
@@ -250,10 +250,10 @@ int StitchedTexture::getFrames()
*/
void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
{
if(frameOverride != NULL)
if(frameOverride != nullptr)
{
delete frameOverride;
frameOverride = NULL;
frameOverride = nullptr;
}
frame = 0;
subFrame = 0;
@@ -303,10 +303,10 @@ void StitchedTexture::loadAnimationFrames(BufferedReader *bufferedReader)
void StitchedTexture::loadAnimationFrames(const wstring &string)
{
if(frameOverride != NULL)
if(frameOverride != nullptr)
{
delete frameOverride;
frameOverride = NULL;
frameOverride = nullptr;
}
frame = 0;
subFrame = 0;