aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche/basher.cpp
diff options
context:
space:
mode:
authoruruk2013-06-21 14:08:10 +0200
committeruruk2013-06-21 14:08:10 +0200
commitaeff42074ade0ab29e8130a6b92ffe73f94070b7 (patch)
tree5b1375688b87a8bab54047d121bb3bfc1fc88c6c /engines/avalanche/basher.cpp
parent1ce5e3bc3ff9082e057475bb5cfbc15a212f43eb (diff)
downloadscummvm-rg350-aeff42074ade0ab29e8130a6b92ffe73f94070b7.tar.gz
scummvm-rg350-aeff42074ade0ab29e8130a6b92ffe73f94070b7.tar.bz2
scummvm-rg350-aeff42074ade0ab29e8130a6b92ffe73f94070b7.zip
AVALANCHE: Reorganise source files.
Diffstat (limited to 'engines/avalanche/basher.cpp')
-rw-r--r--engines/avalanche/basher.cpp502
1 files changed, 0 insertions, 502 deletions
diff --git a/engines/avalanche/basher.cpp b/engines/avalanche/basher.cpp
deleted file mode 100644
index dcab52540e..0000000000
--- a/engines/avalanche/basher.cpp
+++ /dev/null
@@ -1,502 +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. */
-
-#define __basher_implementation__
-
-
-/* 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 "basher.h"
-
-
-#include "enhanced.h"
-#include "lucerna.h"
-#include "Graph.h"
-#include "scrolls.h"
-#include "acci.h"
-#include "trip5.h"
-#include "pingo.h"
-#include "dropdown.h"
-#include "logger.h"
-#include "Sticks.h"
-#include "enid.h"
-
-namespace Avalanche {
-
-boolean entering_filename;
-byte left_margin;
-
-void plottext() {
- const array<0, 2, byte> p = {{0, 1, 3}};
- byte x, y, n;
-
- x = 0;
- if (mouse_near_text()) super_off();
- cursor_off();
- for (n = 0; n <= 2; n ++)
- for (y = 0; y <= 7; y ++) {
- for (x = 1; x <= length(current); x ++)
- mem[0xa000 * p[n]*pagetop + 12882 + y * 80 + x] = little[current[x]][y];
- fillchar(mem[0xa000 * p[n]*pagetop + 12883 + y * 80 + x], 77 - x, '\0');
- }
- cursor_on();
- super_on();
-}
-
-void wipetext() {
- const array<0, 2, byte> n = {{0, 1, 3}};
- byte y, p;
-
- if (mouse_near_text()) super_off();
- cursor_off();
- for (y = 0; y <= 7; y ++)
- for (p = 0; p <= 2; p ++)
- fillchar(mem[0xa000 * n[p]*pagetop + 12883 + y * 80], 77, '\0');
- quote = true;
- curpos = 1;
- cursor_on();
- super_on();
-}
-
-/*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 do_cursor() {
- bytefield bf;
- byte fv;
-
- mem[0xac00 * 13442 + curpos] = ~ mem[0xac00 * 13442 + curpos];
- {
- bf.x1 = curpos + 1;
- bf.x2 = curpos + 2;
- bf.y1 = 168;
- bf.y2 = 168;
- }
- for (fv = 0; fv <= 1; fv ++) getset[fv].remember(bf);
-}
-
-void cursor_on() {
- if (cursoron) return;
- do_cursor();
- cursoron = true;
-}
-
-void cursor_off() {
- if (! cursoron) return;
- do_cursor();
- cursoron = false;
-}
-
-
-void get_demorec() {
- demofile >> demo_rec;
- inchar = demo_rec.key;
- extd = demo_rec.extd;
- demo_rec.delay -= 1;
-}
-
-#ifdef RECORD
-void record_one() {
- demo_rec.delay = count;
- demo_rec.key = inchar;
- demo_rec.extd = extd;
-
- demofile << demo_rec;
- count = 0;
-}
-#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;
-*/
-void typein();
-
-static char firstchar(string x) {
- char firstchar_result;
- firstchar_result = x[1];
- return firstchar_result;
-}
-
-
-static void try_dd() { /* This asks the Parsekey proc in Dropdown if it knows it. */
- parsekey(inchar, extd);
-}
-
-void typein() {
- byte w;
-
- inkey();
-#ifdef RECORD record_one(); #endif
-
- switch (inchar) {
- case RANGE_15('\40', '\56'):
- case '\60' ... '\337':
- case '\341' ... '\377':
- if (ddm_o.menunow) {
- parsekey(inchar, extd);
- } else {
- if (length(current) < 76) {
- if ((inchar == '"') || (inchar == '`')) {
- if (quote) inchar = '`';
- else inchar = '"';
- quote = ! quote; /* Quote- Unquote... */
- }
- insert(inchar, current, curpos);
- curpos += 1;
- plottext();
- } else blip();
- }
- break;
- case '\10':
- if (! ddm_o.menunow) {
- if (curpos > left_margin) {
- curpos -= 1;
- if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote;
- Delete(current, curpos, 1);
- plottext();
- } else blip();
- }
- break;
- case '\0':
- case '\340': {
- switch (extd) {
- /* Function keys: */
- case cf1:
- callverb(vb_help);
- break; /* f1 - help (obviously) */
- case cf2:
- fxtoggle();
- break; /* f2 - sound */
- case ccf2:
- case cf11: {
- clearwords();
- callverb(vb_save);
- }
- break; /* ^f2 - save */
- case cf3:
- if (length(current) < length(/*previous^[20]*/last)) { /* f3 - rec last */
- current = current + copy(/*previous^[20]*/last, length(current) + 1, 255);
- curpos = length(current) + 1;
- plottext();
- }
- break;
- case ccf3:
- case cf12: {
- clearwords();
- callverb(vb_load);
- }
- break; /* ^f3 - load */
- case cf4:
- callverb(vb_restart);
- break; /* f4 - restart game */
- case cf5: {
- person = pardon;
- thing = pardon;
- callverb(firstchar(f5_does())); /* f5 - get up/ whatever */
- }
- break;
- case cf6:
- callverb(vb_pause);
- break; /* f6 - pause */
- case cf7:
- callverb(vb_open);
- break; /* f7 - open door */
- case cf8:
- callverb(vb_look);
- break; /* f8 - look */
- case cf9:
- callverb(vb_score);
- break; /* f9 - score */
- case ccf7:
- major_redraw();
- break; /* ^f7 - open door */
- case cf10:
- case c_ax:
- case caf4: {
-#ifdef RECORD
- display("Hi. You have just finished recording. GIED.");
- close(demofile);
- exit(0);
-#endif
- callverb(vb_quit); /* f10, alt-X, alt-f4 - quit */
- }
- break;
- case ccf5:
- back_to_bootstrap(2);
- break; /* ^f5 - Dos shell. */
- case csf10:
- callverb(vb_info);
- break; /* sf10 - version */
-
- case c_ab:
- callverb(vb_boss);
- break; /* alt-B */
- case c_ad:
- display("Wrong game!");
- break; /* alt-D */
- case ccleft:
- if (curpos > left_margin) {
- cursor_off();
- curpos -= 1;
- cursor_on();
- }
- break; /* ^left */
- case ccright:
- if (curpos <= length(current)) { /* ^right */
- cursor_off();
- curpos += 1;
- cursor_on();
- }
- break;
- case cchome: {
- cursor_off();
- curpos = 1;
- cursor_on();
- }
- break; /* ^home */
- case ccend: {
- cursor_off();
- curpos = length(current) + 1;
- cursor_on();
- }
- break; /* ^end */
- case c_ar:
- oh = 177;
- break; /* alt-R = repeater (re-chime) */
- case cup:
- case cdown:
- case cleft:
- case cright:
- case cpgup:
- case cpgdn:
- case chome:
- case cend:
- if (ddm_o.menunow) try_dd();
- else tripkey(extd);
- break; /* Up/Down/Left/Right/PgUp/PgDn */
- case cnum5:
- tripkey(extd);
- break; /* Numeric 5 */
- case cdel:
- if (! ddm_o.menunow) {
- if (curpos <= length(current)) {
- if (set::of('"', '`', eos).has(current[curpos])) quote = ! quote;
- Delete(current, curpos, 1);
- plottext();
- } else blip();
- }
- break;
- default:
- try_dd();
- }
- }
- break;
- case cescape:
- case '/':
- if (ddm_o.menunow) { /* Escape */
- ddm_o.wipe();
- } else if (entering_filename) {
- normal_edit();
- wipetext();
- } else
- ddm_m.getcertain(ddm_o.menunum);
- break;
- case creturn:
- if (ddm_o.menunow) try_dd(); /* Return */
- else {
- log_command(current);
- if (entering_filename) {
- edna_save(copy(current, 24, 255));
- normal_edit();
- wipetext();
- } else {
- if (current != "") last = current;
- parse();
- do_that();
- if (! entering_filename) {
- current = "";
- wipetext();
- }
- }
- }
- break;
- case '\11':
- callverb(vb_inv);
- break; /* Ctrl-I= inventory */
- case '\7':
- errorled();
- break;
- case '\25': {
- current = "";
- wipetext();
- }
- break;
-
- case '\27': {
- tr[1].xs = walk;
- newspeed();
- }
- break;
- case '\22': {
- tr[1].xs = run;
- newspeed();
- }
- break;
-
- case '\2':
- bosskey();
- break;
- case '\12':
- ctrl = cjoy;
- break; /* Joystick */
- case '\13':
- ctrl = ckey;
- break; /* Keyboard */
- case '\3':
- callverb(vb_quit);
- break; /* Ctrl-C= request to quit */
-
- }
- showrw();
-
- if (demo) get_demorec();
-}
-
-/* 'x'..'z': begin setvisualpage(ord(extd)-63); write(#7); inkey; end;
- '': begin setvisualpage(0); write(#7); inkey; end;*/
-
-void keyboard_link() {
- state(defaultled); /* if defaultled=1 then on; { For the menus }*/
- joykeys(); /* Test joystick buttons- I know that's not keyboard. */
-
- if (demo) {
- if (keypressede()) exit(0);
- if (demo_rec.delay > 0)
- demo_rec.delay -= 1;
- else typein();
- return;
- }
-
-#ifdef RECORD count += 1; #endif
-
- if (! keypressede()) return;
- if (keyboardclick) click();
- typein();
-}
-
-boolean demo_ready() {
- boolean demo_ready_result;
- if (demo_rec.delay > 0) {
- slowdown();
- demo_rec.delay -= 1;
- }
- demo_ready_result = demo_rec.delay == 0;
- return demo_ready_result;
-}
-
-void filename_edit() {
- entering_filename = true;
- current = "Filename\? (Esc=cancel):";
- left_margin = 24;
- curpos = 24;
- plottext();
-}
-
-void normal_edit() {
- entering_filename = false;
- current = "";
- left_margin = 1;
- curpos = 1;
-}
-
-class unit_basher_initialize {
-public:
- unit_basher_initialize();
-};
-static unit_basher_initialize basher_constructor;
-
-unit_basher_initialize::unit_basher_initialize() {
- /* new(previous);*/ last = "";
- normal_edit();
-
- if (demo) {
- assign(demofile, "demo.avd");
- reset(demofile);
- }
-
-#ifdef RECORD
- count = 0;
- assign(demofile, "demo.avd");
- rewrite(demofile);
-#endif
-
-}
-
-} // End of namespace Avalanche. \ No newline at end of file