Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MORPHOS : Fixed for int vs int32 types for AmigaOS/MorphOS #2510

Merged
merged 16 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backends/graphics3d/openglsdl/openglsdl-graphics3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ void OpenGLSdlGraphics3dManager::createOrUpdateScreen() {

_screenChangeCount++;

#if !defined(AMIGAOS)
#if !defined(AMIGAOS) && !defined(__MORPHOS__)
if (renderToFrameBuffer) {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
_frameBuffer = createFramebuffer(_engineRequestedWidth, _engineRequestedHeight);
Expand Down Expand Up @@ -537,7 +537,7 @@ void OpenGLSdlGraphics3dManager::drawOverlay() {
_surfaceRenderer->restorePreviousState();
}

#ifndef AMIGAOS
#if !defined(AMIGAOS) && !defined(__MORPHOS__)
OpenGL::FrameBuffer *OpenGLSdlGraphics3dManager::createFramebuffer(uint width, uint height) {
#if !defined(USE_GLES2)
if (_antialiasing && OpenGLContext.framebufferObjectMultisampleSupported) {
Expand Down
4 changes: 3 additions & 1 deletion engines/grim/gfx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,9 @@ void GfxOpenGL::drawEmergString(int x, int y, const char *text, const Color &fgC
glColor3f(1.0f, 1.0f, 1.0f);

glListBase(_emergFont);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (const GLubyte *)text);

char *list = const_cast<char *>(text);
glCallLists(strlen(text), GL_UNSIGNED_BYTE, (void *)text);

glEnable(GL_LIGHTING);

Expand Down
5 changes: 3 additions & 2 deletions engines/myst3/gfx_opengl_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ void OpenGLTexture::updateTexture(const Graphics::Surface *surface, const Common
const Graphics::Surface subArea = surface->getSubArea(rect);

glPixelStorei(GL_UNPACK_ROW_LENGTH, surface->pitch / surface->format.bytesPerPixel);
glTexSubImage2D(GL_TEXTURE_2D, 0, rect.left, rect.top, subArea.w, subArea.h, internalFormat, sourceFormat, subArea.getPixels());

aquadran marked this conversation as resolved.
Show resolved Hide resolved
glTexSubImage2D(GL_TEXTURE_2D, 0, rect.left, rect.top, subArea.w, subArea.h, internalFormat, sourceFormat, const_cast<void *>(subArea.getPixels()));
BeWorld2018 marked this conversation as resolved.
Show resolved Hide resolved
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
} else {
// GL_UNPACK_ROW_LENGTH is not supported, don't bother and do a full texture update
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, internalFormat, sourceFormat, surface->getPixels());
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, surface->w, surface->h, internalFormat, sourceFormat, const_cast<void *>(surface->getPixels()));
BeWorld2018 marked this conversation as resolved.
Show resolved Hide resolved
}
}

Expand Down
4 changes: 2 additions & 2 deletions engines/wintermute/ad/ad_actor_3dx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ bool AdActor3DX::update() {
Math::Matrix4 newWorldMat;
getMatrix(&newWorldMat, &newPos);

int newX, newY;
int32 newX, newY;
convert3DTo2D(&newWorldMat, &newX, &newY);
canWalk = !scene->isBlockedAt(newX, newY, false, this);
} else {
Expand Down Expand Up @@ -2441,7 +2441,7 @@ bool AdActor3DX::updatePartEmitter() {

Math::Vector3d bonePos;
getBonePosition3D(_partBone.c_str(), &bonePos, &_partOffset);
int x = 0, y = 0;
int32 x = 0, y = 0;
static_cast<AdGame *>(_gameRef)->_scene->_sceneGeometry->convert3Dto2D(&bonePos, &x, &y);

_partEmitter->_posX = x - _gameRef->_renderer->_drawOffsetX;
Expand Down
2 changes: 1 addition & 1 deletion engines/wintermute/base/gfx/base_renderer3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class BaseRenderer3D : public BaseRenderer {
virtual void resetModelViewTransform() = 0;
virtual void setWorldTransform(const Math::Matrix4 &transform) = 0;

void project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int &x, int &y);
void project(const Math::Matrix4 &worldMatrix, const Math::Vector3d &point, int32 &x, int32 &y);
Math::Ray rayIntoScene(int x, int y);

Math::Matrix4 lastProjectionMatrix() {
Expand Down
15 changes: 10 additions & 5 deletions engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,10 @@ void BaseRenderOpenGL3D::displayShadow(BaseObject *object, const Math::Vector3d
glEnable(GL_TEXTURE_2D);
static_cast<BaseSurfaceOpenGL3D *>(shadowImage)->setTexture();

#ifndef __MORPHOS__
glInterleavedArrays(GL_T2F_N3F_V3F, 0, _simpleShadow);

#endif

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

glDepthMask(true);
Expand Down Expand Up @@ -476,7 +478,7 @@ bool BaseRenderOpenGL3D::setup2D(bool force) {
#if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW)
glActiveTexturePtr(GL_TEXTURE0);
#else
glActiveTexture(GL_TEXTURE0);
glActiveTextureARB(GL_TEXTURE0);
#endif
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE);
Expand All @@ -489,16 +491,16 @@ bool BaseRenderOpenGL3D::setup2D(bool force) {
#if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW)
glActiveTexturePtr(GL_TEXTURE1);
#else
glActiveTexture(GL_TEXTURE1);
glActiveTextureARB(GL_TEXTURE1);
#endif
glDisable(GL_TEXTURE_2D);

#if defined(__MINGW32__) && defined (SDL_BACKEND) && !defined(USE_GLEW)
glActiveTexturePtr(GL_TEXTURE0);
#else
glActiveTexture(GL_TEXTURE0);

glActiveTextureARB(GL_TEXTURE0);
BeWorld2018 marked this conversation as resolved.
Show resolved Hide resolved
#endif

glViewport(0, 0, _width, _height);
setProjection2D();
}
Expand Down Expand Up @@ -722,7 +724,10 @@ bool BaseRenderOpenGL3D::drawSpriteEx(BaseSurfaceOpenGL3D &tex, const Wintermute
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

#ifndef __MORPHOS__
glInterleavedArrays(GL_T2F_C4UB_V3F, 0, vertices);
#endif

glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

if (alphaDisable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ bool BaseSurfaceOpenGL3D::putSurface(const Graphics::Surface &surface, bool hasA
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _texWidth, _texHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, surface.getPixels());
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<void *>(surface.getPixels()));
BeWorld2018 marked this conversation as resolved.
Show resolved Hide resolved
glBindTexture(GL_TEXTURE_2D, 0);
_valid = true;

Expand Down
3 changes: 2 additions & 1 deletion engines/wintermute/base/gfx/opengl/meshx_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ bool MeshXOpenGL::render(ModelX *model) {
glDisable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);
}

#ifndef __MORPHOS__
glInterleavedArrays(GL_T2F_N3F_V3F, 0, _vertexData);
#endif
glDrawElements(GL_TRIANGLES, _indexRanges[i + 1] - _indexRanges[i], GL_UNSIGNED_SHORT, _indexData.data() + _indexRanges[i]);
}

Expand Down
2 changes: 2 additions & 0 deletions engines/wintermute/base/gfx/opengl/shadow_volume_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ bool ShadowVolumeOpenGL::renderToScene() {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

// Draw a big, gray square
#ifndef __MORPHOS__
glInterleavedArrays(GL_C4UB_V3F, 0, _shadowMask);
#endif
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

// Restore render states
Expand Down
2 changes: 1 addition & 1 deletion engines/wintermute/base/gfx/x/modelx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ void ModelX::updateBoundingRect() {
}

//////////////////////////////////////////////////////////////////////////
void ModelX::updateRect(Rect32 *rc, int x, int y) {
void ModelX::updateRect(Rect32 *rc, int32 x, int32 y) {
rc->left = MIN(rc->left, x);
rc->right = MAX(rc->right, x);
rc->top = MIN(rc->top, y);
Expand Down
2 changes: 1 addition & 1 deletion engines/wintermute/base/gfx/x/modelx.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class ModelX : public BaseObject {
void parseFrameDuringMerge(XFileLexer &lexer, const Common::String &filename);

void updateBoundingRect();
void static inline updateRect(Rect32 *rc, int x, int y);
void static inline updateRect(Rect32 *rc, int32 x, int32 y);
Rect32 _drawingViewport;
Math::Matrix4 _lastViewMat;
Math::Matrix4 _lastProjMat;
Expand Down
6 changes: 3 additions & 3 deletions graphics/opengl/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "common/textconsole.h"
#include "common/util.h"

#if defined(USE_OPENGL_GAME) && !defined(AMIGAOS)
#if defined(USE_OPENGL_GAME) && !defined(AMIGAOS) && !defined(__MORPHOS__)

#if defined(SDL_BACKEND) && !defined(USE_GLEW) && !defined(USE_GLES2)
#define GL_GLEXT_PROTOTYPES // For the GL_EXT_framebuffer_object extension
Expand Down Expand Up @@ -188,7 +188,7 @@ void FrameBuffer::detach() {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

#if !defined(USE_GLES2) && !defined(AMIGAOS)
#if !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__)
MultiSampleFrameBuffer::MultiSampleFrameBuffer(uint width, uint height, int samples)
: FrameBuffer(width,height) {
if (!OpenGLContext.framebufferObjectMultisampleSupported) {
Expand Down Expand Up @@ -251,7 +251,7 @@ void MultiSampleFrameBuffer::detach() {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}

#endif // !defined(USE_GLES2) && !defined(AMIGAOS)
#endif // !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__)

} // End of namespace OpenGL

Expand Down
4 changes: 2 additions & 2 deletions graphics/opengl/framebuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class FrameBuffer : public TextureGL {
public:
FrameBuffer(uint width, uint height);
FrameBuffer(GLuint texture_name, uint width, uint height, uint texture_width, uint texture_height);
#ifdef AMIGAOS
#if defined(AMIGAOS) || defined(__MORPHOS__)
virtual ~FrameBuffer() {}

void attach() {}
Expand All @@ -53,7 +53,7 @@ class FrameBuffer : public TextureGL {
GLuint _frameBuffer;
};

#if !defined(USE_GLES2) && !defined(AMIGAOS)
#if !defined(USE_GLES2) && !defined(AMIGAOS) && !defined(__MORPHOS__)
class MultiSampleFrameBuffer : public FrameBuffer {
public:
MultiSampleFrameBuffer(uint width, uint height, int samples);
Expand Down
2 changes: 1 addition & 1 deletion graphics/opengl/texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ TextureGL::TextureGL(const Graphics::Surface &srf) :
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, format, _texWidth, _texHeight, 0, format, type, 0);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, format, type, surfaceToUpload->getPixels());
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _width, _height, format, type, const_cast<void *>(surfaceToUpload->getPixels()));

if (OpenGLContext.unpackSubImageSupported) {
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
Expand Down