Skip to content

Commit

Permalink
NEVERHOOD: Rename SetSpriteCallback to SetSpriteUpdate
Browse files Browse the repository at this point in the history
- Started replace message numbers with constants
- Add NRect::contains
- Some cleanup
  • Loading branch information
johndoe123 authored and wjp committed May 8, 2013
1 parent 9c23416 commit 0683ed9
Show file tree
Hide file tree
Showing 20 changed files with 309 additions and 293 deletions.
2 changes: 1 addition & 1 deletion engines/neverhood/blbarchive.cpp
Expand Up @@ -98,7 +98,7 @@ void BlbArchive::load(uint index, byte *buffer, uint32 size) {
Common::decompressDCL(&_fd, buffer, entry.diskSize, entry.size);
break;
default:
;
error("BlbArchive::load() Unknown compression type %d", entry.comprType);
}

}
Expand Down
11 changes: 4 additions & 7 deletions engines/neverhood/collisionman.cpp
Expand Up @@ -56,13 +56,10 @@ void CollisionMan::clearHitRects() {
}

HitRect *CollisionMan::findHitRectAtPos(int16 x, int16 y) {
if (_hitRects) {
for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++) {
HitRect *hitRect = &(*it);
if (x >= hitRect->rect.x1 && x <= hitRect->rect.x2 && y >= hitRect->rect.y1 && y <= hitRect->rect.y2)
return hitRect;
}
}
if (_hitRects)
for (HitRectList::iterator it = _hitRects->begin(); it != _hitRects->end(); it++)
if ((*it).rect.contains(x, y))
return &(*it);
return &defaultHitRect;
}

Expand Down
8 changes: 8 additions & 0 deletions engines/neverhood/graphics.h
Expand Up @@ -42,14 +42,22 @@ struct NDimensions {

struct NRect {
int16 x1, y1, x2, y2;

NRect() : x1(0), y1(0), x2(0), y2(0) {}

NRect(int16 x01, int16 y01, int16 x02, int16 y02) : x1(x01), y1(y01), x2(x02), y2(y02) {}

void set(int16 x01, int16 y01, int16 x02, int16 y02) {
x1 = x01;
y1 = y01;
x2 = x02;
y2 = y02;
}

bool contains(int16 x, int16 y) const {
return x >= x1 && x <= x2 && y >= y1 && y <= y2;
}

};

typedef Common::Array<NRect> NRectArray;
Expand Down

0 comments on commit 0683ed9

Please sign in to comment.