aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoryinsimei2017-07-11 11:09:26 +0200
committerEugene Sandulenko2017-07-13 18:27:45 +0200
commit59ea5e5834d107d98101fb016686f0a4e8f30218 (patch)
treeae8ca4a739f2f97818e0928589129a059667844d /engines
parentae8df00f56521841ba438f28c84bf1e2a7a4a1bd (diff)
downloadscummvm-rg350-59ea5e5834d107d98101fb016686f0a4e8f30218.tar.gz
scummvm-rg350-59ea5e5834d107d98101fb016686f0a4e8f30218.tar.bz2
scummvm-rg350-59ea5e5834d107d98101fb016686f0a4e8f30218.zip
SLUDGE: use Graphics::Surface::drawLine instead of sludge defined drawLine
Diffstat (limited to 'engines')
-rw-r--r--engines/sludge/backdrop.cpp5
-rw-r--r--engines/sludge/floor.cpp16
-rw-r--r--engines/sludge/line.cpp140
-rw-r--r--engines/sludge/line.h31
-rw-r--r--engines/sludge/module.mk1
5 files changed, 12 insertions, 181 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp
index aada7f110c..82260b9192 100644
--- a/engines/sludge/backdrop.cpp
+++ b/engines/sludge/backdrop.cpp
@@ -34,7 +34,6 @@
#include "sludge/moreio.h"
#include "sludge/zbuffer.h"
#include "sludge/graphics.h"
-#include "sludge/line.h"
#include "sludge/sludge.h"
#include "sludge/sludger.h"
#include "sludge/variable.h"
@@ -458,11 +457,11 @@ void hardScroll(int distance) {
}
void drawVerticalLine(uint x, uint y1, uint y2) {
- drawLine(x, y1, x, y2);
+ backdropSurface.drawLine(x, y1, x, y2, backdropSurface.format.ARGBToColor(255, 0, 0, 0));
}
void drawHorizontalLine(uint x1, uint y, uint x2) {
- drawLine(x1, y, x2, y);
+ backdropSurface.drawLine(x1, y, x2, y, backdropSurface.format.ARGBToColor(255, 0, 0, 0));
}
void darkScreen() {
diff --git a/engines/sludge/floor.cpp b/engines/sludge/floor.cpp
index 591a5ff321..7e9677a36f 100644
--- a/engines/sludge/floor.cpp
+++ b/engines/sludge/floor.cpp
@@ -20,15 +20,18 @@
*
*/
+#include "graphics/surface.h"
+
#include "sludge/allfiles.h"
#include "sludge/newfatal.h"
#include "sludge/fileset.h"
#include "sludge/moreio.h"
#include "sludge/floor.h"
-#include "sludge/line.h"
namespace Sludge {
+extern Graphics::Surface backdropSurface;
+
flor *currentFloor = NULL;
bool pointInFloorPolygon(floorPolygon &floorPoly, int x, int y) {
@@ -245,15 +248,16 @@ bool setFloor(int fileNum) {
void drawFloor() {
int i, j, nV;
for (i = 0; i < currentFloor->numPolygons; i++) {
-// drawLine (i, 0, i + 5, 100);
nV = currentFloor->polygon[i].numVertices;
if (nV > 1) {
for (j = 1; j < nV; j++) {
- drawLine(currentFloor->vertex[currentFloor->polygon[i].vertexID[j - 1]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[j - 1]].y,
- currentFloor->vertex[currentFloor->polygon[i].vertexID[j]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[j]].y);
+ backdropSurface.drawLine(currentFloor->vertex[currentFloor->polygon[i].vertexID[j - 1]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[j - 1]].y,
+ currentFloor->vertex[currentFloor->polygon[i].vertexID[j]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[j]].y,
+ backdropSurface.format.ARGBToColor(255, 0, 0, 0));
}
- drawLine(currentFloor->vertex[currentFloor->polygon[i].vertexID[0]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[0]].y,
- currentFloor->vertex[currentFloor->polygon[i].vertexID[nV - 1]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[nV - 1]].y);
+ backdropSurface.drawLine(currentFloor->vertex[currentFloor->polygon[i].vertexID[0]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[0]].y,
+ currentFloor->vertex[currentFloor->polygon[i].vertexID[nV - 1]].x, currentFloor->vertex[currentFloor->polygon[i].vertexID[nV - 1]].y,
+ backdropSurface.format.ARGBToColor(255, 0, 0, 0));
}
}
}
diff --git a/engines/sludge/line.cpp b/engines/sludge/line.cpp
deleted file mode 100644
index 58fd64a59b..0000000000
--- a/engines/sludge/line.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "sludge/graphics.h"
-#include "sludge/allfiles.h"
-
-namespace Sludge {
-
-extern int sceneWidth, sceneHeight;
-#if 0
-extern GLuint backdropTextureName;
-#endif
-
-void drawLine(int x1, int y1, int x2, int y2) {
- int x, y;
- bool backwards = false;
-#if 0
- if (x1 < 0)
- x1 = 0;
- if (y1 < 0)
- y1 = 0;
- if (x2 < 0)
- x2 = 0;
- if (y2 < 0)
- y2 = 0;
- if (x1 > sceneWidth)
- x1 = sceneWidth - 1;
- if (x2 > sceneWidth)
- x2 = sceneWidth - 1;
- if (y1 > sceneHeight)
- y1 = sceneHeight - 1;
- if (y2 > sceneHeight)
- y2 = sceneHeight - 1;
-
- if (x1 > x2) {
- x = x2;
- backwards = !backwards;
- } else
- x = x1;
-
- if (y1 > y2) {
- y = y2;
- backwards = !backwards;
- } else
- y = y1;
-
- int diffX = ABS(x2 - x1);
- int diffY = ABS(y2 - y1);
-
- if (!diffX) {
- diffX = 1;
- if (x == sceneWidth - 1)
- x = sceneWidth - 2;
- }
- if (!diffY) {
- diffY = 1;
- if (y == sceneHeight - 1)
- y = sceneHeight - 2;
- }
- setPixelCoords(true);
-
- glLineWidth(2.0);
-
- int xoffset = 0;
- while (xoffset < diffX) {
- int w = (diffX - xoffset < viewportWidth) ? diffX - xoffset : viewportWidth;
-
- int yoffset = 0;
- while (yoffset < diffY) {
- int h = (diffY - yoffset < viewportHeight) ? diffY - yoffset : viewportHeight;
-
- // Render the scene - first the old backdrop
- glBindTexture(GL_TEXTURE_2D, backdropTextureName);
- //glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
- const GLfloat vertices[] = { (GLfloat)-x - xoffset, (GLfloat)1 - y - yoffset, 0., (GLfloat)sceneWidth - x - xoffset, (GLfloat)1 - y - yoffset, 0., (GLfloat)-x - xoffset,
- (GLfloat)sceneHeight - y - yoffset, 0., (GLfloat)sceneWidth - x - xoffset, (GLfloat)sceneHeight - y - yoffset, 0. };
-
- const GLfloat texCoords[] = { 0.0f, 0.0f, backdropTexW, 0.0f, 0.0f, backdropTexH, backdropTexW, backdropTexH };
-
- glUseProgram(shader.texture);
-
- setPMVMatrix(shader.texture);
- drawQuad(shader.texture, vertices, 1, texCoords);
-
- // Then the line
- //FIXME:Removing the lines doesn't work, but also didn't work properly before.
-
- GLint xo1 = -xoffset, xo2 = -xoffset;
- if (!backwards) {
- xo2 += diffX;
- } else {
- xo1 += diffX;
- }
- const GLint lineVertices[] = { xo1, -yoffset, 0, xo2, -yoffset + diffY, 0, };
-
- glUseProgram(shader.color);
-
- setPMVMatrix(shader.color);
-
- glUniform4f(glGetUniformLocation(shader.color, "myColor"), 0.0f, 0.0f, 0.0f, 1.0f);
-
- int vertexLoc = glGetAttribLocation(shader.color, "myVertex");
- glEnableVertexAttribArray(vertexLoc);
- glVertexAttribPointer(vertexLoc, 3, GL_INT, GL_FALSE, 0, lineVertices);
- glDrawArrays(GL_LINES, 0, 2);
- glDisableVertexAttribArray(vertexLoc);
-
- glUseProgram(0);
-
- // Copy Our ViewPort To The Texture
- copyTexSubImage2D(GL_TEXTURE_2D, 0, x + xoffset, y + yoffset, viewportOffsetX, viewportOffsetY, w, h, backdropTextureName);
-
- yoffset += viewportHeight;
- }
- xoffset += viewportWidth;
- }
- setPixelCoords(false);
-#endif
-}
-
-} // End of namespace Sludge
diff --git a/engines/sludge/line.h b/engines/sludge/line.h
deleted file mode 100644
index 49e895f9e5..0000000000
--- a/engines/sludge/line.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-#ifndef SLUDGE_LINE_H
-#define SLUDGE_LINE_H
-
-namespace Sludge {
-
-void drawLine(int x1, int y1, int x2, int y2);
-
-} // End of namespace Sludge
-
-#endif
diff --git a/engines/sludge/module.mk b/engines/sludge/module.mk
index ac5529fb15..03bcc72e8b 100644
--- a/engines/sludge/module.mk
+++ b/engines/sludge/module.mk
@@ -16,7 +16,6 @@ MODULE_OBJS := \
hsi.o \
imgloader.o \
language.o \
- line.o \
loadsave.o \
main_loop.o \
memwatch.o \