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.
This commit is contained in:
Paul Gilbert 2012-01-08 11:21:11 +11:00 committed by Strangerke
parent c45e7c5d94
commit c72eed7980
9 changed files with 41 additions and 37 deletions

View File

@ -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;
}

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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));

View File

@ -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)));

View File

@ -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

View File

@ -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) {

View File

@ -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")