aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-01-08 11:21:11 +1100
committerStrangerke2012-04-06 08:19:30 +0200
commitc72eed79806b0dca804b7cea6ae2ae73d6069ccd (patch)
tree711567349c03116cef44c2a8c18cf9c696f0cc9c
parentc45e7c5d94fc5bee5b638029470aedd4b8f7eaf3 (diff)
downloadscummvm-rg350-c72eed79806b0dca804b7cea6ae2ae73d6069ccd.tar.gz
scummvm-rg350-c72eed79806b0dca804b7cea6ae2ae73d6069ccd.tar.bz2
scummvm-rg350-c72eed79806b0dca804b7cea6ae2ae73d6069ccd.zip
MORTEVIELLE: Converted memw[] usage to use mem[] array with endian macros
This is better for now, since mem and memw share the same memory space.
-rw-r--r--engines/mortevielle/level15.cpp13
-rw-r--r--engines/mortevielle/mor.cpp5
-rw-r--r--engines/mortevielle/mort.cpp6
-rw-r--r--engines/mortevielle/mouse.cpp41
-rw-r--r--engines/mortevielle/parole.cpp4
-rw-r--r--engines/mortevielle/parole2.cpp3
-rw-r--r--engines/mortevielle/taffich.cpp4
-rw-r--r--engines/mortevielle/var_mor.cpp1
-rw-r--r--engines/mortevielle/var_mor.h1
9 files changed, 41 insertions, 37 deletions
diff --git a/engines/mortevielle/level15.cpp b/engines/mortevielle/level15.cpp
index 5195e7c2a4..bd908b47c4 100644
--- a/engines/mortevielle/level15.cpp
+++ b/engines/mortevielle/level15.cpp
@@ -61,8 +61,8 @@ void outbloc(int n, pattern p, t_nhom pal) {
ad = n * 404 + 0xd700;
{
- memw[0x6000 + ad] = p.tax;
- memw[0x6000 + ad + 2] = p.tay;
+ WRITE_LE_UINT16(&mem[0x6000 + ad], p.tax);
+ WRITE_LE_UINT16(&mem[0x6000 + ad + 2], p.tay);
ad = ad + 4;
for (i = 1; i <= p.tax; i ++)
for (j = 1; j <= p.tay; j ++)
@@ -102,7 +102,8 @@ void pictout(int seg, int dep, int x, int y) {
mem[0x7000 * 16 + 2] = 0;
mem[0x7000 * 16 + 32] = 15;
}
- if ((caff != 51) && (memw[0x7000 + 0x4138] > 0x100)) memw[0x7000 + 0x4138] = 0x100;
+ if ((caff != 51) && (READ_LE_UINT16(&mem[0x7000 + 0x4138]) > 0x100))
+ WRITE_LE_UINT16(&mem[0x7000 + 0x4138], 0x100);
afff(gd, seg, dep, x, y);
}
@@ -191,10 +192,10 @@ int animof(int ouf, int num) {
nani = mem[adani * 16 + 1];
aux = num;
if (ouf != 1) aux = aux + nani;
- animof_result = (nani << 2) + 2 + swap(memw[adani + (aux << 1)]);
+ animof_result = (nani << 2) + 2 + swap(READ_LE_UINT16(&mem[adani + (aux << 1)]));
/*aux:= nani shl 2 + 2;
- if ouf=1 then aux:= aux+ swap(memw[adani: num shl 1])
- else aux:= aux+ swap(memw[adani: (nani+num) shl 1]);
+ if ouf=1 then aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: num shl 1])
+ else aux:= aux+ swap(WRITE_LE_UINT16(&mem[adani: (nani+num) shl 1]);
animof:=aux;*/
return animof_result;
}
diff --git a/engines/mortevielle/mor.cpp b/engines/mortevielle/mor.cpp
index 4af3967eae..ede69a5765 100644
--- a/engines/mortevielle/mor.cpp
+++ b/engines/mortevielle/mor.cpp
@@ -25,6 +25,7 @@
* Copyright (c) 1988-1989 Lankhor
*/
+#include "common/endian.h"
#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/alert.h"
@@ -1231,8 +1232,8 @@ void messint(int nu) {
clsf2();
clsf3();
decomp(0x73a2, 1008);
- memw[0x7413 + 12] = 80;
- memw[0x7413 + 14] = 40;
+ WRITE_LE_UINT16(&mem[0x7413 + 12], 80);
+ WRITE_LE_UINT16(&mem[0x7413 + 14], 40);
writepal(90);
afff(gd, 0x73a2, 1008, 0, 0);
afff(gd, 0x73a2, 1008, 0, 70);
diff --git a/engines/mortevielle/mort.cpp b/engines/mortevielle/mort.cpp
index ea8cbcb663..9b05196ab9 100644
--- a/engines/mortevielle/mort.cpp
+++ b/engines/mortevielle/mort.cpp
@@ -83,9 +83,9 @@ int mortevielle_main(int argc, const char *argv[]) {
c_zzz = 1;
init_nbrepm();
init_mouse();
- /* crep:=memw[$7f00:0];
- memw[$7f00:0]:= crep+1;
- if (memw[$7f00:0]<> crep+1) then
+ /* crep:=WRITE_LE_UINT16(&mem[$7f00:0];
+ WRITE_LE_UINT16(&mem[$7f00:0]:= crep+1;
+ if (WRITE_LE_UINT16(&mem[$7f00:0]<> crep+1) then
begin
hirs;
show_mouse;
diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp
index 1ae04417bf..e7eb225edf 100644
--- a/engines/mortevielle/mouse.cpp
+++ b/engines/mortevielle/mouse.cpp
@@ -25,6 +25,7 @@
* Copyright (c) 1988-1989 Lankhor
*/
+#include "common/endian.h"
#include "common/rect.h"
#include "mortevielle/mouse.h"
#include "mortevielle/var_mor.h"
@@ -57,7 +58,7 @@ void init_mouse() {
/*int_m:= False;*/
clic = false;
m_show = m_arrow;
- if ((memw[0xcc] == 0) && (memw[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);
@@ -101,10 +102,10 @@ void hide_mouse() {
k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
do {
- memw[0xb000 + j] = s_s[0][k];
- memw[0xb800 + j + 2] = s_s[1][k];
- memw[0xba00 + j] = s_s[2][k];
- memw[0xba00 + j + 2] = s_s[3][k];
+ WRITE_LE_UINT16(&mem[0xb000 + j], s_s[0][k]);
+ WRITE_LE_UINT16(&mem[0xb800 + j + 2], s_s[1][k]);
+ WRITE_LE_UINT16(&mem[0xba00 + j], s_s[2][k]);
+ WRITE_LE_UINT16(&mem[0xba00 + j + 2], s_s[3][k]);
j = j + 80;
k = succ(int, k);
} while (!(k >= 5));
@@ -117,10 +118,10 @@ void hide_mouse() {
j = p_o_s;
do {
if (imp) {
- memw[0xb800 + j] = s_s[i][k];
+ WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]);
j = j + 80 - 0x2000;
} else {
- memw[0xb800 + j] = s_s[i][k];
+ WRITE_LE_UINT16(&mem[0xb800 + j], s_s[i][k]);
j = j + 0x2000;
}
imp = ! imp;
@@ -153,7 +154,8 @@ void hide_mouse() {
case her : {
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3);
for (i = 0; i <= 5; i ++) {
- for (k = 0; k <= 3; k ++) memw[0xb000 + k * 0x200 + j] = s_s[i][k];
+ for (k = 0; k <= 3; k ++)
+ WRITE_LE_UINT16(&mem[0xb000 + k * 0x200 + j], s_s[i][k]);
j = j + 80;
}
}
@@ -163,8 +165,8 @@ void hide_mouse() {
k = 0;
do {
for (i = 0; i <= 3; i ++) {
- memw[0xb800 + 0x200 * i + j] = s_s[k][i + (k << 2)];
- memw[0xb800 + 0x200 * i + j + 2] = s_s[k + 3][i + (k << 2)];
+ WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j], s_s[k][i + (k << 2)]);
+ WRITE_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2], s_s[k + 3][i + (k << 2)]);
}
j = j + 160;
k = succ(int, k);
@@ -190,10 +192,10 @@ void show_mouse() {
k = 0;
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 2);
do {
- s_s[0][k] = memw[0xb800 + j];
- s_s[1][k] = memw[0xb800 + j + 2];
- s_s[2][k] = memw[0xba00 + j];
- s_s[3][k] = memw[0xba00 + j + 2];
+ s_s[0][k] = READ_LE_UINT16(&mem[0xb800 + j]);
+ s_s[1][k] = READ_LE_UINT16(&mem[0xb800 + j + 2]);
+ s_s[2][k] = READ_LE_UINT16(&mem[0xba00 + j]);
+ s_s[3][k] = READ_LE_UINT16(&mem[0xba00 + j + 2]);
j = j + 80;
k = succ(int, k);
} while (!(k >= 5));
@@ -207,10 +209,10 @@ void show_mouse() {
k = 0;
do {
if (imp) {
- s_s[i][k] = memw[0xb800 + j];
+ s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]);
j = j + 80 - 0x2000;
} else {
- s_s[i][k] = memw[0xb800 + j];
+ s_s[i][k] = READ_LE_UINT16(&mem[0xb800 + j]);
j = j + 0x2000;
}
imp = ! imp;
@@ -238,7 +240,8 @@ void show_mouse() {
case her : {
j = ((uint)y_s >> 1) * 80 + ((uint)x_s >> 3);
for (i = 0; i <= 5; i ++) {
- for (k = 0; k <= 3; k ++) s_s[i][k] = memw[0xb000 + k * 0x200 + j];
+ for (k = 0; k <= 3; k ++)
+ s_s[i][k] = READ_LE_UINT16(&mem[0xb000 + k * 0x200 + j]);
j = j + 80;
}
}
@@ -248,8 +251,8 @@ void show_mouse() {
k = 0;
do {
for (i = 0; i <= 3; i ++) {
- s_s[k][i + (k << 2)] = memw[0xb800 + 0x200 * i + j];
- s_s[k + 3][i + (k << 2)] = memw[0xb800 + 0x200 * i + j + 2];
+ s_s[k][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j]);
+ s_s[k + 3][i + (k << 2)] = READ_LE_UINT16(&mem[0xb800 + 0x200 * i + j + 2]);
}
j = j + 160;
k = succ(int, k);
diff --git a/engines/mortevielle/parole.cpp b/engines/mortevielle/parole.cpp
index 7f8476da80..76d6c9a177 100644
--- a/engines/mortevielle/parole.cpp
+++ b/engines/mortevielle/parole.cpp
@@ -45,7 +45,7 @@ void spfrac(int wor) {
void charg_car() {
int wor, int_;
- wor = swap(memw[adword + ptr_word]);
+ wor = swap(READ_LE_UINT16(&mem[adword + ptr_word]));
int_ = wor & 0x3f;
if ((int_ >= 0) && (int_ <= 13)) {
@@ -113,7 +113,7 @@ void veracf(byte b) {
i = offsetb3 + 8590;
j = 0;
do {
- t_cph[j] = memw[adbruit3 + i];
+ t_cph[j] = READ_LE_UINT16(&mem[adbruit3 + i]);
i = i + 2;
j = j + 1;
} while (!(i >= offsetb3 + 8790));
diff --git a/engines/mortevielle/parole2.cpp b/engines/mortevielle/parole2.cpp
index be8c17bf3b..cba5588ffc 100644
--- a/engines/mortevielle/parole2.cpp
+++ b/engines/mortevielle/parole2.cpp
@@ -25,6 +25,7 @@
* Copyright (c) 1988-1989 Lankhor
*/
+#include "common/endian.h"
#include "mortevielle/level15.h"
#include "mortevielle/parole2.h"
#include "mortevielle/parole.h"
@@ -62,7 +63,7 @@ void trait_ph() {
ptr_tcph = (uint)ledeb >> 1;
ptr_word = 0;
do {
- memw[adword + ptr_word] = t_cph[ptr_tcph];
+ WRITE_LE_UINT16(&mem[adword + ptr_word], t_cph[ptr_tcph]);
ptr_word = ptr_word + 2;
ptr_tcph = ptr_tcph + 1;
} while (!(ptr_tcph >= (int)((uint)lefin >> 1)));
diff --git a/engines/mortevielle/taffich.cpp b/engines/mortevielle/taffich.cpp
index 449e003394..1cb0f76325 100644
--- a/engines/mortevielle/taffich.cpp
+++ b/engines/mortevielle/taffich.cpp
@@ -182,7 +182,7 @@ void taffich() {
chardes(nom, lgt, handle);
if (gd == her) {
for (i = 0; i <= 15; i ++) {
- palh = memw[0x7000 + (succ(int, i) << 1)];
+ palh = READ_LE_UINT16(&mem[0x7000 + (succ(int, i) << 1)]);
alllum[i] = (palh & 15) + (((uint)palh >> 12) & 15) + (((uint)palh >> 8) & 15);
}
for (i = 0; i <= 15; i ++) {
@@ -221,7 +221,7 @@ void taffich() {
/* begin
for i:=0 to 15 do
begin
- PalH:=memw[$7000:succ(i) shl 1];
+ PalH:=WRITE_LE_UINT16(&mem[$7000:succ(i) shl 1];
Alllum[i]:=PalH and 15 + PalH shr 4 and 15 + PalH shr 8 and 15;
end;
for i:=0 to 15 do
diff --git a/engines/mortevielle/var_mor.cpp b/engines/mortevielle/var_mor.cpp
index 589a0bbac5..5166f201c4 100644
--- a/engines/mortevielle/var_mor.cpp
+++ b/engines/mortevielle/var_mor.cpp
@@ -351,7 +351,6 @@ Common::String copy(const Common::String &s, int idx, size_t size) {
int port[0xfff];
byte mem[65536 * 16];
-int memw[0xffff];
int wherey;
void gotoxy(int x, int y) {
diff --git a/engines/mortevielle/var_mor.h b/engines/mortevielle/var_mor.h
index fbd324b548..16ab044569 100644
--- a/engines/mortevielle/var_mor.h
+++ b/engines/mortevielle/var_mor.h
@@ -406,7 +406,6 @@ void affput(const Common::Point &pt, int palIndex, int ch);
extern int port[0xfff];
extern byte mem[65536 * 16];
-extern int memw[0xffff];
#define hires {}
#define mortevielle_exit(ret) error("Exit the game")