From 84ae6db8938cde4d24a764917972eaef9936472e Mon Sep 17 00:00:00 2001 From: uruk Date: Tue, 3 Sep 2013 17:45:11 +0200 Subject: AVALANCHE: Get rid of Basher. Move everything needed from it to Parser::init(). --- engines/avalanche/avalanche.cpp | 1 + engines/avalanche/basher2.cpp | 169 ---------------------------------------- engines/avalanche/basher2.h | 80 ------------------- engines/avalanche/parser.cpp | 7 ++ engines/avalanche/parser.h | 2 + 5 files changed, 10 insertions(+), 249 deletions(-) delete mode 100644 engines/avalanche/basher2.cpp delete mode 100644 engines/avalanche/basher2.h diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 05c01ef95f..b977aeb3b0 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -109,6 +109,7 @@ Common::ErrorCode AvalancheEngine::initialize() { _lucerna->init(); _acci->init(); _basher->init(); + _parser->init(); return Common::kNoError; } diff --git a/engines/avalanche/basher2.cpp b/engines/avalanche/basher2.cpp deleted file mode 100644 index 6bbf8b290f..0000000000 --- a/engines/avalanche/basher2.cpp +++ /dev/null @@ -1,169 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* BASHER Handles the keyboard. */ - -// Note: this unit can record keystrokes, for the demo. If you want it -// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will -// cause them to be played back. - -#include "avalanche/avalanche.h" - -#include "avalanche/basher2.h" -#include "avalanche/enhanced2.h" -#include "avalanche/lucerna2.h" -#include "avalanche/scrolls2.h" -#include "avalanche/acci2.h" -#include "avalanche/trip6.h" -#include "avalanche/pingo2.h" -#include "avalanche/dropdown2.h" -#include "avalanche/logger2.h" -#include "avalanche/enid2.h" -//#include "Sticks.h" - Responsible for the joystick - -#include "common/textconsole.h" - -namespace Avalanche { - - -Basher::Basher(AvalancheEngine *vm) { - _vm = vm; -} - -void Basher::init() { - /* new(previous);*/ - if (!_vm->_parser->_inputTextBackup.empty()) - _vm->_parser->_inputTextBackup.clear(); - - normal_edit(); - - if (_vm->_gyro->demo) { - if (!_vm->_gyro->demofile.open("demo.avd")) { - warning("AVALANCHE: Basher: File not found: demo.avd"); - throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. - } - } - -// Not sure that the following part will be used ever... -#ifdef RECORD - count = 0; - if (!_vm->_gyro->demofile_save.open("demo.avd")) { - warning("AVALANCHE: Basher: File not found: demo.avd"); - throw "AVALANCHE: Basher: File not found: demo.avd"; // TODO: Some proper exception handling will be needed here. - } -#endif -} - -/*procedure cursor; -begin - if curflash=0 then - begin - if mouse_near_text then Super_Off; - cursoron:=not cursoron; - mem[$A000*13442+curpos]:=not mem[$A000*13442+curpos]; - mem[$A000*pagetop+13442+curpos]:=not mem[$A000*pagetop+13442+curpos]; - curflash:=17; - Super_On; - end else dec(curflash); -end;*/ - -void Basher::get_demorec() { - warning("STUB: Basher::get_demorec()"); -} - -#ifdef RECORD -void Basher::record_one() { - warning("STUB: Basher::record_one()"); -} -#endif -/* -procedure storeline(whatwhat:string); -var - fv:byte; - what:string[77]; - ok:boolean; - - function upline(x:string):string; - var fv:byte; n:string[77]; - begin - for fv:=1 to length(x) do n[fv]:=upcase(x[fv]); - n[0]:=x[0]; upline:=n; - end; -begin - - what:=upline(whatwhat); ok:=false; - for fv:=1 to 20 do - if what=upline(previous^[fv]) then - begin { it already exists, in string "fv" } - move(previous^[fv+1],previous^[fv],(20-fv)*78); - previous^[20]:=whatwhat; ok:=true; - end; - if ok then exit; - { it's not on the list, so add it } - move(previous^[2],previous^[1],1482); { shove up } - previous^[20]:=whatwhat; -end; -*/ - - -char Basher::firstchar(Common::String x) { - warning("STUB: Basher::firstchar()"); - return 'S'; -} - - - - -void Basher::typein() { - warning("STUB: Basher::typein()"); -} - -/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end; - '': begin setvisualpage(0); write(#7); inkey; end;*/ - -void Basher::keyboard_link() { - warning("STUB: Basher::keyboard_link()"); -} - -bool Basher::demo_ready() { - warning("STUB: Basher::demo_ready()"); - return true; -} - -void Basher::filename_edit() { - warning("STUB: Basher::filename_edit()"); -} - -void Basher::normal_edit() { - entering_filename = false; - _vm->_parser->_leftMargin = 0; - if (!_vm->_parser->_inputText.empty()) - _vm->_parser->_inputText.clear(); - _vm->_parser->_inputTextPos = 0; -} - -} // End of namespace Avalanche. diff --git a/engines/avalanche/basher2.h b/engines/avalanche/basher2.h deleted file mode 100644 index f4a78f4d42..0000000000 --- a/engines/avalanche/basher2.h +++ /dev/null @@ -1,80 +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 the original source code of Lord Avalot d'Argent version 1.3. - * Copyright (c) 1994-1995 Mike, Mark and Thomas Thurman. - */ - -/* BASHER Handles the keyboard. */ - -// Note: this unit can record keystrokes, for the demo. If you want it -// to do this, define the o.c.c. RECORD. Setting gyro.demo to True will -// cause them to be played back. - -// TODO: Replace these functions gradually with ScummVM's own methods. - -#ifndef BASHER2_H -#define BASHER2_H - -#include "common/scummsys.h" - -namespace Avalanche { -class AvalancheEngine; - -class Basher { -public: - uint16 count; - - - - Basher(AvalancheEngine *vm); - - void init(); - - void keyboard_link(); - - void get_demorec(); - - bool demo_ready(); - - void filename_edit(); - - void normal_edit(); - -#ifdef RECORD - void record_one(); -#endif - -private: - AvalancheEngine *_vm; - - bool entering_filename; - - char firstchar(Common::String x); - - void typein(); -}; - -} // End of namespace Avalanche. - -#endif // BASHER2_H diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 615f4a4d54..2457354e17 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -34,6 +34,13 @@ Parser::Parser(AvalancheEngine *vm) { _vm = vm; } +void Parser::init() { + _leftMargin = 0; + if (!_inputText.empty()) + _inputText.clear(); + _inputTextPos = 0; +} + void Parser::handleInputText(const Common::Event &event) { byte inChar = event.kbd.ascii; if (_vm->_dropdown->ddm_o.menunow) { diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index da2b761417..e16df6d3bc 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -46,6 +46,8 @@ public: Parser(AvalancheEngine *vm); + void init(); + void handleInputText(const Common::Event &event); void handleBackspace(); -- cgit v1.2.3