From 797eaee43385ddd438bc08fcf9e4dbae625fb978 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20G=C3=B6ffringmann?= Date: Mon, 9 Jun 2003 23:02:56 +0000 Subject: [PATCH] removed debugging leftovers, fixed one more sprite clipping issue. svn-id: r8423 --- sky/logic.cpp | 2 +- sky/screen.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/sky/logic.cpp b/sky/logic.cpp index 4acc3af93b0..8a8ae07103b 100644 --- a/sky/logic.cpp +++ b/sky/logic.cpp @@ -1877,7 +1877,7 @@ bool SkyLogic::fnResetId(uint32 id, uint32 resetBlock, uint32 c) { Compact *cpt = SkyState::fetchCompact(id); uint16 *rst = (uint16 *)SkyState::fetchCompact(resetBlock); - SkyCompact::jobsworth; + if (!cpt) { warning("fnResetId(): Compact %d (id) == NULL\n",id); return true; diff --git a/sky/screen.cpp b/sky/screen.cpp index 0073176dcdc..07f7e76e4ad 100644 --- a/sky/screen.cpp +++ b/sky/screen.cpp @@ -601,11 +601,12 @@ void SkyScreen::drawSprite(uint8 *spriteInfo, Compact *sprCompact) { } else { int32 botClip = GAME_SCREEN_HEIGHT - FROM_LE_16(sprDataFile->s_height) - spriteY; if (botClip < 0) { - if (botClip + _sprHeight <= 0) { + botClip = -botClip; + if (_sprHeight <= botClip) { _sprWidth = 0; return ; } - _sprHeight += botClip; + _sprHeight -= botClip; } } _sprY = (uint32)spriteY; @@ -633,13 +634,17 @@ void SkyScreen::drawSprite(uint8 *spriteInfo, Compact *sprCompact) { } _sprX = (uint32)spriteX; uint8 *screenPtr = _backScreen + _sprY * GAME_SCREEN_WIDTH + _sprX; + if ((_sprHeight > 192) || (_sprY > 192)) { + _sprWidth = 0; + return; + } if ((_sprX + _sprWidth > 320) || (_sprY + _sprHeight > 192)) { warning("SkyScreen::drawSprite fatal error: got x = %d, y = %d, w = %d, h = %d\n",_sprX, _sprY, _sprWidth, _sprHeight); _sprWidth = 0; return ; } - for (uint8 cnty = 0; cnty < _sprHeight; cnty++) { + for (uint16 cnty = 0; cnty < _sprHeight; cnty++) { for (uint16 cntx = 0; cntx < _sprWidth; cntx++) if (spriteData[cntx + _maskX1]) screenPtr[cntx] = spriteData[cntx + _maskX1]; spriteData += _sprWidth + _maskX2 + _maskX1;