MORTEVIELLE: Correct loading of the text data index, and fixed decoding of text lines

This commit is contained in:
Paul Gilbert 2012-01-02 21:29:11 +11:00 committed by Strangerke
parent 9957819311
commit 2a6ec0eaa6
4 changed files with 16 additions and 11 deletions

View File

@ -72,11 +72,11 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
(uchar)'6', (uchar)'7', (uchar)'8', (uchar)'9'
};
*/
int oct, ocd;
uint16 oct, ocd;
/* 5-8 */
oct = t_mot[idx];
oct = (uint)(oct << (16 - pt)) >> (16 - pt);
oct = ((uint16)(oct << (16 - pt))) >> (16 - pt);
if (pt < 6) {
idx = idx + 1;
oct = oct << (5 - pt);
@ -96,7 +96,7 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
case 30:
case 31 : {
ocd = t_mot[idx];
ocd = (uint)(ocd << (16 - pt)) >> (16 - pt);
ocd = (uint16)(ocd << (16 - pt)) >> (16 - pt);
if (pt < 6) {
idx = idx + 1;
ocd = ocd << (5 - pt);
@ -119,7 +119,10 @@ static void cinq_huit(char &c, int &idx, byte &pt, bool &the_end) {
}
} /* 5-8 */
void deline(int num , char *l , int &tl) {
/**
* Decode and extract the line with the given Id
*/
void deline(int num, char *l , int &tl) {
int i, j, ts;
char let;
byte ps, k;
@ -142,7 +145,8 @@ void deline(int num , char *l , int &tl) {
j = j + 1;
} while (!the_end);
tl = j - 1;
if (tl < 255) delig = copy(delig, 1, tl - 1); /* enleve le $ */ //Translation: Remove '$'
if (tl < 255)
delig.deleteLastChar(); // Remove trailing '$'
} /* DETEX */

View File

@ -201,18 +201,17 @@ void ani50() {
assert(f.size() <= (maxti * 2));
for (i = 0; i < f.size() / 2; ++i)
t_mot[i] = f.readSint16LE();
t_mot[i] = f.readUint16LE();
f.close();
if (!f.open("TXX.NTP"))
error("Missing file - TXX.NTP");
assert(f.size() <= (maxtd * 4));
for (i = 0; i < (f.size() + 3) / 4; ++i) {
assert(f.size() <= (maxtd * 3));
for (i = 0; i < (f.size() / 3); ++i) {
t_rec[i].indis = f.readSint16LE();
t_rec[i].point = f.readByte();
f.readByte();
}
f.close();

View File

@ -25,6 +25,7 @@
* Copyright (c) 1988-1989 Lankhor
*/
#include "common/debug.h"
#include "common/str.h"
#include "common/textconsole.h"
#include "mortevielle/sprint.h"
@ -216,7 +217,7 @@ byte lettres[7][24];
byte palher[16];
int t_mot[maxti + 1];
uint16 t_mot[maxti + 1];
int tay_tchar;
ind t_rec[maxtd + 1];
//file<ind> sauv_t;
@ -349,6 +350,7 @@ void gotoxy(int x, int y) {
void textcolor(int c) {
}
void output(const Common::String &s) {
debug(s.c_str());
}
void graphbackground(int c) {
}

View File

@ -370,7 +370,7 @@ extern byte lettres[7][24];
extern byte palher[16];
extern int t_mot[maxti + 1];
extern uint16 t_mot[maxti + 1];
extern int tay_tchar;
extern ind t_rec[maxtd + 1];
//file<ind> sauv_t;