LAB: Rename RoomData members
This commit is contained in:
parent
c485d9e8a6
commit
8d70f33efe
6 changed files with 63 additions and 61 deletions
|
@ -39,7 +39,7 @@ namespace Lab {
|
||||||
#define EMPTYROOM ((uint16) -1)
|
#define EMPTYROOM ((uint16) -1)
|
||||||
#define MAXMARKERS 10
|
#define MAXMARKERS 10
|
||||||
|
|
||||||
extern RoomData *Rooms;
|
extern RoomData *_rooms;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16 RoomNum;
|
uint16 RoomNum;
|
||||||
|
@ -87,19 +87,19 @@ static void freeRoom(uint16 RMarker) {
|
||||||
RoomNum = RoomMarkers[RMarker].RoomNum;
|
RoomNum = RoomMarkers[RMarker].RoomNum;
|
||||||
|
|
||||||
if (RoomNum != EMPTYROOM) {
|
if (RoomNum != EMPTYROOM) {
|
||||||
Rooms[RoomNum].NorthView = NULL;
|
_rooms[RoomNum]._northView = nullptr;
|
||||||
Rooms[RoomNum].SouthView = NULL;
|
_rooms[RoomNum]._southView = nullptr;
|
||||||
Rooms[RoomNum].EastView = NULL;
|
_rooms[RoomNum]._eastView = nullptr;
|
||||||
Rooms[RoomNum].WestView = NULL;
|
_rooms[RoomNum]._westView = nullptr;
|
||||||
|
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = _rooms[RoomNum]._rules;
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule)
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule)
|
||||||
delete *rule;
|
delete *rule;
|
||||||
Rooms[RoomNum].rules->clear();
|
_rooms[RoomNum]._rules->clear();
|
||||||
delete Rooms[RoomNum].rules;
|
delete _rooms[RoomNum]._rules;
|
||||||
Rooms[RoomNum].rules = NULL;
|
_rooms[RoomNum]._rules = nullptr;
|
||||||
|
|
||||||
Rooms[RoomNum].RoomMsg = NULL;
|
_rooms[RoomNum]._roomMsg = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomMarkers[RMarker].RoomNum = EMPTYROOM;
|
RoomMarkers[RMarker].RoomNum = EMPTYROOM;
|
||||||
|
|
|
@ -51,7 +51,7 @@ extern bool DoBlack, waitForEffect, stopsound, DoNotDrawMessage, IsHiRes, nopalc
|
||||||
|
|
||||||
/* Global parser data */
|
/* Global parser data */
|
||||||
|
|
||||||
extern RoomData *Rooms;
|
extern RoomData *_rooms;
|
||||||
extern InventoryData *Inventory;
|
extern InventoryData *Inventory;
|
||||||
extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
extern uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
||||||
CloseDataPtr CPtr;
|
CloseDataPtr CPtr;
|
||||||
|
@ -1282,8 +1282,10 @@ from_crumbs:
|
||||||
delete g_lab->_conditions;
|
delete g_lab->_conditions;
|
||||||
delete g_lab->_roomsFound;
|
delete g_lab->_roomsFound;
|
||||||
|
|
||||||
if (Rooms)
|
if (_rooms) {
|
||||||
free(Rooms);
|
free(_rooms);
|
||||||
|
_rooms = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
if (Inventory) {
|
if (Inventory) {
|
||||||
for (code = 1; code <= NumInv; code++) {
|
for (code = 1; code <= NumInv; code++) {
|
||||||
|
|
|
@ -127,7 +127,7 @@ void readImage(byte **buffer, Image **im) {
|
||||||
/*------------------------------ The Map stuff ------------------------------*/
|
/*------------------------------ The Map stuff ------------------------------*/
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
extern RoomData *Rooms;
|
extern RoomData *_rooms;
|
||||||
|
|
||||||
static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge,
|
static Image *Map, *Room, *UpArrowRoom, *DownArrowRoom, *Bridge,
|
||||||
*HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth,
|
*HRoom, *VRoom, *Maze, *HugeMaze, *Path, *MapNorth,
|
||||||
|
@ -646,7 +646,7 @@ static void drawMap(uint16 CurRoom, uint16 CurMsg, uint16 Floor, bool fadeout, b
|
||||||
if (sptr)
|
if (sptr)
|
||||||
flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(75), VGAScaleX(134), VGAScaleY(97), 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);
|
flowText(MsgFont, 0, 5, 3, true, true, true, true, VGAScaleX(14), VGAScaleY(148), VGAScaleX(134), VGAScaleY(186), sptr);
|
||||||
|
|
||||||
if (fadein)
|
if (fadein)
|
||||||
|
@ -795,10 +795,10 @@ void processMap(uint16 CurRoom) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OldMsg != CurMsg) {
|
if (OldMsg != CurMsg) {
|
||||||
if (Rooms[CurMsg].RoomMsg == NULL)
|
if (_rooms[CurMsg]._roomMsg == nullptr)
|
||||||
g_resource->readViews(CurMsg);
|
g_resource->readViews(CurMsg);
|
||||||
|
|
||||||
if ((sptr = Rooms[CurMsg].RoomMsg)) {
|
if ((sptr = _rooms[CurMsg]._roomMsg)) {
|
||||||
mouseHide();
|
mouseHide();
|
||||||
g_lab->setAPen(3);
|
g_lab->setAPen(3);
|
||||||
g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186));
|
g_lab->rectFill(VGAScaleX(13), VGAScaleY(148), VGAScaleX(135), VGAScaleY(186));
|
||||||
|
|
|
@ -134,13 +134,13 @@ struct Rule {
|
||||||
typedef Common::List<Rule *> RuleList;
|
typedef Common::List<Rule *> RuleList;
|
||||||
|
|
||||||
struct RoomData {
|
struct RoomData {
|
||||||
uint16 NorthDoor, SouthDoor, EastDoor, WestDoor;
|
uint16 _northDoor, _southDoor, _eastDoor, _westDoor;
|
||||||
|
|
||||||
byte WipeType;
|
byte _wipeType;
|
||||||
|
|
||||||
ViewData *NorthView, *SouthView, *EastView, *WestView;
|
ViewData *_northView, *_southView, *_eastView, *_westView;
|
||||||
RuleList *rules;
|
RuleList *_rules;
|
||||||
char *RoomMsg;
|
char *_roomMsg;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct InventoryData {
|
struct InventoryData {
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace Lab {
|
||||||
|
|
||||||
#define NOFILE "no file"
|
#define NOFILE "no file"
|
||||||
|
|
||||||
RoomData *Rooms;
|
RoomData *_rooms;
|
||||||
InventoryData *Inventory;
|
InventoryData *Inventory;
|
||||||
uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
uint16 NumInv, RoomNum, ManyRooms, HighestCondition, Direction;
|
||||||
const char *NewFileName;
|
const char *NewFileName;
|
||||||
|
@ -95,17 +95,17 @@ static bool checkConditions(int16 *Condition) {
|
||||||
ViewData *getViewData(uint16 roomNum, uint16 direction) {
|
ViewData *getViewData(uint16 roomNum, uint16 direction) {
|
||||||
ViewData *view = NULL;
|
ViewData *view = NULL;
|
||||||
|
|
||||||
if (!Rooms[roomNum].RoomMsg)
|
if (!_rooms[roomNum]._roomMsg)
|
||||||
g_resource->readViews(roomNum);
|
g_resource->readViews(roomNum);
|
||||||
|
|
||||||
if (direction == NORTH)
|
if (direction == NORTH)
|
||||||
view = Rooms[roomNum].NorthView;
|
view = _rooms[roomNum]._northView;
|
||||||
else if (direction == SOUTH)
|
else if (direction == SOUTH)
|
||||||
view = Rooms[roomNum].SouthView;
|
view = _rooms[roomNum]._southView;
|
||||||
else if (direction == EAST)
|
else if (direction == EAST)
|
||||||
view = Rooms[roomNum].EastView;
|
view = _rooms[roomNum]._eastView;
|
||||||
else if (direction == WEST)
|
else if (direction == WEST)
|
||||||
view = Rooms[roomNum].WestView;
|
view = _rooms[roomNum]._westView;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (checkConditions(view->Condition))
|
if (checkConditions(view->Condition))
|
||||||
|
@ -196,8 +196,8 @@ void drawDirection(CloseDataPtr LCPtr) {
|
||||||
|
|
||||||
Common::String message;
|
Common::String message;
|
||||||
|
|
||||||
if (Rooms[RoomNum].RoomMsg) {
|
if (_rooms[RoomNum]._roomMsg) {
|
||||||
message += Rooms[RoomNum].RoomMsg;
|
message += _rooms[RoomNum]._roomMsg;
|
||||||
message += ", ";
|
message += ", ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,13 +221,13 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
|
||||||
|
|
||||||
if (Arrow == 1) { /* Forward */
|
if (Arrow == 1) { /* Forward */
|
||||||
if (*direction == NORTH)
|
if (*direction == NORTH)
|
||||||
room = Rooms[RoomNum].NorthDoor;
|
room = _rooms[RoomNum]._northDoor;
|
||||||
else if (*direction == SOUTH)
|
else if (*direction == SOUTH)
|
||||||
room = Rooms[RoomNum].SouthDoor;
|
room = _rooms[RoomNum]._southDoor;
|
||||||
else if (*direction == EAST)
|
else if (*direction == EAST)
|
||||||
room = Rooms[RoomNum].EastDoor;
|
room = _rooms[RoomNum]._eastDoor;
|
||||||
else if (*direction == WEST)
|
else if (*direction == WEST)
|
||||||
room = Rooms[RoomNum].WestDoor;
|
room = _rooms[RoomNum]._westDoor;
|
||||||
|
|
||||||
if (room == 0)
|
if (room == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -611,11 +611,11 @@ static bool doActionRuleSub(int16 action, int16 roomNum, CloseDataPtr LCPtr, Clo
|
||||||
action++;
|
action++;
|
||||||
|
|
||||||
if (LCPtr) {
|
if (LCPtr) {
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = _rooms[RoomNum]._rules;
|
||||||
|
|
||||||
if ((rules == NULL) && (roomNum == 0)) {
|
if ((rules == NULL) && (roomNum == 0)) {
|
||||||
g_resource->readViews(roomNum);
|
g_resource->readViews(roomNum);
|
||||||
rules = Rooms[roomNum].rules;
|
rules = _rooms[roomNum]._rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
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) {
|
static bool doOperateRuleSub(int16 ItemNum, int16 roomNum, CloseDataPtr LCPtr, CloseDataPtr *Set, bool AllowDefaults) {
|
||||||
if (LCPtr)
|
if (LCPtr)
|
||||||
if (LCPtr->CloseUpType > 0) {
|
if (LCPtr->CloseUpType > 0) {
|
||||||
RuleList *rules = Rooms[roomNum].rules;
|
RuleList *rules = _rooms[roomNum]._rules;
|
||||||
|
|
||||||
if ((rules == NULL) && (roomNum == 0)) {
|
if ((rules == NULL) && (roomNum == 0)) {
|
||||||
g_resource->readViews(roomNum);
|
g_resource->readViews(roomNum);
|
||||||
rules = Rooms[roomNum].rules;
|
rules = _rooms[roomNum]._rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
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. */
|
/* Goes thru the rules if the user tries to go forward. */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool doGoForward(CloseDataPtr *LCPtr) {
|
bool doGoForward(CloseDataPtr *LCPtr) {
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = _rooms[RoomNum]._rules;
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
|
if (((*rule)->RuleType == GOFORWARD) && ((*rule)->Param1 == (Direction + 1))) {
|
||||||
|
@ -749,7 +749,7 @@ bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr) {
|
||||||
from++;
|
from++;
|
||||||
to++;
|
to++;
|
||||||
|
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = _rooms[RoomNum]._rules;
|
||||||
|
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if (((*rule)->RuleType == TURN) ||
|
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 */
|
/* Goes thru the rules if the user tries to go to the main view */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
bool doMainView(CloseDataPtr *LCPtr) {
|
bool doMainView(CloseDataPtr *LCPtr) {
|
||||||
RuleList *rules = Rooms[RoomNum].rules;
|
RuleList *rules = _rooms[RoomNum]._rules;
|
||||||
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
for (RuleList::iterator rule = rules->begin(); rule != rules->end(); ++rule) {
|
||||||
if ((*rule)->RuleType == GOMAINVIEW) {
|
if ((*rule)->RuleType == GOMAINVIEW) {
|
||||||
if (checkConditions((*rule)->Condition)) {
|
if (checkConditions((*rule)->Condition)) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace Lab {
|
||||||
|
|
||||||
static uint16 allocroom;
|
static uint16 allocroom;
|
||||||
|
|
||||||
extern RoomData *Rooms;
|
extern RoomData *_rooms;
|
||||||
extern InventoryData *Inventory;
|
extern InventoryData *Inventory;
|
||||||
extern uint16 NumInv, ManyRooms, HighestCondition;
|
extern uint16 NumInv, ManyRooms, HighestCondition;
|
||||||
|
|
||||||
|
@ -87,22 +87,22 @@ bool Resource::readRoomData(const char *fileName) {
|
||||||
|
|
||||||
ManyRooms = dataFile->readUint16LE();
|
ManyRooms = dataFile->readUint16LE();
|
||||||
HighestCondition = dataFile->readUint16LE();
|
HighestCondition = dataFile->readUint16LE();
|
||||||
Rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData));
|
_rooms = (RoomData *)malloc((ManyRooms + 1) * sizeof(RoomData));
|
||||||
memset(Rooms, 0, (ManyRooms + 1) * sizeof(RoomData));
|
memset(_rooms, 0, (ManyRooms + 1) * sizeof(RoomData));
|
||||||
|
|
||||||
for (uint16 i = 1; i <= ManyRooms; i++) {
|
for (uint16 i = 1; i <= ManyRooms; i++) {
|
||||||
Rooms[i].NorthDoor = dataFile->readUint16LE();
|
_rooms[i]._northDoor = dataFile->readUint16LE();
|
||||||
Rooms[i].SouthDoor = dataFile->readUint16LE();
|
_rooms[i]._southDoor = dataFile->readUint16LE();
|
||||||
Rooms[i].EastDoor = dataFile->readUint16LE();
|
_rooms[i]._eastDoor = dataFile->readUint16LE();
|
||||||
Rooms[i].WestDoor = dataFile->readUint16LE();
|
_rooms[i]._westDoor = dataFile->readUint16LE();
|
||||||
Rooms[i].WipeType = dataFile->readByte();
|
_rooms[i]._wipeType = dataFile->readByte();
|
||||||
|
|
||||||
Rooms[i].NorthView = NULL;
|
_rooms[i]._northView = nullptr;
|
||||||
Rooms[i].SouthView = NULL;
|
_rooms[i]._southView = nullptr;
|
||||||
Rooms[i].EastView = NULL;
|
_rooms[i]._eastView = nullptr;
|
||||||
Rooms[i].WestView = NULL;
|
_rooms[i]._westView = nullptr;
|
||||||
Rooms[i].rules = NULL;
|
_rooms[i]._rules = nullptr;
|
||||||
Rooms[i].RoomMsg = NULL;
|
_rooms[i]._roomMsg = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete dataFile;
|
delete dataFile;
|
||||||
|
@ -135,12 +135,12 @@ bool Resource::readViews(uint16 roomNum) {
|
||||||
|
|
||||||
allocroom = roomNum;
|
allocroom = roomNum;
|
||||||
|
|
||||||
Rooms[roomNum].RoomMsg = readString(dataFile);
|
_rooms[roomNum]._roomMsg = readString(dataFile);
|
||||||
Rooms[roomNum].NorthView = readView(dataFile);
|
_rooms[roomNum]._northView = readView(dataFile);
|
||||||
Rooms[roomNum].SouthView = readView(dataFile);
|
_rooms[roomNum]._southView = readView(dataFile);
|
||||||
Rooms[roomNum].EastView = readView(dataFile);
|
_rooms[roomNum]._eastView = readView(dataFile);
|
||||||
Rooms[roomNum].WestView = readView(dataFile);
|
_rooms[roomNum]._westView = readView(dataFile);
|
||||||
Rooms[roomNum].rules = readRule(dataFile);
|
_rooms[roomNum]._rules = readRule(dataFile);
|
||||||
|
|
||||||
g_music->updateMusic();
|
g_music->updateMusic();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue