diff options
| -rw-r--r-- | engines/lab/allocroom.cpp | 20 | ||||
| -rw-r--r-- | engines/lab/engine.cpp | 8 | ||||
| -rw-r--r-- | engines/lab/map.cpp | 8 | ||||
| -rw-r--r-- | engines/lab/parsetypes.h | 10 | ||||
| -rw-r--r-- | engines/lab/processroom.cpp | 38 | ||||
| -rw-r--r-- | engines/lab/resource.cpp | 42 | 
6 files changed, 64 insertions, 62 deletions
diff --git a/engines/lab/allocroom.cpp b/engines/lab/allocroom.cpp index 2b80967032..b98bd24acb 100644 --- a/engines/lab/allocroom.cpp +++ b/engines/lab/allocroom.cpp @@ -39,7 +39,7 @@ namespace Lab {  #define EMPTYROOM      ((uint16) -1)  #define MAXMARKERS     10 -extern RoomData *Rooms; +extern RoomData *_rooms;  typedef struct {  	uint16 RoomNum; @@ -87,19 +87,19 @@ static void freeRoom(uint16 RMarker) {  	RoomNum = RoomMarkers[RMarker].RoomNum;  	if (RoomNum != EMPTYROOM) { -		Rooms[RoomNum].NorthView = NULL; -		Rooms[RoomNum].SouthView = NULL; -		Rooms[RoomNum].EastView  = NULL; -		Rooms[RoomNum].WestView  = NULL; +		_rooms[RoomNum]._northView = nullptr; +		_rooms[RoomNum]._southView = nullptr; +		_rooms[RoomNum]._eastView = nullptr; +		_rooms[RoomNum]._westView = nullptr; -		RuleList *rules = Rooms[RoomNum].rules; +		RuleList *rules = _rooms[RoomNum]._rules;  		for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule)  			delete *rule; -		Rooms[RoomNum].rules->clear(); -		delete Rooms[RoomNum].rules; -		Rooms[RoomNum].rules  = NULL; +		_rooms[RoomNum]._rules->clear(); +		delete _rooms[RoomNum]._rules; +		_rooms[RoomNum]._rules = nullptr; -		Rooms[RoomNum].RoomMsg   = NULL; +		_rooms[RoomNum]._roomMsg = nullptr;  	}  	RoomMarkers[RMarker].RoomNum = EMPTYROOM; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 837529b846..417cffeac3 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -51,7 +51,7 @@ extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalc  /* Global parser data */ -extern RoomData *Rooms; +extern RoomData *_rooms;  extern InventoryData *Inventory;  extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;  CloseDataPtr CPtr; @@ -1282,8 +1282,10 @@ from_crumbs:  	delete g_lab->_conditions;  	delete g_lab->_roomsFound; -	if (Rooms) -		free(Rooms); +	if (_rooms) { +		free(_rooms); +		_rooms = nullptr; +	}  	if (Inventory) {  		for (code = 1; code <= NumInv; code++) { diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 50a551473f..8cb1eaf189 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -127,7 +127,7 @@ void readImage(byte **buffer, Image **im) {  /*------------------------------ The Map stuff ------------------------------*/  /*---------------------------------------------------------------------------*/ -extern RoomData *Rooms; +extern RoomData *_rooms;  static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge,  			 *HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth, @@ -646,7 +646,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b  	if (sptr)  		flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), sptr); -	if ((sptr = Rooms[CurMsg].RoomMsg)) +	if ((sptr = _rooms[CurMsg]._roomMsg))  		flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr);  	if (fadein) @@ -795,10 +795,10 @@ void processMap(uint16 CurRoom) {  					}  					if (OldMsg != CurMsg) { -						if (Rooms[CurMsg].RoomMsg == NULL) +						if (_rooms[CurMsg]._roomMsg == nullptr)  							g_resource->readViews(CurMsg); -						if ((sptr = Rooms[CurMsg].RoomMsg)) { +						if ((sptr = _rooms[CurMsg]._roomMsg)) {  							mouseHide();  							g_lab->setAPen(3);  							g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186)); diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h index 681bbe70ae..e482775f5d 100644 --- a/engines/lab/parsetypes.h +++ b/engines/lab/parsetypes.h @@ -134,13 +134,13 @@ struct Rule {  typedef Common::List<Rule *> RuleList;  struct RoomData { -	uint16 NorthDoor, SouthDoor, EastDoor, WestDoor; +	uint16 _northDoor, _southDoor, _eastDoor, _westDoor; -	byte WipeType; +	byte _wipeType; -	ViewData *NorthView, *SouthView, *EastView, *WestView; -	RuleList *rules; -	char *RoomMsg; +	ViewData *_northView, *_southView, *_eastView, *_westView; +	RuleList *_rules; +	char *_roomMsg;  };  struct InventoryData { diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 37c21d8399..645e202867 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -45,7 +45,7 @@ namespace Lab {  #define NOFILE         "no file" -RoomData *Rooms; +RoomData *_rooms;  InventoryData *Inventory;  uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;  const char *NewFileName; @@ -95,17 +95,17 @@ static bool checkConditions(int16 *Condition) {  ViewData *getViewData(uint16 roomNum, uint16 direction) {  	ViewData *view = NULL; -	if (!Rooms[roomNum].RoomMsg) +	if (!_rooms[roomNum]._roomMsg)  		g_resource->readViews(roomNum);  	if (direction == NORTH) -		view = Rooms[roomNum].NorthView; +		view = _rooms[roomNum]._northView;  	else if (direction == SOUTH) -		view = Rooms[roomNum].SouthView; +		view = _rooms[roomNum]._southView;  	else if (direction == EAST) -		view = Rooms[roomNum].EastView; +		view = _rooms[roomNum]._eastView;  	else if (direction == WEST) -		view = Rooms[roomNum].WestView; +		view = _rooms[roomNum]._westView;  	do {  		if (checkConditions(view->Condition)) @@ -196,8 +196,8 @@ void drawDirection(CloseDataPtr LCPtr) {  	Common::String message; -	if (Rooms[RoomNum].RoomMsg) { -		message += Rooms[RoomNum].RoomMsg; +	if (_rooms[RoomNum]._roomMsg) { +		message += _rooms[RoomNum]._roomMsg;  		message += ", ";  	} @@ -221,13 +221,13 @@ bool processArrow(uint16 *direction, uint16 Arrow) {  	if (Arrow == 1) { /* Forward */  		if (*direction == NORTH) -			room = Rooms[RoomNum].NorthDoor; +			room = _rooms[RoomNum]._northDoor;  		else if (*direction == SOUTH) -			room = Rooms[RoomNum].SouthDoor; +			room = _rooms[RoomNum]._southDoor;  		else if (*direction == EAST) -			room = Rooms[RoomNum].EastDoor; +			room = _rooms[RoomNum]._eastDoor;  		else if (*direction == WEST) -			room = Rooms[RoomNum].WestDoor; +			room = _rooms[RoomNum]._westDoor;  		if (room == 0)  			return false; @@ -611,11 +611,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo  	action++;  	if (LCPtr) { -		RuleList *rules = Rooms[RoomNum].rules; +		RuleList *rules = _rooms[RoomNum]._rules;  		if ((rules == NULL) && (roomNum == 0)) {  			g_resource->readViews(roomNum); -			rules = Rooms[roomNum].rules; +			rules = _rooms[roomNum]._rules;  		}  		for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -668,11 +668,11 @@ bool doActionRule(Common::Point pos, int16 action, int16 roomNum, CloseDataPtr *  static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) {  	if (LCPtr)  		if (LCPtr->CloseUpType > 0) { -			RuleList *rules = Rooms[roomNum].rules; +			RuleList *rules = _rooms[roomNum]._rules;  			if ((rules == NULL) && (roomNum == 0)) {  				g_resource->readViews(roomNum); -				rules = Rooms[roomNum].rules; +				rules = _rooms[roomNum]._rules;  			}  			for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) { @@ -728,7 +728,7 @@ bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr) {  /* Goes thru the rules if the user tries to go forward.                      */  /*****************************************************************************/  bool doGoForward(CloseDataPtr *LCPtr) { -	RuleList *rules = Rooms[RoomNum].rules; +	RuleList *rules = _rooms[RoomNum]._rules;  	for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {  		if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) { @@ -749,7 +749,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {  	from++;  	to++; -	RuleList *rules = Rooms[RoomNum].rules; +	RuleList *rules = _rooms[RoomNum]._rules;  	for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {  		if (((*rule)->RuleType == TURN) || @@ -769,7 +769,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {  /* Goes thru the rules if the user tries to go to the main view              */  /*****************************************************************************/  bool doMainView(CloseDataPtr *LCPtr) { -	RuleList *rules = Rooms[RoomNum].rules; +	RuleList *rules = _rooms[RoomNum]._rules;  	for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {  		if ((*rule)->RuleType == GOMAINVIEW) {  			if (checkConditions((*rule)->Condition)) { diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index e2afcc6889..180152e218 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -35,7 +35,7 @@ namespace Lab {  static uint16 allocroom; -extern RoomData *Rooms; +extern RoomData *_rooms;  extern InventoryData *Inventory;  extern uint16 NumInv, ManyRooms, HighestCondition; @@ -87,22 +87,22 @@ bool Resource::readRoomData(const char *fileName) {  	ManyRooms = dataFile->readUint16LE();  	HighestCondition = dataFile->readUint16LE(); -	Rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); -	memset(Rooms, 0, (ManyRooms + 1) * sizeof(RoomData)); +	_rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData)); +	memset(_rooms, 0, (ManyRooms + 1) * sizeof(RoomData));  	for (uint16 i = 1; i <= ManyRooms; i++) { -		Rooms[i].NorthDoor = dataFile->readUint16LE(); -		Rooms[i].SouthDoor = dataFile->readUint16LE(); -		Rooms[i].EastDoor = dataFile->readUint16LE(); -		Rooms[i].WestDoor = dataFile->readUint16LE(); -		Rooms[i].WipeType = dataFile->readByte(); - -		Rooms[i].NorthView = NULL; -		Rooms[i].SouthView = NULL; -		Rooms[i].EastView = NULL; -		Rooms[i].WestView = NULL; -		Rooms[i].rules = NULL; -		Rooms[i].RoomMsg = NULL; +		_rooms[i]._northDoor = dataFile->readUint16LE(); +		_rooms[i]._southDoor = dataFile->readUint16LE(); +		_rooms[i]._eastDoor = dataFile->readUint16LE(); +		_rooms[i]._westDoor = dataFile->readUint16LE(); +		_rooms[i]._wipeType = dataFile->readByte(); + +		_rooms[i]._northView = nullptr; +		_rooms[i]._southView = nullptr; +		_rooms[i]._eastView = nullptr; +		_rooms[i]._westView = nullptr; +		_rooms[i]._rules = nullptr; +		_rooms[i]._roomMsg = nullptr;  	}  	delete dataFile; @@ -135,12 +135,12 @@ bool Resource::readViews(uint16 roomNum) {  	allocroom = roomNum; -	Rooms[roomNum].RoomMsg = readString(dataFile); -	Rooms[roomNum].NorthView = readView(dataFile); -	Rooms[roomNum].SouthView = readView(dataFile); -	Rooms[roomNum].EastView = readView(dataFile); -	Rooms[roomNum].WestView = readView(dataFile); -	Rooms[roomNum].rules = readRule(dataFile); +	_rooms[roomNum]._roomMsg = readString(dataFile); +	_rooms[roomNum]._northView = readView(dataFile); +	_rooms[roomNum]._southView = readView(dataFile); +	_rooms[roomNum]._eastView = readView(dataFile); +	_rooms[roomNum]._westView = readView(dataFile); +	_rooms[roomNum]._rules = readRule(dataFile);  	g_music->updateMusic();  | 
