diff options
| author | Paul Gilbert | 2012-02-12 23:05:08 +1100 | 
|---|---|---|
| committer | Strangerke | 2012-04-06 08:21:19 +0200 | 
| commit | 2fb94dfa01e7673358aef3ef67022f29e74c1b3b (patch) | |
| tree | 9da9ce534abee9d4993284ce8a1ba2ee0af41d40 /engines/mortevielle/graphics.cpp | |
| parent | b4bed3cba36ac90bc78a8550390481aa394e9e68 (diff) | |
| download | scummvm-rg350-2fb94dfa01e7673358aef3ef67022f29e74c1b3b.tar.gz scummvm-rg350-2fb94dfa01e7673358aef3ef67022f29e74c1b3b.tar.bz2 scummvm-rg350-2fb94dfa01e7673358aef3ef67022f29e74c1b3b.zip | |
MORTEVIELLE: Moved DROITE() into the ScreenSurface class
Diffstat (limited to 'engines/mortevielle/graphics.cpp')
| -rw-r--r-- | engines/mortevielle/graphics.cpp | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index bdf6c86daa..0fab9de965 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -1097,4 +1097,37 @@ int ScreenSurface::getStringWidth(const Common::String &s) {  	return s.size() * charWidth;  } +void ScreenSurface::droite(int x, int y, int xx, int yy, int coul) { +	int step, i; +	float a, b; +	float xr, yr, xro, yro; + +	xr = x; +	yr = y; +	xro = xx; +	yro = yy; +	 +	if (abs(y - yy) > abs(x - xx)) { +		a = (float)((x - xx)) / (y - yy); +		b = (yr * xro - yro * xr) / (y - yy); +		i = y; +		if (y > yy)  step = -1; +		else step = 1; +		do { +			g_vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); +			i = i + step; +		} while (!(i == yy)); +	} else { +		a = (float)((y - yy)) / (x - xx); +		b = ((yro * xr) - (yr * xro)) / (x - xx); +		i = x; +		if (x > xx)  step = -1; +		else step = 1; +		do { +			g_vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); +			i = i + step; +		} while (!(i == xx)); +	} +} +  } // End of namespace Mortevielle | 
