aboutsummaryrefslogtreecommitdiff
path: root/saga/font.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2004-05-04 03:33:03 +0000
committerEugene Sandulenko2004-05-04 03:33:03 +0000
commit8de181f4f0b6f974016eaee6ec238bbdfb5ded2f (patch)
tree0079332b27bf2ca641387f8a6f2a0bb02db339de /saga/font.cpp
parentb9ebd68022f5614b0db6b30d8494062e911a8cc5 (diff)
downloadscummvm-rg350-8de181f4f0b6f974016eaee6ec238bbdfb5ded2f.tar.gz
scummvm-rg350-8de181f4f0b6f974016eaee6ec238bbdfb5ded2f.tar.bz2
scummvm-rg350-8de181f4f0b6f974016eaee6ec238bbdfb5ded2f.zip
Move from ys_binread.cpp and ys_binwrite.cpp to MemoryReadStream.
In fact there were no binary writes at all. svn-id: r13773
Diffstat (limited to 'saga/font.cpp')
-rw-r--r--saga/font.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/saga/font.cpp b/saga/font.cpp
index 64c280bae2..f073d85c46 100644
--- a/saga/font.cpp
+++ b/saga/font.cpp
@@ -25,8 +25,6 @@
#include "saga.h"
#include "reinherit.h"
-#include "yslib.h"
-
#include "rscfile_mod.h"
#include "game_mod.h"
@@ -103,8 +101,6 @@ int FONT_Load(uint32 font_rn, int font_id) {
R_FONT_STYLE *normal_font;
byte *fontres_p;
size_t fontres_len;
- size_t remain;
- const byte *read_p;
int nbits;
int c;
@@ -122,8 +118,7 @@ int FONT_Load(uint32 font_rn, int font_id) {
FontModule.err_str = "Invalid font length.";
}
- read_p = fontres_p;
- remain = fontres_len;
+ MemoryReadStream *readS = new MemoryReadStream(fontres_p, fontres_len);
// Create new font structure
font = (R_FONT *)malloc(sizeof *font);
@@ -133,9 +128,9 @@ int FONT_Load(uint32 font_rn, int font_id) {
}
// Read font header
- fh.c_height = ys_read_u16_le(read_p, &read_p);
- fh.c_width = ys_read_u16_le(read_p, &read_p);
- fh.row_length = ys_read_u16_le(read_p, &read_p);
+ fh.c_height = readS->readUint16LE();
+ fh.c_width = readS->readUint16LE();
+ fh.row_length = readS->readUint16LE();
#if R_FONT_DBGLVL >= R_DEBUG_INFO
R_printf(R_STDOUT, "FONT_Load(): Reading font resource...\n");
@@ -161,23 +156,23 @@ int FONT_Load(uint32 font_rn, int font_id) {
normal_font->hdr.row_length = fh.row_length;
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
- normal_font->fce[c].index = ys_read_u16_le(read_p, &read_p);
+ normal_font->fce[c].index = readS->readUint16LE();
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
- nbits = normal_font->fce[c].width = ys_read_u8(read_p, &read_p);
+ nbits = normal_font->fce[c].width = readS->readByte();
normal_font->fce[c].byte_width = GetByteLen(nbits);
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
- normal_font->fce[c].flag = ys_read_u8(read_p, &read_p);
+ normal_font->fce[c].flag = readS->readByte();
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
- normal_font->fce[c].tracking = ys_read_u8(read_p, &read_p);
+ normal_font->fce[c].tracking = readS->readByte();
}
- if ((read_p - fontres_p) != R_FONT_DESCSIZE) {
+ if (readS->tell() != R_FONT_DESCSIZE) {
R_printf(R_STDERR, "Invalid font resource size.\n");
return R_FAILURE;
}