aboutsummaryrefslogtreecommitdiff
path: root/engines/mortevielle/mouse.cpp
diff options
context:
space:
mode:
authorStrangerke2012-02-19 21:15:57 +0100
committerStrangerke2012-04-06 08:21:32 +0200
commitd8686819760db1e8fec28a99ef989c98f116c77a (patch)
treebee933b268aa7a66caa7173bb5fc8ac3b4e05f16 /engines/mortevielle/mouse.cpp
parentb12f8bf5ad72290bddf9d5b9c50bc1c4aa516005 (diff)
downloadscummvm-rg350-d8686819760db1e8fec28a99ef989c98f116c77a.tar.gz
scummvm-rg350-d8686819760db1e8fec28a99ef989c98f116c77a.tar.bz2
scummvm-rg350-d8686819760db1e8fec28a99ef989c98f116c77a.zip
MORTEVIELLE: Rename mouse functions, various formatting fixes
Diffstat (limited to 'engines/mortevielle/mouse.cpp')
-rw-r--r--engines/mortevielle/mouse.cpp247
1 files changed, 129 insertions, 118 deletions
diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp
index 51af36b5f0..d99163cc6f 100644
--- a/engines/mortevielle/mouse.cpp
+++ b/engines/mortevielle/mouse.cpp
@@ -47,8 +47,11 @@ int m_show,
int s_s[12][6];
-
-void init_mouse() {
+/**
+ * Initialize the mouse
+ * @remarks Originally called 'init_mouse'
+ */
+void initMouse() {
registres reg;
mouse_shwn = 0;
@@ -58,23 +61,28 @@ void init_mouse() {
g_vm->setMouseClick(false);
m_show = m_arrow;
- if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0)) int_m = false;
+ if ((READ_LE_UINT16(&mem[0xcc]) == 0) && (READ_LE_UINT16(&mem[0xce]) == 0))
+ int_m = false;
+
if (int_m) {
reg.ax = 0;
intr(0x33, reg);
int_m = (reg.ax == -1);
if (int_m) {
- {
- reg.ax = 4;
- reg.cx = 0;
- reg.dx = 0;
- }
+ reg.ax = 4;
+ reg.cx = 0;
+ reg.dx = 0;
+
intr(0x33, reg);
}
}
}
-void hide_mouse() {
+/**
+ * Hide the mouse
+ * @remarks Originally called 'hide_mouse'
+ */
+void hideMouse() {
int i, j, k, ps;;
bool imp;
@@ -83,7 +91,7 @@ void hide_mouse() {
imp = odd(y_s);
j = p_o_s;
switch (gd) {
- case cga : {
+ case cga: {
k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
do {
@@ -91,12 +99,12 @@ void hide_mouse() {
WRITE_LE_UINT16(&mem[0xb800 * 16 + j + 2], s_s[1][k]);
WRITE_LE_UINT16(&mem[0xba00 * 16 + j], s_s[2][k]);
WRITE_LE_UINT16(&mem[0xba00 * 16 + j + 2], s_s[3][k]);
- j = j + 80;
+ j += 80;
k = succ(int, k);
} while (!(k >= 5));
}
break;
- case ams : {
+ case ams: {
for (i = 0; i <= 3; i ++) {
port[0x3dd] = 1 << i;
k = 0;
@@ -104,10 +112,10 @@ void hide_mouse() {
do {
if (imp) {
WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]);
- j = j + 80 - 0x2000;
+ j += 80 - 0x2000;
} else {
WRITE_LE_UINT16(&mem[0xb800 * 16 + j], s_s[i][k]);
- j = j + 0x2000;
+ j += 0x2000;
}
imp = ! imp;
k = succ(int, k);
@@ -115,7 +123,7 @@ void hide_mouse() {
}
}
break;
- case ega : {
+ case ega: {
port[0x3c4] = 2;
port[0x3ce] = 8;
port[0x3cf] = 255;
@@ -129,23 +137,23 @@ void hide_mouse() {
mem[0xa000 * 16 + j] = lo(s_s[i][k]);
ps = mem[0xa000 * 16 + j + 1];
mem[0xa000 * 16 + j + 1] = hi(s_s[i][k]);
- j = j + 80;
+ j += 80;
k = succ(int, k);
} while (!(k >= 8));
- i = i + 1;
+ ++i;
} while (!(i == 4));
}
break;
- case her : {
+ case her: {
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3);
for (i = 0; i <= 5; i ++) {
for (k = 0; k <= 3; k ++)
WRITE_LE_UINT16(&mem[0xb000 * 16 + k * 0x200 + j], s_s[i][k]);
- j = j + 80;
+ j += 80;
}
}
break;
- case tan : {
+ case tan: {
j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1);
k = 0;
do {
@@ -153,7 +161,7 @@ void hide_mouse() {
WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j], s_s[k][i + (k << 2)]);
WRITE_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]);
}
- j = j + 160;
+ j += 160;
k = succ(int, k);
} while (!(k == 3));
}
@@ -163,7 +171,11 @@ void hide_mouse() {
}
}
-void show_mouse() {
+/**
+ * Show mouse
+ * @remarks Originally called 'show_mouse'
+ */
+void showMouse() {
int i, j, k, l;
bool imp;
@@ -173,7 +185,7 @@ void show_mouse() {
imp = odd(y_s);
i = x_s & 7;
switch (gd) {
- case cga : {
+ case cga: {
k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
do {
@@ -181,12 +193,12 @@ void show_mouse() {
s_s[1][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j + 2]);
s_s[2][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j]);
s_s[3][k] = READ_LE_UINT16(&mem[0xba00 * 16 + j + 2]);
- j = j + 80;
+ j += 80;
k = succ(int, k);
} while (!(k >= 5));
}
break;
- case ams : {
+ case ams: {
for (i = 0; i <= 3; i ++) {
j = p_o_s;
imp = odd(y_s);
@@ -195,10 +207,10 @@ void show_mouse() {
do {
if (imp) {
s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]);
- j = j + 80 - 0x2000;
+ j += 80 - 0x2000;
} else {
s_s[i][k] = READ_LE_UINT16(&mem[0xb800 * 16 + j]);
- j = j + 0x2000;
+ j += 0x2000;
}
imp = ! imp;
k = succ(int, k);
@@ -206,7 +218,7 @@ void show_mouse() {
}
}
break;
- case ega : {
+ case ega: {
port[0x3ce] = 4;
l = 0;
do {
@@ -215,14 +227,14 @@ void show_mouse() {
j = p_o_s;
do {
s_s[l][k] = mem[0xa000 * 16 + j] + (mem[0xa000 * 16 + succ(int, j)] << 8);
- j = j + 80;
+ j += 80;
k = succ(int, k);
} while (!(k >= 8));
- l = l + 1;
+ ++l;
} while (!(l == 4));
}
break;
- case her : {
+ case her: {
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3);
for (i = 0; i <= 5; i ++) {
for (k = 0; k <= 3; k ++)
@@ -231,7 +243,7 @@ void show_mouse() {
}
}
break;
- case tan : {
+ case tan: {
j = ((uint)y_s >> 2) * 160 + ((uint)x_s >> 1);
k = 0;
do {
@@ -239,7 +251,7 @@ void show_mouse() {
s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j]);
s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 * 16 + 0x200 * i + j + 2]);
}
- j = j + 160;
+ j += 160;
k = succ(int, k);
} while (!(k == 3));
}
@@ -247,24 +259,41 @@ void show_mouse() {
} /* case Gd */
}
-void pos_mouse(int x, int y) {
- if (x > 314 * res) x = 314 * res;
- else if (x < 0) x = 0;
- if (y > 199) y = 199;
- else if (y < 0) y = 0;
- if ((x == x_s) && (y == y_s)) return;
+/**
+ * Set mouse position
+ * @remarks Originally called 'pos_mouse'
+ */
+void setMousePos(int x, int y) {
+ if (x > 314 * res)
+ x = 314 * res;
+ else if (x < 0)
+ x = 0;
+ if (y > 199)
+ y = 199;
+ else if (y < 0)
+ y = 0;
+ if ((x == x_s) && (y == y_s))
+ return;
// Set the new position
g_vm->setMousePos(Common::Point(x, y));
}
-void read_pos_mouse(int &x, int &y, int &c) {
+/**
+ * Get mouse poisition
+ * @remarks Originally called 'read_pos_mouse'
+ */
+void getMousePos(int &x, int &y, int &c) {
x = g_vm->getMousePos().x;
y = g_vm->getMousePos().y;
c = g_vm->getMouseClick() ? 1 : 0;
}
-void mov_mouse(bool &funct, char &key) {
+/**
+ * Move mouse
+ * @remarks Originally called 'mov_mouse'
+ */
+void moveMouse(bool &funct, char &key) {
bool p_key;
char in1, in2;
int cx, cy, cd;
@@ -283,52 +312,46 @@ void mov_mouse(bool &funct, char &key) {
CHECK_QUIT;
in1 = get_ch();
- read_pos_mouse(cx, cy, cd);
+ getMousePos(cx, cy, cd);
switch (toupper(in1)) {
- case '4' :
+ case '4':
cx = cx - 8;
break;
- case '2' :
+ case '2':
cy = cy + 8;
break;
- case '6' :
+ case '6':
cx = cx + 8;
break;
- case '8' :
+ case '8':
cy = cy - 8;
break;
- case '7' : {
+ case '7':
cy = 1;
cx = 1;
- }
- break;
- case '1' : {
+ break;
+ case '1':
cx = 1;
cy = 190;
- }
- break;
- case '9' : {
+ break;
+ case '9':
cx = 315 * res;
cy = 1;
- }
- break;
- case '3' : {
+ break;
+ case '3':
cy = 190;
cx = 315 * res;
- }
- break;
- case '5' : {
+ break;
+ case '5':
cy = 100;
cx = 155 * res;
- }
- break;
+ break;
case ' ':
- case '\15' : {
+ case '\15':
g_vm->setMouseClick(true);
return;
- }
- break;
- case '\33' : {
+ break;
+ case '\33':
p_key = keypressed();
if (p_key) {
@@ -340,102 +363,90 @@ void mov_mouse(bool &funct, char &key) {
return;
} else {
switch (in2) {
- case 'K' :
+ case 'K':
cx = pred(int, cx);
break;
- case 'P' :
+ case 'P':
cy = succ(int, cy);
break;
- case 'M' :
+ case 'M':
cx = cx + 2;
break;
- case 'H' :
+ case 'H':
cy = pred(int, cy);
break;
- case 'G' : {
+ case 'G':
cx = cx - 1;
cy = cy - 1;
- }
- break;
- case 'I' : {
+ break;
+ case 'I':
cx = cx + 1;
cy = cy - 1;
- }
- break;
- case 'O' : {
+ break;
+ case 'O':
cx = cx - 1;
cy = cy + 1;
- }
- break;
- case 'Q' : {
+ break;
+ case 'Q':
cx = cx + 1;
cy = cy + 1;
- }
- break;
- } /* case */
+ break;
+ default:
+ break;
+ } // case
}
}
- }
- break;
- case 'I' : {
+ break;
+ case 'I':
cx = res * 32;
cy = 8;
- }
- break;
- case 'D' : {
+ break;
+ case 'D':
cx = 80 * res;
cy = 8;
- }
- break;
- case 'A' : {
+ break;
+ case 'A':
cx = 126 * res;
cy = 8;
- }
- break;
- case 'S' : {
+ break;
+ case 'S':
cx = 174 * res;
cy = 8;
- }
- break;
- case 'P' : {
+ break;
+ case 'P':
cx = 222 * res;
cy = 8;
- }
- break;
- case 'F' : {
+ break;
+ case 'F':
cx = res * 270;
cy = 8;
- }
- break;
- case '\23' : {
+ break;
+ case '\23':
sonoff = ! sonoff;
return;
- }
- break;
- case '\26' : {
+ break;
+ case '\26':
zuul = true;
return;
- }
- break;
- case '\24' : { /* ^T => mode tandy */
+ break;
+ case '\24': // ^T => mode tandy
funct = true;
key = '\11';
- }
- break;
- case '\10' : { /* ^H => mode Hercule */
+ break;
+ case '\10': // ^H => mode Hercule
funct = true;
key = '\7';
- }
- break;
+ break;
case '\1':
case '\3':
- case '\5' : {
+ case '\5':
funct = true;
key = in1;
+ break;
+ default:
+ break;
}
- break;
- }
- pos_mouse(cx, cy);
+ setMousePos(cx, cy);
p_key = keypressed();
}
}