Skip to content

Commit

Permalink
HUGO: Rename pointers
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 13, 2012
1 parent 999ae29 commit 179427c
Show file tree
Hide file tree
Showing 22 changed files with 165 additions and 165 deletions.
14 changes: 7 additions & 7 deletions engines/hugo/display.cpp
Expand Up @@ -657,7 +657,7 @@ void Screen::drawBoundaries() {

for (int i = 0; i < _vm->_object->_numObj; i++) {
Object *obj = &_vm->_object->_objects[i]; // Get pointer to object
if (obj->_screenIndex == *_vm->_screen_p) {
if (obj->_screenIndex == *_vm->_screenPtr) {
if ((obj->_currImagePtr != 0) && (obj->_cycling != kCycleInvisible))
drawRectangle(false, obj->_x + obj->_currImagePtr->_x1, obj->_y + obj->_currImagePtr->_y1,
obj->_x + obj->_currImagePtr->_x2, obj->_y + obj->_currImagePtr->_y2, _TLIGHTGREEN);
Expand Down Expand Up @@ -730,10 +730,10 @@ void Screen_v1d::loadFontArr(Common::ReadStream &in) {
* processed object by looking down the current column for an overlay
* base byte set (in which case the object is foreground).
*/
OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) {
OverlayState Screen_v1d::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) {
debugC(4, kDebugDisplay, "findOvl()");

uint16 index = (uint16)(dst_p - _frontBuffer) >> 3;
uint16 index = (uint16)(dstPtr - _frontBuffer) >> 3;

for (int i = 0; i < seqPtr->_lines-y; i++) { // Each line in object
if (_vm->_object->getBaseBoundary(index)) // If any overlay base byte is non-zero then the object is foreground, else back.
Expand Down Expand Up @@ -799,14 +799,14 @@ void Screen_v1w::loadFontArr(Common::ReadStream &in) {
* processed object by looking down the current column for an overlay
* base bit set (in which case the object is foreground).
*/
OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) {
OverlayState Screen_v1w::findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) {
debugC(4, kDebugDisplay, "findOvl()");

for (; y < seqPtr->_lines; y++) { // Each line in object
byte ovb = _vm->_object->getBaseBoundary((uint16)(dst_p - _frontBuffer) >> 3); // Ptr into overlay bits
if (ovb & (0x80 >> ((uint16)(dst_p - _frontBuffer) & 7))) // Overlay bit is set
byte ovb = _vm->_object->getBaseBoundary((uint16)(dstPtr - _frontBuffer) >> 3); // Ptr into overlay bits
if (ovb & (0x80 >> ((uint16)(dstPtr - _frontBuffer) & 7))) // Overlay bit is set
return kOvlForeground; // Found a bit - must be foreground
dst_p += kXPix;
dstPtr += kXPix;
}

return kOvlBackground; // No bits set, must be background
Expand Down
6 changes: 3 additions & 3 deletions engines/hugo/display.h
Expand Up @@ -114,7 +114,7 @@ class Screen {
inline bool isInY(const int16 y, const Rect *rect) const;
inline bool isOverlapping(const Rect *rectA, const Rect *rectB) const;

virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y) = 0;
virtual OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y) = 0;

private:
byte *_curPalette;
Expand Down Expand Up @@ -150,7 +150,7 @@ class Screen_v1d : public Screen {
void loadFont(int16 fontId);
void loadFontArr(Common::ReadStream &in);
protected:
OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y);
OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y);
};

class Screen_v1w : public Screen {
Expand All @@ -161,7 +161,7 @@ class Screen_v1w : public Screen {
void loadFont(int16 fontId);
void loadFontArr(Common::ReadStream &in);
protected:
OverlayState findOvl(Seq *seqPtr, ImagePtr dst_p, uint16 y);
OverlayState findOvl(Seq *seqPtr, ImagePtr dstPtr, uint16 y);
};

} // End of namespace Hugo
Expand Down
18 changes: 9 additions & 9 deletions engines/hugo/file.cpp
Expand Up @@ -92,7 +92,7 @@ const char *FileManager::getUifFilename() const {
* Return original plane data ptr
*/
byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const {
debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr data_p)", y, bpl);
debugC(2, kDebugFile, "convertPCC(byte *p, %d, %d, ImagePtr dataPtr)", y, bpl);

dataPtr += y * bpl * 8; // Point to correct DIB line
for (int16 r = 0, g = bpl, b = g + bpl, i = b + bpl; r < bpl; r++, g++, b++, i++) { // Each byte in all planes
Expand Down Expand Up @@ -282,7 +282,7 @@ void FileManager::readImage(const int objNum, Object *objPtr) {
* Read sound (or music) file data. Call with SILENCE to free-up
* any allocated memory. Also returns size of data
*/
sound_pt FileManager::getSound(const int16 sound, uint16 *size) {
SoundPtr FileManager::getSound(const int16 sound, uint16 *size) {
debugC(1, kDebugFile, "getSound(%d)", sound);

// No more to do if SILENCE (called for cleanup purposes)
Expand All @@ -298,25 +298,25 @@ sound_pt FileManager::getSound(const int16 sound, uint16 *size) {

if (!_hasReadHeader) {
for (int i = 0; i < kMaxSounds; i++) {
_s_hdr[i]._size = fp.readUint16LE();
_s_hdr[i]._offset = fp.readUint32LE();
_soundHdr[i]._size = fp.readUint16LE();
_soundHdr[i]._offset = fp.readUint32LE();
}
if (fp.err())
error("Wrong sound file format");
_hasReadHeader = true;
}

*size = _s_hdr[sound]._size;
*size = _soundHdr[sound]._size;
if (*size == 0)
error("Wrong sound file format or missing sound %d", sound);

// Allocate memory for sound or music, if possible
sound_pt soundPtr = (byte *)malloc(_s_hdr[sound]._size); // Ptr to sound data
SoundPtr soundPtr = (byte *)malloc(_soundHdr[sound]._size); // Ptr to sound data
assert(soundPtr);

// Seek to data and read it
fp.seek(_s_hdr[sound]._offset, SEEK_SET);
if (fp.read(soundPtr, _s_hdr[sound]._size) != _s_hdr[sound]._size)
fp.seek(_soundHdr[sound]._offset, SEEK_SET);
if (fp.read(soundPtr, _soundHdr[sound]._size) != _soundHdr[sound]._size)
error("Wrong sound file format");

fp.close();
Expand Down Expand Up @@ -513,7 +513,7 @@ bool FileManager::restoreGame(const int16 slot) {
_vm->_maze._x4 = in->readSint16BE();
_vm->_maze._firstScreenIndex = in->readByte();

_vm->_scheduler->restoreScreen(*_vm->_screen_p);
_vm->_scheduler->restoreScreen(*_vm->_screenPtr);
if ((_vm->getGameStatus()._viewState = (Vstate) in->readByte()) != kViewPlay)
_vm->_screen->hideCursor();

Expand Down
4 changes: 2 additions & 2 deletions engines/hugo/file.h
Expand Up @@ -47,7 +47,7 @@ class FileManager {
FileManager(HugoEngine *vm);
virtual ~FileManager();

sound_pt getSound(const int16 sound, uint16 *size);
SoundPtr getSound(const int16 sound, uint16 *size);

void readBootFile();
void readImage(const int objNum, Object *objPtr);
Expand Down Expand Up @@ -118,7 +118,7 @@ class FileManager {

// If this is the first call, read the lookup table
bool _hasReadHeader;
SoundHdr _s_hdr[kMaxSounds]; // Sound lookup table
SoundHdr _soundHdr[kMaxSounds]; // Sound lookup table

private:
byte *convertPCC(byte *p, const uint16 y, const uint16 bpl, ImagePtr dataPtr) const;
Expand Down
2 changes: 1 addition & 1 deletion engines/hugo/game.h
Expand Up @@ -95,7 +95,7 @@ struct hugoBoot { // Common HUGO boot file
* Game specific type definitions
*/
typedef byte *ImagePtr; // ptr to an object image (sprite)
typedef byte *sound_pt; // ptr to sound (or music) data
typedef byte *SoundPtr; // ptr to sound (or music) data

/**
* Structure for initializing maze processing
Expand Down
4 changes: 2 additions & 2 deletions engines/hugo/hugo.cpp
Expand Up @@ -427,7 +427,7 @@ bool HugoEngine::loadHugoDat() {
_scheduler->loadActListArr(in);
_scheduler->loadAlNewscrIndex(in);
_hero = &_object->_objects[kHeroIndex]; // This always points to hero
_screen_p = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's
_screenPtr = &(_object->_objects[kHeroIndex]._screenIndex); // Current screen is hero's
_heroImage = kHeroIndex; // Current in use hero image

for (int varnt = 0; varnt < _numVariant; varnt++) {
Expand Down Expand Up @@ -660,7 +660,7 @@ void HugoEngine::readScreenFiles(const int screenNum) {
void HugoEngine::setNewScreen(const int screenNum) {
debugC(1, kDebugEngine, "setNewScreen(%d)", screenNum);

*_screen_p = screenNum; // HERO object
*_screenPtr = screenNum; // HERO object
_object->setCarriedScreen(screenNum); // Carried objects
}

Expand Down
2 changes: 1 addition & 1 deletion engines/hugo/hugo.h
Expand Up @@ -226,7 +226,7 @@ class HugoEngine : public Engine {
int8 _normalTPS; // Number of ticks (frames) per second.
// 8 for Win versions, 9 for DOS versions
Object *_hero;
byte *_screen_p;
byte *_screenPtr;
byte _heroImage;
byte *_screenStates;
Command _line; // Line of user text input
Expand Down
4 changes: 2 additions & 2 deletions engines/hugo/mouse.cpp
Expand Up @@ -223,7 +223,7 @@ void MouseHandler::processLeftClick(const int16 objId, const int16 cx, const int
_vm->_screen->displayList(kDisplayAdd, 0, kDibOffY, kXPix, kInvDy);
break;
case kExitHotspot: // Walk to exit hotspot
i = findExit(cx, cy, *_vm->_screen_p);
i = findExit(cx, cy, *_vm->_screenPtr);
x = _hotspots[i]._viewx;
y = _hotspots[i]._viewy;
if (x >= 0) { // Hotspot refers to an exit
Expand Down Expand Up @@ -327,7 +327,7 @@ void MouseHandler::mouseHandler() {

// Process cursor over an exit hotspot
if (objId == -1) {
int i = findExit(cx, cy, *_vm->_screen_p);
int i = findExit(cx, cy, *_vm->_screenPtr);
if (i != -1 && _hotspots[i]._viewx >= 0) {
objId = kExitHotspot;
cursorText(_vm->_text->getTextMouse(kMsExit), cx, cy, U_FONT8, _TBRIGHTWHITE);
Expand Down
4 changes: 2 additions & 2 deletions engines/hugo/object.cpp
Expand Up @@ -199,7 +199,7 @@ int16 ObjectHandler::findObject(uint16 x, uint16 y) {
// Check objects on screen
for (int i = 0; i < _numObj; i++, obj++) {
// Object must be in current screen and "useful"
if (obj->_screenIndex == *_vm->_screen_p && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) {
if (obj->_screenIndex == *_vm->_screenPtr && (obj->_genericCmd || obj->_objValue || obj->_cmdIndex)) {
Seq *curImage = obj->_currImagePtr;
// Object must have a visible image...
if (curImage != 0 && obj->_cycling != kCycleInvisible) {
Expand Down Expand Up @@ -347,7 +347,7 @@ void ObjectHandler::showTakeables() {
for (int j = 0; j < _numObj; j++) {
Object *obj = &_objects[j];
if ((obj->_cycling != kCycleInvisible) &&
(obj->_screenIndex == *_vm->_screen_p) &&
(obj->_screenIndex == *_vm->_screenPtr) &&
(((TAKE & obj->_genericCmd) == TAKE) || obj->_objValue)) {
Utils::notifyBox(Common::String::format("You can also see:\n%s.", _vm->_text->getNoun(obj->_nounIndex, LOOK_NAME)));
}
Expand Down
8 changes: 4 additions & 4 deletions engines/hugo/object_v1d.cpp
Expand Up @@ -64,7 +64,7 @@ void ObjectHandler_v1d::updateImages() {

for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i];
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
objindex[objNumb++] = i;
}

Expand Down Expand Up @@ -185,7 +185,7 @@ void ObjectHandler_v1d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if (obj->_screenIndex == *_vm->_screen_p) {
if (obj->_screenIndex == *_vm->_screenPtr) {
switch (obj->_pathType) {
case kPathChase: {
// Allowable motion wrt boundary
Expand Down Expand Up @@ -272,7 +272,7 @@ void ObjectHandler_v1d::moveObjects() {
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) {
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving

// Do object movement. Delta_x,y return allowed movement in x,y
Expand Down Expand Up @@ -327,7 +327,7 @@ void ObjectHandler_v1d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}

Expand Down
8 changes: 4 additions & 4 deletions engines/hugo/object_v1w.cpp
Expand Up @@ -64,7 +64,7 @@ void ObjectHandler_v1w::updateImages() {

for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i];
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
objindex[objNumb++] = i;
}

Expand Down Expand Up @@ -182,7 +182,7 @@ void ObjectHandler_v1w::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if (obj->_screenIndex == *_vm->_screen_p) {
if (obj->_screenIndex == *_vm->_screenPtr) {
switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
Expand Down Expand Up @@ -282,7 +282,7 @@ void ObjectHandler_v1w::moveObjects() {
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) {
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving

// Do object movement. Delta_x,y return allowed movement in x,y
Expand Down Expand Up @@ -337,7 +337,7 @@ void ObjectHandler_v1w::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}

Expand Down
8 changes: 4 additions & 4 deletions engines/hugo/object_v2d.cpp
Expand Up @@ -64,7 +64,7 @@ void ObjectHandler_v2d::updateImages() {

for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i];
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling >= kCycleAlmostInvisible))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling >= kCycleAlmostInvisible))
objindex[objNumb++] = i;
}

Expand Down Expand Up @@ -185,7 +185,7 @@ void ObjectHandler_v2d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if (obj->_screenIndex == *_vm->_screen_p) {
if (obj->_screenIndex == *_vm->_screenPtr) {
switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
Expand Down Expand Up @@ -285,7 +285,7 @@ void ObjectHandler_v2d::moveObjects() {
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) {
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving

// Do object movement. Delta_x,y return allowed movement in x,y
Expand Down Expand Up @@ -340,7 +340,7 @@ void ObjectHandler_v2d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}

Expand Down
6 changes: 3 additions & 3 deletions engines/hugo/object_v3d.cpp
Expand Up @@ -66,7 +66,7 @@ void ObjectHandler_v3d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if (obj->_screenIndex == *_vm->_screen_p) {
if (obj->_screenIndex == *_vm->_screenPtr) {
switch (obj->_pathType) {
case kPathChase:
case kPathChase2: {
Expand Down Expand Up @@ -167,7 +167,7 @@ void ObjectHandler_v3d::moveObjects() {
// Move objects, allowing for boundaries
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_vx || obj->_vy)) {
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_vx || obj->_vy)) {
// Only process if it's moving

// Do object movement. Delta_x,y return allowed movement in x,y
Expand Down Expand Up @@ -222,7 +222,7 @@ void ObjectHandler_v3d::moveObjects() {
for (int i = 0; i < _numObj; i++) {
Object *obj = &_objects[i]; // Get pointer to object
Seq *currImage = obj->_currImagePtr; // Get ptr to current image
if ((obj->_screenIndex == *_vm->_screen_p) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
if ((obj->_screenIndex == *_vm->_screenPtr) && (obj->_cycling > kCycleAlmostInvisible) && (obj->_priority == kPriorityFloating))
clearBoundary(obj->_oldx + currImage->_x1, obj->_oldx + currImage->_x2, obj->_oldy + currImage->_y2);
}

Expand Down
4 changes: 2 additions & 2 deletions engines/hugo/parser.cpp
Expand Up @@ -164,11 +164,11 @@ void Parser::loadArrayReqs(Common::SeekableReadStream &in) {
const char *Parser::useBG(const char *name) {
debugC(1, kDebugEngine, "useBG(%s)", name);

ObjectList p = _backgroundObjects[*_vm->_screen_p];
ObjectList p = _backgroundObjects[*_vm->_screenPtr];
for (int i = 0; p[i]._verbIndex != 0; i++) {
if ((name == _vm->_text->getNoun(p[i]._nounIndex, 0) &&
p[i]._verbIndex != _vm->_look) &&
((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screen_p])))
((p[i]._roomState == kStateDontCare) || (p[i]._roomState == _vm->_screenStates[*_vm->_screenPtr])))
return _vm->_text->getVerb(p[i]._verbIndex, 0);
}

Expand Down

0 comments on commit 179427c

Please sign in to comment.