Skip to content

Commit

Permalink
ZVISION: Move the screen initialization code into a separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
bluegr committed Jan 7, 2015
1 parent fb135b3 commit 2d0e9fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
24 changes: 14 additions & 10 deletions engines/zvision/zvision.cpp
Expand Up @@ -105,15 +105,6 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)

debug(1, "ZVision::ZVision");

uint16 workingWindowWidth = (gameDesc->gameId == GID_NEMESIS) ? ZNM_WORKING_WINDOW_WIDTH : ZGI_WORKING_WINDOW_WIDTH;
uint16 workingWindowHeight = (gameDesc->gameId == GID_NEMESIS) ? ZNM_WORKING_WINDOW_HEIGHT : ZGI_WORKING_WINDOW_HEIGHT;
_workingWindow = Common::Rect(
(WINDOW_WIDTH - workingWindowWidth) / 2,
(WINDOW_HEIGHT - workingWindowHeight) / 2,
((WINDOW_WIDTH - workingWindowWidth) / 2) + workingWindowWidth,
((WINDOW_HEIGHT - workingWindowHeight) / 2) + workingWindowHeight
);

memset(_cheatBuffer, 0, sizeof(_cheatBuffer));
}

Expand Down Expand Up @@ -211,7 +202,7 @@ void ZVision::initialize() {
} else if (_gameDescription->gameId == GID_NEMESIS)
_searchManager->loadZix("NEMESIS.ZIX");

initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_screenPixelFormat);
initScreen();

// Register random source
_rnd = new Common::RandomSource("zvision");
Expand Down Expand Up @@ -358,4 +349,17 @@ void ZVision::fpsTimer() {
_renderedFrameCount = 0;
}

void ZVision::initScreen() {
uint16 workingWindowWidth = (_gameDescription->gameId == GID_NEMESIS) ? ZNM_WORKING_WINDOW_WIDTH : ZGI_WORKING_WINDOW_WIDTH;
uint16 workingWindowHeight = (_gameDescription->gameId == GID_NEMESIS) ? ZNM_WORKING_WINDOW_HEIGHT : ZGI_WORKING_WINDOW_HEIGHT;
_workingWindow = Common::Rect(
(WINDOW_WIDTH - workingWindowWidth) / 2,
(WINDOW_HEIGHT - workingWindowHeight) / 2,
((WINDOW_WIDTH - workingWindowWidth) / 2) + workingWindowWidth,
((WINDOW_HEIGHT - workingWindowHeight) / 2) + workingWindowHeight
);

initGraphics(WINDOW_WIDTH, WINDOW_HEIGHT, true, &_screenPixelFormat);
}

} // End of namespace ZVision
2 changes: 2 additions & 0 deletions engines/zvision/zvision.h
Expand Up @@ -194,6 +194,8 @@ class ZVision : public Engine {
_clock.stop();
}

void initScreen();

/**
* Play a video until it is finished. This is a blocking call. It will call
* _clock.stop() when the video starts and _clock.start() when the video finishes.
Expand Down

0 comments on commit 2d0e9fc

Please sign in to comment.