Skip to content

Commit

Permalink
TONY: Move some functions from .h to .cpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Aug 31, 2012
1 parent f2df769 commit 8c753c9
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 85 deletions.
31 changes: 31 additions & 0 deletions engines/tony/game.cpp
Expand Up @@ -1571,4 +1571,35 @@ void RMPointer::updateCursor() {
CursorMan.replaceCursor(cursorData, 64, 64, _cursorHotspot._x, _cursorHotspot._y, 0, 1, &pixelFormat);
}

/**
* Sets a new action as current
*/
void RMPointer::setAction(RMTonyAction action) {
_nCurPointer = action;
updateCursor();
}

/**
* Sets a new pointer
*/
void RMPointer::setSpecialPointer(PointerType ptr) {
_nCurSpecialPointer = ptr;
if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM)
_specialPointer[ptr - 1]->setPattern(1);

updateCursor();
}

RMPointer::PointerType RMPointer::getSpecialPointer() {
return (PointerType)_nCurSpecialPointer;
}

/**
* Set the new custom pointer
*/
void RMPointer::setCustomPointer(RMGfxSourceBuffer8 *ptr) {
_nCurCustomPointer = ptr;
updateCursor();
}

} // End of namespace Tony
44 changes: 15 additions & 29 deletions engines/tony/game.h
Expand Up @@ -53,8 +53,18 @@ namespace Tony {
(buf8)->init(*raw, raw->width(), raw->height(), true); \
delete raw;


class RMPointer {
public:
enum PointerType {
PTR_NONE = 0,
PTR_ARROWUP,
PTR_ARROWDOWN,
PTR_ARROWLEFT,
PTR_ARROWRIGHT,
PTR_ARROWMAP,
PTR_CUSTOM
};

private:
RMGfxSourceBuffer8 *_pointer[16];
RMPoint _hotspot[16];
Expand All @@ -67,17 +77,6 @@ class RMPointer {

RMGfxSourceBuffer8 *_nCurCustomPointer;

public:
enum PointerType {
PTR_NONE = 0,
PTR_ARROWUP,
PTR_ARROWDOWN,
PTR_ARROWLEFT,
PTR_ARROWRIGHT,
PTR_ARROWMAP,
PTR_CUSTOM
};

public:
/**
* Constructor & destructor
Expand Down Expand Up @@ -108,32 +107,19 @@ class RMPointer {
/**
* Sets a new action as current
*/
void setAction(RMTonyAction action) {
_nCurPointer = action;
updateCursor();
}
void setAction(RMTonyAction action);

/**
* Sets a new pointer
*/
void setSpecialPointer(PointerType ptr) {
_nCurSpecialPointer = ptr;
if (_nCurSpecialPointer && _nCurSpecialPointer != PTR_CUSTOM)
_specialPointer[ptr - 1]->setPattern(1);
void setSpecialPointer(PointerType ptr);

updateCursor();
}
PointerType getSpecialPointer() {
return (PointerType)_nCurSpecialPointer;
}
PointerType getSpecialPointer();

/**
* Set the new custom pointer
*/
void setCustomPointer(RMGfxSourceBuffer8 *ptr) {
_nCurCustomPointer = ptr;
updateCursor();
}
void setCustomPointer(RMGfxSourceBuffer8 *ptr);

/**
* Return the current action to be applied according to the pointer
Expand Down
23 changes: 23 additions & 0 deletions engines/tony/gfxengine.cpp
Expand Up @@ -836,4 +836,27 @@ bool RMGfxEngine::canLoadSave() {
return _bInput && !_tony.inAction() && !g_vm->getIsDemo();
}

RMGfxEngine::operator RMGfxTargetBuffer &() {
return _bigBuf;
}

RMInput &RMGfxEngine::getInput() {
return _input;
}

RMPointer &RMGfxEngine::getPointer() {
return _point;
}

/**
* Link to graphic task
*/
void RMGfxEngine::linkGraphicTask(RMGfxTask *task) {
_bigBuf.addPrim(new RMGfxPrimitive(task));
}

void RMGfxEngine::setPerorate(bool bpal) {
_inter.setPerorate(bpal);
}

} // End of namespace Tony
21 changes: 6 additions & 15 deletions engines/tony/gfxengine.h
Expand Up @@ -102,23 +102,15 @@ class RMGfxEngine {
void enableMouse();
void disableMouse();

operator RMGfxTargetBuffer &() {
return _bigBuf;
}
RMInput &getInput() {
return _input;
}
RMPointer &getPointer() {
return _point;
}
operator RMGfxTargetBuffer &();
RMInput &getInput();
RMPointer &getPointer();

// Link to the custom function list
void initCustomDll();

// Link to graphic task
void linkGraphicTask(RMGfxTask *task) {
_bigBuf.addPrim(new RMGfxPrimitive(task));
};
void linkGraphicTask(RMGfxTask *task);

// Manage a location
uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
Expand All @@ -137,9 +129,8 @@ class RMGfxEngine {
void closeWipe();
void waitWipeEnd(CORO_PARAM);

void setPerorate(bool bpal) {
_inter.setPerorate(bpal);
}
void setPerorate(bool bpal);

bool canLoadSave();
};

Expand Down
1 change: 1 addition & 0 deletions engines/tony/loc.h
Expand Up @@ -529,6 +529,7 @@ class RMLocation : public RMGfxTaskSetPrior {

public:
// @@@@@@@@@@@@@@@@@@@@@@@

RMPoint TEMPTonyStart;
RMPoint TEMPGetTonyStart() {
return TEMPTonyStart;
Expand Down
8 changes: 3 additions & 5 deletions engines/tony/sound.h
Expand Up @@ -49,11 +49,9 @@ enum SoundCodecs {
FPCODEC_ADPCM
};

//****************************************************************************
//* class FPSound
//* -------------
//* Description: Sound driver For Tony Tough
//****************************************************************************
/**
* Sound driver For Tony Tough
*/

class FPSound {
private:
Expand Down
16 changes: 16 additions & 0 deletions engines/tony/tony.cpp
Expand Up @@ -615,6 +615,14 @@ void TonyEngine::grabThumbnail() {
_window.grabThumbnail(_curThumbnail);
}

uint16 *TonyEngine::getThumbnail() {
return _curThumbnail;
}

void TonyEngine::quitGame() {
_bQuitNow = true;
}

void TonyEngine::openInitLoadMenu(CORO_PARAM) {
_theEngine.openOptionScreen(coroParam, 1);
}
Expand Down Expand Up @@ -776,4 +784,12 @@ void TonyEngine::saveSoundSettings() {
ConfMan.setInt("talkspeed", GLOBALS._nCfgTextSpeed * 256 / 10);
}

void TonyEngine::showLocation() {
_bDrawLocation = true;
}

void TonyEngine::hideLocation() {
_bDrawLocation = false;
}

} // End of namespace Tony
16 changes: 4 additions & 12 deletions engines/tony/tony.h
Expand Up @@ -173,12 +173,8 @@ class TonyEngine : public Engine {

void getDataDirectory(DataDir dir, char *path);

void showLocation() {
_bDrawLocation = true;
}
void hideLocation() {
_bDrawLocation = false;
}
void showLocation();
void hideLocation();

/**
* Reads the time
Expand Down Expand Up @@ -226,13 +222,9 @@ class TonyEngine : public Engine {
* Get a thumbnail
*/
void grabThumbnail();
uint16 *getThumbnail() {
return _curThumbnail;
}
uint16 *getThumbnail();

void quitGame() {
_bQuitNow = true;
}
void quitGame();

void openInitLoadMenu(CORO_PARAM);
void openInitOptions(CORO_PARAM);
Expand Down
50 changes: 50 additions & 0 deletions engines/tony/tonychar.cpp
Expand Up @@ -1892,4 +1892,54 @@ void RMTony::endStatic(CORO_PARAM, CharacterTalkType nTalk) {
CORO_END_CODE;
}

/**
* Waits until the end of a pattern
*/
void RMTony::waitForEndPattern(CORO_PARAM, uint32 hCustomSkip) {
RMCharacter::waitForEndPattern(coroParam, hCustomSkip);
}

/**
* Check if currently in an action
*/
bool RMTony::inAction() {
return (_bActionPending && _action != 0) | _bAction;
}

/**
* Check if there needs to be an update for scrolling movement
*/
bool RMTony::mustUpdateScrolling() {
return ((!inAction()) || (isMoving()));
}

/**
* Returns Tony's position
*/
RMPoint RMTony::position() {
return _pos;
}

/**
* Set the scrolling position
*/
void RMTony::setScrollPosition(const RMPoint &pt) {
RMCharacter::setScrollPosition(pt);
}

/**
* Tony disguises himself!
*/
void RMTony::setShepherdess(bool bIsPast) {
_bShepherdess = bIsPast;
}

int RMTony::getShepherdess() {
return _bShepherdess;
}

void RMTony::playSfx(int nSfx) {
RMItem::playSfx(nSfx);
}

} // End of namespace Tony
33 changes: 9 additions & 24 deletions engines/tony/tonychar.h
Expand Up @@ -416,37 +416,27 @@ class RMTony : public RMCharacter {
/**
* Waits until the end of a pattern
*/
void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE) {
RMCharacter::waitForEndPattern(coroParam, hCustomSkip);
}
void waitForEndPattern(CORO_PARAM, uint32 hCustomSkip = CORO_INVALID_PID_VALUE);

/**
* Check if currently in an action
*/
bool inAction() {
return (_bActionPending && _action != 0) | _bAction;
}
bool inAction();

/**
* Check if there needs to be an update for scrolling movement
*/
bool mustUpdateScrolling() {
return ((!inAction()) || (isMoving()));
}
bool mustUpdateScrolling();

/**
* Returns Tony's position
*/
RMPoint position() {
return _pos;
}
RMPoint position();

/**
* Set the scrolling position
*/
void setScrollPosition(const RMPoint &pt) {
RMCharacter::setScrollPosition(pt);
}
void setScrollPosition(const RMPoint &pt);

/**
* Set the take animation
Expand Down Expand Up @@ -475,21 +465,16 @@ class RMTony : public RMCharacter {
/**
* Tony disguises himself!
*/
void setShepherdess(bool bIsPast) {
_bShepherdess = bIsPast;
}
int getShepherdess() {
return _bShepherdess;
}
void setShepherdess(bool bIsPast);

int getShepherdess();

/**
* Perform an action
*/
void executeAction(int nAction, int nActionItem, int nParm);

void playSfx(int nSfx) {
RMItem::playSfx(nSfx);
}
void playSfx(int nSfx);
};

} // End of namespace Tony
Expand Down

0 comments on commit 8c753c9

Please sign in to comment.