aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2015-07-17 10:50:04 +0300
committerEugene Sandulenko2015-12-15 00:05:02 +0100
commit4f0c63c0f89aedad21ab41f4b440d0a8b7ae8b6b (patch)
treee73f2313ff2586cddf8b2e189567ac6d10b555f6 /engines
parent9a12f6be3fc48f4fa4cc3dc45fce7a0b406bff9b (diff)
downloadscummvm-rg350-4f0c63c0f89aedad21ab41f4b440d0a8b7ae8b6b.tar.gz
scummvm-rg350-4f0c63c0f89aedad21ab41f4b440d0a8b7ae8b6b.tar.bz2
scummvm-rg350-4f0c63c0f89aedad21ab41f4b440d0a8b7ae8b6b.zip
LAB: Merge the VGAScale and setCurClose functions
Diffstat (limited to 'engines')
-rw-r--r--engines/lab/labfun.h6
-rw-r--r--engines/lab/machine.cpp35
-rw-r--r--engines/lab/parsefun.h26
-rw-r--r--engines/lab/processroom.cpp50
-rw-r--r--engines/lab/readdiff.cpp2
-rw-r--r--engines/lab/special.cpp30
6 files changed, 34 insertions, 115 deletions
diff --git a/engines/lab/labfun.h b/engines/lab/labfun.h
index 61f27fcc81..e2f7844596 100644
--- a/engines/lab/labfun.h
+++ b/engines/lab/labfun.h
@@ -244,10 +244,8 @@ public:
uint16 scaleX(uint16 x);
uint16 scaleY(uint16 y);
-uint16 VGAScaleX(uint16 x);
-uint16 VGAScaleY(uint16 y);
-int16 VGAScaleXs(int16 x);
-int16 VGAScaleYs(int16 y);
+int16 VGAScaleX(int16 x);
+int16 VGAScaleY(int16 y);
uint16 SVGACord(uint16 cord);
uint16 VGAUnScaleX(uint16 x);
uint16 VGAUnScaleY(uint16 y);
diff --git a/engines/lab/machine.cpp b/engines/lab/machine.cpp
index 61375d6867..ede75e0aec 100644
--- a/engines/lab/machine.cpp
+++ b/engines/lab/machine.cpp
@@ -61,54 +61,23 @@ uint16 scaleY(uint16 y) {
/*****************************************************************************/
/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
/*****************************************************************************/
-uint16 VGAScaleX(uint16 x) {
+int16 VGAScaleX(int16 x) {
if (IsHiRes)
return (x * 2);
else
return x;
}
-
-
-
/*****************************************************************************/
/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
/*****************************************************************************/
-uint16 VGAScaleY(uint16 y) {
+int16 VGAScaleY(int16 y) {
if (IsHiRes)
return ((y * 12) / 5);
else
return y;
}
-
-
-/*****************************************************************************/
-/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
-/*****************************************************************************/
-int16 VGAScaleXs(int16 x) {
- if (IsHiRes)
- return (x * 2);
- else
- return x;
-}
-
-
-
-
-/*****************************************************************************/
-/* Scales the VGA cords to SVGA if necessary; otherwise, returns VGA cords. */
-/*****************************************************************************/
-int16 VGAScaleYs(int16 y) {
- if (IsHiRes)
- return ((y * 12) / 5);
- else
- return y;
-}
-
-
-
-
uint16 SVGACord(uint16 cord) {
if (IsHiRes)
return cord;
diff --git a/engines/lab/parsefun.h b/engines/lab/parsefun.h
index 6766dd27f0..f5929ae306 100644
--- a/engines/lab/parsefun.h
+++ b/engines/lab/parsefun.h
@@ -45,54 +45,30 @@ bool parse(const char *InputFile);
/* From allocRoom.c */
bool initRoomBuffer();
-
void freeRoomBuffer();
-
void allocRoom(void **Ptr, uint16 Size, uint16 RoomNum);
/* From ReadParse.c */
bool readRoomData(const char *fileName);
-
bool readInventory(const char *fileName);
-
-char *numtostr(char *text, uint16 Num);
-
bool readViews(uint16 RoomNum, const char *Path);
/* From ProcessRoom.c */
ViewDataPtr getViewData(uint16 RoomNum, uint16 Direction);
-
char *getPictName(CloseDataPtr *LCPtr);
-
void drawDirection(CloseDataPtr LCPtr);
-
bool processArrow(uint16 *Direction, uint16 Arrow);
-
-void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr);
-
-void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr);
-
+void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords = false);
bool takeItem(uint16 x, uint16 y, CloseDataPtr *cptr);
-
bool doActionRule(int16 x, int16 y, int16 action, int16 RoomNum, CloseDataPtr *LCPtr);
-
bool doOperateRule(int16 x, int16 y, int16 ItemNum, CloseDataPtr *LCPtr);
-
bool doGoForward(CloseDataPtr *LCPtr);
-
bool doTurn(uint16 from, uint16 to, CloseDataPtr *LCPtr);
-
bool doMainView(CloseDataPtr *LCPtr);
-/*
- bool doConditions(int16 x,
- int16 y,
- CloseDataPtr *LCPtr);
- */
-
} // End of namespace Lab
#endif /* LAB_PARSEFUN_H */
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 27d480bf69..7293b908ea 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -234,12 +234,6 @@ void drawDirection(CloseDataPtr LCPtr) {
else if (Direction == WEST)
strcat(Message, FACINGWEST);
- /*
- numtostr(test, RoomNum);
- strcat(Message, ", ");
- strcat(Message, test);
- */
-
drawMessage(Message);
}
@@ -307,11 +301,12 @@ bool processArrow(uint16 *direction, uint16 Arrow) {
}
/*****************************************************************************/
-/* Sets the current close up data, but uses absolute cords. */
+/* Sets the current close up data. */
/*****************************************************************************/
-void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) {
+void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr, bool useAbsoluteCoords) {
ViewDataPtr VPtr;
CloseDataPtr LCPtr;
+ uint16 x1, y1, x2, y2;
if (*cptr == NULL) {
VPtr = getViewData(RoomNum, Direction);
@@ -319,37 +314,20 @@ void setCurCloseAbs(uint16 x, uint16 y, CloseDataPtr *cptr) {
} else
LCPtr = (*cptr)->SubCloseUps;
-
while (LCPtr != NULL) {
- if ((x >= LCPtr->x1) && (y >= LCPtr->y1) &&
- (x <= LCPtr->x2) && (y <= LCPtr->y2) &&
- (LCPtr->GraphicName)) {
- *cptr = LCPtr;
- return;
+ if (!useAbsoluteCoords) {
+ x1 = LCPtr->x1;
+ y1 = LCPtr->y1;
+ x2 = LCPtr->x2;
+ y2 = LCPtr->y2;
+ } else {
+ x1 = scaleX(LCPtr->x1);
+ y1 = scaleY(LCPtr->y1);
+ x2 = scaleX(LCPtr->x2);
+ y2 = scaleY(LCPtr->y2);
}
- LCPtr = LCPtr->NextCloseUp;
- }
-}
-
-/*****************************************************************************/
-/* Sets the current close up data. */
-/*****************************************************************************/
-void setCurClose(uint16 x, uint16 y, CloseDataPtr *cptr) {
- ViewDataPtr VPtr;
- CloseDataPtr LCPtr;
-
- if (*cptr == NULL) {
- VPtr = getViewData(RoomNum, Direction);
- LCPtr = VPtr->closeUps;
- } else
- LCPtr = (*cptr)->SubCloseUps;
-
-
- while (LCPtr != NULL) {
- if ((x >= scaleX(LCPtr->x1)) && (y >= scaleY(LCPtr->y1)) &&
- (x <= scaleX(LCPtr->x2)) && (y <= scaleY(LCPtr->y2)) &&
- (LCPtr->GraphicName)) {
+ if (x >= x1 && y >= y1 && x <= x2 && y <= y2 && LCPtr->GraphicName) {
*cptr = LCPtr;
return;
}
diff --git a/engines/lab/readdiff.cpp b/engines/lab/readdiff.cpp
index fa1a009780..e1ecb3b6d0 100644
--- a/engines/lab/readdiff.cpp
+++ b/engines/lab/readdiff.cpp
@@ -42,8 +42,6 @@ extern uint32 VGABytesPerPage;
/*
extern int32 ReadSoFar;
- extern bool ReadIsDone,
- ReadIsError;
*/
extern byte **startoffile;
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 603dfbe348..b8e66626d2 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -363,22 +363,22 @@ static void doTileScroll(uint16 col, uint16 row, uint16 scrolltype) {
uint16 counter;
if (scrolltype == LEFTSCROLL) {
- dX = VGAScaleXs(5);
- sx = VGAScaleXs(5);
+ dX = VGAScaleX(5);
+ sx = VGAScaleX(5);
last = 6;
} else if (scrolltype == RIGHTSCROLL) {
- dX = VGAScaleXs(-5);
- dx = VGAScaleXs(-5);
+ dX = VGAScaleX(-5);
+ dx = VGAScaleX(-5);
sx = VGAScaleX(5);
last = 6;
} else if (scrolltype == UPSCROLL) {
- dY = VGAScaleYs(5);
- sy = VGAScaleYs(5);
+ dY = VGAScaleY(5);
+ sy = VGAScaleY(5);
last = 5;
} else if (scrolltype == DOWNSCROLL) {
- dY = VGAScaleYs(-5);
- dy = VGAScaleYs(-5);
- sy = VGAScaleYs(5);
+ dY = VGAScaleY(-5);
+ dy = VGAScaleY(-5);
+ sy = VGAScaleY(5);
last = 5;
}
@@ -437,9 +437,6 @@ static void changeTile(uint16 col, uint16 row) {
}
if (scrolltype != -1) {
- /* NYI:
- readPict("Music:Click", true);
- */
doTileScroll(col, row, scrolltype);
#if defined(LABDEMO)
@@ -933,6 +930,8 @@ extern uint16 RoomNum, Direction;
bool saveRestoreGame() {
bool isOK = false;
+ //g_lab->showMainMenu();
+
// The original had one screen for saving/loading. We have two.
// Ask the user which screen to use.
GUI::MessageDialog saveOrLoad(_("Would you like to save or restore a game?"), _("Save"), _("Restore"));
@@ -990,17 +989,18 @@ Image *MonButton, *AltMonButton, *MonQuit, *AltMonQuit, *MonBack, *AltMonBack,
/*****************************************************************************/
static void getMonImages() {
byte **buffer;
+ uint32 bufferSize;
resetBuffer();
- buffer = g_music->newOpen("P:MonImage");
+ buffer = g_music->newOpen("P:MonImage", bufferSize);
if (!buffer)
return;
readImage(buffer, &MonButton);
- stealBufMem(sizeOfFile("P:MonImage")); /* Trick: protects the memory where the buttons are so they won't be over-written */
+ stealBufMem(bufferSize); /* Trick: protects the memory where the buttons are so they won't be over-written */
}
@@ -1150,7 +1150,7 @@ static void processMonitor(char *ntext, bool isinteractive, uint16 x1, uint16 y1
TestCPtr = CPtr;
MouseY = 64 + (MouseY / MonGadHeight) * 42;
MouseX = 101;
- setCurCloseAbs(MouseX, MouseY, &CPtr);
+ setCurClose(MouseX, MouseY, &CPtr, true);
if (TestCPtr != CPtr) {
LastCPtr[depth] = TestCPtr;