[Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.19,1.20 console.cpp,1.9,1.10 font.cpp,1.13,1.14 font.h,1.5,1.6 font_map.cpp,1.2,1.3 ihnm_introproc.cpp,1.11,1.12 interface.cpp,1.16,1.17 ite_introproc.cpp,1.15,1.16 objectmap.cpp,1.15,1.16 render.cpp,1.24,1.25 saga.cpp,1.36,1.37 saga.h,1.26,1.27 sdebug.cpp,1.11,1.12 sprite.cpp,1.13,1.14 text.cpp,1.5,1.6 font_mod.h,1.2,NONE
Eugene Sandulenko
sev at users.sourceforge.net
Mon Aug 2 17:07:06 CEST 2004
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.231,1.232 script.cpp,1.168,1.169
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.20,1.21 events.cpp,1.16,1.17 gfx.h,1.7,1.8 ihnm_introproc.cpp,1.12,1.13 ite_introproc.cpp,1.16,1.17 render.cpp,1.25,1.26 saga.cpp,1.37,1.38 saga.h,1.27,1.28 scene.cpp,1.24,1.25 scene_mod.h,1.6,1.7 script.cpp,1.16,1.17 script.h,1.9,1.10 sdata.cpp,1.12,1.13 sdebug.cpp,1.12,1.13 sfuncs.cpp,1.11,1.12 sprite.cpp,1.14,1.15 sstack.cpp,1.6,1.7 sthread.cpp,1.17,1.18 text.cpp,1.6,1.7 text.h,1.2,1.3 text_mod.h,1.3,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/saga
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6067
Modified Files:
actor.cpp console.cpp font.cpp font.h font_map.cpp
ihnm_introproc.cpp interface.cpp ite_introproc.cpp
objectmap.cpp render.cpp saga.cpp saga.h sdebug.cpp sprite.cpp
text.cpp
Removed Files:
font_mod.h
Log Message:
Move FONT_* to class.
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/actor.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- actor.cpp 2 Aug 2004 16:20:34 -0000 1.19
+++ actor.cpp 3 Aug 2004 00:06:18 -0000 1.20
@@ -32,7 +32,7 @@
#include "saga/script_mod.h"
#include "saga/sndres.h"
#include "saga/sprite_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/text_mod.h"
#include "saga/sound.h"
Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/console.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- console.cpp 2 Aug 2004 16:20:34 -0000 1.9
+++ console.cpp 3 Aug 2004 00:06:18 -0000 1.10
@@ -25,7 +25,7 @@
#include "saga/saga.h"
#include "saga/gfx.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
@@ -219,8 +219,8 @@
txt_fgcolor = _vm->_gfx->matchColor(R_CONSOLE_TXTCOLOR);
txt_shcolor = _vm->_gfx->matchColor(R_CONSOLE_TXTSHADOW);
- FONT_Draw(SMALL_FONT_ID, ds, ">", 1, 2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
- FONT_Draw(SMALL_FONT_ID, ds, ConInfo.input_buf, strlen(ConInfo.input_buf),
+ _vm->_font->draw(SMALL_FONT_ID, ds, ">", 1, 2, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
+ _vm->_font->draw(SMALL_FONT_ID, ds, ConInfo.input_buf, strlen(ConInfo.input_buf),
10, ConInfo.y_pos - 10, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y = ConInfo.y_pos - (R_CON_INPUT_H + R_CON_LINE_H);
@@ -235,7 +235,7 @@
}
for (walk_ptr = start_ptr; walk_ptr; walk_ptr = walk_ptr->next) {
- FONT_Draw(SMALL_FONT_ID, ds, walk_ptr->str_p, walk_ptr->str_len, 2, line_y, txt_fgcolor, txt_shcolor, FONT_SHADOW);
+ _vm->_font->draw(SMALL_FONT_ID, ds, walk_ptr->str_p, walk_ptr->str_len, 2, line_y, txt_fgcolor, txt_shcolor, FONT_SHADOW);
line_y -= R_CON_LINE_H;
if (line_y < -R_CON_LINE_H)
break;
Index: font.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- font.cpp 2 Aug 2004 16:20:34 -0000 1.13
+++ font.cpp 3 Aug 2004 00:06:18 -0000 1.14
@@ -28,74 +28,61 @@
#include "saga/rscfile_mod.h"
#include "saga/game_mod.h"
-#include "saga/font_mod.h"
#include "saga/font.h"
namespace Saga {
-static R_FONT_MODULE FontModule;
-
-int FONT_Init() {
+Font::Font(SagaEngine *vm) : _vm(vm), _initialized(false) {
R_GAME_FONTDESC *gamefonts;
int i;
- if (FontModule.init) {
- FontModule.err_str = "Font module already initialized.";
- return R_FAILURE;
- }
-
// Load font module resource context
- if (GAME_GetFileContext(&FontModule.font_ctxt,
+ if (GAME_GetFileContext(&_font_ctxt,
R_GAME_RESOURCEFILE, 0) != R_SUCCESS) {
- FontModule.err_str = "Couldn't get resource context.";
- return R_FAILURE;
+ error("Font::Font(): Couldn't get resource context.");
}
// Allocate font table
- GAME_GetFontInfo(&gamefonts, &FontModule.n_fonts);
+ GAME_GetFontInfo(&gamefonts, &_n_fonts);
- assert(FontModule.n_fonts > 0);
+ assert(_n_fonts > 0);
- FontModule.fonts = (R_FONT **)malloc(FontModule.n_fonts * sizeof *FontModule.fonts);
- if (FontModule.fonts == NULL) {
- FontModule.err_str = "Memory allocation failure.";
- return R_MEM;
+ _fonts = (R_FONT **)malloc(_n_fonts * sizeof *_fonts);
+ if (_fonts == NULL) {
+ error("Font::Font(): Memory allocation failure.");
}
- for (i = 0; i < FontModule.n_fonts; i++) {
- FONT_Load(gamefonts[i].font_rn, gamefonts[i].font_id);
+ for (i = 0; i < _n_fonts; i++) {
+ loadFont(gamefonts[i].font_rn, gamefonts[i].font_id);
}
- FontModule.init = 1;
-
- return R_SUCCESS;
+ _initialized = true;
}
-int FONT_Shutdown() {
+Font::~Font(void) {
// int i;
- debug(0, "FONT_Shutdown(): Freeing fonts.");
+ debug(0, "Font::~Font(): Freeing fonts.");
/*
for ( i = 0 ; i < R_FONT_COUNT ; i ++ ) {
- if ( FontModule.fonts[i] != NULL ) {
- if ( FontModule.fonts[i]->normal_loaded ) {
- free( FontModule.fonts[i]->normal->font_free_p );
- free( FontModule.fonts[i]->normal );
+ if ( _fonts[i] != NULL ) {
+ if ( _fonts[i]->normal_loaded ) {
+ free( _fonts[i]->normal->font_free_p );
+ free( _fonts[i]->normal );
}
- if ( FontModule.fonts[i]->outline_loaded ) {
- free( FontModule.fonts[i]->outline->font_free_p );
- free( FontModule.fonts[i]->outline );
+ if ( _fonts[i]->outline_loaded ) {
+ free( _fonts[i]->outline->font_free_p );
+ free( _fonts[i]->outline );
}
}
- free( FontModule.fonts[i] );
+ free( _fonts[i] );
}
*/
- return R_SUCCESS;
}
-int FONT_Load(uint32 font_rn, int font_id) {
+int Font::loadFont(uint32 font_rn, int font_id) {
R_FONT_HEADER fh;
R_FONT *font;
R_FONT_STYLE *normal_font;
@@ -104,18 +91,18 @@
int nbits;
int c;
- if ((font_id < 0) || (font_id >= FontModule.n_fonts)) {
+ if ((font_id < 0) || (font_id >= _n_fonts)) {
return R_FAILURE;
}
// Load font resource
- if (RSC_LoadResource(FontModule.font_ctxt, font_rn, &fontres_p, &fontres_len) != R_SUCCESS) {
- FontModule.err_str = "Couldn't load font resource.";
+ if (RSC_LoadResource(_font_ctxt, font_rn, &fontres_p, &fontres_len) != R_SUCCESS) {
+ error("Font::loadFont(): Couldn't load font resource.");
return R_FAILURE;
}
if (fontres_len < R_FONT_DESCSIZE) {
- FontModule.err_str = "Invalid font length.";
+ error("Font::loadFont(): Invalid font length.");
}
MemoryReadStream readS(fontres_p, fontres_len);
@@ -123,7 +110,7 @@
// Create new font structure
font = (R_FONT *)malloc(sizeof *font);
if (font == NULL) {
- FontModule.err_str = "Memory allocation error.";
+ error("Font:loadFont(): Memory allocation error.");
return R_MEM;
}
@@ -132,7 +119,7 @@
fh.c_width = readS.readUint16LE();
fh.row_length = readS.readUint16LE();
- debug(1, "FONT_Load(): Reading font resource...");
+ debug(1, "Font::loadFont(): Reading font resource...");
debug(2, "Character width:\t%d", fh.c_width);
debug(2, "Character height:\t%d", fh.c_height);
@@ -141,7 +128,7 @@
// Create normal font style
normal_font = (R_FONT_STYLE *)malloc(sizeof *normal_font);
if (normal_font == NULL) {
- FontModule.err_str = "Memory allocation error.";
+ error("Font::loadFont(): Memory allocation error.");
free(font);
return R_MEM;
}
@@ -157,7 +144,7 @@
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
nbits = normal_font->fce[c].width = readS.readByte();
- normal_font->fce[c].byte_width = GetByteLen(nbits);
+ normal_font->fce[c].byte_width = getByteLen(nbits);
}
for (c = 0; c < R_FONT_CHARCOUNT; c++) {
@@ -179,33 +166,33 @@
font->normal_loaded = 1;
// Create outline font style
- font->outline = FONT_CreateOutline(normal_font);
+ font->outline = createOutline(normal_font);
font->outline_loaded = 1;
// Set font data
- FontModule.fonts[font_id] = font;
+ _fonts[font_id] = font;
return R_SUCCESS;
}
-int FONT_GetHeight(int font_id) {
+int Font::getHeight(int font_id) {
R_FONT *font;
- if (!FontModule.init) {
+ if (!_initialized) {
return R_FAILURE;
}
- if ((font_id < 0) || (font_id >= FontModule.n_fonts) || (FontModule.fonts[font_id] == NULL)) {
- FontModule.err_str = "Invalid font id.";
+ if ((font_id < 0) || (font_id >= _n_fonts) || (_fonts[font_id] == NULL)) {
+ error("Font::getHeight(): Invalid font id.");
return R_FAILURE;
}
- font = FontModule.fonts[font_id];
+ font = _fonts[font_id];
return font->normal->hdr.c_height;
}
-static R_FONT_STYLE *FONT_CreateOutline(R_FONT_STYLE *src_font) {
+R_FONT_STYLE *Font::createOutline(R_FONT_STYLE *src_font) {
R_FONT_STYLE *new_font;
unsigned char *new_font_data;
size_t new_font_data_len;
@@ -230,7 +217,7 @@
new_font = (R_FONT_STYLE *)malloc(sizeof *new_font);
if (new_font == NULL) {
- FontModule.err_str = "Memory allocation error.";
+ error("Font::createOutline(): Memory allocation error.");
return NULL;
}
@@ -250,8 +237,8 @@
new_font->fce[i].flag = src_font->fce[i].flag;
if (src_font->fce[i].width != 0) {
- new_byte_width = GetByteLen(src_font->fce[i].width + 2);
- old_byte_width = GetByteLen(src_font->fce[i].width);
+ new_byte_width = getByteLen(src_font->fce[i].width + 2);
+ old_byte_width = getByteLen(src_font->fce[i].width);
if (new_byte_width > old_byte_width) {
index_offset++;
@@ -274,7 +261,7 @@
new_font_data = (unsigned char *)malloc(new_font_data_len);
if (new_font_data == NULL) {
- FontModule.err_str = "Memory allocation error.";
+ error("Font::createOutline(): Memory allocation error.");
return NULL;
}
@@ -335,7 +322,7 @@
return new_font;
}
-static int GetByteLen(int num_bits) {
+int Font::getByteLen(int num_bits) {
int byte_len;
byte_len = num_bits / 8;
@@ -350,23 +337,23 @@
// of at most 'test_str_ct' characters of the string 'test_str', taking
// into account any formatting options specified by 'flags'.
// If 'test_str_ct' is 0, all characters of 'test_str' are counted.
-int FONT_GetStringWidth(int font_id, const char *test_str, size_t test_str_ct, int flags) {
+int Font::getStringWidth(int font_id, const char *test_str, size_t test_str_ct, int flags) {
R_FONT *font;
size_t ct;
int width = 0;
int ch;
const byte *txt_p;
- if (!FontModule.init) {
+ if (!_initialized) {
return R_FAILURE;
}
- if ((font_id < 0) || (font_id >= FontModule.n_fonts) || (FontModule.fonts[font_id] == NULL)) {
- FontModule.err_str = "Invalid font id.";
+ if ((font_id < 0) || (font_id >= _n_fonts) || (_fonts[font_id] == NULL)) {
+ error("Font::getStringWidth(): Invalid font id.");
return R_FAILURE;
}
- font = FontModule.fonts[font_id];
+ font = _fonts[font_id];
assert(font != NULL);
txt_p = (const byte *) test_str;
@@ -374,7 +361,7 @@
for (ct = test_str_ct; *txt_p && (!test_str_ct || ct > 0); txt_p++, ct--) {
ch = *txt_p & 0xFFU;
// Translate character
- ch = CharMap[ch];
+ ch = _charMap[ch];
assert(ch < R_FONT_CHARCOUNT);
width += font->normal->fce[ch].tracking;
}
@@ -386,37 +373,37 @@
return width;
}
-int FONT_Draw(int font_id, R_SURFACE *ds, const char *draw_str, size_t draw_str_ct,
+int Font::draw(int font_id, R_SURFACE *ds, const char *draw_str, size_t draw_str_ct,
int text_x, int text_y, int color, int effect_color, int flags) {
R_FONT *font;
- if (!FontModule.init) {
- FontModule.err_str = "Font Module not initialized.";
+ if (!_initialized) {
+ error("Font::draw(): Font Module not initialized.");
return R_FAILURE;
}
- if ((font_id < 0) || (font_id >= FontModule.n_fonts) || (FontModule.fonts[font_id] == NULL)) {
- FontModule.err_str = "Invalid font id.";
+ if ((font_id < 0) || (font_id >= _n_fonts) || (_fonts[font_id] == NULL)) {
+ error("Font::draw(): Invalid font id.");
return R_FAILURE;
}
- font = FontModule.fonts[font_id];
+ font = _fonts[font_id];
if (flags & FONT_OUTLINE) {
- FONT_Out(font->outline, ds, draw_str, draw_str_ct, text_x - 1, text_y - 1, effect_color);
- FONT_Out(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->outline, ds, draw_str, draw_str_ct, text_x - 1, text_y - 1, effect_color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
} else if (flags & FONT_SHADOW) {
- FONT_Out(font->normal, ds, draw_str, draw_str_ct, text_x - 1, text_y + 1, effect_color);
- FONT_Out(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x - 1, text_y + 1, effect_color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
} else { // FONT_NORMAL
- FONT_Out(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
+ outFont(font->normal, ds, draw_str, draw_str_ct, text_x, text_y, color);
}
return R_SUCCESS;
}
-int FONT_Out(R_FONT_STYLE * draw_font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
+int Font::outFont(R_FONT_STYLE * draw_font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
int text_x, int text_y, int color) {
const byte *draw_str_p;
byte *c_data_ptr;
@@ -449,7 +436,7 @@
c_code = *draw_str_p & 0xFFU;
// Translate character
- c_code = CharMap[c_code];
+ c_code = _charMap[c_code];
assert(c_code < R_FONT_CHARCOUNT);
// Check if character is defined
Index: font.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- font.h 5 May 2004 13:05:30 -0000 1.5
+++ font.h 3 Aug 2004 00:06:18 -0000 1.6
@@ -26,6 +26,8 @@
#ifndef SAGA_FONT_H__
#define SAGA_FONT_H__
+#include "saga/gfx.h"
+
namespace Saga {
#define R_FONT_SHOWUNDEFINED 1 // Define to draw undefined characters * as ?'s
@@ -46,6 +48,20 @@
#define SAGA_FONT_HEADER_LEN 6
+enum FONT_ID {
+ SMALL_FONT_ID,
+ MEDIUM_FONT_ID,
+ BIG_FONT_ID
+};
+
+enum FONT_EFFECT_FLAGS {
+ FONT_NORMAL = 0x00,
+ FONT_OUTLINE = 0x01,
+ FONT_SHADOW = 0x02,
+ FONT_BOLD = 0x04,
+ FONT_CENTERED = 0x08
+};
+
struct R_FONT_HEADER {
int c_height;
int c_width;
@@ -80,23 +96,32 @@
size_t res_len;
};
-struct R_FONT_MODULE {
- int init;
- R_RSCFILE_CONTEXT *font_ctxt;
+class Font {
+ public:
+ Font(SagaEngine *vm);
+ ~Font(void);
+ int draw(int font_id, R_SURFACE *ds, const char *draw_str, size_t draw_str_len,
+ int text_x, int text_y, int color, int effect_color, int flags);
+ int getStringWidth(int font_id, const char *test_str, size_t test_str_ct, int flags);
+ int getHeight(int font_id);
- int n_fonts;
- R_FONT **fonts;
+ private:
- int err_n;
- const char *err_str;
-};
+ int loadFont(uint32 font_rn, int font_id);
+ R_FONT_STYLE *createOutline(R_FONT_STYLE * src_font);
+ int outFont(R_FONT_STYLE *font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
+ int text_x, int text_y, int color);
+ int getByteLen(int num_bits);
-int FONT_Load(uint32 font_rn, int font_id);
-static R_FONT_STYLE *FONT_CreateOutline(R_FONT_STYLE * src_font);
-int FONT_Out(R_FONT_STYLE *font, R_SURFACE * ds, const char *draw_str, size_t draw_str_ct,
- int text_x, int text_y, int color);
-static int GetByteLen(int num_bits);
-extern int CharMap[];
+ static const int _charMap[256];
+ SagaEngine *_vm;
+
+ bool _initialized;
+ R_RSCFILE_CONTEXT *_font_ctxt;
+
+ int _n_fonts;
+ R_FONT **_fonts;
+};
} // End of namespace Saga
Index: font_map.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/font_map.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- font_map.cpp 1 May 2004 08:44:00 -0000 1.2
+++ font_map.cpp 3 Aug 2004 00:06:18 -0000 1.3
@@ -25,9 +25,12 @@
// Translation table derived from http://www.kostis.net/charsets/
+#include "saga/saga.h"
+#include "saga/font.h"
+
namespace Saga {
-int CharMap[] = {
+const int Font::_charMap[256] = {
0, // 0
1, // 1
2, // 2
Index: ihnm_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ihnm_introproc.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ihnm_introproc.cpp 2 Aug 2004 16:20:34 -0000 1.11
+++ ihnm_introproc.cpp 3 Aug 2004 00:06:18 -0000 1.12
@@ -30,7 +30,6 @@
#include "saga/animation.h"
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
-#include "saga/font_mod.h"
#include "saga/rscfile_mod.h"
#include "saga/scene_mod.h"
#include "saga/text_mod.h"
Index: interface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/interface.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- interface.cpp 2 Aug 2004 16:20:34 -0000 1.16
+++ interface.cpp 3 Aug 2004 00:06:18 -0000 1.17
@@ -29,7 +29,7 @@
#include "saga/cvar_mod.h"
#include "saga/actor.h"
#include "saga/console_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/objectmap.h"
#include "saga/rscfile_mod.h"
#include "saga/script_mod.h"
@@ -359,9 +359,9 @@
_vm->_gfx->drawRect(ds, &rect, IfModule.i_desc.status_bgcol);
- string_w = FONT_GetStringWidth(SMALL_FONT_ID, IfModule.status_txt, 0, 0);
+ string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, IfModule.status_txt, 0, 0);
- FONT_Draw(SMALL_FONT_ID, ds, IfModule.status_txt, 0, (IfModule.i_desc.status_w / 2) - (string_w / 2),
+ _vm->_font->draw(SMALL_FONT_ID, ds, IfModule.status_txt, 0, (IfModule.i_desc.status_w / 2) - (string_w / 2),
IfModule.i_desc.status_y + IfModule.i_desc.status_txt_y, IfModule.i_desc.status_txt_col, 0, 0);
return R_SUCCESS;
@@ -448,7 +448,7 @@
verb_idx = IfModule.c_panel.buttons[i].data;
- string_w = FONT_GetStringWidth(SMALL_FONT_ID, I_VerbData[verb_idx].verb_str, 0, 0);
+ string_w = _vm->_font->getStringWidth(SMALL_FONT_ID, I_VerbData[verb_idx].verb_str, 0, 0);
if (i == hit_button) {
color = IfModule.i_desc.cmd_txt_hilitecol;
@@ -459,7 +459,7 @@
button_x = IfModule.c_panel.x + IfModule.c_panel.buttons[i].x1;
button_y = IfModule.c_panel.y + IfModule.c_panel.buttons[i].y1;
- FONT_Draw(SMALL_FONT_ID, ds, I_VerbData[verb_idx].verb_str, 0,
+ _vm->_font->draw(SMALL_FONT_ID, ds, I_VerbData[verb_idx].verb_str, 0,
button_x + ((button_w / 2) - (string_w / 2)), button_y + 1,
color, IfModule.i_desc.cmd_txt_shadowcol, FONT_SHADOW);
Index: ite_introproc.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/ite_introproc.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- ite_introproc.cpp 2 Aug 2004 16:20:34 -0000 1.15
+++ ite_introproc.cpp 3 Aug 2004 00:06:18 -0000 1.16
@@ -31,7 +31,7 @@
#include "saga/animation.h"
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/game_mod.h"
#include "saga/rscfile_mod.h"
#include "saga/scene_mod.h"
Index: objectmap.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/objectmap.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- objectmap.cpp 2 Aug 2004 16:20:34 -0000 1.15
+++ objectmap.cpp 3 Aug 2004 00:06:18 -0000 1.16
@@ -31,7 +31,7 @@
#include "saga/gfx.h"
#include "saga/cvar_mod.h"
#include "saga/console_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/objectmap.h"
namespace Saga {
@@ -339,7 +339,7 @@
}
if (draw_txt) {
- FONT_Draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
+ _vm->_font->draw(SMALL_FONT_ID, ds, txt_buf, 0, 2, 2,
_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
}
Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/render.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- render.cpp 2 Aug 2004 16:20:35 -0000 1.24
+++ render.cpp 3 Aug 2004 00:06:18 -0000 1.25
@@ -28,7 +28,7 @@
#include "saga/actor.h"
#include "saga/console_mod.h"
#include "saga/cvar_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/game_mod.h"
#include "saga/interface_mod.h"
#include "saga/scene_mod.h"
@@ -155,16 +155,16 @@
// Display rendering information
if (_flags & RF_SHOW_FPS) {
sprintf(txt_buf, "%d", _fps);
- fps_width = FONT_GetStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
- FONT_Draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->buf_w - fps_width, 2,
+ fps_width = _vm->_font->getStringWidth(SMALL_FONT_ID, txt_buf, 0, FONT_NORMAL);
+ _vm->_font->draw(SMALL_FONT_ID, backbuf_surface, txt_buf, 0, backbuf_surface->buf_w - fps_width, 2,
_gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
}
// Display "paused game" message, if applicable
if (_flags & RF_RENDERPAUSE) {
int msg_len = strlen(R_PAUSEGAME_MSG);
- int msg_w = FONT_GetStringWidth(BIG_FONT_ID, R_PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
- FONT_Draw(BIG_FONT_ID, backbuf_surface, R_PAUSEGAME_MSG, msg_len,
+ int msg_w = _vm->_font->getStringWidth(BIG_FONT_ID, R_PAUSEGAME_MSG, msg_len, FONT_OUTLINE);
+ _vm->_font->draw(BIG_FONT_ID, backbuf_surface, R_PAUSEGAME_MSG, msg_len,
(backbuf_surface->buf_w - msg_w) / 2, 90, _gfx->getWhite(), _gfx->getBlack(), FONT_OUTLINE);
}
Index: saga.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.cpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- saga.cpp 2 Aug 2004 16:20:35 -0000 1.36
+++ saga.cpp 3 Aug 2004 00:06:18 -0000 1.37
@@ -41,7 +41,7 @@
#include "saga/cvar_mod.h"
#include "saga/events_mod.h"
#include "saga/actionmap.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/game_mod.h"
#include "saga/game.h"
#include "saga/interface_mod.h"
@@ -149,7 +149,7 @@
// Initialize engine modules
_sndRes = new SndRes(this);
EVENT_Init();
- FONT_Init();
+ _font = new Font(this);
SPRITE_Init();
_anim = new Anim(this);
_script = new Script();
@@ -247,7 +247,7 @@
delete _actor;
delete _script;
SPRITE_Shutdown();
- FONT_Shutdown();
+ delete _font;
CON_Shutdown();
CVAR_Shutdown();
EVENT_Shutdown();
Index: saga.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/saga.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- saga.h 2 Aug 2004 15:47:42 -0000 1.26
+++ saga.h 3 Aug 2004 00:06:18 -0000 1.27
@@ -49,6 +49,7 @@
class SData;
class Script;
class Actor;
+class Font;
using Common::MemoryReadStream;
@@ -103,6 +104,7 @@
SData *_sdata;
Script *_script;
Actor *_actor;
+ Font *_font;
private:
int decodeBGImageRLE(const byte *inbuf, size_t inbuf_len, byte *outbuf, size_t outbuf_len);
Index: sdebug.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sdebug.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- sdebug.cpp 2 Aug 2004 16:20:35 -0000 1.11
+++ sdebug.cpp 3 Aug 2004 00:06:18 -0000 1.12
@@ -28,7 +28,7 @@
#include "saga/console_mod.h"
#include "saga/text_mod.h"
#include "saga/scene_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/script.h"
#include "saga/sthread.h"
Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/sprite.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sprite.cpp 2 Aug 2004 16:20:35 -0000 1.13
+++ sprite.cpp 3 Aug 2004 00:06:18 -0000 1.14
@@ -30,7 +30,7 @@
#include "saga/rscfile_mod.h"
#include "saga/text_mod.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/sprite_mod.h"
#include "saga/sprite.h"
Index: text.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/saga/text.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- text.cpp 2 Aug 2004 16:20:35 -0000 1.5
+++ text.cpp 3 Aug 2004 00:06:18 -0000 1.6
@@ -27,7 +27,7 @@
#include "saga/yslib.h"
#include "saga/gfx.h"
-#include "saga/font_mod.h"
+#include "saga/font.h"
#include "saga/text_mod.h"
#include "saga/text.h"
@@ -69,7 +69,7 @@
return R_FAILURE;
}
- string_w = FONT_GetStringWidth(font_id, string, string_len, flags);
+ string_w = _vm->_font->getStringWidth(font_id, string, string_len, flags);
if (text_x < (ds->buf_w / 2)) {
// Fit to right side
@@ -82,12 +82,12 @@
if (fit_w >= string_w) {
// Entire string fits, draw it
text_x = text_x - (string_w / 2);
- FONT_Draw(font_id, ds, string, string_len, text_x, text_y, color, effect_color, flags);
+ _vm->_font->draw(font_id, ds, string, string_len, text_x, text_y, color, effect_color, flags);
return R_SUCCESS;
}
// String won't fit on one line
- h = FONT_GetHeight(font_id);
+ h = _vm->_font->getHeight(font_id);
w_total = 0;
len_total = 0;
wc = 0;
@@ -106,7 +106,7 @@
len = found_p - measure_p;
}
- w = FONT_GetStringWidth(font_id, measure_p, len, flags);
+ w = _vm->_font->getStringWidth(font_id, measure_p, len, flags);
measure_p = found_p;
if ((w_total + w) > fit_w) {
@@ -117,7 +117,7 @@
}
// Wrap what we've got and restart
- FONT_Draw(font_id, ds, start_p, len_total, text_x - (w_total / 2), text_y, color,
+ _vm->_font->draw(font_id, ds, start_p, len_total, text_x - (w_total / 2), text_y, color,
effect_color, flags);
text_y += h + R_TEXT_LINESPACING;
w_total = 0;
@@ -132,7 +132,7 @@
wc++;
if (found_p == NULL) {
// Since word hit NULL but fit, we are done
- FONT_Draw(font_id, ds, start_p, len_total, text_x - (w_total / 2), text_y, color,
+ _vm->_font->draw(font_id, ds, start_p, len_total, text_x - (w_total / 2), text_y, color,
effect_color, flags);
return R_SUCCESS;
}
@@ -141,7 +141,7 @@
}
} else {
// Text is not centered; No formatting required
- FONT_Draw(font_id, ds, string, string_len, text_x, text_y, color, effect_color, flags);
+ _vm->_font->draw(font_id, ds, string, string_len, text_x, text_y, color, effect_color, flags);
}
return R_SUCCESS;
--- font_mod.h DELETED ---
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/scumm string.cpp,1.231,1.232 script.cpp,1.168,1.169
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.20,1.21 events.cpp,1.16,1.17 gfx.h,1.7,1.8 ihnm_introproc.cpp,1.12,1.13 ite_introproc.cpp,1.16,1.17 render.cpp,1.25,1.26 saga.cpp,1.37,1.38 saga.h,1.27,1.28 scene.cpp,1.24,1.25 scene_mod.h,1.6,1.7 script.cpp,1.16,1.17 script.h,1.9,1.10 sdata.cpp,1.12,1.13 sdebug.cpp,1.12,1.13 sfuncs.cpp,1.11,1.12 sprite.cpp,1.14,1.15 sstack.cpp,1.6,1.7 sthread.cpp,1.17,1.18 text.cpp,1.6,1.7 text.h,1.2,1.3 text_mod.h,1.3,NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list