aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lab/engine.cpp2
-rw-r--r--engines/lab/parsefun.h2
-rw-r--r--engines/lab/parsetypes.h13
-rw-r--r--engines/lab/processroom.cpp42
-rw-r--r--engines/lab/resource.cpp10
-rw-r--r--engines/lab/resource.h2
6 files changed, 31 insertions, 40 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index f7f65e24b1..d45d9f128b 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -665,7 +665,7 @@ static void mainGameLoop() {
uint16 OldRoomNum, OldDirection = 0, GadID = 0, NewDir;
CloseDataPtr OldCPtr, TempCPtr, HCPtr = NULL;
- ViewDataPtr VPtr;
+ ViewData *VPtr;
VGASetPal(initcolors, 8);
diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h
index b634e9c120..672d19a95c 100644
--- a/engines/lab/parsefun.h
+++ b/engines/lab/parsefun.h
@@ -51,7 +51,7 @@ void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum);
/* From ProcessRoom.c */
-ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction);
+ViewData *getViewData(uint16 RoomNum, uint16 Direction);
char *getPictName(CloseDataPtr *LCPtr);
void drawDirection(CloseDataPtr LCPtr);
bool processArrow(uint16 *Direction, uint16 Arrow);
diff --git a/engines/lab/parsetypes.h b/engines/lab/parsetypes.h
index f185c11b63..a437df0534 100644
--- a/engines/lab/parsetypes.h
+++ b/engines/lab/parsetypes.h
@@ -110,15 +110,13 @@ typedef struct closeData {
typedef CloseData *CloseDataPtr;
-struct viewData {
+struct ViewData {
int16 *Condition;
char *GraphicName;
- struct viewData *NextCondition;
+ struct ViewData *NextCondition;
CloseDataPtr closeUps;
};
-typedef viewData *ViewDataPtr;
-
struct Action {
int16 ActionType, Param1, Param2, Param3;
@@ -127,14 +125,11 @@ struct Action {
Action *NextAction;
};
-typedef Action *ActionPtr;
-
-
struct Rule {
int16 RuleType, Param1, Param2, *Condition;
- ActionPtr ActionList;
+ Action * ActionList;
Rule *NextRule;
};
@@ -145,7 +140,7 @@ struct RoomData {
byte WipeType;
- ViewDataPtr NorthView, SouthView, EastView, WestView;
+ ViewData *NorthView, *SouthView, *EastView, *WestView;
RuleList *rules;
char *RoomMsg;
};
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index ea0309af22..0ef844cfae 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -94,40 +94,36 @@ static bool checkConditions(int16 *Condition) {
/*****************************************************************************/
/* Gets the current ViewDataPointer. */
/*****************************************************************************/
-ViewDataPtr getViewData(uint16 roomNum, uint16 direction) {
- ViewDataPtr *VPtr = NULL, ViewPtr;
- bool doit = true;
+ViewData *getViewData(uint16 roomNum, uint16 direction) {
+ ViewData *view = NULL;
+
+ if (!Rooms[roomNum].RoomMsg)
+ g_resource->readViews(roomNum);
if (direction == NORTH)
- VPtr = &Rooms[roomNum].NorthView;
+ view = Rooms[roomNum].NorthView;
else if (direction == SOUTH)
- VPtr = &Rooms[roomNum].SouthView;
+ view = Rooms[roomNum].SouthView;
else if (direction == EAST)
- VPtr = &Rooms[roomNum].EastView;
+ view = Rooms[roomNum].EastView;
else if (direction == WEST)
- VPtr = &Rooms[roomNum].WestView;
-
- if (*VPtr == NULL)
- g_resource->readViews(roomNum);
-
- ViewPtr = *VPtr;
+ view = Rooms[roomNum].WestView;
do {
- if (checkConditions(ViewPtr->Condition))
- doit = false;
- else
- ViewPtr = ViewPtr->NextCondition;
+ if (checkConditions(view->Condition))
+ break;
- } while (doit);
+ view = view->NextCondition;
+ } while (true);
- return ViewPtr;
+ return view;
}
/*****************************************************************************/
/* Gets an object, if any, from the user's click on the screen. */
/*****************************************************************************/
static CloseData *getObject(uint16 x, uint16 y, CloseDataPtr LCPtr) {
- ViewDataPtr VPtr;
+ ViewData *VPtr;
if (LCPtr == NULL) {
VPtr = getViewData(RoomNum, Direction);
@@ -179,7 +175,7 @@ static CloseDataPtr findCPtrMatch(CloseDataPtr Main, CloseDataPtr List) {
/* Returns the current picture name. */
/*****************************************************************************/
char *getPictName(CloseDataPtr *LCPtr) {
- ViewDataPtr ViewPtr = getViewData(RoomNum, Direction);
+ ViewData *ViewPtr = getViewData(RoomNum, Direction);
if (*LCPtr != NULL) {
*LCPtr = findCPtrMatch(*LCPtr, ViewPtr->closeUps);
@@ -266,7 +262,7 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
/* Sets the current close up data. */
/*****************************************************************************/
void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) {
- ViewDataPtr VPtr;
+ ViewData *VPtr;
CloseDataPtr LCPtr;
uint16 x1, y1, x2, y2;
@@ -302,7 +298,7 @@ void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords)
/* Takes the currently selected item. */
/*****************************************************************************/
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
- ViewDataPtr VPtr;
+ ViewData *VPtr;
CloseDataPtr LCPtr;
if (*cptr == NULL) {
@@ -332,7 +328,7 @@ bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr) {
/*****************************************************************************/
/* Processes the action list. */
/*****************************************************************************/
-static void doActions(ActionPtr APtr, CloseDataPtr *LCPtr) {
+static void doActions(Action * APtr, CloseDataPtr *LCPtr) {
CloseDataPtr TLCPtr;
bool FirstLoaded = true;
char **str, *Test;
diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp
index 7ca59ba2fd..e2afcc6889 100644
--- a/engines/lab/resource.cpp
+++ b/engines/lab/resource.cpp
@@ -283,17 +283,17 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) {
return head;
}
-viewData *Resource::readView(Common::File *file) {
+ViewData *Resource::readView(Common::File *file) {
char c;
- viewData *view = NULL;
- viewData *prev = NULL;
- viewData *head = NULL;
+ ViewData *view = NULL;
+ ViewData *prev = NULL;
+ ViewData *head = NULL;
do {
c = file->readByte();
if (c == 1) {
- view = (viewData *)malloc(sizeof(viewData));
+ view = (ViewData *)malloc(sizeof(ViewData));
if (!head)
head = view;
if (prev)
diff --git a/engines/lab/resource.h b/engines/lab/resource.h
index d254cd068e..d41859e9f5 100644
--- a/engines/lab/resource.h
+++ b/engines/lab/resource.h
@@ -111,7 +111,7 @@ private:
RuleList *readRule(Common::File *file);
Action *readAction(Common::File *file);
CloseData *readCloseUps(uint16 depth, Common::File *file);
- viewData *readView(Common::File *file);
+ ViewData *readView(Common::File *file);
void readStaticText();
Common::String _staticText[48];