Skip to content

Commit

Permalink
ZVISION: Style modifing by astyle.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Oct 20, 2013
1 parent aefa58f commit 25834fa
Show file tree
Hide file tree
Showing 50 changed files with 465 additions and 377 deletions.
18 changes: 9 additions & 9 deletions engines/zvision/actions.cpp
Expand Up @@ -103,8 +103,8 @@ bool ActionChangeLocation::execute(ZVision *engine) {

ActionCrossfade::ActionCrossfade(const Common::String &line) {
sscanf(line.c_str(),
"%*[^(](%u %u %u %u %u %u %u)",
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
"%*[^(](%u %u %u %u %u %u %u)",
&_keyOne, &_keyTwo, &_oneStartVolume, &_twoStartVolume, &_oneEndVolume, &_twoEndVolume, &_timeInMillis);
}

bool ActionCrossfade::execute(ZVision *engine) {
Expand All @@ -123,7 +123,7 @@ ActionDisableControl::ActionDisableControl(const Common::String &line) {

bool ActionDisableControl::execute(ZVision *engine) {
debug("Disabling control %u", _key);

engine->getScriptManager()->disableControl(_key);

return true;
Expand Down Expand Up @@ -189,7 +189,7 @@ bool ActionMusic::execute(ZVision *engine) {
} else {
audioStream = makeRawZorkStream(_fileName, engine);
}

if (_loop) {
Audio::LoopingAudioStream *loopingAudioStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES);
engine->_mixer->playStream(_soundType, 0, loopingAudioStream, -1, _volume);
Expand Down Expand Up @@ -235,8 +235,8 @@ ActionPlayAnimation::ActionPlayAnimation(const Common::String &line) {

// The two %*u are always 0 and dont seem to have a use
sscanf(line.c_str(),
"%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)",
&_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loopCount, &_mask, &_framerate);
"%*[^:]:%*[^:]:%u(%25s %u %u %u %u %u %u %u %*u %*u %u %u)",
&_key, fileName, &_x, &_y, &_width, &_height, &_start, &_end, &_loopCount, &_mask, &_framerate);

_fileName = Common::String(fileName);
}
Expand All @@ -253,8 +253,8 @@ bool ActionPlayAnimation::execute(ZVision *engine) {

ActionPlayPreloadAnimation::ActionPlayPreloadAnimation(const Common::String &line) {
sscanf(line.c_str(),
"%*[^:]:%*[^:]:%u(%u %u %u %u %u %u %u %u)",
&_animationKey, &_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount);
"%*[^:]:%*[^:]:%u(%u %u %u %u %u %u %u %u)",
&_animationKey, &_controlKey, &_x1, &_y1, &_x2, &_y2, &_startFrame, &_endFrame, &_loopCount);
}

bool ActionPlayPreloadAnimation::execute(ZVision *engine) {
Expand Down Expand Up @@ -320,7 +320,7 @@ ActionSetPartialScreen::ActionSetPartialScreen(const Common::String &line) {

bool ActionSetPartialScreen::execute(ZVision *engine) {
RenderManager *renderManager = engine->getRenderManager();

if (_backgroundColor > 0) {
renderManager->clearWorkingWindowTo555Color(_backgroundColor);
}
Expand Down
2 changes: 1 addition & 1 deletion engines/zvision/actions.h
Expand Up @@ -319,7 +319,7 @@ class ActionStreamVideo : public ResultAction {

private:
enum {
DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions
DIFFERENT_DIMENSIONS = 0x1 // 0x1 flags that the destRect dimensions are different from the original video dimensions
};

Common::String _fileName;
Expand Down
14 changes: 7 additions & 7 deletions engines/zvision/animation_control.cpp
Expand Up @@ -38,13 +38,13 @@
namespace ZVision {

AnimationControl::AnimationControl(ZVision *engine, uint32 controlKey, const Common::String &fileName)
: Control(engine, controlKey),
_fileType(RLF),
_loopCount(1),
_currentLoop(0),
_accumulatedTime(0),
_cachedFrame(0),
_cachedFrameNeedsDeletion(false) {
: Control(engine, controlKey),
_fileType(RLF),
_loopCount(1),
_currentLoop(0),
_accumulatedTime(0),
_cachedFrame(0),
_cachedFrameNeedsDeletion(false) {
if (fileName.hasSuffix(".rlf")) {
_fileType = RLF;
_animation.rlf = new RlfAnimation(fileName, false);
Expand Down
22 changes: 15 additions & 7 deletions engines/zvision/animation_control.h
Expand Up @@ -50,13 +50,13 @@ class AnimationControl : public Control {

private:
enum FileType {
RLF = 1,
AVI = 2
RLF = 1,
AVI = 2
};

private:
uint32 _animationKey;

union {
RlfAnimation *rlf;
Video::VideoDecoder *avi;
Expand All @@ -76,10 +76,18 @@ class AnimationControl : public Control {
public:
bool process(uint32 deltaTimeInMillis);

void setAnimationKey(uint32 animationKey) { _animationKey = animationKey; }
void setLoopCount(uint loopCount) { _loopCount = loopCount; }
void setXPos(int32 x) { _x = x; }
void setYPost(int32 y) { _y = y; }
void setAnimationKey(uint32 animationKey) {
_animationKey = animationKey;
}
void setLoopCount(uint loopCount) {
_loopCount = loopCount;
}
void setXPos(int32 x) {
_x = x;
}
void setYPost(int32 y) {
_y = y;
}
};

} // End of namespace ZVision
Expand Down
2 changes: 1 addition & 1 deletion engines/zvision/clock.cpp
Expand Up @@ -30,7 +30,7 @@

namespace ZVision {

Clock::Clock(OSystem *system)
Clock::Clock(OSystem *system)
: _system(system),
_lastTime(0),
_deltaTime(0),
Expand Down
12 changes: 8 additions & 4 deletions engines/zvision/clock.h
Expand Up @@ -53,22 +53,26 @@ class Clock {
*
* @return Delta time since the last frame (in milliseconds)
*/
uint32 getDeltaTime() const { return _deltaTime; }
uint32 getDeltaTime() const {
return _deltaTime;
}
/**
* Get the time from the program starting to the last update() call
*
* @return Time from program start to last update() call (in milliseconds)
*/
uint32 getLastMeasuredTime() { return _lastTime; }
uint32 getLastMeasuredTime() {
return _lastTime;
}

/**
* Pause the clock. Any future delta times will take this pause into account.
* Has no effect if the clock is already paused.
* Has no effect if the clock is already paused.
*/
void start();
/**
* Un-pause the clock.
* Has no effect if the clock is already un-paused.
* Has no effect if the clock is already un-paused.
*/
void stop();
};
Expand Down
20 changes: 14 additions & 6 deletions engines/zvision/control.h
Expand Up @@ -42,7 +42,9 @@ class Control {
Control(ZVision *engine, uint32 key) : _engine(engine), _key(key), _enabled(false) {}
virtual ~Control() {}

uint32 getKey() { return _key; }
uint32 getKey() {
return _key;
}

virtual void enable();
virtual void disable();
Expand All @@ -69,7 +71,9 @@ class Control {
* @param backgroundImageSpacePos The position of the mouse in background image space
* @return Was the cursor changed?
*/
virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) { return false; }
virtual bool onMouseMove(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
return false;
}
/**
* Called when a key is pressed. Default is NOP.
*
Expand All @@ -88,14 +92,16 @@ class Control {
* @param deltaTimeInMillis The number of milliseconds that have passed since last frame
* @return If true, the node can be deleted after process() finishes
*/
virtual bool process(uint32 deltaTimeInMillis) { return false; }
virtual bool process(uint32 deltaTimeInMillis) {
return false;
}
/**
* Serialize a Control for save game use. This should only be used if a Control needs
* to save values that would be different from initialization. AKA a TimerNode needs to
* store the amount of time left on the timer. Any Controls overriding this *MUST* write
* their key as the first data outputted. The default implementation is NOP.
*
* NOTE: If this method is overridden, you MUST also override deserialize()
* NOTE: If this method is overridden, you MUST also override deserialize()
* and needsSerialization()
*
* @param stream Stream to write any needed data to
Expand All @@ -118,10 +124,12 @@ class Control {
*
* @return Does the Control need save game serialization?
*/
virtual inline bool needsSerialization() { return false; }
virtual inline bool needsSerialization() {
return false;
}

protected:
ZVision * _engine;
ZVision *_engine;
uint32 _key;
bool _enabled;

Expand Down
12 changes: 6 additions & 6 deletions engines/zvision/cursor.cpp
Expand Up @@ -30,18 +30,18 @@

namespace ZVision {

ZorkCursor::ZorkCursor()
ZorkCursor::ZorkCursor()
: _width(0),
_height(0),
_hotspotX(0),
_hotspotY(0) {
}

ZorkCursor::ZorkCursor(const Common::String &fileName)
: _width(0),
_height(0),
_hotspotX(0),
_hotspotY(0) {
ZorkCursor::ZorkCursor(const Common::String &fileName)
: _width(0),
_height(0),
_hotspotX(0),
_hotspotY(0) {
Common::File file;
if (!file.open(fileName))
return;
Expand Down
26 changes: 19 additions & 7 deletions engines/zvision/cursor.h
Expand Up @@ -32,7 +32,7 @@ class String;

namespace ZVision {

/**
/**
* Utility class to parse and hold cursor data
* Modeled off Graphics::Cursor
*/
Expand All @@ -53,12 +53,24 @@ class ZorkCursor {
public:
ZorkCursor &operator=(const ZorkCursor &other);

uint16 getWidth() const { return _width; }
uint16 getHeight() const { return _height; }
uint16 getHotspotX() const { return _hotspotX; }
uint16 getHotspotY() const { return _hotspotY; }
byte getKeyColor() const { return 0; }
const byte *getSurface() const { return (const byte *)_surface.getPixels(); }
uint16 getWidth() const {
return _width;
}
uint16 getHeight() const {
return _height;
}
uint16 getHotspotX() const {
return _hotspotX;
}
uint16 getHotspotY() const {
return _hotspotY;
}
byte getKeyColor() const {
return 0;
}
const byte *getSurface() const {
return (const byte *)_surface.getPixels();
}
};

} // End of namespace ZVision
Expand Down
15 changes: 9 additions & 6 deletions engines/zvision/cursor_manager.cpp
Expand Up @@ -35,19 +35,22 @@
namespace ZVision {

const char *CursorManager::_cursorNames[NUM_CURSORS] = { "active", "arrow", "backward", "downarrow", "forward", "handpt", "handpu", "hdown", "hleft",
"hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow" };
"hright", "hup", "idle", "leftarrow", "rightarrow", "suggest_surround", "suggest_tilt", "turnaround", "zuparrow"
};

const char *CursorManager::_zgiCursorFileNames[NUM_CURSORS] = { "g0gbc011.zcr", "g0gac001.zcr", "g0gac021.zcr", "g0gac031.zcr", "g0gac041.zcr", "g0gac051.zcr", "g0gac061.zcr", "g0gac071.zcr", "g0gac081.zcr",
"g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr" };
"g0gac091.zcr", "g0gac101.zcr", "g0gac011.zcr", "g0gac111.zcr", "g0gac121.zcr", "g0gac131.zcr", "g0gac141.zcr", "g0gac151.zcr", "g0gac161.zcr"
};

const char *CursorManager::_zNemCursorFileNames[NUM_CURSORS] = { "00act", "arrow", "back", "down", "forw", "handpt", "handpu", "hdown", "hleft",
"hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up" };
"hright", "hup", "00idle", "left", "right", "ssurr", "stilt", "turn", "up"
};


CursorManager::CursorManager(ZVision *engine, const Graphics::PixelFormat *pixelFormat)
: _engine(engine),
_pixelFormat(pixelFormat),
_cursorIsPushed(false) {
: _engine(engine),
_pixelFormat(pixelFormat),
_cursorIsPushed(false) {
// WARNING: The index IDLE_CURSOR_INDEX is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly
if (_engine->getGameId() == GID_NEMESIS) {
Common::String name(Common::String::format("%sa.zcr", _zNemCursorFileNames[IDLE_CURSOR_INDEX]));
Expand Down
8 changes: 4 additions & 4 deletions engines/zvision/cursor_manager.h
Expand Up @@ -48,9 +48,9 @@ class CursorManager {

private:
enum {
NUM_CURSORS = 18,
// WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly
IDLE_CURSOR_INDEX = 11
NUM_CURSORS = 18,
// WARNING: The index 11 is hardcoded. If you change the order of _cursorNames/_zgiCursorFileNames/_zNemCursorFileNames, you HAVE to change the index accordingly
IDLE_CURSOR_INDEX = 11
};

ZVision *_engine;
Expand All @@ -77,7 +77,7 @@ class CursorManager {
/**
* Parses a cursor name into a cursor file then creates and shows that cursor.
*
* @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[]
* @param cursorName The name of a cursor. This *HAS* to correspond to one of the entries in _cursorNames[]
* @param pushed Should the cursor be pushed (true) or not pushed (false) (Another way to say it: down or up)
*/
void changeCursor(const Common::String &cursorName, bool pushed);
Expand Down

0 comments on commit 25834fa

Please sign in to comment.