aboutsummaryrefslogtreecommitdiff
path: root/engines/cge
diff options
context:
space:
mode:
Diffstat (limited to 'engines/cge')
-rw-r--r--engines/cge/cge_main.cpp1
-rw-r--r--engines/cge/fileio.h4
-rw-r--r--engines/cge/gettext.cpp119
-rw-r--r--engines/cge/gettext.h61
-rw-r--r--engines/cge/module.mk1
-rw-r--r--engines/cge/talk.cpp85
-rw-r--r--engines/cge/talk.h29
7 files changed, 112 insertions, 188 deletions
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index cf3e5223b4..2d83dce040 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -43,7 +43,6 @@
#include "cge/events.h"
#include "cge/talk.h"
#include "cge/vmenu.h"
-#include "cge/gettext.h"
#include "cge/cge_main.h"
#include "cge/cge.h"
#include "cge/walk.h"
diff --git a/engines/cge/fileio.h b/engines/cge/fileio.h
index a8577207bd..7cb5ce07e0 100644
--- a/engines/cge/fileio.h
+++ b/engines/cge/fileio.h
@@ -25,8 +25,8 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
-#ifndef __CGE_BTFILE__
-#define __CGE_BTFILE__
+#ifndef __CGE_FILEIO__
+#define __CGE_FILEIO__
#include "cge/general.h"
#include "common/stream.h"
diff --git a/engines/cge/gettext.cpp b/engines/cge/gettext.cpp
deleted file mode 100644
index 46dacbe1de..0000000000
--- a/engines/cge/gettext.cpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/* 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 Soltys source code
- * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
- */
-
-#include "cge/gettext.h"
-#include "cge/events.h"
-#include "cge/cge_main.h"
-
-namespace CGE {
-
-GetText *GetText::_ptr = NULL;
-
-GetText::GetText(CGEEngine *vm, const char *info, char *text, int size)
- : Talk(vm), _text(text), _size(min<int>(size, kGetTextMax)), _len(min<int>(_size, strlen(text))),
- _cntr(kGetTextBlink), _oldKeybClient(_keyboard->setClient(this)), _vm(vm) {
- _ptr = this;
- _mode = kTBRect;
-
- _ts = new BitmapPtr[2];
- const int i = 2 * kTextHMargin + _font->width(info);
- _ts[0] = box((i + 3) & ~3, 2 * kTextVMargin + 2 * kFontHigh + kTextLineSpace);
- _ts[1] = NULL;
- setShapeList(_ts);
-
- _flags._bDel = true;
- _flags._kill = true;
- memcpy(_buff, text, _len);
- _buff[_len] = ' ';
- _buff[_len + 1] = '\0';
- putLine(0, info);
- tick();
-}
-
-GetText::~GetText() {
- _keyboard->setClient(_oldKeybClient);
- _ptr = NULL;
-}
-
-void GetText::tick() {
- if (++_cntr >= kGetTextBlink) {
- _buff[_len] ^= (' ' ^ '_');
- _cntr = 0;
- }
- putLine(1, _buff);
- _time = kGetTextTime;
-}
-
-void GetText::touch(uint16 mask, int x, int y) {
- static char ogon[] = "";
- static char bezo[] = "ACELNOSXZ";
- char *p;
-
- if (mask & kEventKeyb) {
- _vm->keyClick();
- switch (x) {
- case Enter:
- _buff[_len] = '\0';
- strcpy(_text, _buff);
- for (p = _text; *p; p++) {
- char *q = strchr(ogon, *p);
- if (q)
- *p = bezo[q - ogon];
- }
- case Esc:
- _snail_->addCom(kSnKill, -1, 0, this);
- break;
- case BSp:
- if (_len) {
- _len--;
- _buff[_len] = _buff[_len + 1];
- _buff[_len + 1] = _buff[_len + 2];
- }
- break;
- default:
- if (x < 'A' || x > 'Z') {
- if (_oldKeybClient)
- _oldKeybClient->touch(mask, x, y);
- } else {
- if (_keyboard->_key[kKeyAlt]) {
- p = strchr(bezo, x);
- if (p)
- x = ogon[p - bezo];
- }
- if (_len < _size && 2 * kTextHMargin + _font->width(_buff) + _font->_wid[x] <= _w) {
- _buff[_len + 2] = _buff[_len + 1];
- _buff[_len + 1] = _buff[_len];
- _buff[_len++] = x;
- }
- }
- break;
- }
- } else
- Sprite::touch(mask, x, y);
-}
-
-} // End of namespace CGE
diff --git a/engines/cge/gettext.h b/engines/cge/gettext.h
deleted file mode 100644
index 6afa9ccfec..0000000000
--- a/engines/cge/gettext.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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 Soltys source code
- * Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
- */
-
-#ifndef __CGE_GETTEXT__
-#define __CGE_GETTEXT__
-
-#include "cge/general.h"
-#include "cge/talk.h"
-
-namespace CGE {
-
-#define kGetTextMax 24
-#define kGetTextBlink 6
-#define kGetTextTime 6
-
-class GetText : public Talk {
- char _buff[kGetTextMax + 2];
- char *_text;
- uint16 _size;
- uint16 _len;
- uint16 _cntr;
- Sprite *_oldKeybClient;
-
-public:
- static GetText *_ptr;
- GetText(CGEEngine *vm, const char *info, char *text, int size);
- ~GetText();
- void touch(uint16 mask, int x, int y);
- void tick();
-
-private:
- CGEEngine *_vm;
-};
-
-} // End of namespace CGE
-
-#endif
diff --git a/engines/cge/module.mk b/engines/cge/module.mk
index 6d34cdfd14..62b319e190 100644
--- a/engines/cge/module.mk
+++ b/engines/cge/module.mk
@@ -10,7 +10,6 @@ MODULE_OBJS := \
fileio.o \
game.o \
general.o \
- gettext.o \
snail.o \
sound.o \
talk.o \
diff --git a/engines/cge/talk.cpp b/engines/cge/talk.cpp
index 5e8aa1b869..58c68339bb 100644
--- a/engines/cge/talk.cpp
+++ b/engines/cge/talk.cpp
@@ -29,6 +29,7 @@
#include "cge/talk.h"
#include "cge/game.h"
#include "cge/events.h"
+#include "cge/cge_main.h"
namespace CGE {
@@ -301,4 +302,88 @@ void InfoLine::update(const char *text) {
_oldText = text;
}
+GetText *GetText::_ptr = NULL;
+
+GetText::GetText(CGEEngine *vm, const char *info, char *text, int size)
+ : Talk(vm), _text(text), _size(min<int>(size, kGetTextMax)), _len(min<int>(_size, strlen(text))),
+ _cntr(kGetTextBlink), _oldKeybClient(_keyboard->setClient(this)), _vm(vm) {
+ _ptr = this;
+ _mode = kTBRect;
+
+ _ts = new BitmapPtr[2];
+ const int i = 2 * kTextHMargin + _font->width(info);
+ _ts[0] = box((i + 3) & ~3, 2 * kTextVMargin + 2 * kFontHigh + kTextLineSpace);
+ _ts[1] = NULL;
+ setShapeList(_ts);
+
+ _flags._bDel = true;
+ _flags._kill = true;
+ memcpy(_buff, text, _len);
+ _buff[_len] = ' ';
+ _buff[_len + 1] = '\0';
+ putLine(0, info);
+ tick();
+}
+
+GetText::~GetText() {
+ _keyboard->setClient(_oldKeybClient);
+ _ptr = NULL;
+}
+
+void GetText::tick() {
+ if (++_cntr >= kGetTextBlink) {
+ _buff[_len] ^= (' ' ^ '_');
+ _cntr = 0;
+ }
+ putLine(1, _buff);
+ _time = kGetTextTime;
+}
+
+void GetText::touch(uint16 mask, int x, int y) {
+ static char ogon[] = "";
+ static char bezo[] = "ACELNOSXZ";
+ char *p;
+
+ if (mask & kEventKeyb) {
+ _vm->keyClick();
+ switch (x) {
+ case Enter:
+ _buff[_len] = '\0';
+ strcpy(_text, _buff);
+ for (p = _text; *p; p++) {
+ char *q = strchr(ogon, *p);
+ if (q)
+ *p = bezo[q - ogon];
+ }
+ case Esc:
+ _snail_->addCom(kSnKill, -1, 0, this);
+ break;
+ case BSp:
+ if (_len) {
+ _len--;
+ _buff[_len] = _buff[_len + 1];
+ _buff[_len + 1] = _buff[_len + 2];
+ }
+ break;
+ default:
+ if (x < 'A' || x > 'Z') {
+ if (_oldKeybClient)
+ _oldKeybClient->touch(mask, x, y);
+ } else {
+ if (_keyboard->_key[kKeyAlt]) {
+ p = strchr(bezo, x);
+ if (p)
+ x = ogon[p - bezo];
+ }
+ if (_len < _size && 2 * kTextHMargin + _font->width(_buff) + _font->_wid[x] <= _w) {
+ _buff[_len + 2] = _buff[_len + 1];
+ _buff[_len + 1] = _buff[_len];
+ _buff[_len++] = x;
+ }
+ }
+ break;
+ }
+ } else
+ Sprite::touch(mask, x, y);
+}
} // End of namespace CGE
diff --git a/engines/cge/talk.h b/engines/cge/talk.h
index 9a999e5e8e..5bb4aa2052 100644
--- a/engines/cge/talk.h
+++ b/engines/cge/talk.h
@@ -28,9 +28,9 @@
#ifndef __CGE_TALK__
#define __CGE_TALK__
-#include "cge/vga13h.h"
#include "cge/general.h"
#include "cge/jbw.h"
+#include "cge/vga13h.h"
namespace CGE {
@@ -43,10 +43,12 @@ namespace CGE {
#define kWidSize 256
#define kPosSize 256
#define kMapSize (256*8)
-
-#define kFontHigh 8
-#define kFontExt ".CFT"
+#define kFontHigh 8
+#define kFontExt ".CFT"
#define kPathMax 128
+#define kGetTextMax 24
+#define kGetTextBlink 6
+#define kGetTextTime 6
enum TextBoxStyle { kTBPure, kTBRect, kTBRound };
@@ -93,6 +95,25 @@ private:
CGEEngine *_vm;
};
+class GetText : public Talk {
+ char _buff[kGetTextMax + 2];
+ char *_text;
+ uint16 _size;
+ uint16 _len;
+ uint16 _cntr;
+ Sprite *_oldKeybClient;
+
+public:
+ static GetText *_ptr;
+ GetText(CGEEngine *vm, const char *info, char *text, int size);
+ ~GetText();
+ void touch(uint16 mask, int x, int y);
+ void tick();
+
+private:
+ CGEEngine *_vm;
+};
+
} // End of namespace CGE
#endif