2013-06-25 18:03:46 +02:00
/* 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 .
*/
2013-06-28 18:29:59 +02:00
/* LUCERNA The screen, [keyboard] and mouse handler.*/
# include "avalanche/avalanche.h"
2013-06-25 18:03:46 +02:00
# include "avalanche/lucerna2.h"
# include "avalanche/gyro2.h"
# include "avalanche/scrolls2.h"
# include "avalanche/logger2.h"
# include "avalanche/enhanced2.h"
2013-06-28 18:29:59 +02:00
# include "avalanche/visa2.h"
# include "avalanche/timeout2.h"
# include "avalanche/trip6.h"
# include "avalanche/enid2.h"
# include "avalanche/celer2.h"
# include "avalanche/pingo2.h"
# include "avalanche/sequence2.h"
2013-06-29 16:36:40 +02:00
# include "avalanche/acci2.h"
2013-07-01 23:57:56 +02:00
# include "avalanche/roomnums.h"
2013-06-25 18:03:46 +02:00
2013-07-30 20:33:05 +02:00
# include "common/rect.h"
2013-06-29 16:36:40 +02:00
# include "common/system.h"
2013-06-25 18:03:46 +02:00
2013-07-12 09:37:21 +02:00
# include "graphics/palette.h"
2013-06-28 18:29:59 +02:00
//#include "dropdown.h"
//#include "basher.h"
2013-06-25 18:03:46 +02:00
2013-06-28 18:29:59 +02:00
namespace Avalanche {
2013-07-24 19:43:10 +02:00
Lucerna : : Lucerna ( AvalancheEngine * vm ) : fxhidden ( false ) {
2013-06-28 18:29:59 +02:00
_vm = vm ;
}
2013-07-01 23:57:56 +02:00
void Lucerna : : init ( ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > oh = 17717 ;
_vm - > _gyro - > om = 17717 ;
2013-07-24 18:45:10 +02:00
if ( _vm - > _enhanced - > atbios ) _vm - > _gyro - > atkey = " f1 " ;
2013-07-24 18:25:07 +02:00
else _vm - > _gyro - > atkey = " alt- " ;
2013-07-01 23:57:56 +02:00
}
2013-06-28 18:29:59 +02:00
2013-08-26 09:54:40 +02:00
void Lucerna : : callverb ( byte n ) {
2013-07-24 19:43:10 +02:00
if ( n = = _vm - > _acci - > pardon ) {
_vm - > _scrolls - > display ( Common : : String ( " The f5 key lets you do a particular action in certain " ) +
2013-07-01 23:57:56 +02:00
" situations. However, at the moment there is nothing " +
" assigned to it. You may press alt-A to see what the " +
" current setting of this key is. " ) ;
} else {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > weirdword = false ;
2013-07-24 19:43:10 +02:00
_vm - > _acci - > polite = true ;
_vm - > _acci - > verb = n ;
_vm - > _acci - > do_that ( ) ;
2013-07-01 23:57:56 +02:00
}
}
void Lucerna : : draw_also_lines ( ) {
byte ff ;
byte squeaky_code ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-30 20:33:05 +02:00
_vm - > _graphics - > _magics . fillRect ( Common : : Rect ( 0 , 0 , 640 , 200 ) , 0 ) ;
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > _magics . frameRect ( Common : : Rect ( 0 , 45 , 640 , 161 ) , 15 ) ;
2013-08-16 13:40:58 +02:00
2013-08-21 18:01:31 +02:00
for ( ff = 0 ; ff < _vm - > _gyro - > lineNum ; ff + + )
2013-08-30 11:23:17 +02:00
// We had to check if the lines are within the borders of the screen.
2013-08-30 09:37:00 +02:00
if ( ( _vm - > _gyro - > lines [ ff ] . x1 > = 0 ) & & ( _vm - > _gyro - > lines [ ff ] . x1 < _vm - > _graphics - > kScreenWidth ) & & ( _vm - > _gyro - > lines [ ff ] . y1 > = 0 ) & & ( _vm - > _gyro - > lines [ ff ] . y1 < _vm - > _graphics - > kScreenHeight )
& & ( _vm - > _gyro - > lines [ ff ] . x2 > = 0 ) & & ( _vm - > _gyro - > lines [ ff ] . x2 < _vm - > _graphics - > kScreenWidth ) & & ( _vm - > _gyro - > lines [ ff ] . y2 > = 0 ) & & ( _vm - > _gyro - > lines [ ff ] . y2 < _vm - > _graphics - > kScreenHeight ) )
_vm - > _graphics - > _magics . drawLine ( _vm - > _gyro - > lines [ ff ] . x1 , _vm - > _gyro - > lines [ ff ] . y1 , _vm - > _gyro - > lines [ ff ] . x2 , _vm - > _gyro - > lines [ ff ] . y2 , _vm - > _gyro - > lines [ ff ] . col ) ;
2013-08-21 18:01:31 +02:00
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-01 23:57:56 +02:00
}
2013-07-16 22:47:07 +02:00
// nextstring, scram1 and unscrable are only used in load_also
2013-07-01 23:57:56 +02:00
Common : : String Lucerna : : nextstring ( ) {
2013-07-04 18:26:18 +02:00
Common : : String str ;
byte length = f . readByte ( ) ;
for ( int i = 0 ; i < length ; i + + )
str + = f . readByte ( ) ;
return str ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : scram1 ( Common : : String & x ) {
2013-07-02 15:10:16 +02:00
for ( int fz = 0 ; fz < x . size ( ) ; fz + + )
2013-07-01 23:57:56 +02:00
x . setChar ( x [ fz ] ^ 177 , fz ) ;
}
void Lucerna : : unscramble ( ) {
2013-07-05 12:33:15 +02:00
for ( byte fv = 0 ; fv < 31 ; fv + + )
for ( byte ff = 0 ; ff < 2 ; ff + + )
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > also [ fv ] [ ff ] ! = 0 )
scram1 ( * _vm - > _gyro - > also [ fv ] [ ff ] ) ;
scram1 ( _vm - > _gyro - > listen ) ;
scram1 ( _vm - > _gyro - > flags ) ;
2013-07-01 23:57:56 +02:00
}
2013-07-05 15:30:26 +02:00
void Lucerna : : load_also ( Common : : String n ) {
2013-07-01 23:57:56 +02:00
byte ff , fv ;
2013-07-04 18:26:18 +02:00
for ( fv = 0 ; fv < 31 ; fv + + )
for ( ff = 0 ; ff < 2 ; ff + + )
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > also [ fv ] [ ff ] ! = 0 ) {
delete _vm - > _gyro - > also [ fv ] [ ff ] ;
_vm - > _gyro - > also [ fv ] [ ff ] = 0 ;
2013-07-01 23:57:56 +02:00
}
2013-07-04 18:26:18 +02:00
Common : : String filename ;
2013-07-05 15:30:26 +02:00
filename = filename . format ( " also%s.avd " , n . c_str ( ) ) ;
2013-07-04 18:26:18 +02:00
if ( ! f . open ( filename ) ) {
warning ( " AVALANCHE: Lucerna: File not found: %s " , filename . c_str ( ) ) ;
return ;
}
f . seek ( 128 ) ;
byte minnames = f . readByte ( ) ;
for ( fv = 0 ; fv < = minnames ; fv + + ) {
for ( ff = 0 ; ff < 2 ; ff + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > also [ fv ] [ ff ] = new Common : : String ;
* _vm - > _gyro - > also [ fv ] [ ff ] = nextstring ( ) ;
2013-07-04 18:26:18 +02:00
}
2013-07-24 18:25:07 +02:00
* _vm - > _gyro - > also [ fv ] [ 0 ] = Common : : String ( 157 ) + * _vm - > _gyro - > also [ fv ] [ 0 ] + 157 ;
2013-07-04 18:26:18 +02:00
}
2013-07-24 18:25:07 +02:00
memset ( _vm - > _gyro - > lines , 0xFF , sizeof ( _vm - > _gyro - > lines ) ) ;
2013-07-05 01:18:02 +02:00
2013-07-16 22:47:07 +02:00
//fv = getpixel(0, 0);
2013-08-21 18:01:31 +02:00
_vm - > _gyro - > lineNum = f . readByte ( ) ;
for ( byte i = 0 ; i < _vm - > _gyro - > lineNum ; i + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > lines [ i ] . x1 = f . readSint16LE ( ) ;
_vm - > _gyro - > lines [ i ] . y1 = f . readSint16LE ( ) ;
_vm - > _gyro - > lines [ i ] . x2 = f . readSint16LE ( ) ;
_vm - > _gyro - > lines [ i ] . y2 = f . readSint16LE ( ) ;
_vm - > _gyro - > lines [ i ] . col = f . readByte ( ) ;
2013-07-04 18:26:18 +02:00
}
2013-07-24 18:25:07 +02:00
memset ( _vm - > _gyro - > peds , 177 , sizeof ( _vm - > _gyro - > peds ) ) ;
2013-07-04 18:26:18 +02:00
fv = f . readByte ( ) ;
for ( byte i = 0 ; i < fv ; i + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > peds [ i ] . x = f . readSint16LE ( ) ;
_vm - > _gyro - > peds [ i ] . y = f . readSint16LE ( ) ;
_vm - > _gyro - > peds [ i ] . dir = f . readByte ( ) ;
2013-07-04 18:26:18 +02:00
}
2013-08-21 18:01:31 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > numfields = f . readByte ( ) ;
for ( byte i = 0 ; i < _vm - > _gyro - > numfields ; i + + ) {
_vm - > _gyro - > fields [ i ] . x1 = f . readSint16LE ( ) ;
_vm - > _gyro - > fields [ i ] . y1 = f . readSint16LE ( ) ;
_vm - > _gyro - > fields [ i ] . x2 = f . readSint16LE ( ) ;
_vm - > _gyro - > fields [ i ] . y2 = f . readSint16LE ( ) ;
2013-07-04 18:26:18 +02:00
}
for ( byte i = 0 ; i < 15 ; i + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > magics [ i ] . op = f . readByte ( ) ;
_vm - > _gyro - > magics [ i ] . data = f . readUint16LE ( ) ;
2013-07-04 18:26:18 +02:00
}
for ( byte i = 0 ; i < 7 ; i + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > portals [ i ] . op = f . readByte ( ) ;
_vm - > _gyro - > portals [ i ] . data = f . readUint16LE ( ) ;
2013-07-04 18:26:18 +02:00
}
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > flags . clear ( ) ;
2013-07-04 18:26:18 +02:00
for ( byte i = 0 ; i < 26 ; i + + )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > flags + = f . readByte ( ) ;
2013-07-04 18:26:18 +02:00
2013-07-05 01:18:02 +02:00
int16 listen_length = f . readByte ( ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > listen . clear ( ) ;
2013-07-04 18:26:18 +02:00
for ( byte i = 0 ; i < listen_length ; i + + )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > listen + = f . readByte ( ) ;
2013-07-04 18:26:18 +02:00
draw_also_lines ( ) ;
//setactivepage(1);
2013-07-01 23:57:56 +02:00
warning ( " STUB: Lucerna::load_also() " ) ;
2013-07-04 18:26:18 +02:00
f . close ( ) ;
unscramble ( ) ;
for ( fv = 0 ; fv < = minnames ; fv + + )
2013-07-24 18:25:07 +02:00
* _vm - > _gyro - > also [ fv ] [ 0 ] = Common : : String ( ' , ' ) + * _vm - > _gyro - > also [ fv ] [ 0 ] + ' , ' ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : load ( byte n ) { /* Load2, actually */
byte a0 ; /*absolute $A000:800;*/
byte a1 ; /*absolute $A000:17184;*/
byte bit ;
2013-07-05 15:30:26 +02:00
Common : : String xx ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-20 12:16:06 +02:00
2013-07-24 17:52:57 +02:00
_vm - > _graphics - > flesh_colours ( ) ;
2013-07-05 15:30:26 +02:00
2013-07-24 18:25:07 +02:00
xx = _vm - > _gyro - > strf ( n ) ;
2013-07-05 15:30:26 +02:00
Common : : String filename ;
filename = filename . format ( " place%s.avd " , xx . c_str ( ) ) ;
if ( ! f . open ( filename ) ) {
warning ( " AVALANCHE: Lucerna: File not found: %s " , filename . c_str ( ) ) ;
return ;
}
f . seek ( 146 ) ;
2013-08-20 19:23:24 +02:00
if ( ! _vm - > _gyro - > roomname . empty ( ) )
_vm - > _gyro - > roomname . clear ( ) ;
for ( byte i = 0 ; i < 30 ; i + + ) {
char actChar = f . readByte ( ) ;
if ( ( 32 < = actChar ) & & ( actChar < = 126 ) )
_vm - > _gyro - > roomname + = actChar ;
}
2013-07-05 15:30:26 +02:00
/* Compression method byte follows this... */
f . seek ( 177 ) ;
2013-07-12 18:08:27 +02:00
/*for (bit = 0; bit <= 3; bit++) {
port [ 0x3c4 ] = 2 ;
port [ 0x3ce ] = 4 ;
port [ 0x3c5 ] = 1 < < bit ;
port [ 0x3cf ] = bit ;
blockread ( f , a0 , 12080 ) ;
move ( a0 , a1 , 12080 ) ;
} */
2013-07-12 16:11:07 +02:00
2013-07-26 13:32:08 +02:00
2013-07-15 16:57:03 +02:00
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > _background = _vm - > _graphics - > loadPictureRow ( f , _vm - > _graphics - > kBackgroundWidth , _vm - > _graphics - > kBackgroundHeight ) ;
2013-07-12 16:11:07 +02:00
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-12 16:11:07 +02:00
2013-07-16 22:47:07 +02:00
f . close ( ) ;
2013-07-12 16:11:07 +02:00
2013-07-12 18:08:27 +02:00
2013-07-05 15:30:26 +02:00
load_also ( xx ) ;
2013-08-20 19:23:24 +02:00
_vm - > _celer - > load_chunks ( xx ) ;
2013-07-05 15:30:26 +02:00
2013-07-24 17:52:57 +02:00
bit = * _vm - > _graphics - > getPixel ( 0 , 0 ) ;
2013-07-05 15:30:26 +02:00
2013-07-24 18:47:33 +02:00
_vm - > _logger - > log_newroom ( _vm - > _gyro - > roomname ) ;
2013-07-05 15:30:26 +02:00
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : zoomout ( int16 x , int16 y ) {
int16 x1 , y1 , x2 , y2 ;
byte fv ;
warning ( " STUB: Lucerna::zoomout() " ) ;
}
void Lucerna : : find_people ( byte room ) {
2013-08-25 13:25:50 +02:00
for ( byte fv = 1 ; fv < 29 ; fv + + )
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > whereis [ fv ] = = room ) {
2013-08-25 13:25:50 +02:00
if ( fv < 25 )
2013-08-23 14:56:56 +02:00
_vm - > _gyro - > him = fv + 150 ;
2013-07-16 22:47:07 +02:00
else
2013-08-23 14:56:56 +02:00
_vm - > _gyro - > her = fv + 150 ;
2013-07-01 23:57:56 +02:00
}
}
void Lucerna : : exitroom ( byte x ) {
//nosound();
2013-07-24 19:43:10 +02:00
_vm - > _celer - > forget_chunks ( ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > seescroll = true ; /* This stops the trippancy system working over the length of this procedure. */
2013-07-01 23:57:56 +02:00
2013-07-16 22:47:07 +02:00
switch ( x ) {
case r__spludwicks :
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > lose_timer ( _vm - > _timeout - > reason_avariciustalks ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . avaricius_talk = 0 ;
2013-07-16 22:47:07 +02:00
/* He doesn't HAVE to be talking for this to work. It just deletes it IF it exists. */
2013-07-01 23:57:56 +02:00
break ;
2013-07-16 22:47:07 +02:00
case r__bridge :
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . drawbridge_open > 0 ) {
_vm - > _gyro - > dna . drawbridge_open = 4 ; /* Fully open. */
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > lose_timer ( _vm - > _timeout - > reason_drawbridgefalls ) ;
2013-07-01 23:57:56 +02:00
}
2013-07-16 22:47:07 +02:00
break ;
case r__outsidecardiffcastle :
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > lose_timer ( _vm - > _timeout - > reason_cardiffsurvey ) ;
2013-07-16 22:47:07 +02:00
break ;
case r__robins :
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > lose_timer ( _vm - > _timeout - > reason_getting_tied_up ) ;
2013-07-16 22:47:07 +02:00
break ;
2013-07-01 23:57:56 +02:00
}
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > interrogation = 0 ; /* Leaving the room cancels all the questions automatically. */
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > seescroll = false ; /* Now it can work again! */
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . last_room = _vm - > _gyro - > dna . room ;
if ( _vm - > _gyro - > dna . room ! = r__map )
_vm - > _gyro - > dna . last_room_not_map = _vm - > _gyro - > dna . room ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : new_town ( ) { /* You've just entered a town from the map. */
2013-07-24 19:43:10 +02:00
_vm - > _dropdown - > standard_bar ( ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
switch ( _vm - > _gyro - > dna . room ) {
2013-07-01 23:57:56 +02:00
case r__outsidenottspub : /* Entry into Nottingham. */
2013-08-25 13:25:50 +02:00
if ( ( _vm - > _gyro - > dna . rooms [ r__robins ] > 0 ) & & ( _vm - > _gyro - > dna . been_tied_up ) & & ( ! _vm - > _gyro - > dna . taken_mushroom ) )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . mushroom_growing = true ;
2013-07-01 23:57:56 +02:00
break ;
case r__wisewomans : { /* Entry into Argent. */
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . talked_to_crapulus & & ( ! _vm - > _gyro - > dna . lustie_is_asleep ) ) {
_vm - > _gyro - > dna . spludwicks_here = ! ( ( _vm - > _gyro - > dna . rooms [ r__wisewomans ] % 3 ) = = 1 ) ;
_vm - > _gyro - > dna . crapulus_will_tell = ! _vm - > _gyro - > dna . spludwicks_here ;
2013-07-01 23:57:56 +02:00
} else {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . spludwicks_here = true ;
_vm - > _gyro - > dna . crapulus_will_tell = false ;
2013-07-01 23:57:56 +02:00
}
2013-08-25 13:25:50 +02:00
if ( _vm - > _gyro - > dna . box_contents = = _vm - > _gyro - > wine )
_vm - > _gyro - > dna . winestate = 3 ; /* Vinegar */
2013-07-01 23:57:56 +02:00
}
break ;
}
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . room ! = r__outsideducks ) {
2013-08-26 16:10:17 +02:00
if ( ( _vm - > _gyro - > dna . obj [ _vm - > _gyro - > onion - 1 ] ) & & ! ( _vm - > _gyro - > dna . onion_in_vinegar ) )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . rotten_onion = true ; /* You're holding the onion */
2013-07-01 23:57:56 +02:00
}
}
void Lucerna : : put_geida_at ( byte whichped , byte & ped ) {
2013-07-16 22:47:07 +02:00
if ( ped = = 0 )
return ;
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 5 , false , _vm - > _trip ) ; /* load Geida */
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , whichped ) ;
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . call_eachstep = true ;
_vm - > _trip - > tr [ 1 ] . eachstep = _vm - > _trip - > procgeida_procs ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : enterroom ( byte x , byte ped ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > seescroll = true ; /* This stops the trippancy system working over the length of this procedure. */
2013-07-01 23:57:56 +02:00
find_people ( x ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . room = x ;
2013-07-16 22:47:07 +02:00
if ( ped ! = 0 )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . rooms [ x ] + + ;
2013-07-01 23:57:56 +02:00
load ( x ) ;
2013-07-24 18:25:07 +02:00
if ( ( _vm - > _gyro - > dna . rooms [ x ] = = 0 ) & & ( ! _vm - > _gyro - > flagset ( ' S ' ) ) )
2013-07-01 23:57:56 +02:00
points ( 1 ) ;
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pavalot - 150 ] = _vm - > _gyro - > dna . room ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . geida_follows )
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pgeida - 150 ] = x ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > roomtime = 0 ;
2013-07-01 23:57:56 +02:00
2013-07-16 22:47:07 +02:00
2013-07-24 18:25:07 +02:00
if ( ( _vm - > _gyro - > dna . last_room = = r__map ) & & ( _vm - > _gyro - > dna . last_room_not_map ! = _vm - > _gyro - > dna . room ) )
2013-07-16 22:47:07 +02:00
new_town ( ) ;
2013-07-01 23:57:56 +02:00
switch ( x ) {
case r__yours :
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . avvy_in_bed ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 3 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 100 , _vm - > _timeout - > procarkata_shouts , _vm - > _timeout - > reason_arkata_shouts ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__outsideyours :
if ( ped > 0 ) {
2013-07-24 18:25:07 +02:00
if ( ! _vm - > _gyro - > dna . talked_to_crapulus ) {
2013-07-01 23:57:56 +02:00
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pcrapulus - 150 ] = r__outsideyours ;
2013-08-09 03:02:28 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 8 , false , _vm - > _trip ) ; /* load Crapulus */
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . rooms [ r__outsideyours ] = = 1 ) {
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 4 ) ; /* Start on the right-hand side of the screen. */
_vm - > _trip - > tr [ 1 ] . walkto ( 5 ) ; /* Walks up to greet you. */
2013-07-01 23:57:56 +02:00
} else {
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 5 ) ; /* Starts where he was before. */
2013-08-09 03:02:28 +02:00
_vm - > _trip - > tr [ 1 ] . face = 3 ;
2013-07-01 23:57:56 +02:00
}
2013-08-12 17:23:39 +02:00
_vm - > _trip - > tr [ 1 ] . call_eachstep = true ;
_vm - > _trip - > tr [ 1 ] . eachstep = _vm - > _trip - > procface_avvy ; /* He always faces Avvy. */
2013-07-01 23:57:56 +02:00
2013-08-27 20:34:44 +02:00
} else _vm - > _gyro - > whereis [ _vm - > _gyro - > pcrapulus - 150 ] = r__nowhere ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . crapulus_will_tell ) {
2013-08-09 03:02:28 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 8 , false , _vm - > _trip ) ;
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ;
_vm - > _trip - > tr [ 1 ] . walkto ( 4 ) ;
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 20 , _vm - > _timeout - > proccrapulus_splud_out , _vm - > _timeout - > reason_crapulus_says_spludwick_out ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . crapulus_will_tell = false ;
2013-07-01 23:57:56 +02:00
}
}
break ;
2013-08-09 13:21:57 +02:00
case r__outsidespludwicks :
2013-07-24 18:25:07 +02:00
if ( ( _vm - > _gyro - > dna . rooms [ r__outsidespludwicks ] = = 1 ) & & ( ped = = 1 ) ) {
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 20 , _vm - > _timeout - > procbang , _vm - > _timeout - > reason_explosion ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . spludwicks_here = true ;
2013-07-01 23:57:56 +02:00
}
2013-08-09 13:21:57 +02:00
break ;
2013-07-01 23:57:56 +02:00
case r__spludwicks :
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . spludwicks_here ) {
2013-07-01 23:57:56 +02:00
if ( ped > 0 ) {
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 2 , false , _vm - > _trip ) ; /* load Spludwick */
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ;
2013-08-09 13:21:57 +02:00
_vm - > _gyro - > whereis [ 1 ] = r__spludwicks ;
2013-07-01 23:57:56 +02:00
}
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . dogfoodpos = 0 ; /* _vm->_gyro->also Spludwick pos. */
2013-07-01 23:57:56 +02:00
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . call_eachstep = true ;
_vm - > _trip - > tr [ 1 ] . eachstep = _vm - > _trip - > procgeida_procs ;
2013-08-29 12:07:04 +02:00
} else
_vm - > _gyro - > whereis [ 1 ] = r__nowhere ;
2013-07-01 23:57:56 +02:00
break ;
case r__brummieroad : {
2013-08-09 13:21:57 +02:00
if ( _vm - > _gyro - > dna . geida_follows )
2013-08-30 09:37:00 +02:00
put_geida_at ( 5 , ped ) ;
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . cwytalot_gone ) {
2013-08-27 20:46:08 +02:00
_vm - > _gyro - > magics [ lightred - 1 ] . op = _vm - > _gyro - > nix ;
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pcwytalot - 150 ] = r__nowhere ;
2013-07-01 23:57:56 +02:00
} else {
if ( ped > 0 ) {
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 4 , false , _vm - > _trip ) ; /* 4=Cwytalot*/
_vm - > _trip - > tr [ 1 ] . call_eachstep = true ;
_vm - > _trip - > tr [ 1 ] . eachstep = _vm - > _trip - > procfollow_avvy_y ;
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pcwytalot - 150 ] = r__brummieroad ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . rooms [ r__brummieroad ] = = 1 ) { /* First time here... */
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ; /* He appears on the right of the screen... */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . walkto ( 4 ) ; /* ...and he walks up... */
2013-07-01 23:57:56 +02:00
} else {
/* You've been here before. */
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 4 ) ; /* He's standing in your way straight away... */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . face = _vm - > _trip - > left ;
2013-07-01 23:57:56 +02:00
}
}
}
}
break ;
case r__argentroad : {
2013-08-27 20:46:08 +02:00
if ( ( _vm - > _gyro - > dna . cwytalot_gone ) & & ( ! _vm - > _gyro - > dna . cwytalot_in_herts ) & & ( ped = = 2 ) & &
2013-07-24 18:25:07 +02:00
( _vm - > _gyro - > dna . rooms [ r__argentroad ] > 3 ) ) {
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 4 , false , _vm - > _trip ) ; /* 4=Cwytalot again*/
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 1 ) ;
_vm - > _trip - > tr [ 1 ] . walkto ( 2 ) ;
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . vanishifstill = true ;
2013-08-27 20:46:08 +02:00
_vm - > _gyro - > dna . cwytalot_in_herts = true ;
2013-07-24 18:25:07 +02:00
/*_vm->_gyro->whereis[#157]:=r__Nowhere;*/ /* can we fit this in? */
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 20 , _vm - > _timeout - > proc_cwytalot_in_herts , _vm - > _timeout - > reason_cwytalot_in_herts ) ;
2013-07-01 23:57:56 +02:00
}
}
break ;
case r__bridge : {
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . drawbridge_open = = 4 ) { /*open*/
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 3 ) ; /* Position of drawbridge */
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-08-27 20:46:08 +02:00
_vm - > _gyro - > magics [ green - 1 ] . op = _vm - > _gyro - > nix ; /* You may enter the drawbridge. */
2013-07-01 23:57:56 +02:00
}
2013-08-09 13:21:57 +02:00
if ( _vm - > _gyro - > dna . geida_follows )
2013-08-30 09:37:00 +02:00
put_geida_at ( ped + 3 , ped ) ; /* load Geida */
2013-07-01 23:57:56 +02:00
}
break ;
case r__robins : {
if ( ped > 0 ) {
2013-07-24 18:25:07 +02:00
if ( ! _vm - > _gyro - > dna . been_tied_up ) {
2013-07-01 23:57:56 +02:00
/* A welcome party... or maybe not... */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 6 , false , _vm - > _trip ) ;
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ;
_vm - > _trip - > tr [ 1 ] . walkto ( 3 ) ;
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 36 , _vm - > _timeout - > procget_tied_up , _vm - > _timeout - > reason_getting_tied_up ) ;
2013-07-01 23:57:56 +02:00
}
}
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . been_tied_up ) {
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > probinhood - 150 ] = 0 ;
_vm - > _gyro - > whereis [ _vm - > _gyro - > pfriartuck - 150 ] = 0 ;
2013-07-01 23:57:56 +02:00
}
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . tied_up )
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 2 ) ;
2013-07-01 23:57:56 +02:00
2013-08-27 20:34:44 +02:00
if ( ! _vm - > _gyro - > dna . mushroom_growing )
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 3 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__outsidecardiffcastle : {
if ( ped > 0 )
2013-07-24 18:25:07 +02:00
switch ( _vm - > _gyro - > dna . cardiff_things ) {
2013-07-01 23:57:56 +02:00
case 0 : { /* You've answered NONE of his questions. */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 9 , false , _vm - > _trip ) ;
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ;
_vm - > _trip - > tr [ 1 ] . walkto ( 3 ) ;
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 47 , _vm - > _timeout - > proccardiffsurvey , _vm - > _timeout - > reason_cardiffsurvey ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case 5 :
2013-08-09 13:21:57 +02:00
_vm - > _gyro - > magics [ 1 ] . op = _vm - > _gyro - > nix ;
2013-07-01 23:57:56 +02:00
break ; /* You've answered ALL his questions. => nothing happens. */
default : { /* You've answered SOME of his questions. */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 9 , false , _vm - > _trip ) ;
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 3 ) ;
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . face = _vm - > _trip - > right ;
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 3 , _vm - > _timeout - > proccardiff_return , _vm - > _timeout - > reason_cardiffsurvey ) ;
2013-07-01 23:57:56 +02:00
}
}
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . cardiff_things < 5 )
_vm - > _gyro - > interrogation = _vm - > _gyro - > dna . cardiff_things ;
else _vm - > _gyro - > interrogation = 0 ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__map : {
2013-08-23 16:58:22 +02:00
/* You're entering the map. */
dawn ( ) ;
//setactivepage(cp);
if ( ped > 0 )
zoomout ( _vm - > _gyro - > peds [ ped - 1 ] . x , _vm - > _gyro - > peds [ ped - 1 ] . y ) ;
//setactivepage(1 - cp);
{
dnatype & with = _vm - > _gyro - > dna ;
2013-08-26 16:10:17 +02:00
if ( ( _vm - > _gyro - > dna . obj [ _vm - > _gyro - > wine - 1 ] ) & & ( _vm - > _gyro - > dna . winestate ! = 3 ) ) {
2013-08-23 16:58:22 +02:00
_vm - > _visa - > dixi ( ' q ' , 9 ) ; /* Don't want to waste the wine! */
2013-08-26 16:10:17 +02:00
_vm - > _gyro - > dna . obj [ _vm - > _gyro - > wine - 1 ] = false ;
2013-08-23 16:58:22 +02:00
objectlist ( ) ;
}
}
_vm - > _visa - > dixi ( ' q ' , 69 ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__catacombs : {
2013-08-29 23:38:47 +02:00
if ( ( ped = = 0 ) | | ( ped = = 3 ) | | ( ped = = 5 ) | | ( ped = = 6 ) ) {
switch ( ped ) {
case 3 : { // Enter from oubliette
_vm - > _gyro - > dna . cat_x = 8 ;
_vm - > _gyro - > dna . cat_y = 4 ;
}
break ;
case 5 : { // Enter from du Lustie's
_vm - > _gyro - > dna . cat_x = 8 ;
_vm - > _gyro - > dna . cat_y = 7 ;
}
break ;
case 6 : { // Enter from Geida's
_vm - > _gyro - > dna . cat_x = 4 ;
_vm - > _gyro - > dna . cat_y = 1 ;
}
break ;
}
_vm - > _gyro - > dna . enter_catacombs_from_lusties_room = true ;
_vm - > _trip - > catamove ( ped ) ;
_vm - > _gyro - > dna . enter_catacombs_from_lusties_room = false ;
}
2013-07-01 23:57:56 +02:00
}
break ;
case r__argentpub : {
2013-08-23 11:33:37 +02:00
if ( _vm - > _gyro - > dna . wonnim )
_vm - > _celer - > show_one ( 1 ) ; /* No lute by the settle. */
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . malagauche = 0 ; /* Ready to boot Malagauche */
if ( _vm - > _gyro - > dna . givenbadgetoiby ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 8 ) ;
_vm - > _celer - > show_one ( 9 ) ;
2013-07-01 23:57:56 +02:00
}
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__lustiesroom : {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . dogfoodpos = 1 ; /* Actually, du Lustie pos. */
2013-08-09 13:21:57 +02:00
if ( _vm - > _trip - > tr [ 0 ] . whichsprite = = 0 ) /* Avvy in his normal clothes */
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 3 , _vm - > _timeout - > proccallsguards , _vm - > _timeout - > reason_du_lustie_talks ) ;
2013-07-24 18:25:07 +02:00
else if ( ! _vm - > _gyro - > dna . entered_lusties_room_as_monk ) /*already*/
2013-07-01 23:57:56 +02:00
/* Presumably, Avvy dressed as a monk. */
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 3 , _vm - > _timeout - > procgreetsmonk , _vm - > _timeout - > reason_du_lustie_talks ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . geida_follows ) {
2013-08-30 09:37:00 +02:00
put_geida_at ( 5 , ped ) ;
2013-08-23 11:33:37 +02:00
if ( _vm - > _gyro - > dna . lustie_is_asleep ) {
2013-08-09 13:21:57 +02:00
_vm - > _celer - > show_one ( 5 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
}
2013-07-01 23:57:56 +02:00
}
}
break ;
case r__musicroom : {
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . jacques_awake > 0 ) {
_vm - > _gyro - > dna . jacques_awake = 5 ;
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 2 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 4 ) ;
2013-08-27 20:46:08 +02:00
_vm - > _gyro - > magics [ brown - 1 ] . op = _vm - > _gyro - > nix ;
2013-08-27 20:34:44 +02:00
_vm - > _gyro - > whereis [ _vm - > _gyro - > pjacques - 150 ] = 0 ;
2013-07-01 23:57:56 +02:00
}
if ( ped ! = 0 ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 6 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 6 ) ;
_vm - > _sequence - > then_show ( 5 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 7 ) ;
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
}
break ;
case r__outsidenottspub :
if ( ped = = 2 ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 3 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 3 ) ;
_vm - > _sequence - > then_show ( 2 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 1 ) ;
_vm - > _sequence - > then_show ( 4 ) ;
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__outsideargentpub :
if ( ped = = 2 ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 6 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 6 ) ;
_vm - > _sequence - > then_show ( 5 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 7 ) ;
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__wisewomans : {
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 11 , false , _vm - > _trip ) ;
2013-07-24 18:25:07 +02:00
if ( ( _vm - > _gyro - > dna . rooms [ r__wisewomans ] = = 1 ) & & ( ped > 0 ) ) {
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 2 ) ; /* Start on the right-hand side of the screen. */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . walkto ( 4 ) ; /* Walks up to greet you. */
2013-07-01 23:57:56 +02:00
} else {
2013-08-23 16:03:06 +02:00
_vm - > _trip - > apped ( 2 , 4 ) ; /* Starts where she was before. */
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . face = 3 ;
2013-07-01 23:57:56 +02:00
}
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . call_eachstep = true ;
_vm - > _trip - > tr [ 1 ] . eachstep = _vm - > _trip - > procface_avvy ; /* She always faces Avvy. */
2013-07-01 23:57:56 +02:00
}
break ;
case r__insidecardiffcastle :
if ( ped > 0 ) {
2013-08-09 13:21:57 +02:00
_vm - > _trip - > tr [ 1 ] . init ( 10 , false , _vm - > _trip ) ; /* Define the dart. */
2013-08-23 11:33:37 +02:00
_vm - > _celer - > show_one ( 1 ) ;
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > first_show ( 1 ) ;
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . arrow_in_the_door )
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 3 ) ;
2013-07-01 23:57:56 +02:00
else
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 2 ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . taken_pen )
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 4 ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
} else {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 1 ) ;
2013-08-23 11:33:37 +02:00
if ( _vm - > _gyro - > dna . arrow_in_the_door )
_vm - > _celer - > show_one ( 3 ) ;
else
_vm - > _celer - > show_one ( 2 ) ;
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__avvysgarden :
if ( ped = = 1 ) {
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 2 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 2 ) ;
_vm - > _sequence - > then_show ( 1 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > then_show ( 3 ) ;
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
2013-08-23 11:33:37 +02:00
2013-07-01 23:57:56 +02:00
case r__entrancehall :
case r__insideabbey :
2013-08-23 11:33:37 +02:00
case r__yourhall :
2013-07-01 23:57:56 +02:00
if ( ped = = 2 ) {
2013-08-23 11:33:37 +02:00
/* It was the original:
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 2 ) ;
_vm - > _sequence - > first_show ( 1 ) ;
_vm - > _sequence - > then_show ( 3 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _sequence - > start_to_close ( ) ; */
_vm - > _celer - > show_one ( 2 ) ;
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 2 ) ;
_vm - > _sequence - > then_show ( 1 ) ;
_vm - > _sequence - > then_show ( 3 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
case r__aylesoffice :
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . ayles_is_awake )
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 2 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
2013-07-01 23:57:56 +02:00
break ; /* Ayles awake. */
case r__geidas :
2013-08-30 09:37:00 +02:00
put_geida_at ( 2 , ped ) ;
2013-07-01 23:57:56 +02:00
break ; /* load Geida */
case r__easthall :
case r__westhall :
2013-08-09 13:21:57 +02:00
if ( _vm - > _gyro - > dna . geida_follows )
2013-08-30 09:37:00 +02:00
put_geida_at ( ped + 2 , ped ) ;
2013-07-01 23:57:56 +02:00
break ;
case r__lusties :
2013-08-09 13:21:57 +02:00
if ( _vm - > _gyro - > dna . geida_follows )
2013-08-30 09:37:00 +02:00
put_geida_at ( ped + 6 , ped ) ;
2013-07-01 23:57:56 +02:00
break ;
case r__nottspub : {
2013-07-24 19:43:10 +02:00
if ( _vm - > _gyro - > dna . sitting_in_pub ) _vm - > _celer - > show_one ( 3 ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . dogfoodpos = 1 ; /* Actually, du Lustie pos. */
2013-07-01 23:57:56 +02:00
}
break ;
case r__outsideducks :
if ( ped = = 2 ) {
/* Shut the door */
2013-07-24 19:43:10 +02:00
_vm - > _celer - > show_one ( 3 ) ;
2013-08-23 11:33:37 +02:00
_vm - > _graphics - > refreshBackground ( ) ;
_vm - > _sequence - > first_show ( 3 ) ;
2013-07-24 19:43:10 +02:00
_vm - > _sequence - > first_show ( 2 ) ;
_vm - > _sequence - > then_show ( 1 ) ;
_vm - > _sequence - > then_show ( 4 ) ;
_vm - > _sequence - > start_to_close ( ) ;
2013-07-01 23:57:56 +02:00
}
break ;
2013-08-23 16:03:06 +02:00
2013-07-01 23:57:56 +02:00
case r__ducks :
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . dogfoodpos = 1 ;
2013-07-01 23:57:56 +02:00
break ; /* Actually, Duck pos. */
}
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > seescroll = false ; /* Now it can work again! */
2013-07-01 23:57:56 +02:00
2013-08-25 17:38:22 +02:00
if ( _vm - > _gyro - > isLoaded )
_vm - > _gyro - > isLoaded = false ;
2013-07-01 23:57:56 +02:00
}
2013-07-16 13:03:22 +02:00
void Lucerna : : thinkabout ( byte z , bool th ) { /* Hey!!! Get it and put it!!! */
2013-07-05 16:38:34 +02:00
const int16 picsize = 966 ;
const bytefield thinkspace = { 25 , 170 , 32 , 200 } ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > thinks = z ;
2013-07-05 16:38:34 +02:00
z - - ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > wait ( ) ;
2013-07-16 13:03:22 +02:00
2013-07-05 16:38:34 +02:00
if ( th ) {
if ( ! f . open ( " thinks.avd " ) ) {
warning ( " AVALANCHE: Lucerna: File not found: thinks.avd " ) ;
return ;
}
} else {
if ( ! f . open ( " folk.avd " ) ) {
2013-07-05 18:05:08 +02:00
warning ( " AVALANCHE: Lucerna: File not found: folk.avd " ) ;
2013-07-05 16:38:34 +02:00
return ;
}
2013-07-16 13:03:22 +02:00
z = z - 149 ;
if ( z > = 25 )
z - = 8 ;
if ( z = = 20 )
z - - ; /* Last time... */
2013-07-05 16:38:34 +02:00
2013-07-16 13:03:22 +02:00
}
2013-07-05 16:38:34 +02:00
2013-07-16 13:03:22 +02:00
f . seek ( z * picsize + 65 ) ;
2013-07-26 13:32:08 +02:00
: : Graphics : : Surface picture = _vm - > _graphics - > loadPictureGraphic ( f ) ;
2013-07-05 16:38:34 +02:00
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > drawPicture ( _vm - > _graphics - > _surface , picture , 205 , 170 ) ;
2013-07-17 11:35:40 +02:00
2013-07-26 13:32:08 +02:00
picture . free ( ) ;
2013-07-16 13:03:22 +02:00
f . close ( ) ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-05 16:38:34 +02:00
/*setactivepage(3);
putimage ( x , y , p , 0 ) ;
setactivepage ( 1 - cp ) ; */
2013-07-16 13:03:22 +02:00
for ( byte fv = 0 ; fv < = 1 ; fv + + )
2013-07-24 19:43:10 +02:00
_vm - > _trip - > getset [ fv ] . remember ( thinkspace ) ;
2013-07-05 16:38:34 +02:00
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > thinkthing = th ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : load_digits ( ) { /* Load the scoring digits & rwlites */
2013-07-05 18:05:08 +02:00
const byte digitsize = 134 ;
const byte rwlitesize = 126 ;
if ( ! f . open ( " digit.avd " ) ) {
warning ( " AVALANCHE: Lucerna: File not found: digit.avd " ) ;
return ;
}
for ( byte fv = 0 ; fv < 10 ; fv + + ) {
2013-07-26 13:32:08 +02:00
f . seek ( fv * digitsize ) ;
/*_vm->_gyro->digit[fv] = new byte[digitsize];
f . read ( _vm - > _gyro - > digit [ fv ] , digitsize ) ; */
_vm - > _gyro - > digit [ fv ] = _vm - > _graphics - > loadPictureGraphic ( f ) ;
2013-07-05 18:05:08 +02:00
}
for ( byte ff = 0 ; ff < 9 ; ff + + ) {
2013-07-26 13:32:08 +02:00
f . seek ( 10 * digitsize + ff * rwlitesize ) ;
/*_vm->_gyro->rwlite[ff] = new byte[rwlitesize];
f . read ( _vm - > _gyro - > rwlite [ ff ] , rwlitesize ) ; */
_vm - > _gyro - > rwlite [ ff ] = _vm - > _graphics - > loadPictureGraphic ( f ) ;
2013-07-05 18:05:08 +02:00
}
2013-07-09 18:54:53 +02:00
2013-07-05 18:05:08 +02:00
f . close ( ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : toolbar ( ) {
2013-07-05 18:28:43 +02:00
if ( ! f . open ( " useful.avd " ) ) {
warning ( " AVALANCHE: Lucerna: File not found: useful.avd " ) ;
return ;
}
f . seek ( 40 ) ;
2013-07-15 16:57:03 +02:00
2013-07-05 18:28:43 +02:00
/* off;*/
2013-07-26 13:32:08 +02:00
: : Graphics : : Surface picture = _vm - > _graphics - > loadPictureGraphic ( f ) ;
2013-07-17 11:35:40 +02:00
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > drawPicture ( _vm - > _graphics - > _surface , picture , 5 , 169 ) ;
2013-07-15 16:57:03 +02:00
2013-07-26 13:32:08 +02:00
picture . free ( ) ;
2013-07-17 11:35:40 +02:00
2013-07-16 13:03:22 +02:00
f . close ( ) ;
2013-07-05 18:28:43 +02:00
/* on;*/
2013-07-15 16:57:03 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > oldrw = 177 ;
2013-07-05 18:28:43 +02:00
showrw ( ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : showscore ( ) {
2013-07-17 11:35:40 +02:00
const bytefield scorespace = { 33 , 177 , 39 , 200 } ;
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > demo )
2013-07-17 11:35:40 +02:00
return ;
2013-07-24 18:25:07 +02:00
uint16 score = _vm - > _gyro - > dna . score ;
2013-07-17 12:27:08 +02:00
int8 numbers [ 3 ] = { 0 , 0 , 0 } ;
2013-07-17 11:35:40 +02:00
for ( byte i = 0 ; i < 2 ; i + + ) {
byte divisor = 1 ;
for ( byte j = 0 ; j < ( 2 - i ) ; j + + )
divisor * = 10 ;
numbers [ i ] = score / divisor ;
score - = numbers [ i ] * divisor ;
}
numbers [ 2 ] = score ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-17 11:35:40 +02:00
2013-07-17 12:27:08 +02:00
//setactivepage(3);
2013-07-17 11:35:40 +02:00
2013-07-17 12:27:08 +02:00
for ( byte fv = 0 ; fv < 3 ; fv + + )
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > lastscore [ fv ] ! = numbers [ fv ] )
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > drawPicture ( _vm - > _graphics - > _surface , _vm - > _gyro - > digit [ numbers [ fv ] ] , 250 + ( fv + 1 ) * 15 , 177 ) ;
2013-07-17 11:35:40 +02:00
2013-07-17 12:27:08 +02:00
for ( byte fv = 0 ; fv < 2 ; fv + + )
2013-07-24 19:43:10 +02:00
_vm - > _trip - > getset [ fv ] . remember ( scorespace ) ;
2013-07-17 11:35:40 +02:00
//setactivepage(1 - cp);
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-17 12:27:08 +02:00
for ( byte i = 0 ; i < 3 ; i + + )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > lastscore [ i ] = numbers [ i ] ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : points ( byte num ) { /* Add on no. of points */
2013-07-17 13:00:15 +02:00
for ( byte q = 1 ; q < = num ; q + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . score + + ;
2013-07-17 13:00:15 +02:00
/*if (soundfx)
for ( byte fv = 1 ; fv < = 97 ; fv + + )
sound ( 177 + dna . score * 3 ) ;
nosound ; */
}
2013-07-01 23:57:56 +02:00
warning ( " STUB: Lucerna::points() " ) ;
2013-07-17 13:00:15 +02:00
2013-07-24 18:47:33 +02:00
_vm - > _logger - > log_score ( num , _vm - > _gyro - > dna . score ) ;
2013-07-17 13:00:15 +02:00
showscore ( ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : topcheck ( ) {
2013-07-24 19:43:10 +02:00
_vm - > _dropdown - > ddm_m . getmenu ( _vm - > _gyro - > mpx ) ;
2013-07-01 23:57:56 +02:00
}
2013-08-17 15:07:02 +02:00
void Lucerna : : mouseway ( const Common : : Point & cursorPos ) {
byte col = * ( byte * ) _vm - > _graphics - > _surface . getBasePtr ( cursorPos . x , cursorPos . y / 2 ) ;
switch ( col ) {
case green : {
_vm - > _gyro - > dna . rw = _vm - > _trip - > up ;
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > up ) ;
showrw ( ) ;
}
break ;
case brown : {
_vm - > _gyro - > dna . rw = _vm - > _trip - > down ;
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > down ) ;
showrw ( ) ;
}
break ;
case cyan : {
_vm - > _gyro - > dna . rw = _vm - > _trip - > left ;
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > left ) ;
showrw ( ) ;
}
break ;
case lightmagenta : {
_vm - > _gyro - > dna . rw = _vm - > _trip - > right ;
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > right ) ;
showrw ( ) ;
}
break ;
case red :
case white :
case lightcyan :
case yellow : { // Fall-throughs are intended.
_vm - > _trip - > stopwalking ( ) ;
showrw ( ) ;
}
break ;
}
2013-07-01 23:57:56 +02:00
}
void Lucerna : : inkey ( ) {
char r ;
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > demo )
2013-07-01 23:57:56 +02:00
return ; /* Demo handles this itself. */
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > mousetext = = " " ) {
2013-07-01 23:57:56 +02:00
/* read keyboard */
2013-07-24 18:45:10 +02:00
_vm - > _enhanced - > readkeye ( ) ;
if ( ( _vm - > _enhanced - > inchar = = ' ' ) & & ( ( _vm - > _enhanced - > shiftstate & 8 ) > 0 ) ) {
_vm - > _enhanced - > inchar = ' \0 ' ;
_vm - > _enhanced - > extd = ' # ' ; /* alt-spacebar = alt-H */
2013-07-01 23:57:56 +02:00
}
} else {
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > mousetext [ 0 ] = = ' ` ' )
_vm - > _gyro - > mousetext . setChar ( 13 , 0 ) ; /* Backquote = return in a macro */
2013-07-24 18:45:10 +02:00
_vm - > _enhanced - > inchar = _vm - > _gyro - > mousetext [ 0 ] ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > mousetext = Common : : String ( _vm - > _gyro - > mousetext . c_str ( ) + 2 , 253 ) ;
2013-07-01 23:57:56 +02:00
}
}
void Lucerna : : posxy ( ) {
warning ( " STUB: Lucerna::posxy() " ) ;
}
void Lucerna : : fxtoggle ( ) {
warning ( " STUB: Lucerna::fxtoggle() " ) ;
}
2013-06-25 18:03:46 +02:00
2013-07-01 23:57:56 +02:00
void Lucerna : : objectlist ( ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . carrying = 0 ;
2013-08-26 16:10:17 +02:00
if ( _vm - > _gyro - > thinkthing & & ! _vm - > _gyro - > dna . obj [ _vm - > _gyro - > thinks - 1 ] )
2013-07-24 18:25:07 +02:00
thinkabout ( _vm - > _gyro - > money , _vm - > _gyro - > a_thing ) ; /* you always have money */
2013-08-20 19:23:24 +02:00
for ( byte fv = 0 ; fv < numobjs ; fv + + )
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > dna . obj [ fv ] ) {
2013-08-20 19:23:24 +02:00
_vm - > _gyro - > dna . carrying + + ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > objlist [ _vm - > _gyro - > dna . carrying ] = fv + 1 ;
2013-07-01 23:57:56 +02:00
}
2013-06-28 18:29:59 +02:00
}
2013-06-25 18:03:46 +02:00
2013-08-16 23:29:03 +02:00
void Lucerna : : verte ( Common : : Point cursorPos ) {
2013-07-24 18:25:07 +02:00
if ( ! _vm - > _gyro - > dna . user_moves_avvy )
2013-07-16 22:47:07 +02:00
return ;
2013-07-01 23:57:56 +02:00
2013-08-16 23:29:03 +02:00
cursorPos . y / = 2 ;
byte what ;
2013-07-01 23:57:56 +02:00
2013-08-16 23:29:03 +02:00
// _vm->_trip->tr[0] : that's the only one we're interested in here. (It's Avalot.)
if ( cursorPos . x < _vm - > _trip - > tr [ 0 ] . x )
2013-07-16 22:47:07 +02:00
what = 1 ;
2013-08-16 23:29:03 +02:00
else if ( cursorPos . x > ( _vm - > _trip - > tr [ 0 ] . x + _vm - > _trip - > tr [ 0 ] . _info . xl ) )
2013-07-16 22:47:07 +02:00
what = 2 ;
else
2013-08-16 23:29:03 +02:00
what = 0 ; // On top
2013-07-16 22:47:07 +02:00
2013-08-16 23:29:03 +02:00
if ( cursorPos . y < _vm - > _trip - > tr [ 0 ] . y )
2013-07-16 22:47:07 +02:00
what + = 3 ;
2013-08-16 23:29:03 +02:00
else if ( cursorPos . y > ( _vm - > _trip - > tr [ 0 ] . y + _vm - > _trip - > tr [ 0 ] . _info . yl ) )
2013-07-16 22:47:07 +02:00
what + = 6 ;
switch ( what ) {
case 0 :
2013-07-24 19:43:10 +02:00
_vm - > _trip - > stopwalking ( ) ;
2013-08-16 23:29:03 +02:00
break ; // Clicked on Avvy: no movement.
2013-07-16 22:47:07 +02:00
case 1 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > left ) ;
2013-07-16 22:47:07 +02:00
break ;
case 2 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > right ) ;
2013-07-16 22:47:07 +02:00
break ;
case 3 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > up ) ;
2013-07-16 22:47:07 +02:00
break ;
case 4 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > ul ) ;
2013-07-16 22:47:07 +02:00
break ;
case 5 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > ur ) ;
2013-07-16 22:47:07 +02:00
break ;
case 6 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > down ) ;
2013-07-16 22:47:07 +02:00
break ;
case 7 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > dl ) ;
2013-07-16 22:47:07 +02:00
break ;
case 8 :
2013-08-16 23:29:03 +02:00
_vm - > _trip - > rwsp ( 0 , _vm - > _trip - > dr ) ;
2013-07-16 22:47:07 +02:00
break ;
2013-08-16 23:29:03 +02:00
} // No other values are possible.
2013-07-01 23:57:56 +02:00
2013-07-16 22:47:07 +02:00
showrw ( ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : checkclick ( ) {
2013-08-16 23:02:53 +02:00
bytefield b ;
Common : : Point cursorPos = _vm - > getMousePos ( ) ;
_vm - > _gyro - > ontoolbar = _vm - > _gyro - > slow_computer & & ( ( cursorPos . y > = 169 ) | | ( cursorPos . y < = 10 ) ) ;
if ( _vm - > _gyro - > mrelease > 0 )
_vm - > _gyro - > after_the_scroll = false ;
if ( ( 0 < = cursorPos . y ) & & ( cursorPos . y < = 21 ) )
_vm - > _gyro - > newpointer ( 1 ) ; // up arrow
else if ( ( 317 < = cursorPos . y ) & & ( cursorPos . y < = 339 ) )
_vm - > _gyro - > newpointer ( 8 ) ; //I-beam
else if ( ( 340 < = cursorPos . y ) & & ( cursorPos . y < = 399 ) )
_vm - > _gyro - > newpointer ( 2 ) ; // screwdriver
else if ( ! _vm - > _gyro - > ddmnow ) { // Dropdown can handle its own pointers.
if ( holdLeftMouse ) {
_vm - > _gyro - > newpointer ( 7 ) ; // Mark's crosshairs
2013-08-16 23:29:03 +02:00
verte ( cursorPos ) ; // Normally, if you click on the picture, you're guiding Avvy around.
2013-08-16 23:02:53 +02:00
} else
_vm - > _gyro - > newpointer ( 4 ) ; // fletch
}
2013-08-17 15:07:02 +02:00
if ( holdLeftMouse )
if ( ( 0 < = cursorPos . y ) & & ( cursorPos . y < = 21 ) ) { // Clink on the dropdown menu.
if ( _vm - > _gyro - > dropsok )
topcheck ( ) ;
} else if ( ( 317 < = cursorPos . y ) & & ( cursorPos . y < = 339 ) ) { // Click on the command line.
_vm - > _parser - > _inputTextPos = ( cursorPos . x - 23 ) / 8 ;
if ( _vm - > _parser - > _inputTextPos > _vm - > _parser - > _inputText . size ( ) + 1 )
_vm - > _parser - > _inputTextPos = _vm - > _parser - > _inputText . size ( ) + 1 ;
if ( _vm - > _parser - > _inputTextPos < 1 )
_vm - > _parser - > _inputTextPos = 1 ;
_vm - > _parser - > _inputTextPos - - ;
_vm - > _parser - > plotText ( ) ;
} else if ( ( 340 < = cursorPos . y ) & & ( cursorPos . y < = 399 ) ) { // Check the toolbar.
if ( ( 137 < = cursorPos . x ) & & ( cursorPos . x < = 207 ) ) { // Control Avvy with the compass.
if ( _vm - > _gyro - > alive & & _vm - > _gyro - > dna . avvy_is_awake )
mouseway ( cursorPos ) ;
} else if ( ( 208 < = cursorPos . x ) & & ( cursorPos . x < = 260 ) ) { // Examine the thing.
do {
_vm - > updateEvents ( ) ;
} while ( holdLeftMouse ) ;
if ( _vm - > _gyro - > thinkthing ) {
_vm - > _acci - > thing = _vm - > _gyro - > thinks ;
_vm - > _acci - > thing + = 49 ;
_vm - > _acci - > person = _vm - > _acci - > pardon ;
} else {
_vm - > _acci - > person = _vm - > _gyro - > thinks ;
_vm - > _acci - > thing = _vm - > _acci - > pardon ;
}
callverb ( _vm - > _acci - > vb_exam ) ;
} else if ( ( 261 < = cursorPos . x ) & & ( cursorPos . x < = 319 ) ) { // Display the score.
do {
_vm - > updateEvents ( ) ;
} while ( holdLeftMouse ) ;
callverb ( _vm - > _acci - > vb_score ) ;
} else if ( ( 320 < = cursorPos . x ) & & ( cursorPos . x < = 357 ) ) { // Change speed.
_vm - > _trip - > tr [ 0 ] . xs = _vm - > _gyro - > walk ;
_vm - > _trip - > newspeed ( ) ;
} else if ( ( 358 < = cursorPos . x ) & & ( cursorPos . x < = 395 ) ) { // Change speed.
_vm - > _trip - > tr [ 0 ] . xs = _vm - > _gyro - > run ;
_vm - > _trip - > newspeed ( ) ;
} else if ( ( 396 < = cursorPos . x ) & & ( cursorPos . x < = 483 ) )
fxtoggle ( ) ;
else if ( ( 535 < = cursorPos . x ) & & ( cursorPos . x < = 640 ) )
_vm - > _gyro - > mousetext = Common : : String ( 13 ) + _vm - > _gyro - > mousetext ;
} else if ( ! _vm - > _gyro - > dropsok )
_vm - > _gyro - > mousetext = Common : : String ( 13 ) + _vm - > _gyro - > mousetext ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : mouse_init ( ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > wait ( ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : mousepage ( uint16 page_ ) {
warning ( " STUB: Lucerna::mousepage() " ) ;
}
void Lucerna : : errorled ( ) {
warning ( " STUB: Lucerna::errorled() " ) ;
}
int8 Lucerna : : fades ( int8 x ) {
2013-07-16 22:47:07 +02:00
byte r = x / 16 ;
2013-07-01 23:57:56 +02:00
x = x % 16 ;
2013-07-16 22:47:07 +02:00
byte g = x / 4 ;
byte b = x % 4 ;
if ( r > 0 ) r - - ;
if ( g > 0 ) g - - ;
if ( b > 0 ) b - - ;
return ( 16 * r + 4 * g + b ) ;
2013-07-01 23:57:56 +02:00
/* fades:=x-1;*/
}
void Lucerna : : fadeout ( byte n ) {
2013-07-12 08:41:14 +02:00
warning ( " STUB: Lucerna::fadeout() " ) ; // I'll bother with colors later.
2013-07-01 23:57:56 +02:00
}
void Lucerna : : dusk ( ) {
2013-07-12 08:41:14 +02:00
warning ( " STUB: Lucerna::dusk() " ) ; // I'll bother with colors later.
2013-07-01 23:57:56 +02:00
}
void Lucerna : : fadein ( byte n ) {
warning ( " STUB: Lucerna::fadein() " ) ;
}
void Lucerna : : dawn ( ) {
warning ( " STUB: Lucerna::dawn() " ) ;
}
2013-07-18 23:56:55 +02:00
void Lucerna : : showrw ( ) { // It's data is loaded in load_digits().
2013-07-24 18:25:07 +02:00
if ( _vm - > _gyro - > oldrw = = _vm - > _gyro - > dna . rw )
2013-07-18 23:56:55 +02:00
return ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > oldrw = _vm - > _gyro - > dna . rw ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-18 23:56:55 +02:00
/* for (byte page_ = 0; page_ <= 1; page_ ++) {
setactivepage ( page_ ) ;
putimage ( 0 , 161 , rwlite [ with . rw ] , 0 ) ;
} */
2013-08-21 18:01:31 +02:00
_vm - > _graphics - > drawPicture ( _vm - > _graphics - > _surface , _vm - > _gyro - > rwlite [ _vm - > _gyro - > dna . rw ] , 0 , 161 ) ;
2013-07-18 23:56:55 +02:00
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-18 23:56:55 +02:00
//setactivepage(1 - cp);
2013-07-01 23:57:56 +02:00
warning ( " STUB: Lucerna::showrw() " ) ;
}
2013-08-08 03:59:29 +02:00
void Lucerna : : calchand ( uint16 ang , uint16 length , Common : : Point & a , byte c ) {
if ( ang > 900 ) {
a . x = 177 ;
return ;
}
a = _vm - > _graphics - > drawArc ( _vm - > _graphics - > _surface , xm , ym , 449 - ang , 450 - ang , length , c ) ;
2013-07-01 23:57:56 +02:00
}
2013-08-08 03:59:29 +02:00
void Lucerna : : hand ( const Common : : Point & a , byte c ) {
if ( a . x = = 177 )
return ;
_vm - > _graphics - > _surface . drawLine ( xm , ym , a . x , a . y , c ) ;
2013-07-01 23:57:56 +02:00
}
2013-08-08 03:59:29 +02:00
void Lucerna : : refresh_hands ( ) {
const bytefield clockspace = { 61 , 166 , 66 , 200 } ;
for ( byte page_ = 0 ; page_ < 2 ; page_ + + )
_vm - > _trip - > getset [ page_ ] . remember ( clockspace ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : plothands ( ) {
2013-08-08 03:59:29 +02:00
/* off;*/
//setactivepage(3);
calchand ( _vm - > _gyro - > onh , 14 , ah , yellow ) ;
calchand ( _vm - > _gyro - > om * 6 , 17 , am , yellow ) ;
hand ( ah , brown ) ;
hand ( am , brown ) ;
calchand ( nh , 14 , ah , brown ) ;
calchand ( _vm - > _gyro - > m * 6 , 17 , am , brown ) ;
hand ( ah , yellow ) ;
hand ( am , yellow ) ;
//setactivepage(1 - cp);
refresh_hands ( ) ;
/* on;*/
}
void Lucerna : : chime ( ) {
warning ( " STUB: Lucerna::chime() " ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : clock_lucerna ( ) {
2013-08-08 03:59:29 +02:00
/* ...Clock. */
TimeDate t ;
_vm - > _system - > getTimeAndDate ( t ) ;
_vm - > _gyro - > h = t . tm_hour ;
_vm - > _gyro - > m = t . tm_min ;
_vm - > _gyro - > s = t . tm_sec ;
nh = ( _vm - > _gyro - > h % 12 ) * 30 + _vm - > _gyro - > m / 2 ;
if ( _vm - > _gyro - > oh ! = _vm - > _gyro - > h ) {
plothands ( ) ;
chime ( ) ;
}
if ( _vm - > _gyro - > om ! = _vm - > _gyro - > m )
plothands ( ) ;
if ( ( _vm - > _gyro - > h = = 0 ) & & ( _vm - > _gyro - > oh ! = 0 ) & & ( _vm - > _gyro - > oh ! = 17717 ) )
_vm - > _scrolls - > display ( Common : : String ( " Good morning! " ) + 13 + 13 + " Yes, it's just past midnight. Are you having an all-night Avvy session? Glad you like the game that much! " ) ;
_vm - > _gyro - > oh = _vm - > _gyro - > h ;
_vm - > _gyro - > onh = nh ;
_vm - > _gyro - > om = _vm - > _gyro - > m ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : delavvy ( ) {
byte page_ ;
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( false ) ;
2013-07-16 22:47:07 +02:00
2013-07-24 19:43:10 +02:00
triptype & with = _vm - > _trip - > tr [ 0 ] ;
2013-07-26 14:50:15 +02:00
/*for (page_ = 0; page_ <= 1; page_ ++)
mblit ( with . x / 8 , with . y , ( with . x + with . _info . xl ) / 8 + 1 , with . y + with . _info . yl , 3 , page_ ) ; */
2013-07-16 22:47:07 +02:00
2013-08-16 13:40:58 +02:00
CursorMan . showMouse ( true ) ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : gameover ( ) {
byte fv ;
int16 sx , sy ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > dna . user_moves_avvy = false ;
2013-07-01 23:57:56 +02:00
2013-08-07 10:30:44 +02:00
sx = _vm - > _trip - > tr [ 0 ] . x ;
sy = _vm - > _trip - > tr [ 0 ] . y ;
2013-07-01 23:57:56 +02:00
2013-08-07 10:30:44 +02:00
_vm - > _trip - > tr [ 0 ] . done ( ) ;
2013-08-25 13:25:50 +02:00
_vm - > _trip - > tr [ 0 ] . init ( 12 , true , _vm - > _trip ) ; // 12 = Avalot falls
2013-08-07 10:30:44 +02:00
_vm - > _trip - > tr [ 0 ] . step = 0 ;
_vm - > _trip - > tr [ 0 ] . appear ( sx , sy , 0 ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:42:41 +02:00
_vm - > _timeout - > set_up_timer ( 3 , _vm - > _timeout - > procavalot_falls , _vm - > _timeout - > reason_falling_over ) ;
2013-08-07 10:30:44 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > alive = false ;
2013-07-01 23:57:56 +02:00
}
/* OK. There are two kinds of redraw: Major and Minor. Minor is what happens
when you load a game , etc . Major redraws EVERYTHING . */
void Lucerna : : minor_redraw ( ) {
dusk ( ) ;
2013-08-20 13:37:14 +02:00
2013-07-24 18:25:07 +02:00
enterroom ( _vm - > _gyro - > dna . room , 0 ) ; /* Ped unknown or non-existant. */
2013-07-01 23:57:56 +02:00
2013-08-20 13:37:14 +02:00
for ( byte fv = 0 ; fv < = 1 ; fv + + ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > cp = 1 - _vm - > _gyro - > cp ;
2013-07-24 19:43:10 +02:00
_vm - > _trip - > getback ( ) ;
2013-07-01 23:57:56 +02:00
}
2013-07-17 12:27:08 +02:00
for ( byte i = 0 ; i < 3 ; i + + )
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > lastscore [ i ] = - 1 ; /* impossible digits */
2013-07-16 22:47:07 +02:00
showscore ( ) ;
2013-07-01 23:57:56 +02:00
dawn ( ) ;
}
void Lucerna : : major_redraw ( ) {
warning ( " STUB: Lucerna::major_redraw() " ) ;
}
uint16 Lucerna : : bearing ( byte whichped ) {
2013-08-25 13:52:05 +02:00
whichped - - ; // Different array indexes in Pascal and C.
const double rad2deg = 180 / 3.14 /*Pi*/ ;
2013-07-16 22:47:07 +02:00
2013-08-25 13:52:05 +02:00
if ( _vm - > _trip - > tr [ 0 ] . x = = _vm - > _gyro - > peds [ whichped ] . x )
return 0 ;
else
if ( _vm - > _trip - > tr [ 0 ] . x < _vm - > _gyro - > peds [ whichped ] . x )
return ( atan ( double ( ( _vm - > _trip - > tr [ 0 ] . y - _vm - > _gyro - > peds [ whichped ] . y ) )
/ ( _vm - > _trip - > tr [ 0 ] . x - _vm - > _gyro - > peds [ whichped ] . x ) ) * rad2deg ) + 90 ;
else
return ( atan ( double ( ( _vm - > _trip - > tr [ 0 ] . y - _vm - > _gyro - > peds [ whichped ] . y ) )
/ ( _vm - > _trip - > tr [ 0 ] . x - _vm - > _gyro - > peds [ whichped ] . x ) ) * rad2deg ) + 270 ;
2013-07-01 23:57:56 +02:00
}
2013-07-16 22:47:07 +02:00
void Lucerna : : sprite_run ( ) {
/* A sprite run is performed before displaying a scroll, if not all the
2013-07-01 23:57:56 +02:00
sprites are still . It performs two fast cycles , only using a few of
the links usually used , and without any extra animation . This should
make the sprites the same on both pages . */
byte fv ;
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > doing_sprite_run = true ;
2013-07-01 23:57:56 +02:00
2013-07-30 00:30:10 +02:00
_vm - > _trip - > get_back_loretta ( ) ;
_vm - > _trip - > trippancy_link ( ) ;
2013-07-01 23:57:56 +02:00
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > doing_sprite_run = false ;
2013-07-01 23:57:56 +02:00
}
void Lucerna : : fix_flashers ( ) {
2013-07-24 18:25:07 +02:00
_vm - > _gyro - > ledstatus = 177 ;
_vm - > _gyro - > oldrw = 177 ;
2013-07-24 19:43:10 +02:00
_vm - > _scrolls - > state ( 2 ) ;
2013-07-01 23:57:56 +02:00
showrw ( ) ;
}
2013-06-25 18:03:46 +02:00
2013-06-28 18:29:59 +02:00
} // End of namespace Avalanche