Moved some more "homeless" functions into Sword2Engine. (Don't worry -- I

promise I will get rid of g_sword2 later.)

svn-id: r11057
This commit is contained in:
Torbjörn Andersson 2003-11-02 17:17:10 +00:00
parent c4404baa45
commit 2adc147600
12 changed files with 191 additions and 186 deletions

View file

@ -42,7 +42,7 @@ void Sword2Engine::buildDisplay(void) {
uint8 *file; uint8 *file;
_multiScreenHeader *screenLayerTable; _multiScreenHeader *screenLayerTable;
if (this_screen.new_palette) { if (_thisScreen.new_palette) {
// start the layer palette fading up // start the layer palette fading up
startNewPalette(); startNewPalette();
@ -52,9 +52,9 @@ void Sword2Engine::buildDisplay(void) {
} }
// there is a valid screen to run // there is a valid screen to run
if (this_screen.background_layer_id) { if (_thisScreen.background_layer_id) {
// set the scroll position // set the scroll position
g_display->setScrollTarget(this_screen.scroll_offset_x, this_screen.scroll_offset_y); g_display->setScrollTarget(_thisScreen.scroll_offset_x, _thisScreen.scroll_offset_y);
// increment the mouse frame // increment the mouse frame
g_display->animateMouse(); g_display->animateMouse();
@ -72,44 +72,44 @@ void Sword2Engine::buildDisplay(void) {
// first background parallax + related anims // first background parallax + related anims
// open the screen resource // open the screen resource
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->bg_parallax[0]) { if (screenLayerTable->bg_parallax[0]) {
g_display->renderParallax(FetchBackgroundParallaxLayer(file, 0), 0); g_display->renderParallax(FetchBackgroundParallaxLayer(file, 0), 0);
// release the screen resource before cacheing // release the screen resource before cacheing
// the sprites // the sprites
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
sendBackPar0Frames(); sendBackPar0Frames();
} else { } else {
// release the screen resource // release the screen resource
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
// second background parallax + related anims // second background parallax + related anims
// open the screen resource // open the screen resource
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->bg_parallax[1]) { if (screenLayerTable->bg_parallax[1]) {
g_display->renderParallax(FetchBackgroundParallaxLayer(file, 1), 1); g_display->renderParallax(FetchBackgroundParallaxLayer(file, 1), 1);
// release the screen resource before cacheing // release the screen resource before cacheing
// the sprites // the sprites
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
sendBackPar1Frames(); sendBackPar1Frames();
} else { } else {
// release the screen resource // release the screen resource
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
// normal backround layer (just the one!) // normal backround layer (just the one!)
// open the screen resource // open the screen resource
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
g_display->renderParallax(FetchBackgroundLayer(file), 2); g_display->renderParallax(FetchBackgroundLayer(file), 2);
// release the screen resource // release the screen resource
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
// sprites & layers // sprites & layers
@ -121,35 +121,35 @@ void Sword2Engine::buildDisplay(void) {
// first foreground parallax + related anims // first foreground parallax + related anims
// open the screen resource // open the screen resource
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->fg_parallax[0]) { if (screenLayerTable->fg_parallax[0]) {
g_display->renderParallax(FetchForegroundParallaxLayer(file, 0), 3); g_display->renderParallax(FetchForegroundParallaxLayer(file, 0), 3);
// release the screen resource before cacheing // release the screen resource before cacheing
// the sprites // the sprites
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
sendForePar0Frames(); sendForePar0Frames();
} else { } else {
// release the screen resource // release the screen resource
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
// second foreground parallax + related anims // second foreground parallax + related anims
// open the screen resource // open the screen resource
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader)); screenLayerTable = (_multiScreenHeader *) ((uint8 *) file + sizeof(_standardHeader));
if (screenLayerTable->fg_parallax[1]) { if (screenLayerTable->fg_parallax[1]) {
g_display->renderParallax(FetchForegroundParallaxLayer(file, 1), 4); g_display->renderParallax(FetchForegroundParallaxLayer(file, 1), 4);
// release the screen resource before cacheing // release the screen resource before cacheing
// the sprites // the sprites
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
sendForePar1Frames(); sendForePar1Frames();
} else { } else {
// release the screen resource // release the screen resource
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
// walkgrid, mouse & player markers & mouse area // walkgrid, mouse & player markers & mouse area
@ -356,7 +356,7 @@ void Sword2Engine::processLayer(uint32 layer_number) {
uint32 current_layer_area = 0; uint32 current_layer_area = 0;
// file points to 1st byte in the layer file // file points to 1st byte in the layer file
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
// point to layer header // point to layer header
layer_head = FetchLayerHeader(file,layer_number); layer_head = FetchLayerHeader(file,layer_number);
@ -381,7 +381,7 @@ void Sword2Engine::processLayer(uint32 layer_number) {
_largestLayerArea = current_layer_area; _largestLayerArea = current_layer_area;
sprintf(_largestLayerInfo, sprintf(_largestLayerInfo,
"largest layer: %s layer(%d) is %dx%d", "largest layer: %s layer(%d) is %dx%d",
FetchObjectName(this_screen.background_layer_id), FetchObjectName(_thisScreen.background_layer_id),
layer_number, layer_head->width, layer_head->height); layer_number, layer_head->width, layer_head->height);
} }
@ -389,7 +389,7 @@ void Sword2Engine::processLayer(uint32 layer_number) {
if (rv) if (rv)
error("Driver Error %.8x in Process_layer(%d)", rv, layer_number); error("Driver Error %.8x in Process_layer(%d)", rv, layer_number);
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
void Sword2Engine::processImage(buildit *build_unit) { void Sword2Engine::processImage(buildit *build_unit) {
@ -530,7 +530,7 @@ void Sword2Engine::resetRenderLists(void) {
_curBgp1 = 0; _curBgp1 = 0;
_curBack = 0; _curBack = 0;
// beginning of sort list is setup with the special sort layers // beginning of sort list is setup with the special sort layers
_curSort = this_screen.number_of_layers; _curSort = _thisScreen.number_of_layers;
_curFore = 0; _curFore = 0;
_curFgp0 = 0; _curFgp0 = 0;
_curFgp1 = 0; _curFgp1 = 0;
@ -764,7 +764,7 @@ void Sword2Engine::startNewPalette(void) {
g_display->waitForFade(); g_display->waitForFade();
// open the screen file // open the screen file
screenFile = res_man.open(this_screen.background_layer_id); screenFile = res_man.open(_thisScreen.background_layer_id);
g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(screenFile)); g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(screenFile));
@ -774,13 +774,13 @@ void Sword2Engine::startNewPalette(void) {
_lastPaletteRes = 0; _lastPaletteRes = 0;
// close screen file // close screen file
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
// start fade up // start fade up
g_display->fadeUp(); g_display->fadeUp();
// reset // reset
this_screen.new_palette = 0; _thisScreen.new_palette = 0;
} }
int32 Logic::fnUpdatePlayerStats(int32 *params) { int32 Logic::fnUpdatePlayerStats(int32 *params) {
@ -790,15 +790,15 @@ int32 Logic::fnUpdatePlayerStats(int32 *params) {
Object_mega *ob_mega = (Object_mega *) params[0]; Object_mega *ob_mega = (Object_mega *) params[0];
this_screen.player_feet_x = ob_mega->feet_x; g_sword2->_thisScreen.player_feet_x = ob_mega->feet_x;
this_screen.player_feet_y = ob_mega->feet_y; g_sword2->_thisScreen.player_feet_y = ob_mega->feet_y;
// for the script // for the script
PLAYER_FEET_X = ob_mega->feet_x; PLAYER_FEET_X = ob_mega->feet_x;
PLAYER_FEET_Y = ob_mega->feet_y; PLAYER_FEET_Y = ob_mega->feet_y;
PLAYER_CUR_DIR = ob_mega->current_dir; PLAYER_CUR_DIR = ob_mega->current_dir;
SCROLL_OFFSET_X = this_screen.scroll_offset_x; SCROLL_OFFSET_X = g_sword2->_thisScreen.scroll_offset_x;
debug(5, "fnUpdatePlayerStats: %d %d", ob_mega->feet_x, ob_mega->feet_y); debug(5, "fnUpdatePlayerStats: %d %d", ob_mega->feet_x, ob_mega->feet_y);
@ -901,9 +901,9 @@ void Sword2Engine::setFullPalette(int32 palRes) {
res_man.close(palRes); res_man.close(palRes);
} else { } else {
// 0: set palette to current screen palette // 0: set palette to current screen palette
if (this_screen.background_layer_id) { if (_thisScreen.background_layer_id) {
// open the screen file // open the screen file
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(file)); g_display->updatePaletteMatchTable((uint8 *) FetchPaletteMatchTable(file));
g_display->setPalette(0, 256, FetchPalette(file), RDPAL_INSTANT); g_display->setPalette(0, 256, FetchPalette(file), RDPAL_INSTANT);
@ -912,7 +912,7 @@ void Sword2Engine::setFullPalette(int32 palRes) {
_lastPaletteRes = 0; _lastPaletteRes = 0;
// close screen file // close screen file
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} else } else
error("setFullPalette(0) called, but no current screen available!"); error("setFullPalette(0) called, but no current screen available!");
} }
@ -927,13 +927,13 @@ int32 Logic::fnChangeShadows(int32 *params) {
// params: none // params: none
// if last screen was using a shading mask (see below) // if last screen was using a shading mask (see below)
if (this_screen.mask_flag) { if (g_sword2->_thisScreen.mask_flag) {
uint32 rv = g_display->closeLightMask(); uint32 rv = g_display->closeLightMask();
if (rv) if (rv)
error("Driver Error %.8x [%s line %u]", rv); error("Driver Error %.8x [%s line %u]", rv);
this_screen.mask_flag = 0; g_sword2->_thisScreen.mask_flag = 0;
} }
return IR_CONT; return IR_CONT;

View file

@ -1473,14 +1473,15 @@ void Gui::restartControl(void) {
// - this is taken from fnInitBackground // - this is taken from fnInitBackground
// switch on scrolling (2 means first time on screen) // switch on scrolling (2 means first time on screen)
this_screen.scroll_flag = 2; g_sword2->_thisScreen.scroll_flag = 2;
if (g_logic.processSession()) if (g_logic.processSession())
error("restart 1st cycle failed??"); error("restart 1st cycle failed??");
// So palette not restored immediately after control panel - we want // So palette not restored immediately after control panel - we want
// to fade up instead! // to fade up instead!
this_screen.new_palette = 99;
g_sword2->_thisScreen.new_palette = 99;
} }
void Gui::optionControl(void) { void Gui::optionControl(void) {

View file

@ -76,7 +76,7 @@ void Debugger::buildDebugText(void) {
/* /*
// print mouse coords beside mouse-marker, if it's being displayed // print mouse coords beside mouse-marker, if it's being displayed
if (displayMouseMarker) { if (displayMouseMarker) {
sprintf(buf, "%d,%d", mousex + this_screen.scroll_offset_x, mousey + this_screen.scroll_offset_y); sprintf(buf, "%d,%d", mousex + _thisScreen.scroll_offset_x, mousey + _thisScreen.scroll_offset_y);
if (mousex>560) if (mousex>560)
makeDebugTextBlock(buf, mousex - 50, mousey - 15); makeDebugTextBlock(buf, mousex - 50, mousey - 15);
else else
@ -187,14 +187,14 @@ void Debugger::buildDebugText(void) {
if (mouse_touching) if (mouse_touching)
sprintf(buf, "mouse %d,%d (id %d: %s)", sprintf(buf, "mouse %d,%d (id %d: %s)",
g_display->_mouseX + this_screen.scroll_offset_x, g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x,
g_display->_mouseY + this_screen.scroll_offset_y, g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y,
mouse_touching, mouse_touching,
FetchObjectName(mouse_touching)); FetchObjectName(mouse_touching));
else else
sprintf(buf, "mouse %d,%d (not touching)", sprintf(buf, "mouse %d,%d (not touching)",
g_display->_mouseX + this_screen.scroll_offset_x, g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x,
g_display->_mouseY + this_screen.scroll_offset_y); g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y);
makeDebugTextBlock(buf, 0, 30); makeDebugTextBlock(buf, 0, 30);
@ -203,16 +203,16 @@ void Debugger::buildDebugText(void) {
if (_playerGraphic.anim_resource) if (_playerGraphic.anim_resource)
sprintf(buf, "player %d,%d %s (%d) #%d/%d", sprintf(buf, "player %d,%d %s (%d) #%d/%d",
this_screen.player_feet_x, g_sword2->_thisScreen.player_feet_x,
this_screen.player_feet_y, g_sword2->_thisScreen.player_feet_y,
FetchObjectName(_playerGraphic.anim_resource), FetchObjectName(_playerGraphic.anim_resource),
_playerGraphic.anim_resource, _playerGraphic.anim_resource,
_playerGraphic.anim_pc, _playerGraphic.anim_pc,
_playerGraphicNoFrames); _playerGraphicNoFrames);
else else
sprintf(buf, "player %d,%d --- %d", sprintf(buf, "player %d,%d --- %d",
this_screen.player_feet_x, g_sword2->_thisScreen.player_feet_x,
this_screen.player_feet_y, g_sword2->_thisScreen.player_feet_y,
_playerGraphic.anim_pc); _playerGraphic.anim_pc);
makeDebugTextBlock(buf, 0, 45); makeDebugTextBlock(buf, 0, 45);
@ -315,12 +315,12 @@ void Debugger::drawDebugGraphics(void) {
// player feet coord marker // player feet coord marker
if (_displayPlayerMarker) if (_displayPlayerMarker)
plotCrossHair(this_screen.player_feet_x, this_screen.player_feet_y, 215); plotCrossHair(g_sword2->_thisScreen.player_feet_x, g_sword2->_thisScreen.player_feet_y, 215);
// mouse marker & coords // mouse marker & coords
if (_displayMouseMarker) if (_displayMouseMarker)
plotCrossHair(g_display->_mouseX + this_screen.scroll_offset_x, g_display->_mouseY + this_screen.scroll_offset_y, 215); plotCrossHair(g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x, g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y, 215);
// mouse area rectangle / sprite box rectangle when testing anims // mouse area rectangle / sprite box rectangle when testing anims
@ -355,10 +355,10 @@ void Debugger::drawRect(int16 x1, int16 y1, int16 x2, int16 y2, uint8 pen) {
void Debugger::printCurrentInfo(void) { void Debugger::printCurrentInfo(void) {
// prints general stuff about the screen, etc. // prints general stuff about the screen, etc.
if (this_screen.background_layer_id) { if (g_sword2->_thisScreen.background_layer_id) {
Debug_Printf("background layer id %d\n", this_screen.background_layer_id); Debug_Printf("background layer id %d\n", g_sword2->_thisScreen.background_layer_id);
Debug_Printf("%d wide, %d high\n", this_screen.screen_wide, this_screen.screen_deep); Debug_Printf("%d wide, %d high\n", g_sword2->_thisScreen.screen_wide, g_sword2->_thisScreen.screen_deep);
Debug_Printf("%d normal layers\n", this_screen.number_of_layers); Debug_Printf("%d normal layers\n", g_sword2->_thisScreen.number_of_layers);
g_logic.examineRunList(); g_logic.examineRunList();
} else } else

View file

@ -26,7 +26,7 @@
#include "sword2/defs.h" #include "sword2/defs.h"
#include "sword2/function.h" #include "sword2/function.h"
#include "sword2/interpreter.h" #include "sword2/interpreter.h"
#include "sword2/layers.h" // for 'this_screen' structure #include "sword2/layers.h" // for '_thisScreen' structure
#include "sword2/logic.h" #include "sword2/logic.h"
#include "sword2/protocol.h" #include "sword2/protocol.h"
#include "sword2/resman.h" #include "sword2/resman.h"
@ -372,7 +372,7 @@ int32 Logic::fnResetGlobals(int32 *params) {
// - this is taken from fnInitBackground // - this is taken from fnInitBackground
// switch on scrolling (2 means first time on screen) // switch on scrolling (2 means first time on screen)
this_screen.scroll_flag = 2; g_sword2->_thisScreen.scroll_flag = 2;
return IR_CONT; return IR_CONT;
} }

View file

@ -38,11 +38,6 @@
namespace Sword2 { namespace Sword2 {
// this_screen describes the current back buffer and its in-game scroll
// positions, etc.
screen_info this_screen;
int32 Logic::fnInitBackground(int32 *params) { int32 Logic::fnInitBackground(int32 *params) {
// this screen defines the size of the back buffer // this screen defines the size of the back buffer
@ -77,7 +72,7 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
g_display->waitForFade(); g_display->waitForFade();
// if last screen was using a shading mask (see below) // if last screen was using a shading mask (see below)
if (this_screen.mask_flag) { if (_thisScreen.mask_flag) {
rv = g_display->closeLightMask(); rv = g_display->closeLightMask();
if (rv) if (rv)
error("Driver Error %.8x", rv); error("Driver Error %.8x", rv);
@ -86,25 +81,25 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
// New stuff for faster screen drivers // New stuff for faster screen drivers
// for drivers: close the previous screen if one is open // for drivers: close the previous screen if one is open
if (this_screen.background_layer_id) if (_thisScreen.background_layer_id)
g_display->closeBackgroundLayer(); g_display->closeBackgroundLayer();
this_screen.background_layer_id = res; _thisScreen.background_layer_id = res;
this_screen.new_palette = new_palette; _thisScreen.new_palette = new_palette;
// ok, now read the resource and pull out all the normal sort layer // ok, now read the resource and pull out all the normal sort layer
// info/and set them up at the beginning of the sort list - why do it // info/and set them up at the beginning of the sort list - why do it
// each cycle // each cycle
// file points to 1st byte in the layer file // file points to 1st byte in the layer file
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screen_head = FetchScreenHeader(file); screen_head = FetchScreenHeader(file);
//set number of special sort layers //set number of special sort layers
this_screen.number_of_layers = screen_head->noLayers; _thisScreen.number_of_layers = screen_head->noLayers;
this_screen.screen_wide = screen_head->width; _thisScreen.screen_wide = screen_head->width;
this_screen.screen_deep = screen_head->height; _thisScreen.screen_deep = screen_head->height;
debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height); debug(5, "res test layers=%d width=%d depth=%d", screen_head->noLayers, screen_head->width, screen_head->height);
@ -133,27 +128,27 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
// if layer is larger than physical screen // if layer is larger than physical screen
if (screen_head->width > g_display->_screenWide || screen_head->height > g_display->_screenDeep) { if (screen_head->width > g_display->_screenWide || screen_head->height > g_display->_screenDeep) {
// switch on scrolling (2 means first time on screen) // switch on scrolling (2 means first time on screen)
this_screen.scroll_flag = 2; _thisScreen.scroll_flag = 2;
// note, if we've already set the player up then we could do // note, if we've already set the player up then we could do
// the initial scroll set here // the initial scroll set here
// reset scroll offsets // reset scroll offsets
this_screen.scroll_offset_x = 0; _thisScreen.scroll_offset_x = 0;
this_screen.scroll_offset_y = 0; _thisScreen.scroll_offset_y = 0;
// calc max allowed offsets (to prevent scrolling off edge) - // calc max allowed offsets (to prevent scrolling off edge) -
// MOVE TO NEW_SCREEN in GTM_CORE.C !! // MOVE TO NEW_SCREEN in GTM_CORE.C !!
// NB. min scroll offsets are both zero // NB. min scroll offsets are both zero
this_screen.max_scroll_offset_x = screen_head->width - g_display->_screenWide; _thisScreen.max_scroll_offset_x = screen_head->width - g_display->_screenWide;
// 'screenDeep' includes the menu's, so take away 80 pixels // 'screenDeep' includes the menu's, so take away 80 pixels
this_screen.max_scroll_offset_y = screen_head->height - (g_display->_screenDeep - (RDMENU_MENUDEEP * 2)); _thisScreen.max_scroll_offset_y = screen_head->height - (g_display->_screenDeep - (RDMENU_MENUDEEP * 2));
} else { } else {
// layer fits on physical screen - scrolling not required // layer fits on physical screen - scrolling not required
this_screen.scroll_flag = 0; // switch off scrolling _thisScreen.scroll_flag = 0; // switch off scrolling
this_screen.scroll_offset_x = 0; // reset scroll offsets _thisScreen.scroll_offset_x = 0; // reset scroll offsets
this_screen.scroll_offset_y = 0; _thisScreen.scroll_offset_y = 0;
} }
// no inter-cycle scroll between new screens (see setScrollTarget in // no inter-cycle scroll between new screens (see setScrollTarget in
@ -162,8 +157,8 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
// these are the physical screen coords where the system // these are the physical screen coords where the system
// will try to maintain George's actual feet coords // will try to maintain George's actual feet coords
this_screen.feet_x = 320; _thisScreen.feet_x = 320;
this_screen.feet_y = 340; _thisScreen.feet_y = 340;
// shading mask // shading mask
@ -187,16 +182,16 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
error("Driver Error %.8x", rv); error("Driver Error %.8x", rv);
// so we know to close it later! (see above) // so we know to close it later! (see above)
this_screen.mask_flag = 1; _thisScreen.mask_flag = 1;
} else { } else {
// no need to close a mask later // no need to close a mask later
this_screen.mask_flag = 0; _thisScreen.mask_flag = 0;
} }
// close the screen file // close the screen file
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
SetUpBackgroundLayers(); setUpBackgroundLayers();
debug(5, "end init"); debug(5, "end init");
return 1; return 1;
@ -204,7 +199,7 @@ int32 Sword2Engine::initBackground(int32 res, int32 new_palette) {
// called from fnInitBackground and also from control panel // called from fnInitBackground and also from control panel
void SetUpBackgroundLayers(void) { void Sword2Engine::setUpBackgroundLayers(void) {
_multiScreenHeader *screenLayerTable; _multiScreenHeader *screenLayerTable;
_screenHeader *screen_head; _screenHeader *screen_head;
uint8 *file; uint8 *file;
@ -212,11 +207,11 @@ void SetUpBackgroundLayers(void) {
// if we actually have a screen to initialise (in case not called from // if we actually have a screen to initialise (in case not called from
// control panel) // control panel)
if (this_screen.background_layer_id) { if (_thisScreen.background_layer_id) {
// open resource & set pointers to headers // open resource & set pointers to headers
// file points to 1st byte in the layer file // file points to 1st byte in the layer file
file = res_man.open(this_screen.background_layer_id); file = res_man.open(_thisScreen.background_layer_id);
screen_head = FetchScreenHeader(file); screen_head = FetchScreenHeader(file);
@ -245,7 +240,7 @@ void SetUpBackgroundLayers(void) {
} }
// close the screen file // close the screen file
res_man.close(this_screen.background_layer_id); res_man.close(_thisScreen.background_layer_id);
} }
} }

View file

@ -46,12 +46,6 @@ typedef struct {
uint8 mask_flag; // Using shading mask uint8 mask_flag; // Using shading mask
} screen_info; } screen_info;
extern screen_info this_screen;
// called from control panel (as well as inside fnInitBackground)
void SetUpBackgroundLayers(void);
} // End of namespace Sword2 } // End of namespace Sword2
#endif #endif

View file

@ -40,23 +40,25 @@ namespace Sword2 {
// pointer resource id's // pointer resource id's
#define CROSHAIR 18 enum {
#define EXIT0 788 CROSHAIR = 18,
#define EXIT1 789 EXIT0 = 788,
#define EXIT2 790 EXIT1 = 789,
#define EXIT3 791 EXIT2 = 790,
#define EXIT4 792 EXIT3 = 791,
#define EXIT5 793 EXIT4 = 792,
#define EXIT6 794 EXIT5 = 793,
#define EXIT7 795 EXIT6 = 794,
#define EXITDOWN 796 EXIT7 = 795,
#define EXITUP 797 EXITDOWN = 796,
#define MOUTH 787 EXITUP = 797,
#define NORMAL 17 MOUTH = 787,
#define PICKUP 3099 NORMAL = 17,
#define SCROLL_L 1440 PICKUP = 3099,
#define SCROLL_R 1441 SCROLL_L = 1440,
#define USE 3100 SCROLL_R = 1441,
USE = 3100
};
//the mouse list stuff //the mouse list stuff
@ -278,7 +280,7 @@ void System_menu_mouse(void) {
// successful restore or restart! // successful restore or restart!
// see RestoreFromBuffer() in save_rest.cpp // see RestoreFromBuffer() in save_rest.cpp
if (this_screen.new_palette != 99) { if (g_sword2->_thisScreen.new_palette != 99) {
// '0' means put back game screen // '0' means put back game screen
// palette; see Build_display.cpp // palette; see Build_display.cpp
@ -287,9 +289,9 @@ void System_menu_mouse(void) {
// stop the engine fading in the // stop the engine fading in the
// restored screens palette // restored screens palette
this_screen.new_palette = 0; g_sword2->_thisScreen.new_palette = 0;
} else } else
this_screen.new_palette = 1; g_sword2->_thisScreen.new_palette = 1;
g_sound->unpauseFx(); g_sound->unpauseFx();
@ -359,8 +361,8 @@ void Drag_mouse(void) {
// these might be required by the action script about // these might be required by the action script about
// to be run // to be run
MOUSE_X = (uint32) g_display->_mouseX + this_screen.scroll_offset_x; MOUSE_X = (uint32) g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x;
MOUSE_Y = (uint32) g_display->_mouseY + this_screen.scroll_offset_y; MOUSE_Y = (uint32) g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y;
// for scripts to know what's been clicked (21jan97). // for scripts to know what's been clicked (21jan97).
// First used for 'room_13_turning_script' in object // First used for 'room_13_turning_script' in object
@ -578,8 +580,8 @@ void Normal_mouse(void) {
if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) { if (me && (me->buttons & (RD_LEFTBUTTONDOWN | RD_RIGHTBUTTONDOWN))) {
// set both (x1,y1) and (x2,y2) to this point // set both (x1,y1) and (x2,y2) to this point
g_sword2->_debugger->_rectX1 = g_sword2->_debugger->_rectX2 = (uint32) g_display->_mouseX + this_screen.scroll_offset_x; g_sword2->_debugger->_rectX1 = g_sword2->_debugger->_rectX2 = (uint32) g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x;
g_sword2->_debugger->_rectY1 = g_sword2->_debugger->_rectY2 = (uint32) g_display->_mouseY + this_screen.scroll_offset_y; g_sword2->_debugger->_rectY1 = g_sword2->_debugger->_rectY2 = (uint32) g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y;
g_sword2->_debugger->_draggingRectangle = 1; g_sword2->_debugger->_draggingRectangle = 1;
} }
} else if (g_sword2->_debugger->_draggingRectangle == 1) { } else if (g_sword2->_debugger->_draggingRectangle == 1) {
@ -591,8 +593,8 @@ void Normal_mouse(void) {
g_sword2->_debugger->_draggingRectangle = 2; g_sword2->_debugger->_draggingRectangle = 2;
} else { } else {
// drag rectangle // drag rectangle
g_sword2->_debugger->_rectX2 = (uint32) g_display->_mouseX + this_screen.scroll_offset_x; g_sword2->_debugger->_rectX2 = (uint32) g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x;
g_sword2->_debugger->_rectY2 = (uint32) g_display->_mouseY + this_screen.scroll_offset_y; g_sword2->_debugger->_rectY2 = (uint32) g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y;
} }
} else { } else {
// currently locked to avoid knocking out of place // currently locked to avoid knocking out of place
@ -642,8 +644,8 @@ void Normal_mouse(void) {
// these might be required by the action script about // these might be required by the action script about
// to be run // to be run
MOUSE_X = (uint32) g_display->_mouseX + this_screen.scroll_offset_x; MOUSE_X = (uint32) g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x;
MOUSE_Y = (uint32) g_display->_mouseY + this_screen.scroll_offset_y; MOUSE_Y = (uint32) g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y;
// only left button // only left button
if (mouse_touching == EXIT_CLICK_ID && (me->buttons & RD_LEFTBUTTONDOWN)) { if (mouse_touching == EXIT_CLICK_ID && (me->buttons & RD_LEFTBUTTONDOWN)) {
@ -834,10 +836,10 @@ uint32 Check_mouse_list(void) {
// mouse-detection-box // mouse-detection-box
if (mouse_list[j].priority == priority && if (mouse_list[j].priority == priority &&
g_display->_mouseX + this_screen.scroll_offset_x >= mouse_list[j].x1 && g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x >= mouse_list[j].x1 &&
g_display->_mouseX + this_screen.scroll_offset_x <= mouse_list[j].x2 && g_display->_mouseX + g_sword2->_thisScreen.scroll_offset_x <= mouse_list[j].x2 &&
g_display->_mouseY + this_screen.scroll_offset_y >= mouse_list[j].y1 && g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y >= mouse_list[j].y1 &&
g_display->_mouseY + this_screen.scroll_offset_y <= mouse_list[j].y2) { g_display->_mouseY + g_sword2->_thisScreen.scroll_offset_y <= mouse_list[j].y2) {
// record id // record id
mouse_touching = mouse_list[j].id; mouse_touching = mouse_list[j].id;
@ -1238,8 +1240,8 @@ int32 Logic::fnInitFloorMouse(int32 *params) {
ob_mouse->x1 = 0; ob_mouse->x1 = 0;
ob_mouse->y1 = 0; ob_mouse->y1 = 0;
ob_mouse->x2 = this_screen.screen_wide - 1; ob_mouse->x2 = g_sword2->_thisScreen.screen_wide - 1;
ob_mouse->y2 = this_screen.screen_deep - 1; ob_mouse->y2 = g_sword2->_thisScreen.screen_deep - 1;
ob_mouse->priority = 9; ob_mouse->priority = 9;
ob_mouse->pointer = NORMAL_MOUSE_ID; ob_mouse->pointer = NORMAL_MOUSE_ID;
@ -1257,11 +1259,11 @@ int32 Logic::fnSetScrollLeftMouse(int32 *params) {
ob_mouse->x1 = 0; ob_mouse->x1 = 0;
ob_mouse->y1 = 0; ob_mouse->y1 = 0;
ob_mouse->x2 = this_screen.scroll_offset_x + SCROLL_MOUSE_WIDTH; ob_mouse->x2 = g_sword2->_thisScreen.scroll_offset_x + SCROLL_MOUSE_WIDTH;
ob_mouse->y2 = this_screen.screen_deep - 1; ob_mouse->y2 = g_sword2->_thisScreen.screen_deep - 1;
ob_mouse->priority = 0; ob_mouse->priority = 0;
if (this_screen.scroll_offset_x > 0) { if (g_sword2->_thisScreen.scroll_offset_x > 0) {
// not fully scrolled to the left // not fully scrolled to the left
ob_mouse->pointer = SCROLL_LEFT_MOUSE_ID; ob_mouse->pointer = SCROLL_LEFT_MOUSE_ID;
} else { } else {
@ -1279,13 +1281,13 @@ int32 Logic::fnSetScrollRightMouse(int32 *params) {
// Highest priority // Highest priority
ob_mouse->x1 = this_screen.scroll_offset_x + g_display->_screenWide - SCROLL_MOUSE_WIDTH; ob_mouse->x1 = g_sword2->_thisScreen.scroll_offset_x + g_display->_screenWide - SCROLL_MOUSE_WIDTH;
ob_mouse->y1 = 0; ob_mouse->y1 = 0;
ob_mouse->x2 = this_screen.screen_wide - 1; ob_mouse->x2 = g_sword2->_thisScreen.screen_wide - 1;
ob_mouse->y2 = this_screen.screen_deep - 1; ob_mouse->y2 = g_sword2->_thisScreen.screen_deep - 1;
ob_mouse->priority = 0; ob_mouse->priority = 0;
if (this_screen.scroll_offset_x < this_screen.max_scroll_offset_x) { if (g_sword2->_thisScreen.scroll_offset_x < g_sword2->_thisScreen.max_scroll_offset_x) {
// not fully scrolled to the right // not fully scrolled to the right
ob_mouse->pointer = SCROLL_RIGHT_MOUSE_ID; ob_mouse->pointer = SCROLL_RIGHT_MOUSE_ID;
} else { } else {

View file

@ -70,8 +70,8 @@ typedef struct {
uint32 varLength; // length of global variables resource uint32 varLength; // length of global variables resource
uint32 screenId; // resource id of screen file uint32 screenId; // resource id of screen file
uint32 runListId; // resource id of run list uint32 runListId; // resource id of run list
uint32 feet_x; // copy of this_screen.feet_x uint32 feet_x; // copy of _thisScreen.feet_x
uint32 feet_y; // copy of this_screen.feet_y uint32 feet_y; // copy of _thisScreen.feet_y
uint32 music_id; // copy of 'looping_music_id' uint32 music_id; // copy of 'looping_music_id'
_object_hub player_hub; // copy of player object's object_hub structure _object_hub player_hub; // copy of player object's object_hub structure
Object_logic logic; // copy of player character logic structure Object_logic logic; // copy of player character logic structure
@ -180,14 +180,14 @@ void FillSaveBuffer(mem *buffer, uint32 size, uint8 *desc) {
g_header.varLength = res_man.fetchLen(1); g_header.varLength = res_man.fetchLen(1);
// resource id of current screen file // resource id of current screen file
g_header.screenId = this_screen.background_layer_id; g_header.screenId = g_sword2->_thisScreen.background_layer_id;
// resource id of current run-list // resource id of current run-list
g_header.runListId = g_logic.getRunList(); g_header.runListId = g_logic.getRunList();
// those scroll position control things // those scroll position control things
g_header.feet_x = this_screen.feet_x; g_header.feet_x = g_sword2->_thisScreen.feet_x;
g_header.feet_y = this_screen.feet_y; g_header.feet_y = g_sword2->_thisScreen.feet_y;
// id of currently looping music (or zero) // id of currently looping music (or zero)
g_header.music_id = looping_music_id; g_header.music_id = looping_music_id;
@ -423,13 +423,13 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size) {
// So palette not restored immediately after control panel - we want to // So palette not restored immediately after control panel - we want to
// fade up instead! // fade up instead!
this_screen.new_palette = 99; g_sword2->_thisScreen.new_palette = 99;
// these need setting after the defaults get set in fnInitBackground // these need setting after the defaults get set in fnInitBackground
// remember that these can change through the game, so need saving & // remember that these can change through the game, so need saving &
// restoring too // restoring too
this_screen.feet_x = g_header.feet_x; g_sword2->_thisScreen.feet_x = g_header.feet_x;
this_screen.feet_y = g_header.feet_y; g_sword2->_thisScreen.feet_y = g_header.feet_y;
// start the new run list // start the new run list
g_logic.expressChangeSession(g_header.runListId); g_logic.expressChangeSession(g_header.runListId);
@ -437,14 +437,14 @@ uint32 RestoreFromBuffer(mem *buffer, uint32 size) {
// Force in the new scroll position, so unsightly scroll-catch-up does // Force in the new scroll position, so unsightly scroll-catch-up does
// not occur when screen first draws after returning from restore panel // not occur when screen first draws after returning from restore panel
// set 'this_screen's record of player position // set '_thisScreen's record of player position
// - ready for Set_scrolling() // - ready for Set_scrolling()
this_screen.player_feet_x = g_header.mega.feet_x; g_sword2->_thisScreen.player_feet_x = g_header.mega.feet_x;
this_screen.player_feet_y = g_header.mega.feet_y; g_sword2->_thisScreen.player_feet_y = g_header.mega.feet_y;
// if this screen is wide, recompute the scroll offsets now // if this screen is wide, recompute the scroll offsets now
if (this_screen.scroll_flag) if (g_sword2->_thisScreen.scroll_flag)
Set_scrolling(); Set_scrolling();
// Any music required will be started after we've returned from // Any music required will be started after we've returned from

View file

@ -18,6 +18,7 @@
*/ */
#include "stdafx.h" #include "stdafx.h"
#include "sword2/sword2.h"
#include "sword2/driver/driver96.h" #include "sword2/driver/driver96.h"
#include "sword2/debug.h" #include "sword2/debug.h"
#include "sword2/defs.h" #include "sword2/defs.h"
@ -52,51 +53,51 @@ void Set_scrolling(void) {
// if the scroll offsets are being forced in script // if the scroll offsets are being forced in script
if (SCROLL_X || SCROLL_Y) { if (SCROLL_X || SCROLL_Y) {
// ensure not too far right // ensure not too far right
if (this_screen.max_scroll_offset_x > SCROLL_X) if (g_sword2->_thisScreen.max_scroll_offset_x > SCROLL_X)
this_screen.scroll_offset_x = SCROLL_X; g_sword2->_thisScreen.scroll_offset_x = SCROLL_X;
else else
this_screen.scroll_offset_x = this_screen.max_scroll_offset_x; g_sword2->_thisScreen.scroll_offset_x = g_sword2->_thisScreen.max_scroll_offset_x;
// ensure not too far down // ensure not too far down
if (this_screen.max_scroll_offset_y > SCROLL_Y) if (g_sword2->_thisScreen.max_scroll_offset_y > SCROLL_Y)
this_screen.scroll_offset_y = SCROLL_Y; g_sword2->_thisScreen.scroll_offset_y = SCROLL_Y;
else else
this_screen.scroll_offset_y = this_screen.max_scroll_offset_y; g_sword2->_thisScreen.scroll_offset_y = g_sword2->_thisScreen.max_scroll_offset_y;
} else { } else {
// George's offset from the centre - the desired position // George's offset from the centre - the desired position
// for him // for him
offset_x = this_screen.player_feet_x - this_screen.feet_x; offset_x = g_sword2->_thisScreen.player_feet_x - g_sword2->_thisScreen.feet_x;
offset_y = this_screen.player_feet_y - this_screen.feet_y; offset_y = g_sword2->_thisScreen.player_feet_y - g_sword2->_thisScreen.feet_y;
// prevent scrolling too far left/right/up/down // prevent scrolling too far left/right/up/down
if (offset_x < 0) if (offset_x < 0)
offset_x = 0; offset_x = 0;
else if ((uint32) offset_x > this_screen.max_scroll_offset_x) else if ((uint32) offset_x > g_sword2->_thisScreen.max_scroll_offset_x)
offset_x = this_screen.max_scroll_offset_x; offset_x = g_sword2->_thisScreen.max_scroll_offset_x;
if (offset_y < 0) if (offset_y < 0)
offset_y = 0; offset_y = 0;
else if ((uint32) offset_y > this_screen.max_scroll_offset_y) else if ((uint32) offset_y > g_sword2->_thisScreen.max_scroll_offset_y)
offset_y = this_screen.max_scroll_offset_y; offset_y = g_sword2->_thisScreen.max_scroll_offset_y;
// first time on this screen - need absolute scroll // first time on this screen - need absolute scroll
// immediately! // immediately!
if (this_screen.scroll_flag == 2) { if (g_sword2->_thisScreen.scroll_flag == 2) {
debug(5, "init scroll"); debug(5, "init scroll");
this_screen.scroll_offset_x = offset_x; g_sword2->_thisScreen.scroll_offset_x = offset_x;
this_screen.scroll_offset_y = offset_y; g_sword2->_thisScreen.scroll_offset_y = offset_y;
this_screen.scroll_flag = 1; g_sword2->_thisScreen.scroll_flag = 1;
} else { } else {
// catch up with required scroll offsets - speed // catch up with required scroll offsets - speed
// depending on distance to catch up (dx and dy) & // depending on distance to catch up (dx and dy) &
// 'SCROLL_FRACTION' used, but limit to certain // 'SCROLL_FRACTION' used, but limit to certain
// number of pixels per cycle (MAX_SCROLL_DISTANCE) // number of pixels per cycle (MAX_SCROLL_DISTANCE)
dx = this_screen.scroll_offset_x - offset_x; dx = g_sword2->_thisScreen.scroll_offset_x - offset_x;
dy = this_screen.scroll_offset_y - offset_y; dy = g_sword2->_thisScreen.scroll_offset_y - offset_y;
// current scroll_offset_x is less than the required // current scroll_offset_x is less than the required
// value // value
@ -115,7 +116,8 @@ void Set_scrolling(void) {
if (scroll_distance_x > MAX_SCROLL_DISTANCE) if (scroll_distance_x > MAX_SCROLL_DISTANCE)
scroll_distance_x = MAX_SCROLL_DISTANCE; scroll_distance_x = MAX_SCROLL_DISTANCE;
this_screen.scroll_offset_x += scroll_distance_x; } else if (dx > 0) { g_sword2->_thisScreen.scroll_offset_x += scroll_distance_x;
} else if (dx > 0) {
// current scroll_offset_x is greater than // current scroll_offset_x is greater than
// the required value // the required value
// => dec by (fraction of the differnce) // => dec by (fraction of the differnce)
@ -125,7 +127,7 @@ void Set_scrolling(void) {
if (scroll_distance_x > MAX_SCROLL_DISTANCE) if (scroll_distance_x > MAX_SCROLL_DISTANCE)
scroll_distance_x = MAX_SCROLL_DISTANCE; scroll_distance_x = MAX_SCROLL_DISTANCE;
this_screen.scroll_offset_x -= scroll_distance_x; g_sword2->_thisScreen.scroll_offset_x -= scroll_distance_x;
} }
if (dy < 0) { if (dy < 0) {
@ -134,14 +136,14 @@ void Set_scrolling(void) {
if (scroll_distance_y > MAX_SCROLL_DISTANCE) if (scroll_distance_y > MAX_SCROLL_DISTANCE)
scroll_distance_y = MAX_SCROLL_DISTANCE; scroll_distance_y = MAX_SCROLL_DISTANCE;
this_screen.scroll_offset_y += scroll_distance_y; g_sword2->_thisScreen.scroll_offset_y += scroll_distance_y;
} else if (dy > 0) { } else if (dy > 0) {
scroll_distance_y = 1 + dy / scroll_fraction; scroll_distance_y = 1 + dy / scroll_fraction;
if (scroll_distance_y > MAX_SCROLL_DISTANCE) if (scroll_distance_y > MAX_SCROLL_DISTANCE)
scroll_distance_y = MAX_SCROLL_DISTANCE; scroll_distance_y = MAX_SCROLL_DISTANCE;
this_screen.scroll_offset_y -= scroll_distance_y; g_sword2->_thisScreen.scroll_offset_y -= scroll_distance_y;
} }
} }
} }
@ -163,8 +165,8 @@ int32 Logic::fnSetScrollCoordinate(int32 *params) {
// params: 0 feet_x value // params: 0 feet_x value
// 1 feet_y value // 1 feet_y value
this_screen.feet_x = params[0]; g_sword2->_thisScreen.feet_x = params[0];
this_screen.feet_y = params[1]; g_sword2->_thisScreen.feet_y = params[1];
return IR_CONT; return IR_CONT;
} }

View file

@ -41,24 +41,25 @@
namespace Sword2 { namespace Sword2 {
#define INS_talk 1 enum {
#define INS_anim 2 INS_talk = 1,
#define INS_reverse_anim 3 INS_anim = 2,
#define INS_walk 4 INS_reverse_anim = 3,
#define INS_turn 5 INS_walk = 4,
#define INS_face 6 INS_turn = 5,
#define INS_trace 7 INS_face = 6,
#define INS_no_sprite 8 INS_trace = 7,
#define INS_sort 9 INS_no_sprite = 8,
#define INS_foreground 10 INS_sort = 9,
#define INS_background 11 INS_foreground = 10,
#define INS_table_anim 12 INS_background = 11,
#define INS_reverse_table_anim 13 INS_table_anim = 12,
#define INS_walk_to_anim 14 INS_reverse_table_anim = 13,
#define INS_set_frame 15 INS_walk_to_anim = 14,
#define INS_stand_after_anim 16 INS_set_frame = 15,
INS_stand_after_anim = 16,
#define INS_quit 42 INS_quit = 42
};
// when not playing a wav we calculate the speech time based upon length of // when not playing a wav we calculate the speech time based upon length of
// ascii // ascii
@ -1451,8 +1452,8 @@ void LocateTalker(int32 *params) {
// adjust the text coords for RDSPR_DISPLAYALIGN // adjust the text coords for RDSPR_DISPLAYALIGN
text_x -= this_screen.scroll_offset_x; text_x -= g_sword2->_thisScreen.scroll_offset_x;
text_y -= this_screen.scroll_offset_y; text_y -= g_sword2->_thisScreen.scroll_offset_y;
// release the anim resource // release the anim resource
res_man.close(anim_id); res_man.close(anim_id);

View file

@ -161,6 +161,8 @@ Sword2Engine::Sword2Engine(GameDetector *detector, OSystem *syst)
_totalMasters = 0; _totalMasters = 0;
memset(_masterMenuList, 0, sizeof(_masterMenuList)); memset(_masterMenuList, 0, sizeof(_masterMenuList));
memset(&_thisScreen, 0, sizeof(_thisScreen));
} }
Sword2Engine::~Sword2Engine() { Sword2Engine::~Sword2Engine() {
@ -284,7 +286,7 @@ int32 GameCycle(void) {
} }
// if this screen is wide, recompute the scroll offsets every cycle // if this screen is wide, recompute the scroll offsets every cycle
if (this_screen.scroll_flag) if (g_sword2->_thisScreen.scroll_flag)
Set_scrolling(); Set_scrolling();
Mouse_engine(); Mouse_engine();

View file

@ -29,6 +29,7 @@
#include "sword2/console.h" #include "sword2/console.h"
#include "sword2/events.h" #include "sword2/events.h"
#include "sword2/icons.h" #include "sword2/icons.h"
#include "sword2/layers.h"
#include "sword2/object.h" #include "sword2/object.h"
#include "sword2/driver/d_sound.h" #include "sword2/driver/d_sound.h"
#include "sword2/driver/d_draw.h" #include "sword2/driver/d_draw.h"
@ -219,6 +220,13 @@ public:
void buildMenu(void); void buildMenu(void);
void buildSystemMenu(void); void buildSystemMenu(void);
// _thisScreen describes the current back buffer and its in-game scroll
// positions, etc.
screen_info _thisScreen;
void setUpBackgroundLayers(void);
void errorString(const char *buf_input, char *buf_output); void errorString(const char *buf_input, char *buf_output);
void initialiseFontResourceFlags(void); void initialiseFontResourceFlags(void);
void initialiseFontResourceFlags(uint8 language); void initialiseFontResourceFlags(uint8 language);