From 57b9a31ac2b027dc4ddf41ad05c85bae808d4537 Mon Sep 17 00:00:00 2001 From: uruk Date: Mon, 19 May 2014 16:32:53 +0200 Subject: CGE2: Add stubbed Font and Talk. All to further implement caveUp(). --- engines/cge2/cge2.cpp | 3 ++ engines/cge2/cge2.h | 16 +++++++++ engines/cge2/cge2_main.cpp | 1 + engines/cge2/cge2_main.h | 1 + engines/cge2/module.mk | 3 +- engines/cge2/talk.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++++++ engines/cge2/talk.h | 78 ++++++++++++++++++++++++++++++++++++++++ engines/cge2/text.h | 2 +- 8 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 engines/cge2/talk.cpp create mode 100644 engines/cge2/talk.h diff --git a/engines/cge2/cge2.cpp b/engines/cge2/cge2.cpp index 7bb861dd1d..54d3ee4c02 100644 --- a/engines/cge2/cge2.cpp +++ b/engines/cge2/cge2.cpp @@ -54,6 +54,7 @@ CGE2Engine::CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription) _eyeTab[i] = nullptr; _spare = nullptr; _commandHandler = nullptr; + _infoLine = nullptr; _quitFlag = false; _bitmapPalette = nullptr; @@ -79,6 +80,7 @@ void CGE2Engine::init() { _eyeTab[i] = new V3D(); _spare = new Spare(this); _commandHandler = new CommandHandler(this, false); + _infoLine = new InfoLine(this, kInfoW); } void CGE2Engine::deinit() { @@ -100,6 +102,7 @@ void CGE2Engine::deinit() { delete _eye; delete _spare; delete _commandHandler; + delete _infoLine; } bool CGE2Engine::hasFeature(EngineFeature f) const { diff --git a/engines/cge2/cge2.h b/engines/cge2/cge2.h index 4b505cb5cb..59eef76989 100644 --- a/engines/cge2/cge2.h +++ b/engines/cge2/cge2.h @@ -48,6 +48,7 @@ class V2D; class Dac; class Spare; class CommandHandler; +class InfoLine; #define kScrWidth 320 #define kScrHeight 240 @@ -65,6 +66,20 @@ enum CallbackType { kNullCB = 0, kQGame, kMiniStep, kXScene, kSoundSetVolume }; +class Font { + char _path[kPathMax]; + void load(); + CGE2Engine *_vm; +public: + uint8 *_widthArr; + uint16 *_pos; + uint8 *_map; + Font(CGE2Engine *vm, const char *name); + ~Font(); + uint16 width(const char *text); + void save(); +}; + class CGE2Engine : public Engine { public: CGE2Engine(OSystem *syst, const ADGameDescription *gameDescription); @@ -127,6 +142,7 @@ public: V3D *_eyeTab[kCaveMax]; Spare *_spare; CommandHandler *_commandHandler; + InfoLine *_infoLine; private: void init(); void deinit(); diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp index 1ce8ea42d1..2a979a02f7 100644 --- a/engines/cge2/cge2_main.cpp +++ b/engines/cge2/cge2_main.cpp @@ -347,6 +347,7 @@ void CGE2Engine::caveUp(int cav) { _fx->clear(); selectPocket(-1); + _infoLine->setText(nullptr); _vga->update(); diff --git a/engines/cge2/cge2_main.h b/engines/cge2/cge2_main.h index ee622dc9ca..9e9dca0ba2 100644 --- a/engines/cge2/cge2_main.h +++ b/engines/cge2/cge2_main.h @@ -34,6 +34,7 @@ namespace CGE2 { #define kIntroExt ".I80" #define kNoByte -1 #define kTabName "CGE.TAB" +#define kInfoW 140 } // End of namespace CGE2 diff --git a/engines/cge2/module.mk b/engines/cge2/module.mk index 60b7db519c..4347dba315 100644 --- a/engines/cge2/module.mk +++ b/engines/cge2/module.mk @@ -11,7 +11,8 @@ MODULE_OBJS = \ text.o \ hero.o \ snail.o \ - spare.o + spare.o \ + talk.o # This module can be built as a plugin ifeq ($(ENABLE_CGE2), DYNAMIC_PLUGIN) diff --git a/engines/cge2/talk.cpp b/engines/cge2/talk.cpp new file mode 100644 index 0000000000..2913327320 --- /dev/null +++ b/engines/cge2/talk.cpp @@ -0,0 +1,88 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Sfinx source code + * Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon + */ + +#include "cge2/general.h" +#include "cge2/talk.h" +//#include "cge2/game.h" +//#include "cge2/events.h" +#include "cge2/cge2_main.h" + +namespace CGE2 { + +Font::Font(CGE2Engine *vm, const char *name) : _vm(vm) { + warning("STUB: Font::Font()"); +} + +Font::~Font() { + warning("STUB: Font::~Font()"); +} + +void Font::load() { + warning("STUB: Font::load()"); +} + +uint16 Font::width(const char *text) { + warning("STUB: Font::width()"); + return 0; +} + +Talk::Talk(CGE2Engine *vm, const char *text, TextBoxStyle mode, bool wideSpace) + : Sprite(vm), _mode(mode), _wideSpace(wideSpace), _vm(vm) { + warning("STUB: Talk::Talk()"); +} + +Talk::Talk(CGE2Engine *vm) + : Sprite(vm), _mode(kTBPure), _vm(vm) { + warning("STUB: Talk::Talk()"); +} + +void Talk::update(const char *text) { + warning("STUB: Talk::update()"); +} + +Bitmap *Talk::box(uint16 w, uint16 h) { + warning("STUB: Talk::box()"); + return *_ts; +} + +InfoLine::InfoLine(CGE2Engine *vm, uint16 w) : Talk(vm), _oldText(NULL), _vm(vm) { + warning("STUB: InfoLine::InfoLine()"); +} + +void InfoLine::update(const char *text) { + warning("STUB: InfoLine::update()"); +} + +void InfoLine::update() { + warning("STUB: InfoLine::update()"); +} + +void InfoLine::setText(const char *txt) { + warning("STUB: InfoLine::setText()"); +} + +} // End of namespace CGE2 diff --git a/engines/cge2/talk.h b/engines/cge2/talk.h new file mode 100644 index 0000000000..2d4c235d9d --- /dev/null +++ b/engines/cge2/talk.h @@ -0,0 +1,78 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +/* + * This code is based on original Sfinx source code + * Copyright (c) 1994-1997 Janus B. Wisniewski and L.K. Avalon + */ + +#ifndef CGE2_TALK_H +#define CGE2_TALK_H + +#include "cge2/general.h" +#include "cge2/vga13h.h" + +namespace CGE2 { + +#define kTextColFG kVgaColDark // foreground color +#define kTextColBG kVgaColGray // background color +#define kTextHMargin (6&~1) // EVEN horizontal margins! +#define kTextVMargin 5 // vertical margins +#define kTextLineSpace 2 // line spacing +#define kTextRoundCorner 3 // rounded corners +#define kWidSize 256 +#define kPosSize 256 +#define kMapSize (256*8) +#define kFontHigh 8 +#define kFontExt ".CFT" + +enum TextBoxStyle { kTBPure, kTBRect, kTBRound }; + +class Talk : public Sprite { +protected: + TextBoxStyle _mode; + BitmapPtr *_ts; + Bitmap *box(uint16 w, uint16 h); + bool _wideSpace; +public: + Talk(CGE2Engine *vm, const char *text, TextBoxStyle mode, bool wideSpace = false); + Talk(CGE2Engine *vm); + + virtual void update(const char *text); +private: + CGE2Engine *_vm; +}; + +class InfoLine : public Talk { + const char *_oldText; +public: + InfoLine(CGE2Engine *vm, uint16 wid); + void update(const char *text); + void update(); + void setText(const char *txt); +private: + CGE2Engine *_vm; +}; + +} // End of namespace CGE2 + +#endif // CGE2_TALK_H diff --git a/engines/cge2/text.h b/engines/cge2/text.h index 634a3c8766..bca774357a 100644 --- a/engines/cge2/text.h +++ b/engines/cge2/text.h @@ -28,7 +28,7 @@ #ifndef CGE2_TEXT_H #define CGE2_TEXT_H -//#include "cge/talk.h" +#include "cge2/talk.h" #include "cge2/cge2.h" namespace CGE2 { -- cgit v1.2.3