diff options
223 files changed, 9378 insertions, 1702 deletions
@@ -1,5 +1,5 @@ ScummVM -Copyright (C) 2001-2013 by the following: +Copyright (C) 2001-2014 by the following: If you have contributed to this project then you deserve to be on this list. Contact us (see: AUTHORS) and we'll add you. @@ -4,13 +4,12 @@ For a more comprehensive changelog of the latest experimental code, see: 1.7.0 (????-??-??) New Games: - Added support for Return to Ringworld. + - Added support for The Neverhood. General: - - Updated MT-32 emulation code to version 1.3.0. - - Switched from our custom JPEG decoder to libjpeg-turbo, which is faster - and can handle all kinds of exotic JPEG images :) - - Switched from our custom PNG decoder to libpng, which is faster and can - handle all kinds of exotic PNG images :) + - Updated Munt MT-32 emulation code to version 1.3.0. + - Switched from our custom JPEG and PNG decoders to libjpeg(-turbo) and + libpng, which are faster and can handle more images. (NOTE: The change to libpng was done in version 1.6.0, but it was not added to the NEWS file). diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index c946b8e747..0a4dcf3ea3 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -267,7 +267,11 @@ const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsMode } int SurfaceSdlGraphicsManager::getDefaultGraphicsMode() const { +#ifdef USE_SCALERS return GFX_DOUBLESIZE; +#else + return GFX_NORMAL; +#endif } void SurfaceSdlGraphicsManager::resetGraphicsScale() { @@ -1076,7 +1080,9 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() { for (r = _dirtyRectList; r != lastRect; ++r) { register int dst_y = r->y + _currentShakePos; register int dst_h = 0; +#ifdef USE_SCALERS register int orig_dst_y = 0; +#endif register int rx1 = r->x * scale1; if (dst_y < height) { @@ -1084,7 +1090,9 @@ void SurfaceSdlGraphicsManager::internUpdateScreen() { if (dst_h > height - dst_y) dst_h = height - dst_y; +#ifdef USE_SCALERS orig_dst_y = dst_y; +#endif dst_y = dst_y * scale1; if (_videoMode.aspectRatioCorrection && !_overlayVisible) diff --git a/backends/platform/android/gfx.cpp b/backends/platform/android/gfx.cpp index 882dcff9a4..0ce95a3cfb 100644 --- a/backends/platform/android/gfx.cpp +++ b/backends/platform/android/gfx.cpp @@ -233,7 +233,7 @@ void OSystem_Android::initViewport() { GLCALL(glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST)); GLCALL(glEnable(GL_BLEND)); - GLCALL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); + GLCALL(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)); GLCALL(glEnableClientState(GL_VERTEX_ARRAY)); GLCALL(glEnableClientState(GL_TEXTURE_COORD_ARRAY)); @@ -726,7 +726,7 @@ void OSystem_Android::setMouseCursor(const void *buf, uint w, uint h, _mouse_keycolor = keycolor; p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } if (w == 0 || h == 0) @@ -779,7 +779,7 @@ void OSystem_Android::setCursorPaletteInternal(const byte *colors, WRITE_UINT16(p, pf.RGBToColor(colors[0], colors[1], colors[2])); p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } void OSystem_Android::setCursorPalette(const byte *colors, @@ -821,7 +821,7 @@ void OSystem_Android::disableCursorPalette() { } byte *p = _mouse_texture_palette->palette() + _mouse_keycolor * 2; - WRITE_UINT16(p, READ_UINT16(p) & ~1); + WRITE_UINT16(p, 0); } } diff --git a/backends/platform/dc/dc-fs.cpp b/backends/platform/dc/dc-fs.cpp index 36f5a1465c..f850c9d26f 100644 --- a/backends/platform/dc/dc-fs.cpp +++ b/backends/platform/dc/dc-fs.cpp @@ -27,7 +27,9 @@ #include <ronin/cdfs.h> #include <stdio.h> +#define usleep usleep_unistd #include <unistd.h> +#undef usleep /** * Implementation of the ScummVM file system API based on Ronin. diff --git a/backends/platform/dc/dc.h b/backends/platform/dc/dc.h index d62ced02e1..ba60c7740e 100644 --- a/backends/platform/dc/dc.h +++ b/backends/platform/dc/dc.h @@ -43,7 +43,9 @@ class Interactive public: virtual int key(int k, byte &shiftFlags) = 0; virtual void mouse(int x, int y) = 0; + virtual ~Interactive() = 0; }; +inline Interactive::~Interactive() { } #include "softkbd.h" diff --git a/backends/platform/dc/dcmain.cpp b/backends/platform/dc/dcmain.cpp index bec1fdae3a..36a22c4b5c 100644 --- a/backends/platform/dc/dcmain.cpp +++ b/backends/platform/dc/dcmain.cpp @@ -79,13 +79,14 @@ static bool find_track(int track, int &first_sec, int &last_sec) if (first < 1 || last > 99 || first > last) return false; for (i=first; i<=last; i++) - if (!(TOC_CTRL(toc->entry[i-1])&4)) + if (!(TOC_CTRL(toc->entry[i-1])&4)) { if (track==1) { first_sec = TOC_LBA(toc->entry[i-1]); last_sec = TOC_LBA(toc->entry[i]); return true; } else --track; + } return false; } @@ -281,7 +282,7 @@ namespace DC_Flash { if((r = syscall_read_flash(info[0] + (bmb++ << 6), bm, 64))<0) return r; } - if(!(bm[(b>>3)&63] & (0x80>>(b&7)))) + if(!(bm[(b>>3)&63] & (0x80>>(b&7)))) { if((r = syscall_read_flash(info[0] + ((b+1) << 6), buf, 64))<0) return r; else if((s=*(unsigned short *)(buf+0)) == sec && @@ -289,6 +290,7 @@ namespace DC_Flash { memcpy(dst+(s-sec)*60, buf+2, 60); got=1; } + } } return got; } diff --git a/backends/platform/dc/icon.cpp b/backends/platform/dc/icon.cpp index cf7afc82e0..28edf27f4f 100644 --- a/backends/platform/dc/icon.cpp +++ b/backends/platform/dc/icon.cpp @@ -47,8 +47,8 @@ void Icon::create_vmicon(void *buffer) void Icon::create_texture() { - static char tt[16] = { 0, 1, 4, 5, 16, 17, 20, 21, - 64, 65, 68, 69, 80, 81, 84, 85 }; + static unsigned char tt[16] = { 0, 1, 4, 5, 16, 17, 20, 21, + 64, 65, 68, 69, 80, 81, 84, 85 }; unsigned short *tex = (unsigned short *)ta_txalloc(512); unsigned short *linebase; unsigned char *src = bitmap+sizeof(bitmap)-17; diff --git a/backends/platform/dc/input.cpp b/backends/platform/dc/input.cpp index 7b21c76efa..5c6adf6c7c 100644 --- a/backends/platform/dc/input.cpp +++ b/backends/platform/dc/input.cpp @@ -50,10 +50,10 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, else if (!(buttons & 512)) newkey = ' '; else if (!(buttons & 1024)) newkey = numpadmap[(buttons>>4)&15]; - if (!(buttons & 128)) if (inter) newkey = 1001; else mouse_x++; - if (!(buttons & 64)) if (inter) newkey = 1002; else mouse_x--; - if (!(buttons & 32)) if (inter) newkey = 1003; else mouse_y++; - if (!(buttons & 16)) if (inter) newkey = 1004; else mouse_y--; + if (!(buttons & 128)) { if (inter) newkey = 1001; else mouse_x++; } + if (!(buttons & 64)) { if (inter) newkey = 1002; else mouse_x--; } + if (!(buttons & 32)) { if (inter) newkey = 1003; else mouse_y++; } + if (!(buttons & 16)) { if (inter) newkey = 1004; else mouse_y--; } mouse_x += ((int)pad->cond.controller.joyx-128)>>4; mouse_y += ((int)pad->cond.controller.joyy-128)>>4; @@ -157,7 +157,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, return -Common::EVENT_RBUTTONUP; } - if (mouse_wheel != lastwheel) + if (mouse_wheel != lastwheel) { if (((int8)(mouse_wheel - lastwheel)) > 0) { lastwheel++; return -Common::EVENT_WHEELDOWN; @@ -165,6 +165,7 @@ int handleInput(struct mapledev *pad, int &mouse_x, int &mouse_y, --lastwheel; return -Common::EVENT_WHEELUP; } + } if (newkey && inter && newkey != lastkey) { int transkey = inter->key(newkey, shiftFlags); diff --git a/backends/platform/dc/ip.txt.in b/backends/platform/dc/ip.txt.in index 23424e0950..539d29dd1e 100644 --- a/backends/platform/dc/ip.txt.in +++ b/backends/platform/dc/ip.txt.in @@ -7,5 +7,5 @@ Product No : T0000 Version : @VERSION@ Release Date : @DATE@ Boot Filename : SCUMMVM.BIN -SW Maker Name : The ScummVM team +SW Maker Name : The ScummVM Team Game Title : ScummVM diff --git a/backends/platform/dc/softkbd.h b/backends/platform/dc/softkbd.h index 8f87d12baa..27826c2744 100644 --- a/backends/platform/dc/softkbd.h +++ b/backends/platform/dc/softkbd.h @@ -40,6 +40,7 @@ class SoftKeyboard : public Interactive public: SoftKeyboard(const OSystem_Dreamcast *os); + virtual ~SoftKeyboard() {} void draw(float x, float y, int transp = 0); int key(int k, byte &shiftFlags); diff --git a/backends/platform/symbian/README b/backends/platform/symbian/README index f2bca8c109..8a44e9399d 100644 --- a/backends/platform/symbian/README +++ b/backends/platform/symbian/README @@ -1,7 +1,7 @@ ScummVM - ScummVM ported to EPOC/SymbianOS - Copyright (C) 2008-2013 ScummVM Team + Copyright (C) 2008-2014 ScummVM Team Copyright (C) 2013-2013 Fedor Strizhniou aka zanac Copyright (C) 2003-2013 Lars 'AnotherGuest' Persson Copyright (C) 2002-2008 Jurgen 'SumthinWicked' Braam diff --git a/backends/platform/symbian/S60/ScummVM_S60.mmp.in b/backends/platform/symbian/S60/ScummVM_S60.mmp.in index 28bd11dec6..ca2ec7f930 100644 --- a/backends/platform/symbian/S60/ScummVM_S60.mmp.in +++ b/backends/platform/symbian/S60/ScummVM_S60.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60/ScummVM_S60_App.mmp b/backends/platform/symbian/S60/ScummVM_S60_App.mmp index 38d6f19590..2fc39c6838 100644 --- a/backends/platform/symbian/S60/ScummVM_S60_App.mmp +++ b/backends/platform/symbian/S60/ScummVM_S60_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in index 99b89efba8..7b9273f2dd 100644 --- a/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_A0000658_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in index 1e0f282bc4..09ff968706 100644 --- a/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in +++ b/backends/platform/symbian/S60v3/ScummVM_S60v3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S80/ScummVM_S80.mmp.in b/backends/platform/symbian/S80/ScummVM_S80.mmp.in index d9b9a5c948..34d1979fe5 100644 --- a/backends/platform/symbian/S80/ScummVM_S80.mmp.in +++ b/backends/platform/symbian/S80/ScummVM_S80.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S80/ScummVM_S80_App.mmp b/backends/platform/symbian/S80/ScummVM_S80_App.mmp index 30b1c3f58b..de96963d80 100644 --- a/backends/platform/symbian/S80/ScummVM_S80_App.mmp +++ b/backends/platform/symbian/S80/ScummVM_S80_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S90/Scummvm_S90.mmp.in b/backends/platform/symbian/S90/Scummvm_S90.mmp.in index 790dca14f0..e65397b145 100644 --- a/backends/platform/symbian/S90/Scummvm_S90.mmp.in +++ b/backends/platform/symbian/S90/Scummvm_S90.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/S90/Scummvm_S90_App.mmp b/backends/platform/symbian/S90/Scummvm_S90_App.mmp index cf17f103ef..88a3e4d221 100644 --- a/backends/platform/symbian/S90/Scummvm_S90_App.mmp +++ b/backends/platform/symbian/S90/Scummvm_S90_App.mmp @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ2/ScummVM.rss b/backends/platform/symbian/UIQ2/ScummVM.rss index bfdd07e898..2e02f1da1d 100644 --- a/backends/platform/symbian/UIQ2/ScummVM.rss +++ b/backends/platform/symbian/UIQ2/ScummVM.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in b/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in index 80ba37d694..68f5bd0cab 100644 --- a/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in +++ b/backends/platform/symbian/UIQ2/ScummVM_UIQ2.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2006 The ScummVM project + * Copyright (C) 2005-2006 The ScummVM Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License diff --git a/backends/platform/symbian/UIQ3/ScummVM.rss b/backends/platform/symbian/UIQ3/ScummVM.rss index b7f0a17113..11cc767671 100644 --- a/backends/platform/symbian/UIQ3/ScummVM.rss +++ b/backends/platform/symbian/UIQ3/ScummVM.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss index b7f0a17113..11cc767671 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in index fac178ad15..c68e780f11 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_A0000658_UIQ3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2009 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2009 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in index 0f1ec7f60f..f554bb3afd 100644 --- a/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in +++ b/backends/platform/symbian/UIQ3/ScummVM_UIQ3.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss index 47e7c44642..f54bcc24d3 100644 --- a/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss +++ b/backends/platform/symbian/UIQ3/scummvm_A0000658_loc.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_agi.mmp.in b/backends/platform/symbian/mmp/scummvm_agi.mmp.in index 892ed57732..a3eaa71065 100644 --- a/backends/platform/symbian/mmp/scummvm_agi.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agi.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_agos.mmp.in b/backends/platform/symbian/mmp/scummvm_agos.mmp.in index d3bc84ed51..92b8862794 100644 --- a/backends/platform/symbian/mmp/scummvm_agos.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_agos.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in index 12f157f1e7..1093181a4e 100644 --- a/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_avalanche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_base.mmp.in b/backends/platform/symbian/mmp/scummvm_base.mmp.in index bf12bffb41..358a2ec961 100644 --- a/backends/platform/symbian/mmp/scummvm_base.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_base.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cge.mmp.in b/backends/platform/symbian/mmp/scummvm_cge.mmp.in index 66a689efd8..2d93671938 100644 --- a/backends/platform/symbian/mmp/scummvm_cge.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cge.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cine.mmp.in b/backends/platform/symbian/mmp/scummvm_cine.mmp.in index cb7143b837..a308f92813 100644 --- a/backends/platform/symbian/mmp/scummvm_cine.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cine.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_composer.mmp.in b/backends/platform/symbian/mmp/scummvm_composer.mmp.in index 19215f65a6..cfe43b59a2 100644 --- a/backends/platform/symbian/mmp/scummvm_composer.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_composer.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in index c26e93dedc..58aed70f81 100644 --- a/backends/platform/symbian/mmp/scummvm_cruise.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_cruise.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_draci.mmp.in b/backends/platform/symbian/mmp/scummvm_draci.mmp.in index 52f862bc6f..ba1759c00b 100644 --- a/backends/platform/symbian/mmp/scummvm_draci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_draci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in index 9ea02fefe8..c4419dd71e 100644 --- a/backends/platform/symbian/mmp/scummvm_drascula.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_drascula.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in index b6369b7d2b..a5cc758ff6 100644 --- a/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_dreamweb.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in index 4a8f69f709..59666b7b74 100644 --- a/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_fullpipe.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_gob.mmp.in b/backends/platform/symbian/mmp/scummvm_gob.mmp.in index 906d54b487..c2c36626ff 100644 --- a/backends/platform/symbian/mmp/scummvm_gob.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_gob.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in index e7f70bc110..639a794260 100644 --- a/backends/platform/symbian/mmp/scummvm_groovie.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_groovie.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in index 4509026b6c..cfe47d09ba 100644 --- a/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hopkins.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in index 13dd7efa1e..fceeb5e5d1 100644 --- a/backends/platform/symbian/mmp/scummvm_hugo.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_hugo.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in index 124f7c0dc3..2f8d22595e 100644 --- a/backends/platform/symbian/mmp/scummvm_kyra.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_kyra.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in index b8db95ea0c..fe2ebdfa1b 100644 --- a/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lastexpress.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_lure.mmp.in b/backends/platform/symbian/mmp/scummvm_lure.mmp.in index 84c3eecd5e..f8b42bf337 100644 --- a/backends/platform/symbian/mmp/scummvm_lure.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_lure.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_m4.mmp.in b/backends/platform/symbian/mmp/scummvm_m4.mmp.in index e69b40ceb0..05395c1816 100644 --- a/backends/platform/symbian/mmp/scummvm_m4.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_m4.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_made.mmp.in b/backends/platform/symbian/mmp/scummvm_made.mmp.in index b52d9cc6cb..b0a0e7d34c 100644 --- a/backends/platform/symbian/mmp/scummvm_made.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_made.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in index 3fe9af68f6..005b5f873e 100644 --- a/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mohawk.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in index 3969a3af9c..90af4cb835 100644 --- a/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_mortevielle.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in index 3a49093c43..b65f0f6ab6 100644 --- a/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_neverhood.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in index f8ee389577..92d916224e 100644 --- a/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_parallaction.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in index fefc63e936..66863f2d74 100644 --- a/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_pegasus.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_queen.mmp.in b/backends/platform/symbian/mmp/scummvm_queen.mmp.in index f507f482f9..3d8cfc1949 100644 --- a/backends/platform/symbian/mmp/scummvm_queen.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_queen.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_saga.mmp.in b/backends/platform/symbian/mmp/scummvm_saga.mmp.in index cd158556dc..9ca633972b 100644 --- a/backends/platform/symbian/mmp/scummvm_saga.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_saga.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sci.mmp.in b/backends/platform/symbian/mmp/scummvm_sci.mmp.in index 333a6d43c2..109b277667 100644 --- a/backends/platform/symbian/mmp/scummvm_sci.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sci.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in index c07725e002..cc008766a8 100644 --- a/backends/platform/symbian/mmp/scummvm_scumm.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_scumm.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sky.mmp.in b/backends/platform/symbian/mmp/scummvm_sky.mmp.in index b5048106dc..0ab35dffd7 100644 --- a/backends/platform/symbian/mmp/scummvm_sky.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sky.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in index 578839e8c4..3b709fe1de 100644 --- a/backends/platform/symbian/mmp/scummvm_sword1.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword1.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in index 23a055c99c..ec5ccaefc9 100644 --- a/backends/platform/symbian/mmp/scummvm_sword2.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword2.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in index e14501e42d..62907f9245 100644 --- a/backends/platform/symbian/mmp/scummvm_sword25.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_sword25.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in index 58bfa4c337..73a86b9913 100644 --- a/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_teenagent.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in index ce6a18508d..07d1df625d 100644 --- a/backends/platform/symbian/mmp/scummvm_testbed.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_testbed.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in index 4cdd0bd774..6436aaaa9b 100644 --- a/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tinsel.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in index 9f9d1c1dda..8685f80f71 100644 --- a/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toltecs.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tony.mmp.in b/backends/platform/symbian/mmp/scummvm_tony.mmp.in index d80d82a9c5..01d4712cbb 100644 --- a/backends/platform/symbian/mmp/scummvm_tony.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tony.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_toon.mmp.in b/backends/platform/symbian/mmp/scummvm_toon.mmp.in index 00f84d2bec..2cddddd777 100644 --- a/backends/platform/symbian/mmp/scummvm_toon.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_toon.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_touche.mmp.in b/backends/platform/symbian/mmp/scummvm_touche.mmp.in index e59dd0cd00..24ca777c70 100644 --- a/backends/platform/symbian/mmp/scummvm_touche.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_touche.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in index cd4aa158dc..d017be593b 100644 --- a/backends/platform/symbian/mmp/scummvm_tsage.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tsage.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in index 0ff8eb9920..f30bbfc469 100644 --- a/backends/platform/symbian/mmp/scummvm_tucker.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_tucker.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in index ebe762fe36..5d26f36df5 100644 --- a/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_wintermute.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in index 3687b10fec..a007f45f5b 100644 --- a/backends/platform/symbian/mmp/scummvm_zvision.mmp.in +++ b/backends/platform/symbian/mmp/scummvm_zvision.mmp.in @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * Copyright (C) 2013 Strizniou Fedor * * ScummVM is the legal property of its developers, whose names diff --git a/backends/platform/symbian/res/ScummVmAif.rss b/backends/platform/symbian/res/ScummVmAif.rss index fab2cadbb8..2dbf436a8f 100644 --- a/backends/platform/symbian/res/ScummVmAif.rss +++ b/backends/platform/symbian/res/ScummVmAif.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/res/scummvm.rss b/backends/platform/symbian/res/scummvm.rss index 7e667f1cf3..6a0ab24ff0 100644 --- a/backends/platform/symbian/res/scummvm.rss +++ b/backends/platform/symbian/res/scummvm.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/res/scummvm_A0000658.rss b/backends/platform/symbian/res/scummvm_A0000658.rss index 3325d72249..562fef54c6 100644 --- a/backends/platform/symbian/res/scummvm_A0000658.rss +++ b/backends/platform/symbian/res/scummvm_A0000658.rss @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT diff --git a/backends/platform/symbian/src/ScummVm.hrh b/backends/platform/symbian/src/ScummVm.hrh index c43a9da118..316e4d08f6 100644 --- a/backends/platform/symbian/src/ScummVm.hrh +++ b/backends/platform/symbian/src/ScummVm.hrh @@ -2,7 +2,7 @@ * Copyright (C) 2003-2005 Andreas 'Sprawl' Karlsson - Original EPOC port, ESDL * Copyright (C) 2003-2005 Lars 'AnotherGuest' Persson - Original EPOC port, Audio System * Copyright (C) 2005 Jurgen 'SumthinWicked' Braam - EPOC/CVS maintainer - * Copyright (C) 2005-2013 The ScummVM project + * Copyright (C) 2005-2014 The ScummVM Team * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT @@ -2423,6 +2423,8 @@ if test -n "$_host"; then CXXFLAGS="$CXXFLAGS -fschedule-insns2" CXXFLAGS="$CXXFLAGS -fomit-frame-pointer" CXXFLAGS="$CXXFLAGS -fdelete-null-pointer-checks" + # no-delayed-branch is a workaround for GCC bug #42841 - "SH: Assembler complains pcrel too far." + CXXFLAGS="$CXXFLAGS -fno-delayed-branch" _backend="dc" _build_scalers=no _mad=yes @@ -3667,6 +3669,25 @@ fi if test "$_readline" = yes ; then LIBS="$LIBS $READLINE_LIBS $_READLINE_LIBS" INCLUDES="$INCLUDES $READLINE_CFLAGS" + + # + # Check the type of rl_completion_entry_function. + # It can be int(*)(const char *, int) or char *(*)(const char *, int). + # + cat > $TMPC << EOF +#include <stdio.h> +#include <readline/readline.h> +#include <readline/history.h> + +int readline_completionFunction(const char *, int); + +int main(void) { + char *x = readline(""); + rl_completion_entry_function = &readline_completionFunction; +} +EOF + cc_check -c && add_line_to_config_h '#define USE_READLINE_INT_COMPLETION' + fi define_in_config_h_if_yes "$_readline" 'USE_READLINE' diff --git a/dists/debian/copyright b/dists/debian/copyright index 1cccd01a07..1317fc6cee 100644 --- a/dists/debian/copyright +++ b/dists/debian/copyright @@ -7,7 +7,7 @@ It was downloaded from <http://www.scummvm.org/>. Upstream Authors: see `/usr/share/doc/scummvm/AUTHORS'. -Scummvm is Copyright © 2002-2013 The ScummVM Project +ScummVM is Copyright © 2002-2014 The ScummVM Team 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 diff --git a/dists/macosx/Info.plist b/dists/macosx/Info.plist index b9a4eff1b8..63813c06de 100644 --- a/dists/macosx/Info.plist +++ b/dists/macosx/Info.plist @@ -28,7 +28,7 @@ <key>CFBundleExecutable</key> <string>scummvm</string> <key>CFBundleGetInfoString</key> - <string>1.7.0git, Copyright 2001-2013 The ScummVM team</string> + <string>1.7.0git, Copyright 2001-2014 The ScummVM Team</string> <key>CFBundleIconFile</key> <string>scummvm.icns</string> <key>CFBundleIdentifier</key> @@ -46,7 +46,7 @@ <key>NSPrincipalClass</key> <string>NSApplication</string> <key>NSHumanReadableCopyright</key> - <string>Copyright 2001-2013 The ScummVM team</string> + <string>Copyright 2001-2014 The ScummVM Team</string> <key>SUFeedURL</key> <string>http://www.scummvm.org/appcasts/macosx/release.xml</string> <key>SUPublicDSAKeyFile</key> diff --git a/dists/macosx/Info.plist.in b/dists/macosx/Info.plist.in index b810b7ea5a..9ef1584440 100644 --- a/dists/macosx/Info.plist.in +++ b/dists/macosx/Info.plist.in @@ -28,7 +28,7 @@ <key>CFBundleExecutable</key> <string>scummvm</string> <key>CFBundleGetInfoString</key> - <string>@VERSION@, Copyright 2001-2013 The ScummVM team</string> + <string>@VERSION@, Copyright 2001-2014 The ScummVM Team</string> <key>CFBundleIconFile</key> <string>scummvm.icns</string> <key>CFBundleIdentifier</key> @@ -46,7 +46,7 @@ <key>NSPrincipalClass</key> <string>NSApplication</string> <key>NSHumanReadableCopyright</key> - <string>Copyright 2001-2013 The ScummVM team</string> + <string>Copyright 2001-2014 The ScummVM Team</string> <key>SUFeedURL</key> <string>http://www.scummvm.org/appcasts/macosx/release.xml</string> <key>SUPublicDSAKeyFile</key> diff --git a/dists/scummvm.rc b/dists/scummvm.rc index 037db3ef62..f0609c1a79 100644 --- a/dists/scummvm.rc +++ b/dists/scummvm.rc @@ -81,7 +81,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "1.7.0git\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright © 2001-2013 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright © 2001-2014 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" diff --git a/dists/scummvm.rc.in b/dists/scummvm.rc.in index c18c18ef63..401c0abb0d 100644 --- a/dists/scummvm.rc.in +++ b/dists/scummvm.rc.in @@ -81,7 +81,7 @@ BEGIN VALUE "FileDescription", "http://www.scummvm.org/\0" VALUE "FileVersion", "@VERSION@\0" VALUE "InternalName", "scummvm\0" - VALUE "LegalCopyright", "Copyright © 2001-2013 The ScummVM Team\0" + VALUE "LegalCopyright", "Copyright © 2001-2014 The ScummVM Team\0" VALUE "LegalTrademarks", "'SCUMM', and all SCUMM games are a TM of LucasArts. Simon The Sorcerer is a TM of AdventureSoft. Beneath a Steel Sky and Broken Sword are a TM of Revolution. Flight of the Amazon Queen is a TM of John Passfield and Steve Stamatiadis. \0" VALUE "OriginalFilename", "scummvm.exe\0" VALUE "ProductName", "ScummVM\0" diff --git a/dists/win32/ScummVM.iss b/dists/win32/ScummVM.iss index fa0f760f59..5afb407177 100644 --- a/dists/win32/ScummVM.iss +++ b/dists/win32/ScummVM.iss @@ -1,5 +1,5 @@ [Setup] -AppCopyright=2013 +AppCopyright=2014 AppName=ScummVM AppVerName=ScummVM Git AppPublisher=The ScummVM Team diff --git a/dists/win32/migration.bat b/dists/win32/migration.bat index b4b00c02cc..e1b27a1fb3 100644 --- a/dists/win32/migration.bat +++ b/dists/win32/migration.bat @@ -4,7 +4,7 @@ :: This script will copy any saved games located in the :: old default location, to the new default location. :: -:: (c) 2012-2013 ScummVM Team +:: (c) 2012-2014 ScummVM Team :: @echo off diff --git a/dists/win32/scummvm.nsi b/dists/win32/scummvm.nsi index 5357be9fe4..602b9fd6c3 100644 --- a/dists/win32/scummvm.nsi +++ b/dists/win32/scummvm.nsi @@ -76,7 +76,7 @@ Name ScummVM !define COMPANY "ScummVM Team" !define URL "http://scummvm.org/" !define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!" -!define COPYRIGHT "Copyright © 2001-2013 The ScummVM Team" +!define COPYRIGHT "Copyright © 2001-2014 The ScummVM Team" ######################################################################################### # Installer configuration diff --git a/dists/win32/scummvm.nsi.in b/dists/win32/scummvm.nsi.in index 9f8bd1dad2..b8ddc74a86 100644 --- a/dists/win32/scummvm.nsi.in +++ b/dists/win32/scummvm.nsi.in @@ -76,7 +76,7 @@ Name ScummVM !define COMPANY "ScummVM Team" !define URL "http://scummvm.org/" !define DESCRIPTION "ScummVM Installer. Look! A three headed monkey (TM)!" -!define COPYRIGHT "Copyright © 2001-2013 The ScummVM Team" +!define COPYRIGHT "Copyright © 2001-2014 The ScummVM Team" ######################################################################################### # Installer configuration diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index cef4088722..66097b2812 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -1433,6 +1433,7 @@ int Animation::getAvvyClothes() { } void Animation::resetVariables() { + setDirection(kDirUp); _geidaSpin = 0; _geidaTime = 0; _arrowTriggered = false; diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 2bb927646e..dbe434cde3 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -144,30 +144,7 @@ void AvalancheEngine::initVariables() { _currentMouse = 177; _holdLeftMouse = false; - _jumpStatus = 0; - _mushroomGrowing = false; - _crapulusWillTell = false; - _enterCatacombsFromLustiesRoom = false; - _teetotal = false; - _malagauche = 0; - _drinking = '\0'; - _enteredLustiesRoomAsMonk = false; - _catacombX = 0; - _catacombY = 0; - _avvysInTheCupboard = false; - _geidaFollows = false; - _givenPotionToGeida = false; - _lustieIsAsleep = false; - _beenTiedUp = false; - _sittingInPub = false; - _spurgeTalkCount = 0; - _metAvaroid = false; - _takenMushroom = false; - _givenPenToAyles = false; - _askedDogfoodAboutNim = false; - _spludwickAtHome = false; - _passedCwytalotInHerts = false; - _lastRoom = _lastRoomNotMap = kRoomDummy; + resetVariables(); } Common::ErrorCode AvalancheEngine::initialize() { @@ -444,7 +421,7 @@ bool AvalancheEngine::loadGame(const int16 slot) { t.tm_mon = f->readSint16LE(); t.tm_year = f->readSint16LE(); - resetVariables(); + resetAllVariables(); Common::Serializer sz(f, NULL); synchronize(sz); diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 87eb3c2158..7392bf3fae 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -340,6 +340,7 @@ private: void checkClick(); void fixFlashers(); void loadAlso(byte num); + void resetAllVariables(); void resetVariables(); }; diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ec3f81e55d..9555bb4505 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1410,7 +1410,6 @@ Common::String AvalancheEngine::intToStr(int32 num) { } void AvalancheEngine::resetVariables() { - _animation->setDirection(kDirUp); _carryNum = 0; for (int i = 0; i < kObjectNum; i++) _objects[i] = false; @@ -1479,7 +1478,10 @@ void AvalancheEngine::resetVariables() { _givenPenToAyles = false; _askedDogfoodAboutNim = false; _startTime = getTimeInSeconds(); +} +void AvalancheEngine::resetAllVariables() { + resetVariables(); _parser->resetVariables(); _nim->resetVariables(); _animation->resetVariables(); @@ -1501,7 +1503,7 @@ void AvalancheEngine::newGame() { avvy->init(0, true); _alive = true; - resetVariables(); + resetAllVariables(); _dialogs->setBubbleStateNatural(); diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 811e71ee1d..7ba482f049 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -1040,6 +1040,8 @@ bool Parser::isHolding() { // Also object if ((51 <= _thing) && (_thing <= 99)) return true; + if (_thing == 0) + return false; bool holdingResult = false; diff --git a/engines/fullpipe/constants.h b/engines/fullpipe/constants.h index f44b39760d..4f8e33c111 100644 --- a/engines/fullpipe/constants.h +++ b/engines/fullpipe/constants.h @@ -25,224 +25,32 @@ namespace Fullpipe { -#define ANI_BALLDROP 2685 -#define ANI_BATUTA 737 -#define ANI_BIGBALL 4923 -#define ANI_BIGLUK 909 -#define ANI_BOOT_1 4231 -#define ANI_BUTTON 598 -#define ANI_BUTTON_6 2988 -#define ANI_CLOCK 588 -#define ANI_CLOCK_8 2989 -#define ANI_CORNERSITTER 71 -#define ANI_DOMINO_3 2732 -#define ANI_DADAYASHIK 306 -#define ANI_EGGEATER 334 -#define ANI_EGGIE 4929 -#define ANI_GUM 978 -#define ANI_HAND 601 -#define ANI_HANDLE 622 -#define ANI_HOOLIGAN 808 -#define ANI_IN1MAN 5110 -#define ANI_INV_COIN 875 -#define ANI_INV_EGGAPL 1564 -#define ANI_INV_EGGBOOT 1570 -#define ANI_INV_EGGCOIN 1567 -#define ANI_INV_EGGDOM 1561 -#define ANI_INV_EGGGLS 1573 -#define ANI_INV_HANDLE 893 +// Common +#define ANI_FLY 4916 #define ANI_INV_MAP 5321 -#define ANI_KOZAWKA 495 #define ANI_LIFTBUTTON 2751 -#define ANI_LUKE 803 -#define ANI_MAMASHA 656 -#define ANI_MAMASHA_4 660 #define ANI_MAN 322 -#define ANI_NADUVATEL 944 -#define ANI_NEWBALL 1073 -#define ANI_OTMOROZ 419 -#define ANI_PACHKA 975 -#define ANI_PACHKA2 3008 -#define ANI_PLANK 501 -#define ANI_PLUSMINUS 2938 -#define ANI_SC2_BOX 1020 -#define ANI_SC4_BOOT 1035 -#define ANI_SC4_COIN 690 -#define ANI_SC7_BOX 791 -#define ANI_SPEAKER_4 3275 -#define ANI_SPRING 542 -#define ANI_VMYATS 764 -#define MSG_CLICKBOTTLE 569 -#define MSG_CLICKBUTTON 609 -#define MSG_CLICKPLANK 549 +#define ANI_PBAR 896 #define MSG_CMN_WINARCADE 4778 #define MSG_DISABLESAVES 5201 #define MSG_ENABLESAVES 5202 #define MSG_HMRKICK_METAL 4764 #define MSG_HMRKICK_STUCCO 4765 -#define MSG_INTR_ENDINTRO 5139 -#define MSG_INTR_GETUPMAN 5135 -#define MSG_INTR_SWITCHTO1 5145 -#define MSG_INTR_SWITCHTO2 5134 -#define MSG_KOZAWRESTART 546 -#define MSG_LIFT_CLICKBUTTON 2780 -#define MSG_LIFT_CLOSEDOOR 5194 -#define MSG_LIFT_EXITLIFT 5187 -#define MSG_LIFT_GO 1065 -#define MSG_LIFT_STARTEXITQUEUE 5186 -#define MSG_LOWERPLANK 540 #define MSG_MANSHADOWSOFF 5196 #define MSG_MANSHADOWSON 5197 -#define MSG_RAISEPLANK 547 -#define MSG_RESTARTGAME 4767 -#define MSG_SC1_SHOWOSK 1019 -#define MSG_SC1_SHOWOSK2 468 -#define MSG_SC1_UTRUBACLICK 1100 -#define MSG_SC2_HIDELADDER 1023 -#define MSG_SC2_LADDERCLICK 1101 -#define MSG_SC2_PUTMANUP 1026 -#define MSG_SC2_SHOWLADDER 1027 -#define MSG_SC3_HIDEDOMINO 3177 -#define MSG_SC3_ONTAKECOIN 5338 -#define MSG_SC3_RELEASEEGG 2681 -#define MSG_SC3_TAKEEGG 1583 -#define MSG_SC3_TESTFAT 1582 -#define MSG_SC3_UTRUBACLICK 1103 -#define MSG_SC4_COINOUT 2895 -#define MSG_SC4_COINPUT 1032 -#define MSG_SC4_CLICKLADDER 1439 -#define MSG_SC4_DROPBOTTLE 2896 -#define MSG_SC4_HANDOVER 2960 -#define MSG_SC4_HIDEBOOT 4563 -#define MSG_SC4_KOZAWFALL 2858 -#define MSG_SC4_MANFROMBOTTLE 2854 -#define MSG_SC4_MANTOBOTTLE 2852 -#define MSG_SC5_BGRSOUNDOFF 5315 -#define MSG_SC5_BGRSOUNDON 5314 -#define MSG_SC5_HANDLEDOWN 916 -#define MSG_SC5_HANDLEUP 915 -#define MSG_SC5_HIDEHANDLE 917 -#define MSG_SC5_MAKEMANFLIGHT 1136 -#define MSG_SC5_MAKEOTMFEEDBACK 1169 -#define MSG_SC5_SHOWHANDLE 918 -#define MSG_SC5_TESTLUK 914 -#define MSG_SC6_BTNPUSH 1017 -#define MSG_SC6_ENABLEDROPS 687 -#define MSG_SC6_INSTHANDLE 1012 -#define MSG_SC6_JUMPBK 2900 -#define MSG_SC6_JUMPFW 2901 -#define MSG_SC6_RESTORESCROLL 2906 -#define MSG_SC6_SHOWNEXTBALL 790 -#define MSG_SC6_STARTDROPS 2897 -#define MSG_SC6_TAKEBALL 682 -#define MSG_SC6_TESTNUMBALLS 2904 -#define MSG_SC6_UTRUBACLICK 1105 -#define MSG_SC7_CLOSELUKE 822 -#define MSG_SC7_HIDEBOX 817 -#define MSG_SC7_HIDELUKE 821 -#define MSG_SC7_OPENLUKE 823 -#define MSG_SC7_PULL 2943 -#define MSG_SC7_SHOWBOX 816 -#define MSG_SC8_ARCADENOW 1044 -#define MSG_SC8_ENTERUP 3037 -#define MSG_SC8_GETHIMUP 789 -#define MSG_SC8_HIDELADDER_D 1107 -#define MSG_SC8_RESUMEFLIGHT 784 -#define MSG_SC8_STANDUP 2976 -#define MSG_SC10_CLICKGUM 992 -#define MSG_SC10_HIDEGUM 993 -#define MSG_SC10_LADDERTOBACK 3002 -#define MSG_SC10_LADDERTOFORE 3004 -#define MSG_SC10_SHOWGUM 994 -#define MSG_GOTOLADDER 618 -#define MSG_SHAKEBOTTLE 584 -#define MSG_SHOOTKOZAW 557 -#define MSG_SHOWCOIN 1033 -#define MSG_SPINHANDLE 2398 -#define MSG_STARTARCADE 781 -#define MSG_STARTHAND 612 -#define MSG_TAKEBOTTLE 614 -#define MSG_TAKEKOZAW 611 -#define MSG_TESTPLANK 538 -#define MSG_UPDATEBOTTLE 613 -#define MV_BLK_CLOSE 911 -#define MV_BLK_OPEN 910 -#define MV_CLK8_GO 2990 -#define MV_CST_CLOSELUKE 807 -#define MV_EGTR_FATASK 5332 -#define MV_IN1MAN_SLEEP 5111 -#define MV_BDG_OPEN 1379 -#define MV_BTN_CLICK 599 -#define MV_CLK_GO 589 -#define MV_HND_POINT 602 -#define MV_KZW_GOR 564 -#define MV_KZW_JUMP 558 -#define MV_KZW_JUMPROTATE 561 -#define MV_KZW_TOHOLERV 537 -#define MV_KZW_WALKPLANK 500 -#define MV_KZW_JUMPHIT 2857 -#define MV_KZW_JUMPOUT 586 -#define MV_KZW_RAISEHEAD 577 -#define MV_KZW_STANDUP 563 -#define MV_KZW_TURN 562 -#define MV_MAN_FROMLADDER 493 -#define MV_MAN_FROMLADDERUP 1522 -#define MV_MAN_GOD 481 +#define MV_FLY_FLY 4917 #define MV_MAN_GOLADDER 451 #define MV_MAN_GOLADDER2 2844 -#define MV_MAN_GOU 460 -#define MV_MAN_JUMPONPLANK 551 -#define MV_MAN_LOOKLADDER 520 -#define MV_MAN_LOOKLADDERRV 556 #define MV_MAN_LOOKUP 4773 -#define MV_MAN_PLANKTOLADDER 553 +#define rMV_MAN_LOOKUP 4775 +#define MV_MAN_TOLADDER 448 +#define MV_MAN_TOLADDER2 2841 #define MV_MAN_STARTLADDER 452 #define MV_MAN_STARTLADDER2 2842 -#define MV_MAN_STARTLADDERD 457 #define MV_MAN_STOPLADDER 454 #define MV_MAN_STOPLADDER2 2845 -#define MV_MAN_TOLADDER 448 -#define MV_MAN_TOLADDERD 1524 -#define MV_MAN_TOLADDER2 2841 #define MV_MAN_TURN_LU 486 -#define MV_MAN_TURN_SUD 1089 -#define MV_MAN6_TAKEBALL 2691 -#define MV_MAN6_THROWBALL 2692 -#define MV_MAN8_BADLUCK 783 -#define MV_MAN8_DRYGDOWN 770 -#define MV_MAN8_DRYGUP 768 -#define MV_MAN8_HANDSDOWN 772 -#define MV_MAN8_HANDSUP 777 -#define MV_MAN8_JUMP 775 -#define MV_MAN8_JUMPOFF 2969 -#define MV_MAN8_SITDOWN 2968 -#define MV_MANHDL_HANDLEDOWN 630 -#define MV_MANHDL_HANDLEUP 631 -#define MV_MOM_CYCLEBK 3012 -#define MV_MOM_JUMPBK 662 -#define MV_MOM_JUMPFW 661 -#define MV_MOM_STARTBK 3010 -#define MV_MOM_STOPBK 3013 -#define MV_MOM_TAKE1 2885 -#define MV_MOM_TAKE2 2886 -#define MV_MOM_TAKE3 2887 -#define MV_MOM_TAKE4 2888 -#define MV_MOM_TAKE5 2889 -#define MV_NDV_BLOW2 2855 -#define MV_NDV_DENIES 952 -#define MV_NDV_DENY_NOGUM 3022 -#define MV_OTM_BOXHANDLEDOWN 626 -#define MV_OTM_BOXHANDLEUP 627 -#define MV_OTM_HANDLEDOWN 620 -#define MV_OTM_HANDLEUP 621 -#define MV_PNK_WEIGHTLEFT 541 -#define MV_PNK_WEIGHTRIGHT 502 -#define MV_SC4_COIN_default 1029 -#define MV_SC7_BOX_default 792 -#define MV_SPK4_PLAY 3276 -#define MV_SPR_LOWER 543 -#define MV_VMT_DEF 765 -#define PIC_CMN_EVAL 3468 +#define MV_PBAR_RUN 897 #define PIC_CSR_DEFAULT 4891 #define PIC_CSR_DEFAULT_INV 4892 #define PIC_CSR_ITN 4893 @@ -279,75 +87,17 @@ namespace Fullpipe { #define PIC_IN1_PIPETITLE 5167 #define PIC_INV_MENU 991 #define PIC_MAP_A13 5275 -#define PIC_MAP_P03 5279 #define PIC_MAP_S01 5223 -#define PIC_SC1_KUCHKA 1321 -#define PIC_SC1_LADDER 1091 -#define PIC_SC1_OSK 1018 -#define PIC_SC1_OSK2 2932 -#define PIC_SC2_DTRUBA 841 -#define PIC_SC2_LADDER 412 -#define PIC_SC3_DOMIN 5182 -#define PIC_SC3_LADDER 1102 -#define PIC_SC4_BOTTLE 568 -#define PIC_SC4_BOTTLE2 2936 -#define PIC_SC4_DOWNTRUBA 619 -#define PIC_SC4_LADDER 1438 -#define PIC_SC4_LRTRUBA 616 -#define PIC_SC4_MASK 585 -#define PIC_SC4_PLANK 5183 -#define PIC_SC6_LADDER 1104 -#define PIC_SC8_ARCADENOW 1043 -#define PIC_SC8_LADDER 754 -#define PIC_SC8_LADDER_D 755 -#define PIC_SC8_LADDERD 1106 -#define PIC_SC10_DTRUBA 974 -#define PIC_SC10_LADDER 995 -#define QU_BALL_WALKL 4920 -#define QU_BALL_WALKR 4919 -#define QU_CST_CLOSELUKE 820 -#define QU_EGG6_GOL 4936 -#define QU_EGG6_GOR 4935 -#define QU_EGTR_MD2_SHOW 4698 -#define QU_EGTR_MD1_SHOW 4697 -#define QU_EGTR_SLIMSHOW 4883 -#define QU_HND_TAKE0 1440 -#define QU_HND_TAKE1 1441 -#define QU_HND_TAKE2 1442 -#define QU_HND_TAKEBOTTLE 1443 -#define QU_IN2_DO 5144 -#define QU_INTR_FINISH 5138 -#define QU_INTR_GETUPMAN 5136 #define QU_INTR_STARTINTRO 5133 -#define QU_KOZAW_WALK 505 -#define QU_MOM_JUMPBK 671 -#define QU_MOM_JUMPFW 670 -#define QU_MOM_PUTBALL 2903 -#define QU_MOM_SITDOWN 685 -#define QU_MOM_STANDUP 2899 -#define QU_MOM_TOLIFT 2902 -#define QU_PNK_CLICK 550 -#define QU_SC3_ENTERLIFT 2779 -#define QU_SC3_EXITLIFT 2808 -#define QU_SC6_FALLHANDLE 2995 -#define QU_SC4_GOCLOCK 595 -#define QU_SC4_MANFROMBOTTLE 2851 -#define QU_SC4_MANTOBOTTLE 2850 -#define QU_SC5_MANBUMP 1167 -#define QU_SC5_MANFLY 1168 -#define QU_SC6_DROPS 2898 -#define QU_SC6_DROPS3 2955 -#define QU_SC6_ENTERLIFT 1054 -#define QU_SC6_EXITLIFT 1055 -#define QU_SC6_FALLBALL 2690 -#define QU_SC6_SHOWHANDLE 1689 -#define QU_SC6_SHOWNEXTBALL 2689 -#define QU_SC8_FINISH 788 -#define QU_SC8_STANDUP 2975 -#define QU_SC10_ENTERLIFT 1067 -#define QU_SC10_EXITLIFT 2809 -#define QU_SC10_TAKEGUM 3026 #define SC_1 301 +#define SC_2 302 +#define SC_3 303 +#define SC_4 304 +#define SC_5 305 +#define SC_6 649 +#define SC_7 650 +#define SC_8 651 +#define SC_9 652 #define SC_10 653 #define SC_11 654 #define SC_12 655 @@ -358,7 +108,6 @@ namespace Fullpipe { #define SC_17 1141 #define SC_18 1142 #define SC_19 1143 -#define SC_2 302 #define SC_20 1144 #define SC_21 1546 #define SC_22 1547 @@ -369,7 +118,6 @@ namespace Fullpipe { #define SC_27 1552 #define SC_28 2062 #define SC_29 2063 -#define SC_3 303 #define SC_30 2064 #define SC_31 2065 #define SC_32 2066 @@ -379,14 +127,9 @@ namespace Fullpipe { #define SC_36 2070 #define SC_37 2071 #define SC_38 2072 -#define SC_4 304 -#define SC_5 305 -#define SC_6 649 -#define SC_7 650 -#define SC_8 651 -#define SC_9 652 #define SC_COMMON 321 #define SC_DBGMENU 726 +#define SC_LDR 635 #define SC_FINAL1 4999 #define SC_FINAL2 5000 #define SC_FINAL3 5001 @@ -394,43 +137,13 @@ namespace Fullpipe { #define SC_INTRO1 3896 #define SC_INTRO2 3907 #define SC_INV 858 -#define SC_LDR 635 -#define SC_MAINMENU 4620 -#define SC_MAP 5222 -#define SC_TEST 903 -#define SC_TITLES 5166 -#define SND_4_010 3125 -#define SND_4_012 3127 -#define SND_4_033 4990 -#define SND_5_026 5316 -#define SND_8_014 3624 #define SND_CMN_031 3516 +#define SND_CMN_060 4921 +#define SND_CMN_061 4922 #define SND_CMN_070 5199 #define SND_INTR_019 5220 -#define ST_BLK_CLOSED 912 -#define ST_BLK_OPEN 913 -#define ST_BTT_CHESHET 746 -#define ST_BTT_NOSPOON 739 -#define ST_BTT_SLEEPS 748 -#define ST_BTT_SPOON 741 -#define ST_CLK_CLOSED 590 -#define ST_CST_HANDLELESS 794 -#define ST_DYAS_LIES 318 -#define ST_EGTR_MID1 2863 -#define ST_EGTR_MID2 2869 -#define ST_EGTR_SLIM 336 -#define ST_HGN_LOOK 811 -#define ST_HGN_LUKE 810 -#define ST_HDL_BROKEN 3342 -#define ST_HDL_DOWN 625 -#define ST_HDL_PLUGGED 2397 -#define ST_HDL_UP 624 -#define ST_HND_EMPTY 603 -#define ST_IN1MAN_SLEEP 5112 -#define ST_KZW_EMPTY 498 -#define ST_KZW_JUMPOUT 587 -#define ST_KZW_RIGHT 559 -#define ST_KZW_SIT 560 +#define ST_EGTR_SLIMSORROW 340 +#define ST_FLY_FLY 4918 #define ST_LBN_0N 2832 #define ST_LBN_0P 2833 #define ST_LBN_1N 2753 @@ -451,42 +164,351 @@ namespace Fullpipe { #define ST_LBN_8P 2775 #define ST_LBN_9N 2777 #define ST_LBN_9P 2778 -#define ST_LUK_CLOSED 805 -#define ST_LUK_OPEN 806 +#define ST_MAN_EMPTY 476 +#define ST_MAN_GOU 459 +#define ST_MAN_RIGHT 325 +#define TrubaDown 697 +#define TrubaLeft 474 +#define TrubaUp 680 + +// Intro +#define ANI_IN1MAN 5110 +#define MSG_INTR_ENDINTRO 5139 +#define MSG_INTR_GETUPMAN 5135 +#define MSG_INTR_SWITCHTO1 5145 +#define MSG_INTR_SWITCHTO2 5134 +#define MV_IN1MAN_SLEEP 5111 +#define QU_IN2_DO 5144 +#define QU_INTR_FINISH 5138 +#define QU_INTR_GETUPMAN 5136 +#define ST_IN1MAN_SLEEP 5112 + +// Scene 1 +#define ANI_BOOT_1 4231 +#define MSG_SC1_SHOWOSK 1019 +#define MSG_SC1_SHOWOSK2 468 +#define MSG_SC1_UTRUBACLICK 1100 +#define PIC_SC1_KUCHKA 1321 +#define PIC_SC1_LADDER 1091 +#define PIC_SC1_OSK 1018 +#define PIC_SC1_OSK2 2932 +#define TrubaRight 696 + +// Scene 2 +#define ANI_SC2_BOX 1020 +#define ANI_DADAYASHIK 306 +#define MSG_SC2_HIDELADDER 1023 +#define MSG_SC2_LADDERCLICK 1101 +#define MSG_SC2_PUTMANUP 1026 +#define MSG_SC2_SHOWLADDER 1027 +#define PIC_SC2_DTRUBA 841 +#define PIC_SC2_LADDER 412 +#define ST_DYAS_LIES 318 + +// Scene 3 +#define ANI_DOMINO_3 2732 +#define ANI_EGGEATER 334 +#define ANI_INV_COIN 875 +#define ANI_INV_EGGAPL 1564 +#define ANI_INV_EGGBOOT 1570 +#define ANI_INV_EGGCOIN 1567 +#define ANI_INV_EGGDOM 1561 +#define ANI_INV_EGGGLS 1573 +#define MSG_LIFT_CLICKBUTTON 2780 +#define MSG_LIFT_CLOSEDOOR 5194 +#define MSG_LIFT_EXITLIFT 5187 +#define MSG_LIFT_GO 1065 +#define MSG_LIFT_STARTEXITQUEUE 5186 +#define MSG_SC3_HIDEDOMINO 3177 +#define MSG_SC3_ONTAKECOIN 5338 +#define MSG_SC3_RELEASEEGG 2681 +#define MSG_SC3_TAKEEGG 1583 +#define MSG_SC3_TESTFAT 1582 +#define MSG_SC3_UTRUBACLICK 1103 +#define MV_EGTR_FATASK 5332 +#define PIC_SC3_DOMIN 5182 +#define PIC_SC3_LADDER 1102 +#define ST_EGTR_MID1 2863 +#define ST_EGTR_MID2 2869 +#define ST_EGTR_SLIM 336 +#define QU_EGTR_MD2_SHOW 4698 +#define QU_EGTR_MD1_SHOW 4697 +#define QU_EGTR_SLIMSHOW 4883 +#define QU_SC3_ENTERLIFT 2779 +#define QU_SC3_EXITLIFT 2808 + +// Scene 4 +#define ANI_BIGBALL 4923 +#define ANI_BUTTON 598 +#define ANI_CLOCK 588 +#define ANI_HAND 601 +#define ANI_KOZAWKA 495 +#define ANI_MAMASHA_4 660 +#define ANI_PLANK 501 +#define ANI_SC4_BOOT 1035 +#define ANI_SC4_COIN 690 +#define ANI_SPEAKER_4 3275 +#define ANI_SPRING 542 +#define MSG_GOTOLADDER 618 +#define MSG_KOZAWRESTART 546 +#define MSG_SC4_COINOUT 2895 +#define MSG_SC4_COINPUT 1032 +#define MSG_SC4_CLICKLADDER 1439 +#define MSG_SC4_DROPBOTTLE 2896 +#define MSG_SC4_HANDOVER 2960 +#define MSG_SC4_HIDEBOOT 4563 +#define MSG_SC4_KOZAWFALL 2858 +#define MSG_SC4_MANFROMBOTTLE 2854 +#define MSG_SC4_MANTOBOTTLE 2852 +#define MSG_SHAKEBOTTLE 584 +#define MSG_SHOOTKOZAW 557 +#define MSG_STARTHAND 612 +#define MSG_CLICKBOTTLE 569 +#define MSG_CLICKBUTTON 609 +#define MSG_CLICKPLANK 549 +#define MSG_LOWERPLANK 540 +#define MSG_RAISEPLANK 547 +#define MSG_SHOWCOIN 1033 +#define MSG_TAKEBOTTLE 614 +#define MSG_TAKEKOZAW 611 +#define MSG_TESTPLANK 538 +#define MSG_UPDATEBOTTLE 613 +#define MV_BTN_CLICK 599 +#define MV_CLK_GO 589 +#define MV_HND_POINT 602 +#define MV_KZW_GOR 564 +#define rMV_KZW_GOR 566 +#define MV_KZW_JUMP 558 +#define MV_KZW_JUMPROTATE 561 +#define MV_KZW_TOHOLERV 537 +#define MV_KZW_WALKPLANK 500 +#define MV_KZW_JUMPHIT 2857 +#define MV_KZW_JUMPOUT 586 +#define MV_KZW_RAISEHEAD 577 +#define MV_KZW_STANDUP 563 +#define MV_KZW_TURN 562 +#define MV_MAN_FROMLADDER 493 +#define MV_MAN_GOD 481 +#define MV_MAN_GOU 460 +#define MV_MAN_JUMPONPLANK 551 +#define MV_MAN_LOOKLADDER 520 +#define MV_MAN_PLANKTOLADDER 553 +#define MV_MAN_STARTLADDERD 457 +#define MV_PNK_WEIGHTLEFT 541 +#define MV_PNK_WEIGHTRIGHT 502 +#define MV_SC4_COIN_default 1029 +#define MV_SPK4_PLAY 3276 +#define MV_SPR_LOWER 543 +#define PIC_MAP_P03 5279 +#define PIC_SC4_BOTTLE 568 +#define PIC_SC4_BOTTLE2 2936 +#define PIC_SC4_DOWNTRUBA 619 +#define PIC_SC4_LADDER 1438 +#define PIC_SC4_LRTRUBA 616 +#define PIC_SC4_MASK 585 +#define PIC_SC4_PLANK 5183 +#define QU_BALL_WALKL 4920 +#define QU_BALL_WALKR 4919 +#define QU_HND_TAKE0 1440 +#define QU_HND_TAKE1 1441 +#define QU_HND_TAKE2 1442 +#define QU_HND_TAKEBOTTLE 1443 +#define QU_KOZAW_WALK 505 +#define QU_PNK_CLICK 550 +#define QU_SC4_GOCLOCK 595 +#define QU_SC4_MANFROMBOTTLE 2851 +#define QU_SC4_MANTOBOTTLE 2850 +#define SND_4_010 3125 +#define SND_4_012 3127 +#define SND_4_033 4990 +#define ST_CLK_CLOSED 590 +#define ST_HND_EMPTY 603 +#define ST_KZW_EMPTY 498 +#define ST_KZW_JUMPOUT 587 +#define ST_KZW_RIGHT 559 +#define ST_KZW_SIT 560 #define ST_MAN_GOLADDER 450 #define ST_MAN_GOLADDER2 2843 -#define ST_MAN_EMPTY 476 +#define MV_MAN_LOOKLADDERRV 556 #define ST_MAN_LADDERDOWN 521 #define ST_MAN_LOOKPLANK 555 #define ST_MAN_ONPLANK 552 -#define ST_MAN_RIGHT 325 #define ST_MAN_SIT 1164 #define ST_MAN_STANDLADDER 453 #define ST_MAN_UP 449 +#define ST_PNK_WEIGHTLEFT 503 +#define ST_PNK_WEIGHTRIGHT 504 +#define ST_SPR_UP 544 + +// Scene 5 +#define ANI_BIGLUK 909 +#define ANI_HANDLE 622 +#define ANI_OTMOROZ 419 +#define MSG_SC5_BGRSOUNDOFF 5315 +#define MSG_SC5_BGRSOUNDON 5314 +#define MSG_SC5_HANDLEDOWN 916 +#define MSG_SC5_HANDLEUP 915 +#define MSG_SC5_HIDEHANDLE 917 +#define MSG_SC5_MAKEMANFLIGHT 1136 +#define MSG_SC5_MAKEOTMFEEDBACK 1169 +#define MSG_SC5_SHOWHANDLE 918 +#define MSG_SC5_TESTLUK 914 +#define MV_BLK_CLOSE 911 +#define MV_BLK_OPEN 910 +#define MV_MANHDL_HANDLEDOWN 630 +#define MV_MANHDL_HANDLEUP 631 +#define MV_OTM_BOXHANDLEDOWN 626 +#define MV_OTM_BOXHANDLEUP 627 +#define MV_OTM_HANDLEDOWN 620 +#define MV_OTM_HANDLEUP 621 +#define QU_SC5_MANBUMP 1167 +#define QU_SC5_MANFLY 1168 +#define SND_5_026 5316 +#define ST_BLK_CLOSED 912 +#define ST_BLK_OPEN 913 +#define ST_HDL_BROKEN 3342 +#define ST_HDL_DOWN 625 +#define ST_HDL_UP 624 +#define ST_OTM_BOX_LEFT 429 +#define ST_OTM_GLS_LEFT 421 +#define ST_OTM_VNT_LEFT 434 + +// Scene 6 +#define ANI_BALLDROP 2685 +#define ANI_BUTTON_6 2988 +#define ANI_EGGIE 4929 +#define ANI_INV_HANDLE 893 +#define ANI_MAMASHA 656 +#define ANI_NEWBALL 1073 +#define MSG_SC6_BTNPUSH 1017 +#define MSG_SC6_ENABLEDROPS 687 +#define MSG_SC6_INSTHANDLE 1012 +#define MSG_SC6_JUMPBK 2900 +#define MSG_SC6_JUMPFW 2901 +#define MSG_SC6_RESTORESCROLL 2906 +#define MSG_SC6_SHOWNEXTBALL 790 +#define MSG_SC6_STARTDROPS 2897 +#define MSG_SC6_TAKEBALL 682 +#define MSG_SC6_TESTNUMBALLS 2904 +#define MSG_SC6_UTRUBACLICK 1105 +#define MSG_SPINHANDLE 2398 +#define MV_MAN6_TAKEBALL 2691 +#define MV_MAN6_THROWBALL 2692 +#define MV_MOM_CYCLEBK 3012 +#define MV_MOM_JUMPBK 662 +#define MV_MOM_JUMPFW 661 +#define MV_MOM_STARTBK 3010 +#define MV_MOM_STOPBK 3013 +#define MV_MOM_TAKE1 2885 +#define MV_MOM_TAKE2 2886 +#define MV_MOM_TAKE3 2887 +#define MV_MOM_TAKE4 2888 +#define MV_MOM_TAKE5 2889 +#define PIC_SC6_LADDER 1104 +#define QU_EGG6_GOL 4936 +#define QU_EGG6_GOR 4935 +#define QU_MOM_JUMPBK 671 +#define QU_MOM_JUMPFW 670 +#define QU_MOM_PUTBALL 2903 +#define QU_MOM_SITDOWN 685 +#define QU_MOM_STANDUP 2899 +#define QU_MOM_TOLIFT 2902 +#define QU_SC6_DROPS 2898 +#define QU_SC6_DROPS3 2955 +#define QU_SC6_ENTERLIFT 1054 +#define QU_SC6_EXITLIFT 1055 +#define QU_SC6_FALLBALL 2690 +#define QU_SC6_FALLHANDLE 2995 +#define QU_SC6_SHOWHANDLE 1689 +#define QU_SC6_SHOWNEXTBALL 2689 +#define ST_HDL_PLUGGED 2397 #define ST_MAN6_BALL 2688 -#define ST_MAN8_FLYDOWN 771 -#define ST_MAN8_FLYUP 769 -#define ST_MAN8_HANDSUP 773 -#define ST_MAN8_STAND 774 #define ST_MOM_SITS 659 #define ST_MOM_STANDS 658 #define ST_NBL_NORM 1076 -#define ST_NDV_SIT 946 -#define ST_OTM_BOX_LEFT 429 -#define ST_OTM_GLS_LEFT 421 -#define ST_OTM_VNT_LEFT 434 + +// Scene 7 +#define ANI_CORNERSITTER 71 +#define ANI_HOOLIGAN 808 +#define ANI_LUKE 803 +#define ANI_PLUSMINUS 2938 +#define ANI_SC7_BOX 791 +#define MSG_SC7_CLOSELUKE 822 +#define MSG_SC7_HIDEBOX 817 +#define MSG_SC7_HIDELUKE 821 +#define MSG_SC7_OPENLUKE 823 +#define MSG_SC7_PULL 2943 +#define MSG_SC7_SHOWBOX 816 +#define MV_CST_CLOSELUKE 807 +#define MV_SC7_BOX_default 792 +#define QU_CST_CLOSELUKE 820 +#define ST_CST_HANDLELESS 794 +#define ST_HGN_LOOK 811 +#define ST_HGN_LUKE 810 +#define ST_LUK_CLOSED 805 +#define ST_LUK_OPEN 806 #define ST_PMS_MINUS 2942 #define ST_PMS_PLUS 2941 -#define ST_PNK_WEIGHTLEFT 503 -#define ST_PNK_WEIGHTRIGHT 504 -#define ST_SPR_UP 544 + +// Scene 8 +#define ANI_BATUTA 737 +#define ANI_CLOCK_8 2989 +#define ANI_VMYATS 764 +#define MSG_SC8_ARCADENOW 1044 +#define MSG_SC8_ENTERUP 3037 +#define MSG_SC8_GETHIMUP 789 +#define MSG_SC8_HIDELADDER_D 1107 +#define MSG_SC8_RESUMEFLIGHT 784 +#define MSG_SC8_STANDUP 2976 +#define MSG_STARTARCADE 781 +#define MV_CLK8_GO 2990 +#define MV_MAN_FROMLADDERUP 1522 +#define MV_MAN_TOLADDERD 1524 +#define MV_MAN8_BADLUCK 783 +#define MV_MAN8_DRYGDOWN 770 +#define MV_MAN8_DRYGUP 768 +#define MV_MAN8_HANDSDOWN 772 +#define MV_MAN8_HANDSUP 777 +#define MV_MAN8_JUMP 775 +#define MV_MAN8_JUMPOFF 2969 +#define MV_MAN8_SITDOWN 2968 +#define MV_VMT_DEF 765 +#define PIC_SC8_ARCADENOW 1043 +#define PIC_SC8_LADDER 754 +#define PIC_SC8_LADDER_D 755 +#define PIC_SC8_LADDERD 1106 +#define QU_SC8_FINISH 788 +#define QU_SC8_STANDUP 2975 +#define SND_8_014 3624 +#define ST_BTT_CHESHET 746 +#define ST_BTT_NOSPOON 739 +#define ST_BTT_SLEEPS 748 +#define ST_BTT_SPOON 741 +#define ST_MAN8_FLYDOWN 771 +#define ST_MAN8_FLYUP 769 +#define ST_MAN8_HANDSUP 773 +#define ST_MAN8_STAND 774 #define ST_VMT_MIN 766 -#define TrubaDown 697 -#define TrubaLeft 474 -#define TrubaRight 696 -#define TrubaUp 680 -#define rMV_MAN_LOOKUP 4775 -#define rMV_KZW_GOR 566 + +// Scene 10 +#define ANI_GUM 978 +#define ANI_NADUVATEL 944 +#define ANI_PACHKA 975 +#define ANI_PACHKA2 3008 +#define MSG_SC10_CLICKGUM 992 +#define MSG_SC10_HIDEGUM 993 +#define MSG_SC10_LADDERTOBACK 3002 +#define MSG_SC10_LADDERTOFORE 3004 +#define MSG_SC10_SHOWGUM 994 +#define MV_NDV_BLOW2 2855 +#define MV_NDV_DENIES 952 +#define MV_NDV_DENY_NOGUM 3022 +#define PIC_SC10_DTRUBA 974 +#define PIC_SC10_LADDER 995 +#define QU_SC10_ENTERLIFT 1067 +#define QU_SC10_EXITLIFT 2809 +#define QU_SC10_TAKEGUM 3026 +#define ST_NDV_SIT 946 // Scene 11 #define ANI_BOOTS_11 2704 @@ -596,11 +618,29 @@ namespace Fullpipe { #define MSG_SC14_SHOWBALLLAST 3246 #define MSG_SC14_SHOWBALLMAN 1254 #define MSG_SC14_STARTARCADE 3252 +#define MV_BAL14_FALL 1258 #define MV_BAL14_SPIN 1247 +#define MV_BAL14_TOGMA 3214 +#define MV_GMA_BACKOFF 1233 +#define MV_GMA_BACKOFF2 3217 +#define MV_GMA_JUMPFW 1230 +#define MV_GMA_THROW 1232 +#define MV_MAN14_DECLINE 1239 +#define MV_MAN14_FALL 1236 #define MV_MAN14_KICK 1237 +#define MV_MAN14_KICKAIR 1256 #define MV_MAN14_STEPFW 1240 +#define PIC_SC14_RTRUBA 1221 +#define ST_GMA_SIT 1229 +#define QU_GMA_BLINK 1252 +#define QU_GMA_JUMPBK 1251 +#define QU_GMA_JUMPFW 1249 +#define QU_GMA_THROW 1255 +#define QU_SC14_ENDARCADE 1391 #define QU_SC14_ENTERLIFT 1225 #define QU_SC14_EXITLIFT 1226 +#define QU_SC14_STARTARCADE 1390 +#define QU_SC14_WINARCADE 3247 // Scene 15 #define ANI_BOOT_15 4779 @@ -622,10 +662,209 @@ namespace Fullpipe { #define ST_GMS_BOOT 1270 #define ST_GMS_BOOTLESS2 3316 +// Scene 16 +#define ANI_BEARDED_CMN 3420 +#define ANI_BOOT_16 3285 +#define ANI_BOY 1327 +#define ANI_GIRL 1328 +#define ANI_JETTIE 1392 +#define ANI_MUG 1296 +#define ANI_WIRE16 1344 +#define MSG_SC16_FILLMUG 1363 +#define MSG_SC16_HIDEMAN 1357 +#define MSG_SC16_HIDEMUG 1351 +#define MSG_SC16_HIDEWIRE 1349 +#define MSG_SC16_LAUGHSOUND 4993 +#define MSG_SC16_MUGCLICK 1366 +#define MSG_SC16_SHOWBEARDED 4956 +#define MSG_SC16_SHOWMAN 1358 +#define MSG_SC16_SHOWMUG 1352 +#define MSG_SC16_SHOWMUGFULL 1396 +#define MSG_SC16_SHOWWIRE 1350 +#define MSG_SC16_STARTLAUGH 1374 +#define MV_BOY_DRINK 1333 +#define MV_BT16_FILL 3286 +#define MV_GRL_DRINK 1339 +#define MV_GRL_FALL 3115 +#define MV_GRL_LAUGH_POPA 3278 +#define MV_JTI_FLOWBY 1393 +#define MV_JTI_FLOWIN 1394 +#define MV_MAN16_TAKEMUG 1362 +#define PIC_SC16_TUMBA 1368 +#define QU_BRD16_STARTBEARDED 4948 +#define QU_SC16_BOYKICK 1367 +#define QU_SC16_BOYOUT 1364 +#define QU_SC16_GIRLLAUGH 1375 +#define QU_SC16_GIRLOUT 1365 +#define QU_SC16_GOBOY 1347 +#define QU_SC16_GOGIRL 1348 +#define QU_SC16_MANDRINK 5200 +#define QU_SC16_SHOWMUG 1361 +#define QU_SC16_TAKEMUG 1435 +#define SND_16_034 3854 +#define SND_16_035 3855 +#define SND_16_037 3857 +#define ST_BOY_STAND 1331 +#define ST_GRL_LAUGH 1342 +#define ST_GRL_STAND 1337 +#define ST_MUG_EMPTY 1298 +#define ST_MUG_FULL 1360 + +// Scene 17 +#define ANI_BOOT_17 4220 +#define ANI_HAND17 1446 +#define ANI_INV_BOTTLE 1418 +#define ANI_INV_SUGAR 1410 +#define ANI_JET_17 2746 +#define ANI_MUG_17 2737 +#define ANI_SAMOGONSHCHIK 1397 +#define MSG_SC17_DROP 3414 +#define MSG_SC17_FILLBOTTLE 1436 +#define MSG_SC17_HIDESUGAR 1417 +#define MSG_SC17_SHOWBOTTLE 1432 +#define MSG_SC17_SHOWSUGAR 1416 +#define MSG_SC17_TESTTRUBA 1458 +#define MSG_SC17_UPDATEHAND 1560 +#define MV_HND17_FIGA 1449 +#define PIC_SC17_RTRUBA 1323 +#define PIC_SC17_RTRUBA2 5297 +#define QU_HND17_ASK 1456 +#define QU_HND17_ATTRACT 1455 +#define QU_HND17_TOCYCLE 1454 +#define QU_JET17_DROP 3295 +#define QU_JET17_FLOW 3294 +#define QU_SC17_FILLBOOT 4237 +#define QU_SC17_FILLBOTTLE 1437 +#define QU_SC17_FILLMUG 2750 +#define QU_SC17_FILLMUG_DROP 3415 +#define QU_SC17_SHOWBOTTLE 1429 +#define QU_SC17_SHOWSUGAR 1415 +#define QU_SMG_FILLBOTTLE 1433 +#define ST_HND17_ATTRACT 1451 +#define ST_HND17_EMPTY 1448 +#define ST_MUG17_EMPTY 2739 +#define ST_SMG_SIT 1399 + +// Scene 20 +#define ANI_GRANDMA_20 2427 +#define MSG_SC20_UPDATELOCKABLE 5217 +#define ST_GMA20_FLOOR 2429 +#define ST_GMA20_STAND 2436 +#define ST_GMA20_STOOL 2432 + +// Scene 21 +#define ANI_GIRAFFE_BOTTOM 1633 +#define ANI_INV_BOX 890 +#define ANI_INV_STOOL 1780 +#define MSG_SC21_UPDATEASS 4211 +#define PIC_SC21_DTRUBA 1823 +#define ST_GRFB_SIT 1687 +#define ST_GRFB_HANG 1638 + +// Scene 22 +#define ANI_GIRAFFE_MIDDLE 1981 +#define ANI_MESHOK 1754 +#define ANI_TABURETTE 1745 +#define MSG_SC22_CHECKGMABOOT 4782 +#define MSG_SC22_CRANEOUT_GMA 5218 +#define MSG_SC22_FROMSTOOL 1799 +#define MSG_SC22_HANDLEDOWN 1796 +#define MSG_SC22_HIDESTOOL 2503 +#define MSG_SC22_ONSTOOL 1798 +#define MSG_SC22_SHOWSTOOL 2495 +#define QU_MSH_CRANEOUT 1811 +#define QU_MSH_CRANEOUT_GMA 5219 +#define QU_SC22_FALLBROOM 1786 +#define QU_SC22_FALLSACK 1791 +#define QU_SC22_FALLSACK_GMA 2613 +#define QU_SC22_FROMSTOOL 1800 +#define QU_SC22_HANDLEDOWN 1804 +#define QU_SC22_PUTSTOOL 1803 +#define QU_SC22_SHOWSTOOL 1793 +#define QU_SC22_TOSTOOL 1801 +#define QU_SC22_TOSTOOL_R 3332 +#define QU_SC22_TRYBOX 5311 +#define QU_SC22_TRYHANDLE 1802 +#define QU_MSH_MOVE 1812 +#define rMV_MAN_TURN_SRL 1090 +#define ST_GRFM_AFTER 3472 +#define ST_GRFM_NORM 1983 +#define ST_MSH_SIT 1756 + +// Scene 23 +#define ANI_CALENDWHEEL 1702 +#define ANI_GIRAFFE_TOP 1645 +#define ANI_GIRAFFEE 1672 +#define ANI_HANDLE23 1978 +#define ANI_INV_LEVERHANDLE 1777 +#define ANI_LUK23_D 1813 +#define ANI_LUK23_U 1817 +#define MSG_SC23_CLICKBTN1 1736 +#define MSG_SC23_CLICKBTN2 1737 +#define MSG_SC23_CLICKBTN3 1738 +#define MSG_SC23_CLICKBTN4 1739 +#define MSG_SC23_FROMSTOOL 3339 +#define MSG_SC23_HIDEGIRAFFEE 4650 +#define MSG_SC23_ONSTOOL 3334 +#define MSG_SC23_SPINWHEEL1 1740 +#define MSG_SC23_SPINWHEEL2 1741 +#define MSG_SC23_SPINWHEEL3 1742 +#define MSG_SC23_SPINWHEEL4 1743 +#define MV_CND_0_1 1703 +#define MV_CND_1_2 1706 +#define MV_CND_2_3 1708 +#define MV_CND_3_4 1710 +#define MV_CND_4_5 1712 +#define MV_CND_5_6 1714 +#define MV_CND_6_7 1716 +#define MV_CND_7_8 1718 +#define MV_CND_8_9 1720 +#define MV_CND_9_0 1722 +#define MV_MAN23_PUSH1 1724 +#define MV_MAN23_PUSH2 1725 +#define MV_MAN23_PUSH3 1726 +#define MV_MAN23_PUSH4 1727 +#define PIC_SC23_BOXCLOSED 1728 +#define PIC_SC23_BOXOPEN 1723 +#define PIC_SC23_BTN1 1729 +#define PIC_SC23_BTN2 1730 +#define PIC_SC23_BTN3 1731 +#define PIC_SC23_BTN4 1732 +#define PIC_SC23_LADDER 1628 +#define PIC_SC23_LADDERU 3411 +#define QU_GRFU_TURN_UD 1664 +#define QU_GRFU_TURN_UL 1662 +#define QU_SC23_FROMCALENDAR 1734 +#define QU_SC23_FROMCALENDAREXIT 1735 +#define QU_SC23_FROMSTOOL 3338 +#define QU_SC23_SHOWSTOOL 3335 +#define QU_SC23_STARTKISS 1822 +#define QU_SC23_TOCALENDAR 1733 +#define ST_CND_0 1704 +#define ST_CND_1 1705 +#define ST_CND_2 1707 +#define ST_CND_3 1709 +#define ST_CND_4 1711 +#define ST_CND_5 1713 +#define ST_CND_6 1715 +#define ST_CND_7 1717 +#define ST_CND_8 1719 +#define ST_CND_9 1721 +#define ST_GRFG_BALD 1675 +#define ST_GRFG_EMPTY 1674 +#define ST_GRFU_KISS 1681 +#define ST_GRFU_UP 1648 +#define ST_LUK23_OPEN 1816 +#define ST_LUK23_WHANDLE2 1977 +#define ST_LUK23U_CLOSED 1819 +#define ST_LUK23U_OPEN 1820 + // Scene 24 #define ANI_DROP_24 3505 +#define ANI_INV_HAMMER 884 #define ANI_JET24 1837 #define ANI_WATER24 1834 +#define MV_MAN_TURN_RL 332 #define MV_WTR24_FLOW 1835 #define MV_WTR24_FLOWLOWER 1844 #define MV_JET24_FLOW 1838 @@ -637,7 +876,273 @@ namespace Fullpipe { #define ST_DRP24_EMPTY 3507 #define ST_WTR24_FLOWLOWER 1843 +// Scene 25 +#define ANI_BEARDED_CMN 3420 +#define ANI_BOARD25 1898 +#define ANI_DROP_25 3499 +#define ANI_INV_BOARD 1872 +#define ANI_INV_BROOM 1774 +#define ANI_INV_LOPAT 1920 +#define ANI_INV_SWAB 1917 +#define ANI_WATER25 1856 +#define MSG_BRD_TURN 4877 +#define MSG_SC25_ENTERMAN 1861 +#define MSG_SC25_ENTERTRUBA 4214 +#define MSG_SC25_STARTBEARDEDS 3423 +#define MSG_SC25_STOPBEARDEDS 3424 +#define MSG_SC25_TOLADDER 4215 +#define MV_MAN_GOLADDERDOWN 455 +#define MV_MAN25_CHIH 1886 +#define rMV_MAN25_CHIH 3343 +#define MV_BRD25_RIGHT 1899 +#define rMV_BRD25_RIGHT 1903 +#define MV_MAN25_ONBOARD 1885 +#define rMV_MAN25_ONBOARD 1966 +#define MV_WTR25_FLOW 1857 +#define PIC_SC25_LADDERDOWN 1855 +#define PIC_SC25_LADDERUP 1854 +#define PIC_SC25_RTRUBA 1853 +#define QU_DRP25_TOFLOOR 3502 +#define QU_DRP25_TOWATER 3504 +#define QU_SC25_BACKTOLADDER 1955 +#define QU_SC25_BACKTOTRUBA 2061 +#define QU_SC25_BEARDED 3425 +#define QU_SC25_BEARDED2 3426 +#define QU_SC25_BEARDED3 3427 +#define QU_SC25_BOARDTOLADDER 1911 +#define QU_SC25_ENTERUP_FLOOR 1904 +#define QU_SC25_ENTERUP_WATER 1895 +#define QU_SC25_LADDERUP 1925 +#define QU_SC25_MANTOTRUBA 1905 +#define QU_SC25_MANTOTRUBA_R 4218 +#define QU_SC25_PUTBOARD 1896 +#define QU_SC25_ROWTOLADDER 1910 +#define QU_SC25_ROWTOTRUBA 1897 +#define QU_SC25_TRUBATOBOARD 1909 +#define QU_SC25_TRYBROOM 1912 +#define QU_SC25_TRYHAND 4219 +#define QU_SC25_TRYROWHAND 3493 +#define QU_SC25_TRYROWHAND_R 3494 +#define QU_SC25_TRYSPADE 3498 +#define QU_SC25_TRYSWAB 1913 +#define QU_SC25_TRYWATER 1906 +#define SND_25_006 4059 +#define SND_25_025 4874 +#define SND_25_026 4875 +#define SND_25_027 4876 +#define SND_25_028 5173 +#define SND_25_029 5174 +#define SND_25_030 5175 +#define ST_BRD25_RIGHT2 1902 +#define ST_BRDCMN_EMPTY 3422 +#define ST_DRP25_EMPTY 3501 +#define ST_MAN_GOLADDERD 456 +#define ST_MAN_LADDERDOWN_R 3419 +#define ST_MAN25_ONBOARD 1879 + +// Scene 26 +#define ANI_CHHI 1957 +#define ANI_DROP_26 3345 +#define ANI_INV_SOCK 1698 +#define ANI_INV_VENT 1968 +#define ANI_LUK26 1867 +#define ANI_SOCK_26 4553 +#define ANI_VENT 1927 +#define MSG_SC26_CLICKVENT 1947 +#define MSG_SC26_HIDECHI 1967 +#define MSG_SC26_HIDEVENT 1945 +#define MSG_SC26_SHOWCHI 3495 +#define MSG_SC26_SHOWVENT 1946 +#define MSG_SC26_TESTVENT 1952 +#define MSG_SC26_UPDATEDROP 3496 +#define MSG_SC26_UPDATEPOOL 1956 +#define PIC_SC26_LTRUBA 1864 +#define PIC_SC26_SOCK 5312 +#define QU_CHI_HIDE 1965 +#define QU_CHI_SHOW 1964 +#define QU_SC26_AUTOCLOSE1 1949 +#define QU_SC26_AUTOCLOSE2 1950 +#define QU_SC26_AUTOCLOSE3 1951 +#define QU_SC26_CLOSE1 1936 +#define QU_SC26_CLOSE2 1938 +#define QU_SC26_CLOSE3 1940 +#define QU_SC26_CLOSE4 1942 +#define QU_SC26_CLOSE5 1944 +#define QU_SC26_OPEN1 1935 +#define QU_SC26_OPEN2 1937 +#define QU_SC26_OPEN3 1939 +#define QU_SC26_OPEN4 1941 +#define QU_SC26_OPEN5 1943 +#define SND_26_003 4079 +#define SND_26_018 5340 +#define SND_26_019 5341 +#define SND_26_020 5342 +#define ST_CHI_EMPTY 1959 +#define ST_CHI_NORM 1960 +#define ST_VNT26_RIGHT2 3348 +#define ST_VNT26_UP2 1948 + +// Scene 28 +#define ANI_LIFT 982 +#define ANI_LIFT_28 4238 +#define ANI_MAN_28 4247 +#define ANI_TIOTIA 4286 +#define MSG_SC28_CLICKLIFT 4258 +#define MSG_SC28_ENDCABIN 3456 +#define MSG_SC28_ENDLIFT1 4259 +#define MSG_SC28_ENDLIFT6 4244 +#define MSG_SC28_LIFT1_SHOWAFTER 4261 +#define MSG_SC28_LIFT6INSIDE 5354 +#define MSG_SC28_LIFT6MUSIC 5355 +#define MSG_SC28_MAKEFACES 4684 +#define MSG_SC28_STARTWORK1 4255 +#define MSG_SC28_TRYVTORPERS 4961 +#define MSG_SC28_TURNOFF_0 4678 +#define MSG_SC28_TURNOFF_1 4279 +#define MSG_SC28_TURNOFF_2 4277 +#define MSG_SC28_TURNOFF_3 4275 +#define MSG_SC28_TURNOFF_4 4282 +#define MSG_SC28_TURNOFF_6 4273 +#define MSG_SC28_TURNON4 4280 +#define MSG_SC28_TURNON_0 4677 +#define MSG_SC28_TURNON_1 4278 +#define MSG_SC28_TURNON_2 4276 +#define MSG_SC28_TURNON_3 4274 +#define MSG_SC28_TURNON_4 4281 +#define MSG_SC28_TURNON_6 4272 +#define MV_WMN28_IN_1 3443 +#define MV_WMN28_IN_2 3445 +#define MV_WMN28_IN_3 3446 +#define MV_WMN28_IN_4 3447 +#define MV_WMN28_IN_5 3448 +#define PIC_SC28_DARK0 4675 +#define PIC_SC28_DARK1 4266 +#define PIC_SC28_DARK2 4267 +#define PIC_SC28_DARK3 4268 +#define PIC_SC28_DARK4 4269 +#define PIC_SC28_DARK5 4270 +#define PIC_SC28_DARK6 4271 +#define QU_BRD28_GOL 4960 +#define QU_BRD28_GOR 4959 +#define QU_GLV28_GOL 4958 +#define QU_GLV28_GOR 4957 +#define QU_SC28_LIFT0_START 4676 +#define QU_SC28_LIFT1_START 4254 +#define QU_SC28_LIFT1_WORK 4256 +#define QU_SC28_LIFT2_START 4246 +#define QU_SC28_LIFT3_START 4245 +#define QU_SC28_LIFT5_START 4674 +#define QU_SC28_LIFT6_END 3563 +#define QU_SC28_LIFT6_START 4243 +#define QU_SC28_LIFT6_START2 4295 +#define QU_SC28_WMN_START 3452 +#define ST_MAN28_RIGHT 4249 + +// Scene 30 +#define ANI_LEG 2322 +#define MSG_SC30_UPDATEPATH 2358 +#define PIC_SC30_LTRUBA 2354 +#define QU_SC30_ENTERLIFT 2823 +#define QU_SC30_EXITLIFT 2824 +#define ST_LEG_DOWN 2325 +#define ST_LEG_DOWN1 2330 +#define ST_LEG_DOWN2 2334 +#define ST_LEG_EMPTY 2338 +#define ST_LEG_UP 2324 + +// Scene 31 +#define LiftDown 1058 +#define LiftUp 1057 +#define ANI_CACTUS_31 2456 +#define MSG_SC31_PULL 2944 +#define MSG_SC31_TESTCACTUS 5095 +#define SND_31_001 4377 +#define ST_CTS31_GROWN2 2472 + +// Scene 32 +#define ANI_BUTTON_32 5347 +#define ANI_CACTUS 2267 +#define ANI_FLAG 2257 +#define ANI_KADKA 2670 +#define ANI_TESTO_BLUE 2659 +#define ANI_TESTO_GREEN 2662 +#define ANI_TESTO_ORANGE 2656 +#define MSG_SC32_ONLADDER 2270 +#define MSG_SC32_SPIN 2405 +#define MSG_SC32_STARTCACTUS 2414 +#define MSG_SC32_STARTFLAGLEFT 2310 +#define MSG_SC32_STARTFLAGRIGHT 2309 +#define MSG_SC32_STOPFLAG 2311 +#define MSG_SC32_TRUBATOBACK 5181 +#define MSG_SC32_TRUBATOFRONT 5180 +#define MSG_SC32_TRYSIT 2294 +#define MV_CTS_DEFAULT 4299 +#define MV_FLG_CYCLEL 2262 +#define MV_FLG_CYCLER 2266 +#define MV_FLG_STARTL 2258 +#define MV_FLG_STARTR 2263 +#define MV_FLG_STOPL 2261 +#define MV_FLG_STOPR 2265 +#define MV_MAN32_SITDOWN 2276 +#define MV_MAN32_STANDUP 2313 +#define MV_TSTG_FLOW 2663 +#define MV_TSTO_FLOW 2657 +#define PIC_SC32_LADDER 4296 +#define PIC_SC32_RTRUBA 2292 +#define QU_CTS_BACK 2415 +#define QU_CTS_GROW 2416 +#define QU_CTS_GROWMAN 2417 +#define QU_KBK32_GO 4977 +#define QU_KBK32_START 4982 +#define QU_KDK_DRIZZLE 4301 +#define QU_SC32_ENTERLIFT 2827 +#define QU_SC32_EXITLIFT 2828 +#define QU_SC32_FALLHANDLE 5351 +#define QU_SC32_FROMLADDER 4300 +#define QU_SC32_SHOWHANDLE 2399 +#define ST_BTN32_OFF 5349 +#define ST_BTN32_ON 5350 +#define ST_CTS_EMPTY 2269 +#define ST_CTS_GROWUP 2467 +#define ST_FLG_LEFT 2260 +#define ST_FLG_NORM 2259 +#define ST_FLG_RIGHT 2264 +#define ST_HDL_LAID 3039 +#define ST_MAN32_SIT 2277 + +// Scene 33 +#define ANI_KUBIK 4963 +#define ANI_JETTIE_FLOW 2627 +#define ANI_MUG_33 2623 +#define ANI_VENT_33 2637 +#define MSG_SC33_HANDLEDOWN 2643 +#define MSG_SC33_POUR 2645 +#define MSG_SC33_TESTMUG 5185 +#define MSG_SC33_TRYKUBIK 4980 +#define MSG_SC33_UPDATEKUBIK 5346 +#define MV_JTI33_FLOW 2628 +#define MV_JTI33_POUR 2630 +#define MV_JTI33_POURFULL 4455 +#define MV_VNT33_TURND 2638 +#define MV_VNT33_TURNR 2641 +#define PIC_SC33_LTRUBA 2618 +#define PIC_SC33_ZONES 5298 +#define QU_KBK33_GO 4978 +#define QU_KBK33_START 4983 +#define QU_SC33_STARTWATER 2644 +#define ST_MUG33_EMPTY 2625 +#define ST_MUG33_FULL 2626 +#define ST_VNT33_DOWN 2640 +#define ST_VNT33_RIGHT 2639 + +// Scene 36 +#define ANI_SCISSORS_36 2647 +#define ANI_ROTOHRUST 2360 +#define PIC_SC36_MASK 5221 +#define ST_RHT_OPEN 2362 + // Debug scene +#define MSG_RESTARTGAME 4767 #define PIC_SCD_1 727 #define PIC_SCD_2 728 #define PIC_SCD_3 729 diff --git a/engines/fullpipe/floaters.cpp b/engines/fullpipe/floaters.cpp index 384bfa2150..9e5ca7b3f1 100644 --- a/engines/fullpipe/floaters.cpp +++ b/engines/fullpipe/floaters.cpp @@ -22,23 +22,233 @@ #include "fullpipe/fullpipe.h" #include "fullpipe/floaters.h" +#include "fullpipe/utils.h" +#include "fullpipe/objects.h" +#include "fullpipe/motion.h" +#include "fullpipe/statics.h" +#include "fullpipe/scene.h" +#include "fullpipe/constants.h" +#include "fullpipe/objectnames.h" namespace Fullpipe { +Floaters::~Floaters() { + delete _hRgn; +} + void Floaters::init(GameVar *var) { - warning("STUB: Floaters::init()"); + _array1.clear(); + _array2.clear(); + + GameVar *varFliers = var->getSubVarByName(sO_Fliers); + + if (!varFliers) + return; + + GameVar *sub = varFliers->getSubVarByName("flyIdleRegion"); + + if (sub) { + _hRgn = new ReactPolygonal(); + + _hRgn->_pointCount = sub->getSubVarsCount(); + _hRgn->_points = (Common::Point **)malloc(sizeof(Common::Point *) * _hRgn->_pointCount); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + _hRgn->_points[idx] = new Common::Point; + _hRgn->_points[idx]->x = sub->_subVars->_value.intValue; + _hRgn->_points[idx]->y = sub->_subVars->_nextVarObj->_value.intValue; + + idx++; + sub = sub->_nextVarObj; + } + } + + sub = varFliers->getSubVarByName("flyIdlePath"); + + if (sub) { + _array1.reserve(sub->getSubVarsCount()); + + sub = sub->_subVars; + + int idx = 0; + + while (sub) { + FloaterArray1 *f = new FloaterArray1; + + f->val1 = sub->_subVars->_value.intValue; + f->val2 = sub->_subVars->_nextVarObj->_value.intValue; + + _array1.push_back(f); + + idx++; + sub = sub->_nextVarObj; + } + + } } -void Floaters::genFlies(Scene *sc, int x, int y, int a5, int a6) { - warning("STUB: Floaters::genFlies()"); +void Floaters::genFlies(Scene *sc, int x, int y, int priority, int flags) { + StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_FLY, -1)); + + ani->_statics = ani->getStaticsById(ST_FLY_FLY); + ani->_movement = 0; + ani->setOXY(x, y); + ani->_flags |= 4; + ani->_priority = priority; + + sc->addStaticANIObject(ani, 1); + + ani->startAnim(MV_FLY_FLY, 0, -1); + + int nummoves; + + if (ani->_movement->_currMovement) + nummoves = ani->_movement->_currMovement->_dynamicPhases.size(); + else + nummoves = ani->_movement->_dynamicPhases.size(); + + ani->_movement->setDynamicPhaseIndex(g_fp->_rnd->getRandomNumber(nummoves - 1)); + + FloaterArray2 *arr2 = new FloaterArray2; + + arr2->ani = ani; + arr2->val11 = 15.0; + arr2->val3 = y; + arr2->val5 = y; + arr2->val2 = x; + arr2->val4 = x; + arr2->fflags = flags; + + _array2.push_back(arr2); } void Floaters::update() { - warning("STUB: Floaters::update()"); + for (uint i = 0; i < _array2.size(); ++i) { + if (_array2[i]->val13 <= 0) { + if (_array2[i]->val4 != _array2[i]->val2 || _array2[i]->val5 != _array2[i]->val3) { + if (_array2[i]->val9 < 2.0) + _array2[i]->val9 = 2.0; + + int dy = _array2[i]->val3 - _array2[i]->val5; + int dx = _array2[i]->val2 - _array2[i]->val4; + double dst = sqrt((double)(dy * dy + dx * dx)); + double at = atan2((double)dx, (double)dy); + int newX = (int)(cos(at) * _array2[i]->val9); + int newY = (int)(sin(at) * _array2[i]->val9); + + if (dst < _array2[i]->val9) { + newX = _array2[i]->val2 - _array2[i]->val4; + newY = _array2[i]->val3 - _array2[i]->val5; + } + if (dst <= 30.0) { + if (dst < 30.0) { + _array2[i]->val9 = _array2[i]->val9 - _array2[i]->val9 * 0.5; + + if (_array2[i]->val9 < 2.0) + _array2[i]->val9 = 2.0; + } + } else { + _array2[i]->val9 = _array2[i]->val9 * 0.5 + _array2[i]->val9; + + if (_array2[i]->val9 > _array2[i]->val11) + _array2[i]->val9 = _array2[i]->val11; + } + + _array2[i]->val4 += newX; + _array2[i]->val5 += newY; + _array2[i]->ani->setOXY(newX + _array2[i]->ani->_ox, newY + _array2[i]->ani->_oy); + + if (_array2[i]->val4 == _array2[i]->val2 && _array2[i]->val5 == _array2[i]->val3) { + _array2[i]->val9 = 0.0; + + _array2[i]->val13 = g_fp->_rnd->getRandomNumber(200) + 20; + + if (_array2[i]->fflags & 1) { + g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani); + + if (_array2[i]->ani) + delete _array2[i]->ani; + + _array2.remove_at(i); + + i--; + + if (!_array2.size()) + g_fp->stopAllSoundInstances(SND_CMN_060); + + continue; + } + } + } else { + if ((_array2[i]->fflags & 4) && _array2[i]->countdown < 1) { + _array2[i]->fflags |= 1; + _array2[i]->val2 = _array2[i]->val6; + _array2[i]->val3 = _array2[i]->val7; + } else { + if (_array2[i]->fflags & 2) { + int idx1 = g_fp->_rnd->getRandomNumber(_array1.size() - 1); + + _array2[i]->val2 = _array1[idx1]->val1; + _array2[i]->val3 = _array1[idx1]->val2; + } else { + Common::Rect rect; + + if (!_hRgn) + error("Floaters::update(): empty fliers region"); + + _hRgn->getBBox(&rect); + + int x2 = rect.left + g_fp->_rnd->getRandomNumber(rect.right - rect.left); + int y2 = rect.top + g_fp->_rnd->getRandomNumber(rect.bottom - rect.top); + + if (_hRgn->pointInRegion(x2, y2)) { + int dx = _array2[i]->val2 - x2; + int dy = _array2[i]->val3 - y2; + double dst = sqrt((double)(dy * dy + dx * dx)); + + if (dst < 300.0 || !_hRgn->pointInRegion(_array2[i]->val4, _array2[i]->val5)) { + _array2[i]->val2 = x2; + _array2[i]->val3 = y2; + } + } + } + + g_fp->playSound(SND_CMN_061, 0); + + if (_array2[i]->fflags & 4) + _array2[i]->countdown--; + } + } + } else { + _array2[i]->val13--; + } + + if (!_array2[i]->ani->_movement && _array2[i]->ani->_statics->_staticsId == ST_FLY_FLY) { + if (!_array2[i]->val15) { + g_fp->playSound(SND_CMN_060, 1); + + _array2[i]->val15 = 1; + } + + _array2[i]->ani->startAnim(MV_FLY_FLY, 0, -1); + } + } } void Floaters::stopAll() { - warning("STUB: Floaters::stopAll()"); + for (uint i = 0; i < _array2.size(); i++) { + g_fp->_currentScene->deleteStaticANIObject(_array2[i]->ani); + + delete _array2[i]->ani; + } + + _array2.clear(); + + g_fp->stopAllSoundInstances(SND_CMN_060); } diff --git a/engines/fullpipe/floaters.h b/engines/fullpipe/floaters.h index a4d64dd79d..3ecbbeea9c 100644 --- a/engines/fullpipe/floaters.h +++ b/engines/fullpipe/floaters.h @@ -27,10 +27,13 @@ namespace Fullpipe { class StaticANIObject; class Scene; +class ReactPolygonal; struct FloaterArray1 { int val1; int val2; + + FloaterArray1() { val1 = 0; val2 = 0; } }; struct FloaterArray2 { @@ -48,16 +51,21 @@ struct FloaterArray2 { int countdown; int val15; int fflags; + + FloaterArray2() : ani(0), val2(0), val3(0), val4(0), val5(0), val6(0), val7(0), val8(0), + val9(0.0), val11(0.0), val13(0), countdown(0), val15(0), fflags(0) {} }; class Floaters { public: - //HRGN hRgn; + ReactPolygonal *_hRgn; Common::Array<FloaterArray1 *> _array1; Common::Array<FloaterArray2 *> _array2; + Floaters() { _hRgn = 0; } + ~Floaters(); void init(GameVar *var); - void genFlies(Scene *sc, int x, int y, int a5, int a6); + void genFlies(Scene *sc, int x, int y, int priority, int flags); void update(); void stopAll(); }; diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index a0348a9407..4cfa330a09 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -94,11 +94,14 @@ FullpipeEngine::FullpipeEngine(OSystem *syst, const ADGameDescription *gameDesc) _isProcessingMessages = false; _musicAllowed = -1; + _musicGameVar = 0; _aniMan = 0; _aniMan2 = 0; _currentScene = 0; + _loaderScene = 0; _scene2 = 0; + _scene3 = 0; _movTable = 0; _floaters = 0; _mgm = 0; diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index 0f3e057b5a..ecf3c12982 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -64,6 +64,7 @@ struct MovTable; class MGM; class NGIArchive; class PictureObject; +struct PreloadItem; class Scene; class SoundList; class StaticANIObject; @@ -128,7 +129,9 @@ public: int _sceneWidth; int _sceneHeight; Scene *_currentScene; + Scene *_loaderScene; Scene *_scene2; + Scene *_scene3; StaticANIObject *_aniMan; StaticANIObject *_aniMan2; byte *_globalPalette; @@ -182,6 +185,7 @@ public: Common::Array<Common::Point *> _arcadeKeys; void initMap(); + void updateMap(PreloadItem *pre); void updateMapPiece(int mapId, int update); void updateScreen(); @@ -272,7 +276,10 @@ public: void lift_sub1(StaticANIObject *ani); void lift_startExitQueue(); void lift_sub05(ExCommand *ex); + bool lift_checkButton(const char *varname); + GameVar *_musicGameVar; + Audio::SoundHandle _sceneTrackHandle; public: bool _isSaveAllowed; diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index 64e6b93fb2..845655dded 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -28,6 +28,9 @@ #include "fullpipe/statics.h" #include "fullpipe/interaction.h" #include "fullpipe/motion.h" +#include "fullpipe/constants.h" +#include "fullpipe/scenes.h" +#include "fullpipe/floaters.h" namespace Fullpipe { @@ -79,6 +82,8 @@ GameLoader::~GameLoader() { delete _gameProject; delete _interactionController; delete _inputController; + + warning("STUB: GameLoader::~GameLoader()"); } bool GameLoader::load(MfcArchive &file) { @@ -228,8 +233,100 @@ bool GameLoader::gotoScene(int sceneId, int entranceId) { return true; } -bool preloadCallback(const PreloadItem &pre, int flag) { - warning("STUB: preloadCallback"); +bool preloadCallback(PreloadItem &pre, int flag) { + if (flag) { + if (flag == 50) + g_fp->_aniMan->preloadMovements(g_fp->_movTable); + + StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1); + + if (pbar) { + int sz; + + if (pbar->_movement->_currMovement) + sz = pbar->_movement->_currMovement->_dynamicPhases.size(); + else + sz = pbar->_movement->_dynamicPhases.size(); + + pbar->_movement->setDynamicPhaseIndex(flag * (sz - 1) / 100); + } + + g_fp->updateMap(&pre); + + g_fp->_currentScene = g_fp->_loaderScene; + + g_fp->_loaderScene->draw(); + + g_fp->_system->updateScreen(); + } else { + if (g_fp->_scene2) { + g_fp->_aniMan = g_fp->_scene2->getAniMan(); + g_fp->_scene2 = 0; + setInputDisabled(1); + } + + g_fp->_floaters->stopAll(); + + if (g_fp->_soundEnabled) { + g_fp->_currSoundListCount = 1; + g_fp->_currSoundList1[0] = g_fp->accessScene(SC_COMMON)->_soundList; + } + + g_vars->scene18_var01 = 0; + + if ((pre.preloadId1 != SC_18 || pre.sceneId != SC_19) && (pre.preloadId1 != SC_19 || (pre.sceneId != SC_18 && pre.sceneId != SC_19))) { + if (g_fp->_scene3) { + if (pre.preloadId1 != SC_18) + g_fp->_gameLoader->unloadScene(SC_18); + + g_fp->_scene3 = 0; + } + } else { + scene19_preload(g_fp->accessScene(pre.preloadId1), pre.keyCode); + + g_vars->scene18_var01 = 1; + + if (pre.preloadId1 == SC_18) { + g_fp->_gameLoader->saveScenePicAniInfos(SC_18); + + scene18_preload(); + } + } + + if (((pre.sceneId == SC_19 && pre.keyCode == TrubaRight) || (pre.sceneId == SC_18 && pre.keyCode == TrubaRight)) && !pre.preloadId2) { + pre.sceneId = SC_18; + pre.keyCode = TrubaLeft; + } + + if (!g_fp->_loaderScene) { + g_fp->_gameLoader->loadScene(SC_LDR); + g_fp->_loaderScene = g_fp->accessScene(SC_LDR);; + } + + StaticANIObject *pbar = g_fp->_loaderScene->getStaticANIObject1ById(ANI_PBAR, -1); + + if (pbar) { + pbar->show1(ST_EGTR_SLIMSORROW, ST_MAN_GOU, MV_PBAR_RUN, 0); + pbar->startAnim(MV_PBAR_RUN, 0, -1); + } + + g_fp->_inventoryScene = 0; + g_fp->_updateCursorCallback = 0; + + g_fp->_sceneRect.translate(-g_fp->_sceneRect.left, -g_fp->_sceneRect.top); + + g_fp->_system->delayMillis(10); + + Scene *oldsc = g_fp->_currentScene; + + g_fp->_currentScene = g_fp->_loaderScene; + + g_fp->_loaderScene->draw(); + + g_fp->_system->updateScreen(); + + g_fp->_currentScene = oldsc; + } return true; } diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index 4cfb803d8e..85bd6ab0fb 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -65,7 +65,7 @@ struct PreloadItem { int keyCode; }; -bool preloadCallback(const PreloadItem &pre, int flag); +bool preloadCallback(PreloadItem &pre, int flag); class PreloadItems : public Common::Array<PreloadItem *>, public CObject { public: @@ -95,7 +95,7 @@ class GameLoader : public CObject { Inventory2 _inventory; Sc2Array _sc2array; void *_sceneSwitcher; - bool (*_preloadCallback)(const PreloadItem &pre, int flag); + bool (*_preloadCallback)(PreloadItem &pre, int flag); void *_readSavegameCallback; int16 _field_F8; int16 _field_FA; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 8b2aca4bdb..6e6e35f17a 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -87,6 +87,10 @@ Background::Background() { _palette = 0; } +Background::~Background() { + warning("STUB: Background::~Background()"); +} + bool Background::load(MfcArchive &file) { debug(5, "Background::load()"); _bgname = file.readPascalString(); @@ -129,8 +133,8 @@ void Background::addPictureObject(PictureObject *pct) { pct->renumPictures(&_picObjList); bool inserted = false; - for (uint i = 0; i < _picObjList.size(); i++) { - if (((PictureObject *)_picObjList[i])->_priority == pct->_priority) { + for (uint i = 1; i < _picObjList.size(); i++) { + if (((PictureObject *)_picObjList[i])->_priority <= pct->_priority) { _picObjList.insert_at(i, pct); inserted = true; break; @@ -152,6 +156,10 @@ PictureObject::PictureObject() { _objtype = kObjTypePictureObject; } +PictureObject::~PictureObject() { + warning("STUB: PictureObject::~PictureObject()"); +} + PictureObject::PictureObject(PictureObject *src) : GameObject(src) { _picture = src->_picture; _ox2 = _ox; @@ -269,6 +277,11 @@ bool PictureObject::isPixelHitAtPos(int x, int y) { return res; } +void PictureObject::setOXY2() { + _ox2 = _ox; + _oy2 = _oy; +} + GameObject::GameObject() { _okeyCode = 0; _flags = 0; @@ -329,8 +342,8 @@ void GameObject::renumPictures(PtrList *lst) { int *buf = (int *)calloc(lst->size() + 2, sizeof(int)); for (uint i = 0; i < lst->size(); i++) { - if (_id == ((PictureObject *)((*lst)[i]))->_id) - buf[((PictureObject *)((*lst)[i]))->_okeyCode] = 1; + if (_id == ((GameObject *)((*lst)[i]))->_id) + buf[((GameObject *)((*lst)[i]))->_okeyCode] = 1; } if (buf[_okeyCode]) { diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 72495bfe0b..6e32c94164 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -115,6 +115,8 @@ class Picture : public MemoryObject { class BigPicture : public Picture { public: BigPicture() {} + virtual ~BigPicture() {} + virtual bool load(MfcArchive &file); virtual void draw(int x, int y, int style, int angle); }; @@ -156,7 +158,9 @@ class PictureObject : public GameObject { public: PictureObject(); + PictureObject(PictureObject *src); + virtual ~PictureObject(); virtual bool load(MfcArchive &file, bool bigPicture); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class @@ -168,6 +172,7 @@ class PictureObject : public GameObject { bool setPicAniInfo(PicAniInfo *picAniInfo); bool isPointInside(int x, int y); bool isPixelHitAtPos(int x, int y); + void setOXY2(); }; class Background : public CObject { @@ -185,6 +190,8 @@ class Background : public CObject { public: Background(); + virtual ~Background(); + virtual bool load(MfcArchive &file); void addPictureObject(PictureObject *pct); diff --git a/engines/fullpipe/init.cpp b/engines/fullpipe/init.cpp index d933e0f578..f661340665 100644 --- a/engines/fullpipe/init.cpp +++ b/engines/fullpipe/init.cpp @@ -94,7 +94,7 @@ void FullpipeEngine::initObjectStates() { setObjectState(sO_Valve4_26, getObjectEnumState(sO_Valve4_26, sO_Closed)); setObjectState(sO_Valve5_26, getObjectEnumState(sO_Valve5_26, sO_Opened)); setObjectState(sO_Pool, getObjectEnumState(sO_Pool, sO_Overfull)); - setObjectState(sO_Plank_25, getObjectEnumState(sO_Plank_25, sO_NearDudesStairs)); + setObjectState(sO_Board_25, getObjectEnumState(sO_Board_25, sO_NearDudesStairs)); setObjectState(sO_Driver, getObjectEnumState(sO_Driver, sO_WithSteering)); setObjectState(sO_Janitress, getObjectEnumState(sO_Janitress, sO_WithMop)); setObjectState(sO_LeftPipe_29, getObjectEnumState(sO_LeftPipe_29, sO_IsClosed)); diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp index 9d92638328..59b01a1777 100644 --- a/engines/fullpipe/interaction.cpp +++ b/engines/fullpipe/interaction.cpp @@ -55,6 +55,10 @@ bool canInteractAny(GameObject *obj1, GameObject *obj2, int invId) { return false; } +InteractionController::~InteractionController() { + warning("STUB: InteractionController::~InteractionController()"); +} + bool InteractionController::load(MfcArchive &file) { debug(5, "InteractionController::load()"); @@ -422,6 +426,10 @@ Interaction::Interaction() { _actionName = 0; } +Interaction::~Interaction() { + warning("STUB: Interaction::~Interaction()"); +} + bool Interaction::load(MfcArchive &file) { debug(5, "Interaction::load()"); diff --git a/engines/fullpipe/interaction.h b/engines/fullpipe/interaction.h index 456b35458b..7d9ee0bd51 100644 --- a/engines/fullpipe/interaction.h +++ b/engines/fullpipe/interaction.h @@ -54,6 +54,8 @@ class Interaction : public CObject { public: Interaction(); + virtual ~Interaction(); + virtual bool load(MfcArchive &file); bool canInteract(GameObject *obj1, GameObject *obj2, int invId); bool isOverlapping(StaticANIObject *subj, GameObject *obj); @@ -70,6 +72,7 @@ class InteractionController : public CObject { public: InteractionController() : _field_20(0), _flag24(true) {} + virtual ~InteractionController(); virtual bool load(MfcArchive &file); diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 3e22f8526d..f5af0611cb 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -30,6 +30,10 @@ namespace Fullpipe { +Inventory::~Inventory() { + warning("STUB: Inventory::~Inventory()"); +} + bool Inventory::load(MfcArchive &file) { debug(5, "Inventory::load()"); @@ -85,6 +89,10 @@ Inventory2::Inventory2() { _topOffset = -65; } +Inventory2::~Inventory2() { + warning("STUB: Inventory2::~Inventory2()"); +} + bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartially int numInvs = file.readUint32LE(); diff --git a/engines/fullpipe/inventory.h b/engines/fullpipe/inventory.h index 6d07f069bd..bc5847312b 100644 --- a/engines/fullpipe/inventory.h +++ b/engines/fullpipe/inventory.h @@ -49,6 +49,8 @@ class Inventory : public CObject { public: Inventory() { _sceneId = 0; } + virtual ~Inventory(); + virtual bool load(MfcArchive &file); int getInventoryPoolItemIndexById(int itemId); @@ -96,6 +98,8 @@ class Inventory2 : public Inventory { public: Inventory2(); + virtual ~Inventory2(); + bool loadPartial(MfcArchive &file); void addItem(int itemId, int count); void addItem2(StaticANIObject *obj); diff --git a/engines/fullpipe/lift.cpp b/engines/fullpipe/lift.cpp index ca23d8223a..cb811d610c 100644 --- a/engines/fullpipe/lift.cpp +++ b/engines/fullpipe/lift.cpp @@ -105,4 +105,10 @@ void FullpipeEngine::lift_sub05(ExCommand *ex) { warning("STUB: FullpipeEngine::lift_sub05()"); } +bool FullpipeEngine::lift_checkButton(const char *varname) { + warning("STUB: FullpipeEngine::lift_checkButton(%s)", varname); + + return false; +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/messages.cpp b/engines/fullpipe/messages.cpp index 36b89f8615..b0abe30504 100644 --- a/engines/fullpipe/messages.cpp +++ b/engines/fullpipe/messages.cpp @@ -41,7 +41,10 @@ ExCommand::ExCommand(ExCommand *src) : Message(src) { _messageNum = src->_messageNum; _excFlags = src->_excFlags; _parId = src->_parId; +} +ExCommand *ExCommand::createClone() { + return new ExCommand(this); } ExCommand::ExCommand(int16 parentId, int messageKind, int messageNum, int x, int y, int a7, int a8, int sceneClickX, int sceneClickY, int a11) : @@ -78,6 +81,8 @@ bool ExCommand::load(MfcArchive &file) { _parId = file.readUint32LE(); } + _objtype = kObjTypeExCommand; + return true; } @@ -120,6 +125,61 @@ void ExCommand::handle() { } } +void ExCommand::setf3c(int val) { + if (val != -1) + _field_3C = val; + + _field_34 = 1; +} + +void ExCommand::firef34() { + if (_field_34) { + if (_field_3C >= _keyCode) { + _field_34 = 0; + + sendMessage(); + + if (!_field_30 ) + setf3c(_field_2C); + } + } +} + +ExCommand2::ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize) : ExCommand(parentId, messageKind, 0, 0, 0, 0, 1, 0, 0, 0) { + _objtype = kObjTypeExCommand2; + + _pointsSize = pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * pointsSize); + + for (int i = 0; i < pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *points[i]; + } +} + +ExCommand2::ExCommand2(ExCommand2 *src) : ExCommand(src) { + _pointsSize = src->_pointsSize; + _points = (Common::Point **)malloc(sizeof(Common::Point *) * _pointsSize); + + for (int i = 0; i < _pointsSize; i++) { + _points[i] = new Common::Point; + + *_points[i] = *src->_points[i]; + } +} + +ExCommand2::~ExCommand2() { + for (int i = 0; i < _pointsSize; i++) + delete _points[i]; + + free(_points); +} + +ExCommand2 *ExCommand2::createClone() { + return new ExCommand2(this); +} + Message::Message() { _messageKind = 0; _parentId = 0; @@ -174,12 +234,23 @@ ObjstateCommand::ObjstateCommand() { _objCommandName = 0; } +ObjstateCommand::ObjstateCommand(ObjstateCommand *src) : ExCommand(src) { + _value = src->_value; + _objCommandName = (char *)calloc(strlen(src->_objCommandName) + 1, 1); + + strncpy(_objCommandName, src->_objCommandName, strlen(src->_objCommandName)); +} + +ObjstateCommand::~ObjstateCommand() { + free(_objCommandName); +} + bool ObjstateCommand::load(MfcArchive &file) { debug(5, "ObjStateCommand::load()"); _objtype = kObjTypeObjstateCommand; - _cmd.load(file); + ExCommand::load(file); _value = file.readUint32LE(); @@ -188,6 +259,10 @@ bool ObjstateCommand::load(MfcArchive &file) { return true; } +ObjstateCommand *ObjstateCommand::createClone() { + return new ObjstateCommand(this); +} + MessageQueue::MessageQueue() { _field_14 = 0; _parId = 0; @@ -219,7 +294,7 @@ MessageQueue::MessageQueue(MessageQueue *src, int parId, int field_38) { _field_38 = (field_38 == 0); for (Common::List<ExCommand *>::iterator it = src->_exCommands.begin(); it != src->_exCommands.end(); ++it) { - ExCommand *ex = new ExCommand(*it); + ExCommand *ex = (*it)->createClone(); ex->_excFlags |= 2; _exCommands.push_back(ex); @@ -331,6 +406,15 @@ void MessageQueue::addExCommandToEnd(ExCommand *ex) { _exCommands.push_back(ex); } +void MessageQueue::insertExCommandAt(int pos, ExCommand *ex) { + Common::List<ExCommand *>::iterator it = _exCommands.begin(); + + for (int i = pos; i > 0; i--) + ++it; + + _exCommands.insert(it, ex); +} + ExCommand *MessageQueue::getExCommandByIndex(uint idx) { if (idx >= getCount()) return 0; diff --git a/engines/fullpipe/messages.h b/engines/fullpipe/messages.h index 44245bcf19..2e8a29c2cb 100644 --- a/engines/fullpipe/messages.h +++ b/engines/fullpipe/messages.h @@ -57,7 +57,6 @@ class Message : public CObject { class ExCommand : public Message { public: - int _messageNum; int _field_3C; int _excFlags; @@ -70,27 +69,42 @@ class ExCommand : public Message { virtual bool load(MfcArchive &file); + virtual ExCommand *createClone(); + bool handleMessage(); void sendMessage(); void postMessage(); void handle(); + + void firef34(); + void setf3c(int val); }; class ExCommand2 : public ExCommand { public: Common::Point **_points; int _pointsSize; + + ExCommand2(int messageKind, int parentId, Common::Point **points, int pointsSize); + ExCommand2(ExCommand2 *src); + virtual ~ExCommand2(); + + virtual ExCommand2 *createClone(); }; -class ObjstateCommand : public CObject { +class ObjstateCommand : public ExCommand { public: - ExCommand _cmd; char *_objCommandName; int _value; public: ObjstateCommand(); + ObjstateCommand(ObjstateCommand *src); + virtual ~ObjstateCommand(); + virtual bool load(MfcArchive &file); + + virtual ObjstateCommand *createClone(); }; class MessageQueue : public CObject { @@ -124,6 +138,7 @@ class MessageQueue : public CObject { void addExCommand(ExCommand *ex); void addExCommandToEnd(ExCommand *ex); + void insertExCommandAt(int pos, ExCommand *ex); ExCommand *getExCommandByIndex(uint idx); void deleteExCommandByIndex(uint idx, bool doFree); diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 516d761aa2..6db916ae4f 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -28,6 +28,9 @@ #include "fullpipe/scenes.h" #include "fullpipe/gameloader.h" +#include "graphics/palette.h" +#include "video/avi_decoder.h" + namespace Fullpipe { ModalIntro::ModalIntro() { @@ -224,8 +227,41 @@ void ModalIntro::finish() { g_fp->_gameLoader->updateSystems(42); } -void ModalVideoPlayer::play(const char *fname) { - warning("STUB: ModalVideoPlayer::play(%s)", fname); +void ModalVideoPlayer::play(const char *filename) { + // TODO: Videos are encoded using Intel Indeo 5 (IV50), which isn't supported yet + + Video::AVIDecoder *aviDecoder = new Video::AVIDecoder(); + + if (!aviDecoder->loadFile(filename)) + return; + + uint16 x = (g_system->getWidth() - aviDecoder->getWidth()) / 2; + uint16 y = (g_system->getHeight() - aviDecoder->getHeight()) / 2; + bool skipVideo = false; + + aviDecoder->start(); + + while (!g_fp->shouldQuit() && !aviDecoder->endOfVideo() && !skipVideo) { + if (aviDecoder->needsUpdate()) { + const Graphics::Surface *frame = aviDecoder->decodeNextFrame(); + if (frame) { + g_fp->_system->copyRectToScreen(frame->getPixels(), frame->pitch, x, y, frame->w, frame->h); + + if (aviDecoder->hasDirtyPalette()) + g_fp->_system->getPaletteManager()->setPalette(aviDecoder->getPalette(), 0, 256); + + g_fp->_system->updateScreen(); + } + } + + Common::Event event; + while (g_fp->_system->getEventManager()->pollEvent(event)) { + if ((event.type == Common::EVENT_KEYDOWN && event.kbd.keycode == Common::KEYCODE_ESCAPE) || event.type == Common::EVENT_LBUTTONUP) + skipVideo = true; + } + + g_fp->_system->delayMillis(aviDecoder->getTimeToNextFrame()); + } } void FullpipeEngine::openMap() { diff --git a/engines/fullpipe/module.mk b/engines/fullpipe/module.mk index f73a82d3a3..af4e614559 100644 --- a/engines/fullpipe/module.mk +++ b/engines/fullpipe/module.mk @@ -24,6 +24,7 @@ MODULE_OBJS = \ stateloader.o \ statics.o \ utils.o \ + scenes/sceneIntro.o \ scenes/scene01.o \ scenes/scene02.o \ scenes/scene03.o \ @@ -38,9 +39,23 @@ MODULE_OBJS = \ scenes/scene13.o \ scenes/scene14.o \ scenes/scene15.o \ + scenes/scene16.o \ + scenes/scene17.o \ + scenes/scene18and19.o \ + scenes/scene20.o \ + scenes/scene21.o \ + scenes/scene22.o \ + scenes/scene23.o \ scenes/scene24.o \ - scenes/sceneDbg.o \ - scenes/sceneIntro.o + scenes/scene25.o \ + scenes/scene26.o \ + scenes/scene28.o \ + scenes/scene30.o \ + scenes/scene31.o \ + scenes/scene32.o \ + scenes/scene33.o \ + scenes/scene36.o \ + scenes/sceneDbg.o # This module can be built as a plugin ifeq ($(ENABLE_FULLPIPE), DYNAMIC_PLUGIN) diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index 3d515da725..f0318581f1 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -210,7 +210,7 @@ MessageQueue *MctlCompound::doWalkTo(StaticANIObject *subj, int xpos, int ypos, if (mq) { for (uint i = 0; i < closestP->_messageQueueObj->getCount(); i++) { - ex = new ExCommand(closestP->_messageQueueObj->getExCommandByIndex(i)); + ex = closestP->_messageQueueObj->getExCommandByIndex(i)->createClone(); ex->_excFlags |= 2; mq->addExCommandToEnd(ex); } @@ -391,7 +391,7 @@ MctlConnectionPoint::~MctlConnectionPoint() { } MovInfo1::MovInfo1(MovInfo1 *src) { - field_0 = src->field_0; + index = src->index; pt1 = src->pt1; pt2 = src->pt2; distance1 = src->distance1; @@ -404,7 +404,7 @@ MovInfo1::MovInfo1(MovInfo1 *src) { } void MovInfo1::clear() { - field_0 = 0; + index = 0; pt1.x = pt1.y = 0; pt2.x = pt2.y = 0; distance1 = 0; @@ -463,6 +463,10 @@ MovGraph::MovGraph() { _objtype = kObjTypeMovGraph; } +MovGraph::~MovGraph() { + warning("STUB: MovGraph::~MovGraph()"); +} + bool MovGraph::load(MfcArchive &file) { debug(5, "MovGraph::load()"); @@ -896,10 +900,10 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { if (i >= movInfo->itemsCount - 2 || movInfo->items[i + 2]->subIndex != 10) { movinfo.flags = 0; - mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex]; + mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turnS[movInfo->items[i + 1]->subIndex]; } else { movinfo.flags = 2; - mg2i = &_items2[movInfo->field_0]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex]; + mg2i = &_items2[movInfo->index]->_subItems[movInfo->items[i]->subIndex]._turn[movInfo->items[i + 1]->subIndex]; } if (i < movInfo->itemsCount - 2 || (movInfo->items[i]->x == movInfo->items[i + 1]->x @@ -909,10 +913,10 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { || movInfo->items[i + 1]->x == -1 || movInfo->items[i + 1]->y == -1) { - ExCommand *ex = new ExCommand(_items2[movInfo->field_0]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0); + ExCommand *ex = new ExCommand(_items2[movInfo->index]->_objectId, 1, mg2i->_movementId, 0, 0, 0, 1, 0, 0, 0); ex->_excFlags |= 2; - ex->_keyCode = _items2[movInfo->field_0]->_obj->_okeyCode; + ex->_keyCode = _items2[movInfo->index]->_obj->_okeyCode; ex->_field_24 = 1; ex->_field_14 = -1; mq->addExCommandToEnd(ex); @@ -924,7 +928,7 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { memset(&mgminfo, 0, sizeof(mgminfo)); - mgminfo.ani = _items2[movInfo->field_0]->_obj; + mgminfo.ani = _items2[movInfo->index]->_obj; mgminfo.staticsId2 = mg2i->_mov->_staticsObj2->_staticsId; mgminfo.x1 = movInfo->items[i + 1]->x; mgminfo.y1 = movInfo->items[i + 1]->y; @@ -967,13 +971,13 @@ MessageQueue *MovGraph2::buildMovInfo1MessageQueue(MovInfo1 *movInfo) { || movInfo->items[i + 2]->subIndex == movInfo->items[i + 3]->subIndex) { movinfo.flags &= 3; } else { - MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex]; + MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turnS[movInfo->items[i + 3]->subIndex]; movinfo.pt2.x -= m->_mx; movinfo.pt2.y -= m->_my; movinfo.flags &= 3; } } else { - MG2I *m = &_items2[movInfo->field_0]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex]; + MG2I *m = &_items2[movInfo->index]->_subItems[movInfo->items[i + 2]->subIndex]._turn[movInfo->items[i + 3]->subIndex]; if (movinfo.item1Index && movinfo.item1Index != 1) { movinfo.pt2.y -= m->_my; @@ -1380,132 +1384,111 @@ int MovGraph2::findLink(Common::Array<MovGraphLink *> *linkList, int idx, Common } MessageQueue *MovGraph2::genMovement(MovInfo1 *info) { -#if 0 - v69 = 0; - v70 = 0; - - if (!(info->_flags & 2)) { - v6 = sizeof(MovGraph2Item) * info->field_0 + 184 * info->subIndex; - v7 = this->items2.m_pData; - v69 = *(int *)((char *)&v7->subItems[0].walk[0].mx + v6); - v70 = *(int *)((char *)&v7->subItems[0].walk[0].my + v6); - } - v59 = 0; - v64 = 0; - if (!(info->_flags & 4)) { - v8 = sizeof(MovGraph2Item) * info->field_0 + 184 * info->subIndex; - v9 = this->items2.m_pData; - v59 = *(Message **)((char *)&v9->subItems[0].walk[2].mx + v8); - v64 = *(int *)((char *)&v9->subItems[0].walk[2].my + v8); - } - v11 = info->_flags & 1; - v12 = info->subIndex; - v13 = info->pt2.y - info->pt1.y - v64 - v70; - v14 = info->field_0; - y = info->pt2.y - info->pt1.y - v64 - v70; - x = info->pt2.x - (_DWORD)v59 - v69 - info->pt1.x; - v10 = x; - v16 = _mgm->calcLength(&point, _items2[v14].subItems[v12].walk[1].mov, x, y, &v65, &a2, v11); - v17 = v16->x; - x1 = v16->x; - v18 = v16->y; - v19 = info->flags & 1; - y1 = v18; - flag = v19; - if (!v19) { - v20 = info->subIndex; - if (v20 == 1 || !v20) { - v21 = 23 * v20; - v22 = 31 * info->field_0; + int mx1 = 0; + int my1 = 0; + + if (!(info->flags & 2)) { + mx1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mx; + my1 = _items2[info->index]->_subItems[info->subIndex]._walk[0]._my; + } + + int mx2 = 0; + int my2 = 0; + + if (!(info->flags & 4)) { + mx2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._mx; + my2 = _items2[info->index]->_subItems[info->subIndex]._walk[2]._my; + } + + Common::Point point; + + int y = info->pt2.y - info->pt1.y - my2 - my1; + int x = info->pt2.x - info->pt1.x - mx2 - mx1; + int a2; + int mgmLen; + + _mgm.calcLength(&point, _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, x, y, &mgmLen, &a2, info->flags & 1); + + int x1 = point.x; + int y1 = point.y; + + if (!(info->flags & 1)) { + if (info->subIndex == 1 || info->subIndex == 0) { a2 = -1; - v17 = v65 * this->items2.m_pData[24 * v22 / 0x2E8u].subItems[8 * v21 / 0xB8u].walk[1].mx; - v10 = v17; - x1 = v17; - x = v17; - info->pt2.x = (int)((char *)&v59->obj.vmt + v17 + v69 + info->pt1.x); + x1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mx; + x = x1; + info->pt2.x = x1 + info->pt1.x + mx1 + mx2; } } - if (!flag) { - v23 = info->subIndex; - if (v23 == 2 || v23 == 3) { - v24 = 23 * v23; - v25 = 31 * info->field_0; + + if (!(info->flags & 1)) { + if (info->subIndex == 2 || info->subIndex == 3) { a2 = -1; - v18 = v65 * this->items2.m_pData[24 * v25 / 0x2E8u].subItems[8 * v24 / 0xB8u].walk[1].my; - v26 = v18 + info->pt1.y; - y1 = v18; - v13 = v18; - info->pt2.y = v70 + v64 + v26; + y1 = mgmLen * _items2[info->index]->_subItems[info->subIndex]._walk[1]._my; + y = y1; + info->pt2.y = y1 + info->pt1.y + my1 + my2; } } - cnt = 0; - v60 = 0; + + int cntX = 0; + int cntY = 0; + if (!(info->flags & 2)) { - cnt = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov, -1, 1); - v27 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov, -1, 2); - v18 = y1; - v17 = x1; - v10 = x; - v60 = (Message *)v27; - } - if (v65 > 1) { - v28 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, -1, 1); - cnt += (v65 - 1) * v28; - v29 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, -1, 2); - v17 = x1; - v10 = x; - v60 = (Message *)((char *)v60 + (v65 - 1) * v29); - v18 = y1; - } - if (v65 > 0) { - cnt += Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, a2, 1); - v30 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, a2, 2); - v17 = x1; - v10 = x; - v60 = (Message *)((char *)v60 + v30); - v18 = y1; + cntX = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 1); + cntY = _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov->countPhasesWithFlag(-1, 2); + } + + if (mgmLen > 1) { + cntX += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 1); + cntY += (mgmLen - 1) * _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(-1, 2); } + + if (mgmLen > 0) { + cntX += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 1); + cntY += _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov->countPhasesWithFlag(a2, 2); + } + if (!(info->flags & 4)) { - cnt += Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov, -1, 1); - v31 = Movement_countPhasesWithFlag(this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov, -1, 2); - v17 = x1; - v10 = x; - v60 = (Message *)((char *)v60 + v31); - v18 = y1; - } - v32 = v10 - v17; - v33 = v13 - v18; - x = v32; - v74 = v33; - if (cnt) - x1 = (signed __int64)((double)x / (double)cnt); + cntX += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 1); + cntY += _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov->countPhasesWithFlag(-1, 2); + } + + int dx1 = x - x1; + int dy1 = y - y1; + + if (cntX) + x1 = (int)((double)dx1 / (double)cntX); else x1 = 0; - if (v60) - y1 = (signed __int64)((double)v74 / (double)(signed int)v60); + + if (cntY) + y1 = (int)((double)dy1 / (double)cntY); else y1 = 0; - v34 = v32 - cnt * x1; - v35 = v33 - (_DWORD)v60 * y1; - y2 = v34; - v76 = v35; + + int v34 = dx1 - cntX * x1; + int v35 = dy1 - cntY * y1; + Common::Point x2; + Common::Point y2(v34, v35); + if (v34) - x2 = v34 / abs(v34); + x2.x = v34 / abs(v34); else - x2 = 0; + x2.x = 0; + if (v35) - v72 = v35 / abs(v35); + x2.y = v35 / abs(v35); else - v72 = 0; - v38 = GlobalMessageQueueList_compact(&g_globalMessageQueueList); - res = MessageQueue_ctor1(v36, v38); - mq = res; - v39 = info->flags & 2; - if ((_BYTE)v39) { - v45 = new ExCommand( - LOWORD(this->items2.m_pData[info->field_0].objectId), + x2.y = 0; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex; + + if (info->flags & 2) { + ex = new ExCommand( + _items2[info->index]->_objectId, 5, - this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].movementId, + _items2[info->index]->_subItems[info->subIndex]._walk[1]._movementId, info->pt1.x, info->pt1.y, 0, @@ -1513,19 +1496,17 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) { 0, 0, 0); - v46 = info->distance1; - v45->msg._field_14 = v46; - v41 = (int)&res->exCommands.obj.vmt; - v47 = v45->_excFlags | 2; - v45->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode; - v45->msg._field_24 = 1; - v45->_excFlags = v47; + + ex->_field_14 = info->distance1; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 1; + ex->_excFlags |= 2; } else { - v40 = ExCommand_ctor( - (ExCommand *)v61, - LOWORD(this->items2.m_pData[info->field_0].objectId), + ex = new ExCommand( + _items2[info->index]->_objectId, 5, - this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].movementId, + _items2[info->index]->_subItems[info->subIndex]._walk[0]._movementId, info->pt1.x, info->pt1.y, 0, @@ -1533,80 +1514,74 @@ MessageQueue *MovGraph2::genMovement(MovInfo1 *info) { 0, 0, 0); - v41 = (int)&res->exCommands.obj.vmt; - v40->msg._field_14 = info->distance1; - v42 = info->field_0; - v43 = info->field_0; - - LOWORD(v43) = *(_WORD *)(*((_DWORD *)&this->items2.m_pData->obj + 6 * (32 * v43 - v42)) + 4); - v44 = v40->_excFlags; - v40->msg._keyCode = (unsigned __int16)v43; - v40->msg._field_24 = 1; - v40->_excFlags = v44 | 2; - CPtrList::AddTail(&res->exCommands, v40); - v45 = MGM_buildExCommand2( - (MGM *)&this->movGraph.mgm, - this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[offsetof(MovGraph2Item, objectId)].mov, - LOWORD(this->items2.m_pData[info->field_0].objectId), + + ex->_field_14 = info->distance1; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 1; + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[0]._mov, + _items2[info->index]->_objectId, x1, y1, &x2, &y2, -1); - v45->_parId = res->_id; - v45->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode; - } - CPtrList::AddTail(v41, v45); - v48 = v65; - v49 = 0; - for (i = 0; i < v65; ++i) { - if (v49 == v48 - 1) - v50 = a2; + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + } + + mq->addExCommandToEnd(ex); + + for (int i = 0; i < mgmLen; ++i) { + int par; + + if (i == mgmLen - 1) + par = a2; else - v50 = -1; - v51 = MGM_buildExCommand2( - (MGM *)&this->movGraph.mgm, - this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[1].mov, - LOWORD(this->items2.m_pData[info->field_0].objectId), + par = -1; + + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[1]._mov, + _items2[info->index]->_objectId, x1, y1, &x2, &y2, - v50); - res = mq; - v51->_parId = mq->_id; - v51->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode; - CPtrList::AddTail(v41, v51); - v48 = v65; - v49 = i + 1; + par); + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + mq->addExCommandToEnd(ex); } + if (!(info->flags & 4)) { - v52 = MGM_buildExCommand2( - (MGM *)&this->movGraph.mgm, - this->items2.m_pData[info->field_0].subItems[info->subIndex].walk[2].mov, - LOWORD(this->items2.m_pData[info->field_0].objectId), + ex = _mgm.buildExCommand2( + _items2[info->index]->_subItems[info->subIndex]._walk[2]._mov, + _items2[info->index]->_objectId, x1, y1, &x2, &y2, -1); - v52->_parId = res->_id; - v52->msg._keyCode = this->items2.m_pData[info->field_0].obj->go._okeyCode; - CPtrList::AddTail(v41, v52); - } - v54 = ExCommand_ctor(v53, LOWORD(this->items2.m_pData[info->field_0].objectId), 5, -1, info->pt2.x, info->pt2.y, 0, 1, 0, 0, 0); - v54->msg._field_14 = info->distance2; - v55 = info->field_0; - v56 = this->items2.m_pData; - v54->msg._keyCode = v56[v55].obj->go._okeyCode; - v57 = v54->_excFlags | 2; - v54->msg._field_24 = 0; - v54->_excFlags = v57; - CPtrList::AddTail(v41, v54); - return res; -#endif + ex->_parId = mq->_id; + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; - return 0; + mq->addExCommandToEnd(ex); + } + + ex = new ExCommand(_items2[info->index]->_objectId, 5, -1, info->pt2.x, info->pt2.y, 0, 1, 0, 0, 0); + ex->_field_14 = info->distance2; + + ex->_keyCode = _items2[info->index]->_obj->_okeyCode; + ex->_field_24 = 0; + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + return mq; } MovGraphLink *MovGraph2::findLink1(int x, int y, int idx, int fuzzyMatch) { @@ -1911,6 +1886,9 @@ Common::Point *MGM::getPoint(Common::Point *point, int objectId, int staticsId1, } int MGM::getStaticsIndexById(int idx, int16 id) { + if (!_items[idx]->statics.size()) + return -1; + for (uint i = 0; i < _items[idx]->statics.size(); i++) { if (_items[idx]->statics[i]->_staticsId == id) return i; @@ -1919,6 +1897,18 @@ int MGM::getStaticsIndexById(int idx, int16 id) { return 0; } +int MGM::getStaticsIndex(int idx, Statics *st) { + if (!_items[idx]->statics.size()) + return -1; + + for (uint i = 0; i < _items[idx]->statics.size(); i++) { + if (_items[idx]->statics[i] == st) + return i; + } + + return 0; +} + void MGM::clearMovements2(int idx) { _items[idx]->movements2.clear(); } @@ -1929,6 +1919,140 @@ int MGM::recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop) { return 0; } +Common::Point *MGM::calcLength(Common::Point *pRes, Movement *mov, int x, int y, int *x1, int *y1, int flag) { + Common::Point point; + + mov->calcSomeXY(point, 0); + int p1x = point.x; + int p1y = point.y; + + int newx1 = 0; + int oldy1 = *y1; + + if (abs(p1y) > abs(p1x)) { + if (mov->calcSomeXY(point, 0)->y) + newx1 = (int)((double)y / point.y); + } else if (mov->calcSomeXY(point, 0)->x) { + newx1 = (int)((double)x / point.y); + } + + if (newx1 < 0) + newx1 = 0; + + *x1 = newx1; + + int phase = 1; + int sz; + + if (flag) { + if (abs(p1y) > abs(p1x)) { + while (abs(p1y * newx1 + mov->calcSomeXY(point, 0)->y) < abs(y)) { + sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + if (phase >= sz) { + phase--; + + break; + } + + phase++; + } + } else { + while (abs(p1x * newx1 + mov->calcSomeXY(point, 0)->x) < abs(x)) { + sz = mov->_currMovement ? mov->_currMovement->_dynamicPhases.size() : mov->_dynamicPhases.size(); + + if (phase >= sz) { + phase--; + + break; + } + + phase++; + } + } + + *y1 = phase - 1; + } else { + *y1 = -1; + } + + int p2x = 0; + int p2y = 0; + + if (!oldy1) + oldy1 = -1; + + if (oldy1 > 0) { + ++*x1; + + mov->calcSomeXY(point, 0); + p2x = point.x; + p2y = point.y; + + if (abs(p1y) > abs(p1x)) + p2x = p1x; + else + p2y = p1y; + } + + pRes->x = p2x + p1x * newx1; + pRes->y = p2y + p1y * newx1; + + return pRes; +} + +ExCommand2 *MGM::buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len) { + uint cnt; + + if (mov->_currMovement) + cnt = mov->_currMovement->_dynamicPhases.size(); + else + cnt = mov->_dynamicPhases.size(); + + if (len > 0 && cnt > (uint)len) + cnt = len; + + Common::Point **points = (Common::Point **)malloc(sizeof(Common::Point *) * cnt); + + for (uint i = 0; i < cnt; i++) { + int flags = mov->getDynamicPhaseByIndex(i)->getDynFlags(); + + points[i] = new Common::Point; + + if (flags & 1) { + points[i]->x = x1 + x2->x; + + y2->x -= x2->x; + + if (!y2->x) + x2->x = 0; + } + + if (flags & 2) { + points[i]->y = y1 + x2->y; + + y2->y -= x2->y; + + if (!y2->y) + x2->y = 0; + } + } + + ExCommand2 *ex = new ExCommand2(20, objId, points, cnt); + ex->_excFlags = 2; + ex->_messageNum = mov->_id; + ex->_field_14 = len; + ex->_field_24 = 1; + ex->_keyCode = -1; + + for (uint i = 0; i < cnt; i++) + delete points[i]; + + free(points); + + return ex; +} + MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; @@ -1943,6 +2067,11 @@ MovGraphLink::MovGraphLink() { _objtype = kObjTypeMovGraphLink; } +MovGraphLink::~MovGraphLink() { + warning("STUB: MovGraphLink::~MovGraphLink()"); +} + + bool MovGraphLink::load(MfcArchive &file) { debug(5, "MovGraphLink::load()"); @@ -2018,7 +2147,7 @@ void ReactParallel::createRegion() { for (int i = 0; i < 4; i++) _points[i] = new Common::Point; - double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796; + double at = atan2((double)(_x1 - _x2), (double)(_y1 - _y2)) + 1.570796; // pi/2 double sn = sin(at); double cs = cos(at); @@ -2038,20 +2167,28 @@ void ReactParallel::createRegion() { // GdiObject::Attach(_rgn, CreatePolygonRgn(_points, 4, 2); } -void ReactParallel::method14() { - warning("STUB: ReactParallel::method14()"); +void ReactParallel::setCenter(int x1, int y1, int x2, int y2) { + _x1 = x1; + _y1 = y1; + _x2 = x2; + _y2 = y2; } ReactPolygonal::ReactPolygonal() { - _field_C = 0; - _field_10 = 0; + _centerX = 0; + _centerY = 0; + _bbox = 0; +} + +ReactPolygonal::~ReactPolygonal() { + delete _bbox; } bool ReactPolygonal::load(MfcArchive &file) { debug(5, "ReactPolygonal::load()"); - _field_C = file.readUint32LE(); - _field_10 = file.readUint32LE(); + _centerX = file.readUint32LE(); + _centerY = file.readUint32LE(); _pointCount = file.readUint32LE(); if (_pointCount > 0) { @@ -2078,10 +2215,54 @@ void ReactPolygonal::createRegion() { } } -void ReactPolygonal::method14() { - warning("STUB: ReactPolygonal::method14()"); +void ReactPolygonal::setCenter(int x1, int y1, int x2, int y2) { + int cX = (x2 + x1) / 2; + int cY = (y2 + y1) / 2; + + if (_points) { + for (int i = 0; i < _pointCount; i++) { + _points[i]->x += cX - _centerX; + _points[i]->y += cY - _centerY; + } + } + + _centerX = cX; + _centerY = cY; +} + +void ReactPolygonal::getBBox(Common::Rect *rect) { + if (!_pointCount) + return; + + if (_bbox) { + *rect = *_bbox; + return; + } + + rect->left = _points[0]->x; + rect->top = _points[0]->y; + rect->right = _points[0]->x; + rect->bottom = _points[0]->y; + + for (int i = 1; i < _pointCount; i++) { + if (rect->left > _points[i]->x) + rect->left = _points[i]->x; + + if (rect->top < _points[i]->y) + rect->top = _points[i]->y; + + if (rect->right < _points[i]->x) + rect->right = _points[i]->x; + + if (rect->bottom > _points[i]->y) + rect->bottom = _points[i]->y; + } + + _bbox = new Common::Rect; + *_bbox = *rect; } + bool MovGraphReact::pointInRegion(int x, int y) { if (_pointCount < 3) { return false; @@ -2133,7 +2314,11 @@ int startWalkTo(int objId, int objKey, int x, int y, int a5) { } int doSomeAnimation(int objId, int objKey, int a3) { - warning("STUB: doSomeAnimation(%d, %d, %d)", objId, objKey, a3); + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(objId, objKey); + MctlCompound *cmp = getCurrSceneSc2MotionController(); + + if (ani && cmp) + return cmp->method3C(ani, a3); return 0; } diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index 1f1e7a733a..6ad46e719a 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -29,6 +29,8 @@ class Statics; class Movement; class MctlConnectionPoint; class MovGraphLink; +class MessageQueue; +class ExCommand2; int startWalkTo(int objId, int objKey, int x, int y, int a5); int doSomeAnimation(int objId, int objKey, int a3); @@ -74,7 +76,7 @@ public: MovGraphReact() : _pointCount(0), _points(0) {} ~MovGraphReact() { free(_points); } - virtual void method14() {} + virtual void setCenter(int x1, int y1, int x2, int y2) {} virtual void createRegion() {} virtual bool pointInRegion(int x, int y); }; @@ -171,8 +173,11 @@ public: void updateAnimStatics(StaticANIObject *ani, int staticsId); Common::Point *getPoint(Common::Point *point, int aniId, int staticsId1, int staticsId2); int getStaticsIndexById(int idx, int16 id); + int getStaticsIndex(int idx, Statics *st); void clearMovements2(int idx); int recalcOffsets(int idx, int st1idx, int st2idx, bool flip, bool flop); + Common::Point *calcLength(Common::Point *point, Movement *mov, int x, int y, int *x1, int *y1, int flag); + ExCommand2 *buildExCommand2(Movement *mov, int objId, int x1, int y1, Common::Point *x2, Common::Point *y2, int len); }; struct MctlLadderMovementVars { @@ -243,25 +248,29 @@ class ReactParallel : public MovGraphReact { int _dx; int _dy; - public: +public: ReactParallel(); virtual bool load(MfcArchive &file); - virtual void method14(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); }; class ReactPolygonal : public MovGraphReact { - //CRgn _rgn; - int _field_C; - int _field_10; + Common::Rect *_bbox; + int _centerX; + int _centerY; - public: +public: ReactPolygonal(); + ~ReactPolygonal(); + virtual bool load(MfcArchive &file); - virtual void method14(); + virtual void setCenter(int x1, int y1, int x2, int y2); virtual void createRegion(); + + void getBBox(Common::Rect *rect); }; class MovGraphLink : public CObject { @@ -280,6 +289,8 @@ class MovGraphLink : public CObject { public: MovGraphLink(); + virtual ~MovGraphLink(); + virtual bool load(MfcArchive &file); void calcNodeDistanceAndAngle(); @@ -317,6 +328,8 @@ public: public: MovGraph(); + virtual ~MovGraph(); + virtual bool load(MfcArchive &file); virtual void addObject(StaticANIObject *obj); @@ -366,7 +379,7 @@ struct MovInfo1Sub { }; struct MovInfo1 { - int field_0; + int index; Common::Point pt1; Common::Point pt2; int distance1; diff --git a/engines/fullpipe/objectnames.h b/engines/fullpipe/objectnames.h index 023e07083e..8939f44975 100644 --- a/engines/fullpipe/objectnames.h +++ b/engines/fullpipe/objectnames.h @@ -32,13 +32,14 @@ namespace Fullpipe { #define sO_Pool "\xc1\xe0\xf1\xf1\xe5\xe9\xed" // "ÐаÑÑейМ" #define sO_TummyTrampie "\xc1\xe0\xf2\xf3\xf2\xe0" // "ÐаÑÑÑа" #define sO_WithoutBoot "\xc1\xe5\xe7 \xe1\xee\xf2\xe8\xed\xea\xe0" // "Ðез бПÑОМка" -#define sO_WithoutJug "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Ðез гПÑÑкПв" +#define sO_WithoutJugs "\xc1\xe5\xe7 \xe3\xee\xf0\xf8\xea\xee\xe2" // "Ðез гПÑÑкПв" #define sO_WithoutCarpet "\xc1\xe5\xe7 \xea\xee\xe2\xf0\xe8\xea\xe0" // "Ðез кПвÑОка" #define sO_WithoutCoin "\xc1\xe5\xe7 \xec\xee\xed\xe5\xf2\xfb" // "Ðез ЌПМеÑÑ" #define sO_WithNothing "\xc1\xe5\xe7 \xed\xe8\xf7\xe5\xe3\xee" // "Ðез МОÑегП" #define sO_WithoutHandle "\xc1\xe5\xe7 \xf0\xf3\xf7\xea\xe8" // "Ðез ÑÑÑкО" #define sO_WithoutStool "\xc1\xe5\xe7 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xe8" // "Ðез ÑабÑÑеÑкО" #define sO_WithoutDrawer "\xc1\xe5\xe7 \xff\xf9\xe8\xea\xe0" // "Ðез ÑÑОка" +#define sO_Nearby "\xc1\xeb\xe8\xe7\xea\xee" // "ÐлОзкП" #define sO_Blocked "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "ÐлПкОÑПваМ" #define sO_BlockedShe "\xc1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed\xe0" // "ÐлПкОÑПваМа" #define sO_Awaken "\xc1\xee\xe4\xf0\xf1\xf2\xe2\xf3\xe5\xf2" // "ÐПЎÑÑÑвÑеÑ" @@ -52,8 +53,10 @@ namespace Fullpipe { #define sO_In_15_1 "\xc2_15_1" // "Ð_15_1" #define sO_In_15_2 "\xc2_15_2" // "Ð_15_2" #define sO_In_15_3 "\xc2_15_3" // "Ð_15_3" +#define sO_In_16 "\xc2_16" // "Ð_16" +#define sO_In_32 "\xc2_32" // "Ð_32" #define sO_In_32_Lies "\xc2_32 \xeb\xe5\xe6\xe8\xf2" // "Ð_32 лежОÑ" -#define sO_In_32_Stands "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "Ð_32 ÑПÑÑОÑ" +#define sO_In_32_Sticks "\xc2_32 \xf2\xee\xf0\xf7\xe8\xf2" // "Ð_32 ÑПÑÑОÑ" #define sO_In_33 "\xc2_33" // "Ð_33" #define sO_In_7 "\xc2_7" // "Ð_7" #define sO_Together "\xc2\xe4\xe2\xee\xe5\xec" // "ÐЎвПеЌ" @@ -77,10 +80,11 @@ namespace Fullpipe { #define sO_Jug "\xc3\xee\xf0\xf8\xee\xea" // "ÐПÑÑПк" #define sO_Strolling "\xc3\xf3\xeb\xff\xe5\xf2" // "ÐÑлÑеÑ" #define sO_Yes "\xc4\xe0" // "Ðа" +#define sO_FarAway "\xc4\xe0\xeb\xe5\xea\xee" // "ÐалекП" #define sO_Girl "\xc4\xe5\xe2\xee\xf7\xea\xe0" // "ÐевПÑка" #define sO_Elephantine "\xc4\xe5\xe2\xee\xf7\xea\xe0-\xf1\xeb\xee\xed\xe8\xea" // "ÐевПÑка-ÑлПМОк" #define sO_Grandpa "\xc4\xe5\xe4\xf3\xf8\xea\xe0" // "ÐеЎÑÑка" -#define sO_Plank_25 "\xc4\xee\xf1\xea\xe0_25" // "ÐПÑка_25" +#define sO_Board_25 "\xc4\xee\xf1\xea\xe0_25" // "ÐПÑка_25" #define sO_Plank_34 "\xc4\xee\xf1\xea\xe0_34" // "ÐПÑка_34" #define sO_DudeHasJumped "\xc4\xff\xe4\xff \xef\xf0\xfb\xe3\xe0\xeb" // "ÐÑÐŽÑ Ð¿ÑÑгал" #define sO_Dude "\xc4\xff\xe4\xff" // "ÐÑÐŽÑ" @@ -165,7 +169,7 @@ namespace Fullpipe { #define sO_FullPipe "\xcf\xee\xeb\xed\xe0\xff \xd2\xf0\xf3\xe1\xe0" // "ÐÐŸÐ»ÐœÐ°Ñ Ð¢ÑÑба" #define sO_RightStairs_9 "\xcf\xf0\xe0\xe2\xe0\xff \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe0_9" // "ÐÑÐ°Ð²Ð°Ñ Ð»ÐµÑÑМОÑа_9" #define sO_RightPipe_17 "\xcf\xf0\xe0\xe2\xe0\xff \xf2\xf0\xf3\xe1\xe0_17" // "ÐÑÐ°Ð²Ð°Ñ ÑÑÑба_17" -#define sO_Available "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "ÐÑОÑÑÑÑÑвÑеÑ" +#define sO_IsPresent "\xcf\xf0\xe8\xf1\xf3\xf2\xf1\xf2\xe2\xf3\xe5\xf2" // "ÐÑОÑÑÑÑÑвÑеÑ" #define sO_GulpedEgg "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xee\xe5 \xff\xe9\xf6\xee" // "ÐÑПглПÑеММПе ÑйÑП" #define sO_GulpedEggs "\xcf\xf0\xee\xe3\xeb\xee\xf7\xe5\xed\xed\xfb\xe5 \xff\xe9\xf6\xe0" // "ÐÑПглПÑеММÑе ÑйÑа" #define sO_BellyInflater "\xcf\xf3\xe7\xee\xe4\xf3\xe2" // "ÐÑзПЎÑв" @@ -175,7 +179,7 @@ namespace Fullpipe { #define sO_IsDrinking "\xcf\xfc\xe5\xf2" // "ÐÑеÑ" #define sO_Broken "\xd0\xe0\xe7\xe1\xe8\xf2\xe0" // "РазбОÑа" #define sO_Unblocked "\xd0\xe0\xe7\xe1\xeb\xee\xea\xe8\xf0\xee\xe2\xe0\xed" // "РазблПкОÑПваМ" -#define sO_Unfolded "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "РазвеÑМÑÑ" +#define sO_Unconvoluted "\xd0\xe0\xe7\xe2\xe5\xf0\xed\xf3\xf2" // "РазвеÑМÑÑ" #define sO_Jawcrucnher "\xd0\xee\xf2\xee\xf5\xf0\xf3\xf1" // "РПÑПÑ
ÑÑÑ" #define sO_UsherHand "\xd0\xf3\xea\xe0 \xc1\xe8\xeb\xe5\xf2\xe5\xf0\xf8\xe8" // "Ð Ñка ÐОлеÑеÑÑО" #define sO_LeverHandle_23 "\xd0\xf3\xea\xee\xff\xf2\xea\xe0 \xf0\xfb\xf7\xe0\xe3\xe0_23" // "Ð ÑкПÑÑка ÑÑÑага_23" @@ -189,7 +193,7 @@ namespace Fullpipe { #define sO_WithJug "\xd1 \xe3\xee\xf0\xf8\xea\xee\xec" // "С гПÑÑкПЌ" #define sO_WithGum "\xd1 \xe6\xe2\xe0\xf7\xea\xee\xe9" // "С жваÑкПй" #define sO_WithShovel "\xd1 \xeb\xee\xef\xe0\xf2\xee\xe9" // "С лПпаÑПй" -#define sO_WithTiny "\xd1 \xec\xe0\xeb\xfb\xec" // "С ЌалÑÐŒ" +#define sO_WithSmall "\xd1 \xec\xe0\xeb\xfb\xec" // "С ЌалÑÐŒ" #define sO_WithHammer "\xd1 \xec\xee\xeb\xee\xf2\xea\xee\xec" // "С ЌПлПÑкПЌ" #define sO_WithCoin "\xd1 \xec\xee\xed\xe5\xf2\xee\xe9" // "С ЌПМеÑПй" #define sO_WithSock "\xd1 \xed\xee\xf1\xea\xee\xec" // "С МПÑкПЌ" @@ -202,8 +206,8 @@ namespace Fullpipe { #define sO_Convoluted "\xd1\xe2\xe5\xf0\xed\xf3\xf2" // "СвеÑМÑÑ" #define sO_IsFree "\xd1\xe2\xee\xe1\xee\xe4\xed\xe0" // "СвПбПЎМа" #define sO_IsSitting "\xd1\xe8\xe4\xe8\xf2" // "СОЎОÑ" -#define sO_Laughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "СЌееÑÑÑ" -#define sO_WithEveryone "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "СП вÑеЌО" +#define sO_IsLaughing "\xd1\xec\xe5\xe5\xf2\xf1\xff" // "СЌееÑÑÑ" +#define sO_WithAll "\xd1\xee \xe2\xf1\xe5\xec\xe8" // "СП вÑеЌО" #define sO_WithMop "\xd1\xee \xf8\xe2\xe0\xe1\xf0\xee\xe9" // "СП ÑвабÑПй" #define sO_WithHose "\xd1\xee \xf8\xeb\xe0\xed\xe3\xee\xec" // "СП ÑлаМгПЌ" #define sO_WithBrush "\xd1\xee \xf9\xe5\xf2\xea\xee\xe9" // "СП ÑеÑкПй" @@ -221,14 +225,15 @@ namespace Fullpipe { #define sO_Pedestal_17 "\xd2\xf3\xec\xe1\xe0_17" // "ТÑЌба_17" #define sO_Pedestal_33 "\xd2\xf3\xec\xe1\xe0_33" // "ТÑЌба_33" #define sO_NearDudesStairs "\xd3 \xc4\xff\xe4\xe8 \xed\xe0 \xeb\xe5\xf1\xf2\xed\xe8\xf6\xe5" // "У ÐÑЎО Ма леÑÑМОÑе" -#define sO_NearDude "\xd3 \xc4\xff\xe4\xe8" // "У ÐÑЎО" +#define sO_DudeHas "\xd3 \xc4\xff\xe4\xe8" // "У ÐÑЎО" #define sO_NearPipeWithStool "\xd3 \xf2\xf0\xf3\xe1\xfb \xf1 \xf2\xe0\xe1\xf3\xf0\xe5\xf2\xea\xee\xe9" // "У ÑÑÑÐ±Ñ Ñ ÑабÑÑеÑкПй" #define sO_NearPipe "\xd3 \xf2\xf0\xf3\xe1\xfb" // "У ÑÑÑбÑ" #define sO_Janitors "\xd3\xe1\xee\xf0\xf9\xe8\xea\xe8" // "УбПÑÑОкО" #define sO_Janitress "\xd3\xe1\xee\xf0\xf9\xe8\xf6\xe0" // "УбПÑÑОÑа" #define sO_IsGone "\xd3\xe5\xf5\xe0\xeb\xe0" // "УеÑ
ала" +#define sO_FallenTwice "\xd3\xef\xe0\xeb \xe4\xe2\xe0" // "Упал Ўва" #define sO_FallenOnce "\xd3\xef\xe0\xeb \xf0\xe0\xe7" // "Упал Ñаз" -#define sO_FallenBrush "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала ÑеÑка" +#define sO_BrushHasFallen "\xd3\xef\xe0\xeb\xe0 \xf9\xe5\xf2\xea\xe0" // "Упала ÑеÑка" #define sO_NotBroken "\xd6\xe5\xeb\xe0" // "Њела" #define sO_IsScratchingBelly "\xd7\xe5\xf8\xe5\xf2 \xef\xf3\xe7\xee" // "ЧеÑÐµÑ Ð¿ÑзП" #define sO_Level0 "\xdd\xf2\xe0\xe6 0" // "ÐÑаж 0" diff --git a/engines/fullpipe/objects.h b/engines/fullpipe/objects.h index a12851e63b..d13559429a 100644 --- a/engines/fullpipe/objects.h +++ b/engines/fullpipe/objects.h @@ -82,6 +82,8 @@ class GameVar : public CObject { public: GameVar(); + virtual ~GameVar(); + virtual bool load(MfcArchive &file); GameVar *getSubVarByName(const char *name); bool setSubVarAsInt(const char *name, int value); diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 558a90978a..997d92ae1c 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -92,6 +92,9 @@ bool SceneTag::load(MfcArchive &file) { SceneTag::~SceneTag() { free(_tag); + + delete _scene; + delete _field_4; } void SceneTag::loadScene() { @@ -129,6 +132,10 @@ Scene::Scene() { _sceneName = 0; } +Scene::~Scene() { + warning("STUB: Scene::~Scene()"); +} + bool Scene::load(MfcArchive &file) { debug(5, "Scene::load()"); @@ -442,8 +449,16 @@ bool Scene::compareObjPriority(const void *p1, const void *p2) { return false; } -void Scene::objectList_sortByPriority(PtrList &list) { - Common::sort(list.begin(), list.end(), Scene::compareObjPriority); +void Scene::objectList_sortByPriority(PtrList &list, bool skipFirst) { + if (skipFirst) { + PtrList::iterator s = list.begin(); + + ++s; + + Common::sort(s, list.end(), Scene::compareObjPriority); + } else { + Common::sort(list.begin(), list.end(), Scene::compareObjPriority); + } } void Scene::draw() { @@ -608,7 +623,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { debug(8, "Scene::drawContent(>%d, <%d, %d)", minPri, maxPri, drawBg); if (_picObjList.size() > 2) { // We need to z-sort them - objectList_sortByPriority(_picObjList); + objectList_sortByPriority(_picObjList, true); } if (minPri == -1 && _picObjList.size()) diff --git a/engines/fullpipe/scene.h b/engines/fullpipe/scene.h index db0da5db31..fc04a877f5 100644 --- a/engines/fullpipe/scene.h +++ b/engines/fullpipe/scene.h @@ -44,6 +44,7 @@ class Scene : public Background { public: Scene(); + virtual ~Scene(); virtual bool load(MfcArchive &file); @@ -79,12 +80,12 @@ class Scene : public Background { private: static bool compareObjPriority(const void *p1, const void *p2); - void objectList_sortByPriority(PtrList &list); + void objectList_sortByPriority(PtrList &list, bool skipFirst = false); }; class SceneTag : public CObject { public: - int _field_4; + CObject *_field_4; char *_tag; Scene *_scene; int16 _sceneId; diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 835f324ef6..4b0a3a1a7e 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -199,31 +199,83 @@ Vars::Vars() { scene13_dudeX = 0; scene14_grandma = 0; - scene14_var01 = 0; - scene14_var02 = 0; - scene14_var03 = 0; - scene14_var04 = 0; - scene14_var05 = 0; - scene14_var06 = 0; - scene14_var07 = 0; - scene14_var08 = 0; + scene14_sceneDeltaX = 0; + scene14_sceneDeltaY = 0; + scene14_arcadeIsOn = false; + scene14_dudeIsKicking = false; + scene14_ballIsFlying = false; + scene14_dudeCanKick = false; + scene14_sceneDiffX = 0; + scene14_sceneDiffY = 0; scene14_pink = 0; - scene14_var10 = 0; - scene14_var11.clear(); - scene14_var12.clear(); - scene14_var13 = 0; - scene14_var14 = 0; - scene14_var15 = 0; - scene14_var16 = 0; - scene14_var17 = 0; - scene14_var18 = 0; - scene14_var19 = 0; + scene14_flyingBall = 0; + scene14_balls.clear(); + scene14_grandmaIsHere = false; + scene14_dudeX = 0; + scene14_dudeY = 0; + scene14_grandmaX = 0; + scene14_grandmaY = 0; + scene14_dude2X = 0; + scene14_ballDeltaX = 0; + scene14_ballDeltaY = 0; + scene14_ballX = 0; + scene14_ballY = 0; + scene14_hitsLeft = 0; scene15_chantingCountdown = 0; scene15_plusminus = 0; scene15_ladder = 0; scene15_boot = 0; + scene16_figures.clear(); + scene16_walkingBoy = 0; + scene16_walkingGirl = 0; + scene16_walkingCount = 0; + scene16_wire = 0; + scene16_mug = 0; + scene16_jettie = 0; + scene16_boot = 0; + scene16_girlIsLaughing = false; + scene16_sound = 0; + scene16_placeIsOccupied = false; + + scene17_flyState = 0; + scene17_sugarIsShown = false; + scene17_sceneOldEdgeX = 0; + scene17_flyCountdown = 0; + scene17_hand = 0; + scene17_handPhase = false; + scene17_sceneEdgeX = 0; + + scene18_var01 = 0; + + scene20_fliesCountdown = 0; + scene20_grandma = 0; + + scene21_giraffeBottom = 0; + scene21_giraffeBottomX = 0; + scene21_giraffeBottomY = 0; + scene21_pipeIsOpen = false; + scene21_wigglePos = 0.0; + scene21_wiggleTrigger = 0; + + scene22_bag = 0; + scene22_giraffeMiddle = 0; + scene22_dudeIsOnStool = false; + scene22_interactionIsDisabled = false; + scene22_craneIsOut = true; + scene22_numBagFalls = 1; + + scene23_calend0 = 0; + scene23_calend1 = 0; + scene23_calend2 = 0; + scene23_calend3 = 0; + scene23_topReached = false; + scene23_isOnStool = false; + scene23_someVar = 0; + scene23_giraffeTop = 0; + scene23_giraffee = 0; + scene24_jetIsOn = false; scene24_flowIsLow = false; scene24_waterIsOn = false; @@ -231,6 +283,65 @@ Vars::Vars() { scene24_jet = 0; scene24_drop = 0; + scene25_water = 0; + scene25_board = 0; + scene25_drop = 0; + scene25_dudeIsOnBoard = false; + scene25_waterIsPresent = false; + scene25_boardIsSelectable = false; + scene25_beardersAreThere = false; + scene25_beardersCounter = 0; + scene25_bearders.clear(); + scene25_sneezeFlipper = false; + + scene26_chhi = 0; + scene26_drop = 0; + scene26_sockPic = 0; + scene26_sock = 0; + scene26_activeVent = 0; + + scene28_fliesArePresent = true; + scene28_beardedDirection = true; + scene28_darkeningObject = 0; + scene28_lighteningObject = 0; + scene28_headDirection = false; + scene28_headBeardedFlipper = false; + scene28_lift6inside = false; + + scene30_leg = 0; + scene30_liftFlag = 1; + + scene31_chantingCountdown = 0; + scene31_cactus = 0; + scene31_plusMinus = 0; + + scene32_flagIsWaving = false; + scene32_flagNeedsStopping = false; + scene32_dudeIsSitting = false; + scene32_cactusCounter = -1; + scene32_dudeOnLadder = false; + scene32_cactusIsGrowing = false; + scene32_flag = 0; + scene32_cactus = 0; + scene32_massOrange = 0; + scene32_massBlue = 0; + scene32_massGreen = 0; + scene32_button = 0; + + scene33_mug = 0; + scene33_jettie = 0; + scene33_cube = 0; + scene33_cubeX = -1; + scene33_handleIsDown = false; + + for (int i = 0; i < 9; i++) { + scene33_ventsX[i] = 0; + scene33_ventsState[i] = 0; + } + + scene36_rotohrust = 0; + scene36_scissors = 0; + selector = 0; } @@ -259,7 +370,7 @@ int FullpipeEngine::convertScene(int scene) { } int FullpipeEngine::getSceneEntrance(int scene) { - for (int i = 0; i < 41; i++) + for (int i = 0; i < 40; i++) if (scenes[i] == scene) return scenesD[i]; @@ -544,7 +655,6 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene15_updateCursor; break; -#if 0 case SC_16: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_16"); scene->preloadMovements(sceneVar); @@ -564,10 +674,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_17"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler17, 2); - scene17_sub_41F060(); + scene17_restoreState(); _updateCursorCallback = scene17_updateCursor; break; +#if 0 case SC_18: sub_40E1B0(); sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_18"); @@ -608,6 +719,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene19_sub_4211D0(scene); _updateCursorCallback = scene19_updateCursor; break; +#endif case SC_20: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_20"); @@ -638,7 +750,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_22"); setSceneMusicParameters(sceneVar); - scene22_sub_4228A0(); + scene22_setBagState(); insertMessageHandler(sceneHandler22, 2, 2); _updateCursorCallback = scene22_updateCursor; break; @@ -651,10 +763,9 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_23"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler23, 2, 2); - scene23_sub_423B00(); + scene23_setGiraffeState(); _updateCursorCallback = scene23_updateCursor; break; -#endif case SC_24: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_24"); @@ -668,16 +779,15 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = defaultUpdateCursor; break; -#if 0 case SC_25: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_25"); scene->preloadMovements(sceneVar); - scene25_initScene(scene, entrance->field_4); + scene25_initScene(scene, entrance->_field_4); _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_25"); setSceneMusicParameters(sceneVar); addMessageHandler(sceneHandler25, 2); - scene25_sub_4253B0(scene, entrance->field_4); + scene25_setupWater(scene, entrance->_field_4); _updateCursorCallback = scene25_updateCursor; break; @@ -689,10 +799,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_26"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler26, 2, 2); - scene26_sub_426140(scene); + scene26_setupDrop(scene); _updateCursorCallback = scene26_updateCursor; break; +#if 0 case SC_27: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_27"); scene->preloadMovements(sceneVar); @@ -703,6 +814,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler27, 2); _updateCursorCallback = scene27_updateCursor; break; +#endif case SC_28: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_28"); @@ -715,6 +827,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene28_updateCursor; break; +#if 0 case SC_29: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_29"); scene->preloadMovements(sceneVar); @@ -725,11 +838,12 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { addMessageHandler(sceneHandler29, 2); _updateCursorCallback = scene29_updateCursor; break; +#endif case SC_30: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_30"); scene->preloadMovements(sceneVar); - scene30_initScene(scene, entrance->field_4); + scene30_initScene(scene, entrance->_field_4); _behaviorManager->initBehavior(scene, sceneVar); scene->initObjectCursors("SC_30"); setSceneMusicParameters(sceneVar); @@ -756,7 +870,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_32"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler32, 2, 2); - scene32_sub_42C5C0(); + scene32_setupMusic(); _updateCursorCallback = scene32_updateCursor; break; @@ -768,10 +882,11 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { scene->initObjectCursors("SC_33"); setSceneMusicParameters(sceneVar); insertMessageHandler(sceneHandler33, 2, 2); - scene33_sub_42CEF0(); + scene33_setupMusic(); _updateCursorCallback = scene33_updateCursor; break; +#if 0 case SC_34: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_34"); scene->preloadMovements(sceneVar); @@ -794,6 +909,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { insertMessageHandler(sceneHandler35, 2, 2); _updateCursorCallback = defaultUpdateCursor; break; +#endif case SC_36: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_36"); @@ -806,6 +922,7 @@ bool FullpipeEngine::sceneSwitcher(EntranceInfo *entrance) { _updateCursorCallback = scene36_updateCursor; break; +#if 0 case SC_37: sceneVar = _gameLoader->_gameVar->getSubVarByName("SC_37"); scene->preloadMovements(sceneVar); diff --git a/engines/fullpipe/scenes.h b/engines/fullpipe/scenes.h index 93abacdc85..cd614ed1a8 100644 --- a/engines/fullpipe/scenes.h +++ b/engines/fullpipe/scenes.h @@ -92,10 +92,74 @@ int scene15_updateCursor(); void scene15_initScene(Scene *sc); int sceneHandler15(ExCommand *cmd); +void scene16_initScene(Scene *sc); +int sceneHandler16(ExCommand *cmd); +int scene16_updateCursor(); + +void scene17_initScene(Scene *sc); +void scene17_restoreState(); +int sceneHandler17(ExCommand *cmd); +int scene17_updateCursor(); + +void scene18_preload(); +void scene19_preload(Scene *sc, int key); + +void scene20_initScene(Scene *sc); +int sceneHandler20(ExCommand *ex); + +int scene21_updateCursor(); +void scene21_initScene(Scene *sc); +int sceneHandler21(ExCommand *cmd); + +void scene22_initScene(Scene *sc); +void scene22_setBagState(); +int sceneHandler22(ExCommand *cmd); +int scene22_updateCursor(); + +void scene23_initScene(Scene *sc); +void scene23_setGiraffeState(); +int sceneHandler23(ExCommand *cmd); +int scene23_updateCursor(); + void scene24_initScene(Scene *sc); void scene24_setPoolState(); int sceneHandler24(ExCommand *cmd); +void scene25_initScene(Scene *sc, int entrance); +void scene25_setupWater(Scene *sc, int entrance); +int sceneHandler25(ExCommand *cmd); +int scene25_updateCursor(); + +void scene26_initScene(Scene *sc); +void scene26_setupDrop(Scene *sc); +int sceneHandler26(ExCommand *cmd); +int scene26_updateCursor(); + +void scene28_initScene(Scene *sc); + int sceneHandler28(ExCommand *ex); +int scene28_updateCursor(); + +int scene30_updateCursor(); +void scene30_initScene(Scene *sc, int flag); +int sceneHandler30(ExCommand *cmd); + +void scene31_initScene(Scene *sc); +int sceneHandler31(ExCommand *ex); + +void scene32_initScene(Scene *sc); +void scene32_setupMusic(); +int sceneHandler32(ExCommand *cmd); +int scene32_updateCursor(); + +void scene33_initScene(Scene *sc); +void scene33_setupMusic(); +int sceneHandler33(ExCommand *cmd); +int scene33_updateCursor(); + +int scene36_updateCursor(); +void scene36_initScene(Scene *sc); +int sceneHandler36(ExCommand *cmd); + void sceneDbgMenu_initScene(Scene *sc); int sceneHandlerDbgMenu(ExCommand *cmd); @@ -275,31 +339,84 @@ public: int scene13_dudeX; StaticANIObject *scene14_grandma; - int scene14_var01; - int scene14_var02; - int scene14_var03; - int scene14_var04; - int scene14_var05; - int scene14_var06; - int scene14_var07; - int scene14_var08; + int scene14_sceneDeltaX; + int scene14_sceneDeltaY; + bool scene14_arcadeIsOn; + bool scene14_dudeIsKicking; + bool scene14_ballIsFlying; + bool scene14_dudeCanKick; + int scene14_sceneDiffX; + int scene14_sceneDiffY; StaticANIObject *scene14_pink; - int scene14_var10; - Common::List<StaticANIObject *> scene14_var11; - Common::List<StaticANIObject *> scene14_var12; - int scene14_var13; - int scene14_var14; - int scene14_var15; - int scene14_var16; - int scene14_var17; - int scene14_var18; - int scene14_var19; + StaticANIObject *scene14_flyingBall; + Common::List<StaticANIObject *> scene14_balls; + bool scene14_grandmaIsHere; + int scene14_dudeX; + int scene14_dudeY; + int scene14_grandmaX; + int scene14_grandmaY; + int scene14_dude2X; + int scene14_ballDeltaX; + int scene14_ballDeltaY; + int scene14_ballX; + int scene14_ballY; + int scene14_hitsLeft; + Common::Point scene14_mouseCursorPos; int scene15_chantingCountdown; StaticANIObject *scene15_plusminus; PictureObject *scene15_ladder; StaticANIObject *scene15_boot; + Common::List<StaticANIObject *> scene16_figures; + StaticANIObject *scene16_walkingBoy; + StaticANIObject *scene16_walkingGirl; + int scene16_walkingCount; + StaticANIObject *scene16_wire; + StaticANIObject *scene16_mug; + StaticANIObject *scene16_jettie; + StaticANIObject *scene16_boot; + bool scene16_girlIsLaughing; + int scene16_sound; + bool scene16_placeIsOccupied; + + int scene17_flyState; + bool scene17_sugarIsShown; + int scene17_sceneOldEdgeX; + int scene17_flyCountdown; + StaticANIObject *scene17_hand; + bool scene17_handPhase; + int scene17_sceneEdgeX; + + int scene18_var01; + + int scene20_fliesCountdown; + StaticANIObject *scene20_grandma; + + StaticANIObject *scene21_giraffeBottom; + int scene21_giraffeBottomX; + int scene21_giraffeBottomY; + int scene21_pipeIsOpen; + double scene21_wigglePos; + bool scene21_wiggleTrigger; + + StaticANIObject *scene22_bag; + StaticANIObject *scene22_giraffeMiddle; + bool scene22_dudeIsOnStool; + bool scene22_interactionIsDisabled; + bool scene22_craneIsOut; + int scene22_numBagFalls; + + StaticANIObject *scene23_calend0; + StaticANIObject *scene23_calend1; + StaticANIObject *scene23_calend2; + StaticANIObject *scene23_calend3; + bool scene23_topReached; + bool scene23_isOnStool; + int scene23_someVar; + StaticANIObject *scene23_giraffeTop; + StaticANIObject *scene23_giraffee; + bool scene24_jetIsOn; bool scene24_flowIsLow; bool scene24_waterIsOn; @@ -307,6 +424,62 @@ public: StaticANIObject *scene24_jet; StaticANIObject *scene24_drop; + StaticANIObject *scene25_water; + StaticANIObject *scene25_board; + StaticANIObject *scene25_drop; + bool scene25_dudeIsOnBoard; + bool scene25_waterIsPresent; + bool scene25_boardIsSelectable; + bool scene25_beardersAreThere; + int scene25_beardersCounter; + Common::Array<StaticANIObject *> scene25_bearders; + bool scene25_sneezeFlipper; + + StaticANIObject *scene26_chhi; + StaticANIObject *scene26_drop; + PictureObject *scene26_sockPic; + StaticANIObject *scene26_sock; + StaticANIObject *scene26_activeVent; + + bool scene28_fliesArePresent; + bool scene28_beardedDirection; + PictureObject *scene28_darkeningObject; + PictureObject *scene28_lighteningObject; + bool scene28_headDirection; + bool scene28_headBeardedFlipper; + bool scene28_lift6inside; + + StaticANIObject *scene30_leg; + int scene30_liftFlag; + + int scene31_chantingCountdown; + StaticANIObject *scene31_cactus; + StaticANIObject *scene31_plusMinus; + + bool scene32_flagIsWaving; + bool scene32_flagNeedsStopping; + bool scene32_dudeIsSitting; + int scene32_cactusCounter; + bool scene32_dudeOnLadder; + bool scene32_cactusIsGrowing; + StaticANIObject *scene32_flag; + StaticANIObject *scene32_cactus; + StaticANIObject *scene32_massOrange; + StaticANIObject *scene32_massBlue; + StaticANIObject *scene32_massGreen; + StaticANIObject *scene32_button; + + StaticANIObject *scene33_mug; + StaticANIObject *scene33_jettie; + StaticANIObject *scene33_cube; + int scene33_cubeX; + bool scene33_handleIsDown; + int scene33_ventsX[9]; + int scene33_ventsState[9]; + + StaticANIObject *scene36_rotohrust; + StaticANIObject *scene36_scissors; + PictureObject *selector; }; diff --git a/engines/fullpipe/scenes/scene04.cpp b/engines/fullpipe/scenes/scene04.cpp index fa9f4ceef0..332935072c 100644 --- a/engines/fullpipe/scenes/scene04.cpp +++ b/engines/fullpipe/scenes/scene04.cpp @@ -298,7 +298,7 @@ void sceneHandler04_walkClimbLadder(ExCommand *ex) { ExCommand *ex3; if (ex) { - ex3 = new ExCommand(ex); + ex3 = ex->createClone(); } else { ex3 = new ExCommand(0, 17, MSG_SC4_CLICKLADDER, 0, 0, 0, 1, 0, 0, 0); ex3->_excFlags |= 3; @@ -498,7 +498,7 @@ void sceneHandler04_gotoLadder(ExCommand *ex) { mq->addExCommandToEnd(ex3); if (ex) { - ExCommand *ex4 = new ExCommand(ex); + ExCommand *ex4 = ex->createClone(); mq->addExCommandToEnd(ex4); } @@ -630,7 +630,7 @@ MessageQueue *sceneHandler04_kozFly5(StaticANIObject *ani, double phase) { MessageQueue *mq2 = mgm.genMovement(&mgminfo); if (mq1 && mq2) { - mq1->addExCommandToEnd(new ExCommand(mq2->getExCommandByIndex(0))); + mq1->addExCommandToEnd(mq2->getExCommandByIndex(0)->createClone()); delete mq2; @@ -890,7 +890,7 @@ void sceneHandler04_animOutOfBottle(ExCommand *ex) { MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC4_MANFROMBOTTLE), 0, 0); if (ex) { - ExCommand *newex = new ExCommand(ex); + ExCommand *newex = ex->createClone(); mq->addExCommandToEnd(newex); } @@ -1066,7 +1066,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) { MessageQueue *mq = g_vars->scene04_ladder->controllerWalkTo(g_fp->_aniMan, 0); if (mq) { - mq->addExCommandToEnd(new ExCommand(ex)); + mq->addExCommandToEnd(ex->createClone()); if (mq->chain(g_fp->_aniMan) ) ex->_messageKind = 0; @@ -1099,7 +1099,7 @@ void sceneHandler04_leaveLadder(ExCommand *ex) { ex1->_excFlags |= 2; mq->addExCommandToEnd(ex1); - ex1 = new ExCommand(ex); + ex1 = ex->createClone(); mq->addExCommandToEnd(ex1); mq->setFlags(mq->getFlags() | 1); diff --git a/engines/fullpipe/scenes/scene08.cpp b/engines/fullpipe/scenes/scene08.cpp index ada63ef22d..716ca1f593 100644 --- a/engines/fullpipe/scenes/scene08.cpp +++ b/engines/fullpipe/scenes/scene08.cpp @@ -282,7 +282,7 @@ void sceneHandler08_finishArcade() { void sceneHandler08_jumpOff(ExCommand *cmd) { MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); - mq->addExCommandToEnd(new ExCommand(cmd)); + mq->addExCommandToEnd(cmd->createClone()); mq->setFlags(mq->getFlags() | 1); g_fp->_globalMessageQueueList->addMessageQueue(mq); diff --git a/engines/fullpipe/scenes/scene11.cpp b/engines/fullpipe/scenes/scene11.cpp index 26fe10d4cc..e7ed947a00 100644 --- a/engines/fullpipe/scenes/scene11.cpp +++ b/engines/fullpipe/scenes/scene11.cpp @@ -52,20 +52,20 @@ void scene11_dudeSwingCallback(int *arg) { g_vars->scene11_swingAngle = g_vars->scene11_swingSpeed * 0.0042 + g_vars->scene11_swingAngle; if (g_vars->scene11_swingAngle < -1.5) { - g_vars->scene11_swingAngle = 1.0004882812500000; - g_vars->scene11_swingSpeed = 1.0; - g_vars->scene11_swingAngleDiff = 1.0; + g_vars->scene11_swingAngle = -1.5; //1.0004882812500000; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; } if (g_vars->scene11_swingAngle > 1.5) { - g_vars->scene11_swingAngle = 1.9990234375; - g_vars->scene11_swingSpeed = 1.0; - g_vars->scene11_swingAngleDiff = 1.0; + g_vars->scene11_swingAngle = 1.5; //1.9990234375; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; } if (g_vars->scene11_swingMaxAngle == *arg && 0.0 != g_vars->scene11_swingSpeed && fabs(g_vars->scene11_swingSpeed) < 2.5) { - g_vars->scene11_swingSpeed = 1.0; - g_vars->scene11_swingAngleDiff = 1.0; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; g_vars->scene11_swingAngle = g_vars->scene11_swingOldAngle; } @@ -110,11 +110,11 @@ void scene11_initScene(Scene *sc) { g_vars->scene11_hintCounter = 0; g_vars->scene11_swingieScreenEdge = 0; g_vars->scene11_crySound = 0; - g_vars->scene11_swingAngle = 1.0; - g_vars->scene11_swingOldAngle = 1.0; - g_vars->scene11_swingSpeed = 1.0; - g_vars->scene11_swingAngleDiff = 1.0; - g_vars->scene11_swingInertia = 1.9849218750000000; + g_vars->scene11_swingAngle = 0.0; + g_vars->scene11_swingOldAngle = 0.0; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + g_vars->scene11_swingInertia = 1.28; //1.9849218750000000; g_vars->scene11_swingCounter = 0; g_vars->scene11_swingCounterPrevTurn = 0; g_vars->scene11_swingDirection = 0; @@ -240,7 +240,7 @@ void sceneHandler11_manToSwing() { g_fp->_aniMan2->hide(); g_vars->scene11_swingCounter = 0; - g_vars->scene11_swingInertia = 1.9849218; + g_vars->scene11_swingInertia = 1.28; //1.9849218; g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB; g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1); @@ -302,10 +302,10 @@ void sceneHandler11_jumpFromSwing() { getCurrSceneSc2MotionController()->setEnabled(); getGameLoaderInteractionController()->enableFlag24(); - g_vars->scene11_swingOldAngle = 1.0; - g_vars->scene11_swingAngleDiff = 1.0; - g_vars->scene11_swingSpeed = 1.0; - g_vars->scene11_swingAngle = 1.0; + g_vars->scene11_swingOldAngle = 0.0; + g_vars->scene11_swingAngleDiff = 0.0; + g_vars->scene11_swingSpeed = 0.0; + g_vars->scene11_swingAngle = 0.0; g_vars->scene11_dudeOnSwing = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN11, -1); g_vars->scene11_dudeOnSwing->_flags &= 0xFFFB; @@ -342,7 +342,7 @@ void sceneHandler11_swing0() { g_vars->scene11_swingDirection = 0; g_vars->scene11_swingMaxAngle = 45; - g_vars->scene11_swingOldAngle = 1.0; + g_vars->scene11_swingOldAngle = 0.0; } void sceneHandler11_swing1() { @@ -381,7 +381,7 @@ void sceneHandler11_emptySwing() { g_vars->scene11_dudeOnSwing->startAnim(MV_KCH_MOVE2, 0, -1); g_vars->scene11_dudeOnSwing->_movement->setDynamicPhaseIndex(g_vars->scene11_dudeOnSwing->_movement->_currDynamicPhaseIndex); - g_vars->scene11_swingInertia = 1.9881250; + g_vars->scene11_swingInertia = 0.03; //1.9881250; } void sceneHandler11_jumpHitAndWin() { @@ -729,7 +729,7 @@ int sceneHandler11(ExCommand *cmd) { x = g_vars->scene11_dudeX; } if (y > g_fp->_sceneRect.bottom - 300) { - //g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300; // FIXME. Causes flicker + g_fp->_currentScene->_y = y - g_fp->_sceneRect.bottom + 300; x = g_vars->scene11_dudeX; } if (x >= 940) diff --git a/engines/fullpipe/scenes/scene12.cpp b/engines/fullpipe/scenes/scene12.cpp index 65f50b465a..0295efcaf5 100644 --- a/engines/fullpipe/scenes/scene12.cpp +++ b/engines/fullpipe/scenes/scene12.cpp @@ -42,7 +42,7 @@ void scene12_initScene(Scene *sc) { g_vars->scene12_fly = g_fp->getObjectState(sO_Fly_12); if (g_vars->scene12_fly) - g_vars->scene12_flyCountdown = 600 * g_fp->_rnd->getRandomNumber(32767) / 0x7fff + 600; + g_vars->scene12_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600; g_fp->setObjectState(sO_Fly_12, g_fp->_rnd->getRandomNumber(1)); } diff --git a/engines/fullpipe/scenes/scene14.cpp b/engines/fullpipe/scenes/scene14.cpp index 7433a91457..4a09bc9cb6 100644 --- a/engines/fullpipe/scenes/scene14.cpp +++ b/engines/fullpipe/scenes/scene14.cpp @@ -32,45 +32,42 @@ #include "fullpipe/interaction.h" #include "fullpipe/behavior.h" - +#include "fullpipe/input.h" namespace Fullpipe { void scene14_initScene(Scene *sc) { g_vars->scene14_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA, -1); - g_vars->scene14_var01 = 200; - g_vars->scene14_var02 = 200; - g_vars->scene14_var03 = 0; - g_vars->scene14_var04 = 0; - g_vars->scene14_var05 = 0; - g_vars->scene14_var06 = 0; - g_vars->scene14_var07 = 300; - g_vars->scene14_var08 = 300; + g_vars->scene14_sceneDeltaX = 200; + g_vars->scene14_sceneDeltaY = 200; + g_vars->scene14_arcadeIsOn = false; + g_vars->scene14_dudeIsKicking = false; + g_vars->scene14_ballIsFlying = false; + g_vars->scene14_dudeCanKick = false; + g_vars->scene14_sceneDiffX = 300; + g_vars->scene14_sceneDiffY = 300; g_vars->scene14_pink = 0; - g_vars->scene14_var10 = 0; - g_vars->scene14_var11.clear(); - g_vars->scene14_var12.clear(); + g_vars->scene14_flyingBall = 0; + g_vars->scene14_balls.clear(); if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) { - g_vars->scene14_var13 = 1; + g_vars->scene14_grandmaIsHere = true; StaticANIObject *ball = sc->getStaticANIObject1ById(ANI_BALL14, -1); - if (ball) { - ball->_flags &= 0xFFFB; - g_vars->scene14_var11.push_back(ball); - } + ball->_flags &= 0xFFFB; + g_vars->scene14_balls.push_back(ball); for (uint i = 0; i < 3; i++) { ball = new StaticANIObject(ball); // create a copy ball->_flags &= 0xFFFB; - g_vars->scene14_var11.push_back(ball); + g_vars->scene14_balls.push_back(ball); sc->addStaticANIObject(ball, 1); } } else { - g_vars->scene14_var13 = 0; + g_vars->scene14_grandmaIsHere = false; g_vars->scene14_grandma->hide(); } @@ -82,15 +79,15 @@ void scene14_initScene(Scene *sc) { } void scene14_setupMusic() { - if (!g_vars->scene14_var13) + if (!g_vars->scene14_grandmaIsHere) g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_14"), "MUSIC2", 0); } int scene14_updateCursor() { g_fp->updateCursorCommon(); - if (g_vars->scene14_var03) { - if (g_vars->scene14_var04) { + if (g_vars->scene14_arcadeIsOn) { + if (g_vars->scene14_dudeIsKicking) { g_fp->_cursorId = PIC_CSR_ARCADE2_D; } else { if (g_fp->_aniMan != g_fp->_objectAtCursor || g_fp->_aniMan->_movement || g_fp->_cursorId != PIC_CSR_DEFAULT) { @@ -109,7 +106,7 @@ int scene14_updateCursor() { int sceneHandler14_updateScreenCallback() { int res; - res = g_fp->drawArcadeOverlay(g_vars->scene14_var03); + res = g_fp->drawArcadeOverlay(g_vars->scene14_arcadeIsOn); if (!res) g_fp->_updateScreenCallback = 0; @@ -117,35 +114,230 @@ int sceneHandler14_updateScreenCallback() { } void sceneHandler14_showBallGrandmaHit2() { - warning("STUB: sceneHandler14_showBallGrandmaHit2()"); + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 223, g_vars->scene14_grandmaY + 35, MV_BAL14_SPIN, 0); + g_vars->scene14_flyingBall->_priority = 27; + + g_vars->scene14_pink = g_vars->scene14_flyingBall; + + g_vars->scene14_flyingBall = 0; + } } void sceneHandler14_showBallGrandmaDive() { - warning("STUB: sceneHandler14_showBallGrandmaDive()"); + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 506, g_vars->scene14_grandmaY - 29, -1, 0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + } + + g_fp->_aniMan2 = g_fp->_aniMan; } void sceneHandler14_showBallGrandmaHit() { - warning("STUB: sceneHandler14_showBallGrandmaHit()"); + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_grandmaX + 190, g_vars->scene14_grandmaY + 56, MV_BAL14_TOGMA, 0); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + } +} + +void sceneHandler14_exitScene() { + g_vars->scene14_arcadeIsOn = false; + + if (g_fp->_aniMan->_movement) + g_fp->_aniMan->_movement->gotoLastFrame(); + + g_fp->_aniMan->stopAnim_maybe(); + + handleObjectInteraction(g_fp->_aniMan, g_fp->_currentScene->getPictureObjectById(PIC_SC14_RTRUBA, 0), 0); + + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + chainQueue(QU_SC14_ENDARCADE, 0); + + getGameLoaderInteractionController()->disableFlag24(); + getCurrSceneSc2MotionController()->clearEnabled(); } void sceneHandler14_showBallMan() { - warning("STUB: sceneHandler14_showBallMan()"); + if (g_vars->scene14_flyingBall) { + g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 166, g_vars->scene14_dudeY + 40, MV_BAL14_TOGMA, 0); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_TOGMA, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_flyingBall->startAnim(MV_BAL14_TOGMA, 0, -1); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + + if (g_vars->scene14_dudeX >= 1300) + sceneHandler14_exitScene(); + } } void sceneHandler14_manKickBall() { - warning("STUB: sceneHandler14_manKickBall()"); + int val = (g_vars->scene14_grandmaX + 65 - (g_vars->scene14_dudeX - 85)) / -32; + int den = val; + + g_vars->scene14_ballX = g_vars->scene14_dudeX - 85; + g_vars->scene14_ballY = g_vars->scene14_dudeY - 76; + g_vars->scene14_ballDeltaX = -32; + + if (!val) + den = 1; + + g_vars->scene14_ballDeltaY = (g_vars->scene14_grandmaY - 102 - val * val / 2 - (g_vars->scene14_dudeY - 76)) / den; + + g_vars->scene14_flyingBall->show1(g_vars->scene14_dudeX - 85, g_vars->scene14_dudeY - 76, -1, 0); + g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1); + g_vars->scene14_flyingBall->_priority = 5; + + g_vars->scene14_ballIsFlying = true; } void sceneHandler14_showBallFly() { - warning("STUB: sceneHandler14_showBallFly()"); + if (g_vars->scene14_balls.size()) { + g_vars->scene14_flyingBall = g_vars->scene14_balls.front(); + g_vars->scene14_balls.pop_front(); + } + + int x, y; + + if (g_vars->scene14_grandma->_movement) { + x = g_vars->scene14_grandma->_movement->_ox; + g_vars->scene14_ballX = x; + y = g_vars->scene14_grandma->_movement->_oy; + } else { + x = g_vars->scene14_grandmaX; + y = g_vars->scene14_grandmaY; + } + + x = x + 38; + y = y - 77; + + g_vars->scene14_ballDeltaX = 32; + + int dist = (g_vars->scene14_dudeX - 16 - x) / 32; + int den = dist; + + if (!dist) + den = 1; + + g_vars->scene14_ballX = x + 32; + g_vars->scene14_ballDeltaY = (g_vars->scene14_dudeY - 40 - dist * dist / 2 - y) / den; + g_vars->scene14_ballY = g_vars->scene14_ballDeltaY + y; + + g_vars->scene14_flyingBall->show1(x + 32, g_vars->scene14_ballDeltaY + y, MV_BAL14_SPIN, 0); + g_vars->scene14_flyingBall->_priority = 5; + g_vars->scene14_flyingBall->startAnim(MV_BAL14_SPIN, 0, -1); + + g_vars->scene14_ballIsFlying = true; } void sceneHandler14_grandmaJump() { - warning("STUB: sceneHandler14_grandmaJump()"); + BehaviorEntryInfo *beh1 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPFW); + BehaviorEntryInfo *beh2 = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_JUMPBK); + + if (beh1) { + if (beh2) { + int p = beh1->_percent; + beh1->_percent = beh2->_percent; + beh2->_percent = p; + } + } +} + +void sceneHandler14_endArcade() { + g_vars->scene14_arcadeIsOn = false; + + setInputDisabled(0); + + getGameLoaderInteractionController()->enableFlag24(); + getCurrSceneSc2MotionController()->setEnabled(); + + BehaviorEntryInfo *beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_BLINK); + if (beh) + beh->_percent = 327; + + beh = g_fp->_behaviorManager->getBehaviorEntryInfoByMessageQueueDataId(g_vars->scene14_grandma, ST_GMA_SIT, QU_GMA_THROW); + if (beh) + beh->_percent = 0; + + g_vars->scene14_sceneDeltaX = 200; + g_vars->scene14_sceneDeltaY = 200; + + g_fp->_aniMan2 = g_fp->_aniMan; + + g_vars->scene14_sceneDiffX = 300; + g_vars->scene14_sceneDiffY = 300; } void sceneHandler14_winArcade() { - warning("STUB: sceneHandler14_winArcade()"); + if (g_vars->scene14_arcadeIsOn) { + if (g_vars->scene14_dudeIsKicking) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + g_vars->scene14_dudeIsKicking = false; + } + + if (g_vars->scene14_flyingBall) { + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + + g_vars->scene14_flyingBall->_flags &= 0xFFFB; + g_vars->scene14_flyingBall = 0; + } + + g_vars->scene14_ballIsFlying = false; + + sceneHandler14_endArcade(); + + g_vars->scene14_grandmaIsHere = false; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_14)) { + g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_In_15)); + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + g_vars->scene14_grandma->_flags &= 0xFFFB; + } + + if (g_fp->_currentScene->_messageQueueId) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(g_fp->_currentScene->_messageQueueId); + if (mq) + delete mq; + + g_fp->_currentScene->_messageQueueId = 0; + } + } } void sceneHandler14_showBallLast() { @@ -158,78 +350,305 @@ void sceneHandler14_showBallLast() { void sceneHandler14_hideBallLast() { if (g_vars->scene14_pink) { g_vars->scene14_pink->hide(); - g_vars->scene14_var11.push_back(g_vars->scene14_pink); + g_vars->scene14_balls.push_back(g_vars->scene14_pink); g_vars->scene14_pink = 0; } } void sceneHandler14_startArcade() { - warning("STUB: sceneHandler14_startArcade()"); -} + g_vars->scene14_arcadeIsOn = true; + g_vars->scene14_dudeCanKick = true; -void sceneHandler14_endArcade() { - warning("STUB: sceneHandler14_endArcade()"); -} + if (g_fp->_aniMan->_movement) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT | 0x4000); + g_fp->_aniMan->setOXY(1237, 451); + g_fp->_aniMan->_priority = 25; + } -void sceneHandler14_sub01() { - warning("STUB: sceneHandler14_sub01()"); -} + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); -void sceneHandler14_sub02() { - warning("STUB: sceneHandler14_sub02()"); + g_fp->_aniMan2 = 0; + g_vars->scene14_sceneDeltaX = 50; + g_vars->scene14_sceneDiffX = 100; + g_vars->scene14_hitsLeft = 4; + g_vars->scene14_pink = 0; + + chainQueue(QU_SC14_STARTARCADE, 0); + + g_fp->_updateScreenCallback = sceneHandler14_updateScreenCallback; } -void sceneHandler14_sub03() { - warning("STUB: sceneHandler14_sub03()"); +void sceneHandler14_clearCallback() { + g_fp->_aniMan->_callback2 = 0; + g_vars->scene14_dudeIsKicking = false; } -bool sceneHandler14_sub04(ExCommand *cmd) { - warning("STUB: sceneHandler14_sub04()"); +void sceneHandler14_kickAnimation() { + if (g_fp->_aniMan->_movement) { + sceneHandler14_clearCallback(); + + if (g_vars->scene14_flyingBall && g_vars->scene14_dudeX - g_vars->scene14_flyingBall->_ox < 180) { + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId); + g_fp->_aniMan->startAnim(MV_MAN14_KICK, 0, -1); - return false; + g_vars->scene14_ballIsFlying = false; + + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + } else { + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_movement->_staticsObj2->_staticsId); + g_fp->_aniMan->startAnim(MV_MAN14_KICKAIR, 0, -1); + } + } } -void sceneHandler14_sub05() { - warning("STUB: sceneHandler14_sub05()"); +void sceneHandler14_declineCallback(int *arg) { + Common::Point point; + + if (g_vars->scene14_dudeIsKicking) { + *arg = (int)(sqrt((double)(g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y) + * (g_fp->_mouseVirtY - g_vars->scene14_mouseCursorPos.y) + + (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x) + * (g_fp->_mouseVirtX - g_vars->scene14_mouseCursorPos.x)) * 0.1); + + if (*arg > 11) + *arg = 11; + } else { + ++*arg; + } } -void sceneHandler14_sub06() { - g_fp->_aniMan->_callback2 = 0; - g_vars->scene14_var04 = 0; +void sceneHandler14_dudeDecline() { + g_vars->scene14_mouseCursorPos.x = g_fp->_mouseVirtX; + g_vars->scene14_mouseCursorPos.y = g_fp->_mouseVirtY; + + g_fp->_aniMan->_callback2 = sceneHandler14_declineCallback; + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + g_fp->_aniMan->startAnim(MV_MAN14_DECLINE, 0, -1); + + g_vars->scene14_dudeIsKicking = true; } -void sceneHandler14_sub07() { - warning("STUB: sceneHandler14_sub07()"); +bool sceneHandler14_arcadeProcessClick(ExCommand *cmd) { + if (!getCurrSceneSc2MotionController()->_isEnabled) + return 0; + + if (!g_vars->scene14_grandmaIsHere) { + if (!cmd->_keyCode) { + if (g_vars->scene14_pink) { + if (g_vars->scene14_pink->_flags & 4) { + if (cmd->_sceneClickX < g_vars->scene14_pink->_ox + 40) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene14_pink, 0); + cmd->_messageKind = 0; + return true; + } + } + } + } + return false; + } + + if (getCurrSceneSc2MotionController()->_objtype != kObjTypeMctlCompound) + return false; + + if (!getCurrSceneSc2MotionController()->_motionControllers[0]->_movGraphReactObj->pointInRegion(cmd->_sceneClickX, cmd->_sceneClickY)) + return false; + + if (cmd->_sceneClickX > 1237) + return false; + + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1237, 451, 1, 0); + + if (!mq) + return false; + + ExCommand *ex = new ExCommand(0, 17, MSG_SC14_STARTARCADE, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->setFlags(mq->getFlags() | 1); + + postExCommand(g_fp->_aniMan->_id, 2, 1237, 451, 0, -1); + + cmd->_messageKind = 0; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + return true; } -void sceneHandler14_sub08() { - warning("STUB: sceneHandler14_sub08()"); +void sceneHandler14_grandmaThrow() { + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + MessageQueue *mq = new MessageQueue; + ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); } -void sceneHandler14_sub09() { - warning("STUB: sceneHandler14_sub09()"); +void sceneHandler14_passToGrandma() { + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->_priority = 27; + + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + ExCommand *ex = new ExCommand(ANI_BALL14, 1, MV_BAL14_FALL, 0, 0, 0, 1, 0, 0, 0); + + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 2; + ex->_field_24 = 1; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_BALL14, 6, 0, 0, 0, 0, 1, 0, 0, 0); + ex->_keyCode = g_vars->scene14_flyingBall->_okeyCode; + ex->_excFlags |= 3; + mq->addExCommandToEnd(ex); + mq->chain(0); + + g_vars->scene14_balls.push_back(g_vars->scene14_flyingBall); + g_vars->scene14_flyingBall = 0; + + sceneHandler14_grandmaThrow(); } -void sceneHandler14_sub10() { - warning("STUB: sceneHandler14_sub10()"); +void sceneHandler14_grandmaJumpThrow() { + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + MessageQueue *mq = new MessageQueue; + ExCommand *ex = new ExCommand(ANI_GRANDMA, 2, 30, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_JUMPFW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + + g_vars->scene14_dude2X += 71; + g_fp->_currentScene->_x = 71; + + g_fp->_aniMan2 = g_fp->_aniMan; } -void sceneHandler14_sub11() { - warning("STUB: sceneHandler14_sub11()"); +void sceneHandler14_dudeFall() { + if (!g_fp->_aniMan->_movement || g_fp->_aniMan->_movement->_id != MV_MAN14_FALL) { + sceneHandler14_clearCallback(); + + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + g_fp->_aniMan->startAnim(MV_MAN14_FALL, 0, -1); + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + + sceneHandler14_grandmaJumpThrow(); + } + ++g_vars->scene14_hitsLeft; } -void sceneHandler14_sub12() { +void sceneHandler14_grandmaStepForward() { g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); g_fp->_aniMan->startAnim(MV_MAN14_STEPFW, 0, -1); - g_vars->scene14_var18 -= 71; + g_vars->scene14_dude2X -= 71; g_fp->_currentScene->_x = -71; g_fp->_aniMan2 = g_vars->scene14_grandma; } -void sceneHandler14_sub13() { - warning("STUB: sceneHandler14_sub13()"); +void sceneHandler14_arcadeLogic() { + g_vars->scene14_flyingBall->stopAnim_maybe(); + g_vars->scene14_flyingBall->hide(); + + if (g_vars->scene14_dudeIsKicking) + sceneHandler14_clearCallback(); + + if (g_vars->scene14_hitsLeft <= 1) { + setInputDisabled(1); + + sceneHandler14_clearCallback(); + + g_vars->scene14_dudeCanKick = false; + g_fp->_aniMan2 = 0; + + chainQueue(QU_SC14_WINARCADE, 1); + + --g_vars->scene14_hitsLeft; + } else { + ExCommand *ex; + + g_vars->scene14_grandma->changeStatics2(ST_GMA_SIT); + + if (g_vars->scene14_hitsLeft != 3 || g_vars->scene14_pink) { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + } else { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_BACKOFF2, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + ex = new ExCommand(ANI_GRANDMA, 1, MV_GMA_THROW, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 2; + mq->addExCommandToEnd(ex); + + mq->chain(0); + } + + sceneHandler14_grandmaStepForward(); + --g_vars->scene14_hitsLeft; + } +} + +void sceneHandler14_animateBall() { + int x = g_vars->scene14_ballDeltaX + g_vars->scene14_ballX; + int y = g_vars->scene14_ballDeltaY + g_vars->scene14_ballY; + + g_vars->scene14_ballX += g_vars->scene14_ballDeltaX; + g_vars->scene14_ballY += g_vars->scene14_ballDeltaY; + + g_vars->scene14_ballDeltaY++; + + if (g_vars->scene14_ballDeltaY - 1 + g_vars->scene14_ballY > 517) { + if (x <= g_vars->scene14_dudeX - 16 ) { + if ( g_vars->scene14_ballDeltaX >= 0 || x >= g_vars->scene14_grandmaX + 65 || x <= g_vars->scene14_grandmaX - 135 || y <= g_vars->scene14_grandmaY - 102 ) { + if (g_vars->scene14_flyingBall->_movement) + g_vars->scene14_flyingBall->_movement->setOXY(x, y); + else + g_vars->scene14_flyingBall->setOXY(x, y); + } else { + sceneHandler14_arcadeLogic(); + g_vars->scene14_ballIsFlying = false; + } + } else { + sceneHandler14_dudeFall(); + g_vars->scene14_ballIsFlying = false; + } + } else { + sceneHandler14_passToGrandma(); + g_vars->scene14_ballIsFlying = false; + } } int sceneHandler14(ExCommand *cmd) { @@ -326,7 +745,7 @@ int sceneHandler14(ExCommand *cmd) { case MSG_SC14_ENDARCADE: sceneHandler14_endArcade(); - g_vars->scene14_var13 = 0; + g_vars->scene14_grandmaIsHere = false; break; case 64: @@ -338,41 +757,40 @@ int sceneHandler14(ExCommand *cmd) { Movement *mov = g_fp->_aniMan->_movement; if (mov) { - g_vars->scene14_var14 = mov->_ox; - g_vars->scene14_var15 = mov->_oy; + g_vars->scene14_dudeX = mov->_ox; + g_vars->scene14_dudeY = mov->_oy; if (mov->_id == MV_MAN14_KICK) - g_vars->scene14_var14 = mov->_ox + 2 * g_fp->_aniMan->_movement->_currDynamicPhaseIndex; + g_vars->scene14_dudeX = mov->_ox + 2 * g_fp->_aniMan->_movement->_currDynamicPhaseIndex; } else { - g_vars->scene14_var14 = g_fp->_aniMan->_ox; - g_vars->scene14_var15 = g_fp->_aniMan->_oy; + g_vars->scene14_dudeX = g_fp->_aniMan->_ox; + g_vars->scene14_dudeY = g_fp->_aniMan->_oy; } mov = g_vars->scene14_grandma->_movement; if (mov) { - g_vars->scene14_var16 = mov->_ox; - g_vars->scene14_var17 = mov->_oy; + g_vars->scene14_grandmaX = mov->_ox; + g_vars->scene14_grandmaY = mov->_oy; } else { - g_vars->scene14_var16 = g_vars->scene14_grandma->_ox; - g_vars->scene14_var17 = g_vars->scene14_grandma->_oy; + g_vars->scene14_grandmaX = g_vars->scene14_grandma->_ox; + g_vars->scene14_grandmaY = g_vars->scene14_grandma->_oy; } if (g_fp->_aniMan2) { int x = g_fp->_aniMan2->_ox; - g_vars->scene14_var18 = x; - g_vars->scene14_var19 = g_fp->_aniMan2->_oy; + g_vars->scene14_dude2X = x; - if (x < g_fp->_sceneRect.left + g_vars->scene14_var01) { - g_fp->_currentScene->_x = x - g_vars->scene14_var07 - g_fp->_sceneRect.left; - x = g_vars->scene14_var18; + if (x < g_fp->_sceneRect.left + g_vars->scene14_sceneDeltaX) { + g_fp->_currentScene->_x = x - g_vars->scene14_sceneDiffX - g_fp->_sceneRect.left; + x = g_vars->scene14_dude2X; } - if (x > g_fp->_sceneRect.right - g_vars->scene14_var01) - g_fp->_currentScene->_x = x + g_vars->scene14_var07 - g_fp->_sceneRect.right; + if (x > g_fp->_sceneRect.right - g_vars->scene14_sceneDeltaX) + g_fp->_currentScene->_x = x + g_vars->scene14_sceneDiffX - g_fp->_sceneRect.right; } - if (g_vars->scene14_var05) - sceneHandler14_sub01(); + if (g_vars->scene14_ballIsFlying) + sceneHandler14_animateBall(); g_fp->_behaviorManager->updateBehaviors(); g_fp->startSceneTrack(); @@ -380,22 +798,22 @@ int sceneHandler14(ExCommand *cmd) { } case 30: - if (g_vars->scene14_var04) { - sceneHandler14_sub02(); + if (g_vars->scene14_dudeIsKicking) { + sceneHandler14_kickAnimation(); break; } - if (!g_vars->scene14_var03) { + if (!g_vars->scene14_arcadeIsOn) { break; } break; case 29: - if (g_vars->scene14_var03) { + if (g_vars->scene14_arcadeIsOn) { int pixel; - if (g_vars->scene14_var06 && g_fp->_aniMan->getPixelAtPos(cmd->_sceneClickX, cmd->_sceneClickY, &pixel) && !g_fp->_aniMan->_movement) { - sceneHandler14_sub03(); + if (g_vars->scene14_dudeCanKick && g_fp->_aniMan->getPixelAtPos(cmd->_sceneClickX, cmd->_sceneClickY, &pixel) && !g_fp->_aniMan->_movement) { + sceneHandler14_dudeDecline(); break; } } else { @@ -407,7 +825,7 @@ int sceneHandler14(ExCommand *cmd) { break; } - if (!sceneHandler14_sub04(cmd) && (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode))) { + if (!sceneHandler14_arcadeProcessClick(cmd) && (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode))) { int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); @@ -416,7 +834,7 @@ int sceneHandler14(ExCommand *cmd) { if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { g_fp->processArcade(cmd); - sceneHandler14_sub04(cmd); + sceneHandler14_arcadeProcessClick(cmd); break; } } diff --git a/engines/fullpipe/scenes/scene15.cpp b/engines/fullpipe/scenes/scene15.cpp index 8310fc8607..fa8db64497 100644 --- a/engines/fullpipe/scenes/scene15.cpp +++ b/engines/fullpipe/scenes/scene15.cpp @@ -82,7 +82,7 @@ void scene15_initScene(Scene *sc) { g_vars->scene15_ladder = sc->getPictureObjectById(PIC_SC15_LADDER, 0); g_vars->scene15_boot = sc->getStaticANIObject1ById(ANI_BOOT_15, -1); - if (g_fp->getObjectState(sO_Boot_15) != g_fp->getObjectEnumState(sO_Boot_15, sO_Available)) + if (g_fp->getObjectState(sO_Boot_15) != g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent)) g_vars->scene15_boot->_flags &= 0xFFFB; g_fp->_currentScene = oldsc; diff --git a/engines/fullpipe/scenes/scene16.cpp b/engines/fullpipe/scenes/scene16.cpp new file mode 100644 index 0000000000..b1e261287a --- /dev/null +++ b/engines/fullpipe/scenes/scene16.cpp @@ -0,0 +1,484 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene16_initScene(Scene *sc) { + g_vars->scene16_figures.clear(); + g_vars->scene16_walkingBoy = 0; + g_vars->scene16_walkingGirl = 0; + g_vars->scene16_walkingCount = 200; + g_vars->scene16_wire = sc->getStaticANIObject1ById(ANI_WIRE16, -1); + g_vars->scene16_mug = sc->getStaticANIObject1ById(ANI_MUG, -1); + g_vars->scene16_jettie = sc->getStaticANIObject1ById(ANI_JETTIE, -1); + g_vars->scene16_boot = sc->getStaticANIObject1ById(ANI_BOOT_16, -1); + g_vars->scene16_girlIsLaughing = false; + g_vars->scene16_sound = SND_16_034; + + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Convoluted)) { + g_vars->scene16_placeIsOccupied = true; + + StaticANIObject *boy[2]; + boy[0] = sc->getStaticANIObject1ById(ANI_BOY, -1); + boy[0]->loadMovementsPixelData(); + + boy[1] = new StaticANIObject(boy[0]); + sc->addStaticANIObject(boy[1], 1); + + int idx = 0; + + for (int i = 0; i < 3; i++) { + g_vars->scene16_figures.push_back(boy[idx]); + + idx++; + + if (idx >= 2) + idx = 0; + } + + g_vars->scene16_figures.push_back(sc->getStaticANIObject1ById(ANI_GIRL, -1)); + + for (int i = 0; i < 4; i++) { + g_vars->scene16_figures.push_back(boy[idx]); + + idx++; + + if (idx >= 2) + idx = 0; + } + } else { + g_fp->setObjectState(sO_Girl, g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)); + + g_vars->scene16_placeIsOccupied = false; + + StaticANIObject *ani = new StaticANIObject(g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1)); + ani->_movement = 0; + ani->_statics = (Statics *)ani->_staticsList[0]; + sc->addStaticANIObject(ani, 1); + } + + if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsLaughing)) { + StaticANIObject *girl = sc->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->show1(554, 432, MV_GRL_LAUGH_POPA, 0); + girl->_priority = 20; + } + + if (g_fp->getObjectState(sO_Cup) == g_fp->getObjectEnumState(sO_Cup, sO_In_16)) { + g_vars->scene16_mug->_statics = g_vars->scene16_mug->getStaticsById(ST_MUG_EMPTY); + g_vars->scene16_mug->_movement = 0; + g_vars->scene16_mug->setOXY(409, 459); + g_vars->scene16_mug->_priority = 5; + g_vars->scene16_mug->_flags |= 4; + } +} + +int scene16_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC16_TUMBA) { + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + } else { + if (g_fp->_objectIdAtCursor == ANI_MUG && g_fp->_cursorId == PIC_CSR_ITN && g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) + g_fp->_cursorId = PIC_CSR_ITN_GREEN; + } + + return g_fp->_cursorId; +} + +void sceneHandler16_laughSound() { + int snd = SND_16_035; + + switch (g_vars->scene16_sound) { + case SND_16_034: + snd = SND_16_035; + break; + + case SND_16_035: + snd = SND_16_037; + break; + + case SND_16_037: + snd = SND_16_034; + break; + } + + g_vars->scene16_sound = snd; + + g_fp->playSound(snd, 0); +} + +void sceneHandler16_showBearded() { + if (g_fp->getObjectState(sO_Bridge) == g_fp->getObjectEnumState(sO_Bridge, sO_Unconvoluted)) { + StaticANIObject *brd = g_fp->_currentScene->getStaticANIObject1ById(ANI_BEARDED_CMN, -1); + + if (!brd || !(brd->_flags & 4)) + chainQueue(QU_BRD16_STARTBEARDED, 0); + } +} + +void sceneHandler16_showMugFull() { + g_vars->scene16_mug->changeStatics2(ST_MUG_FULL); +} + +void sceneHandler16_fillMug() { + if (g_vars->scene16_mug->_flags & 4) { + g_vars->scene16_jettie->_priority = 2; + g_vars->scene16_jettie->startAnim(MV_JTI_FLOWIN, 0, -1); + + if (g_fp->_aniMan->_movement) { + if (g_fp->_aniMan->_movement->_id == MV_MAN16_TAKEMUG) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + + g_vars->scene16_mug->show1(-1, -1, -1, 0); + + g_fp->setObjectState(sO_Cup, g_fp->getObjectEnumState(sO_Cup, sO_DudeHas)); + } + } + return; + } + + MessageQueue *mq; + + if (!(g_vars->scene16_boot->_flags & 4)) { + g_vars->scene16_jettie->_priority = 15; + g_vars->scene16_jettie->startAnim(MV_JTI_FLOWBY, 0, -1); + + if (g_vars->scene16_walkingBoy) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + if (mq->chain(g_vars->scene16_walkingBoy) || !mq) + return; + } else { + if (!g_vars->scene16_walkingGirl) + return; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); + if (mq->chain(g_vars->scene16_walkingGirl)) + return; + } + delete mq; + + return; + } + + g_vars->scene16_jettie->_priority = 15; + + g_vars->scene16_boot->startAnim(MV_BT16_FILL, 0, -1); + + StaticANIObject *ani; + + if (g_vars->scene16_walkingBoy) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + + ani = g_vars->scene16_walkingBoy; + } else { + if (!g_vars->scene16_walkingGirl) + return; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLOUT), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingGirl->_okeyCode); + ani = g_vars->scene16_walkingGirl; + } + + if (!mq->chain(ani)) + delete mq; +} + +void sceneHandler16_startLaugh() { + StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->changeStatics2(ST_GRL_STAND); + + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GIRLLAUGH), 0, 1); + + mq->replaceKeyCode(-1, girl->_okeyCode); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->setSubVarAsInt(sO_DudeSwinged, 0); + + g_vars->scene16_girlIsLaughing = true; +} + +void sceneHandler16_drink() { + if (g_vars->scene16_mug->_flags & 4) { + if (!g_vars->scene16_jettie->_movement) { + if (!g_vars->scene16_walkingBoy || !g_vars->scene16_walkingBoy->_movement || g_vars->scene16_walkingBoy->_movement->_id != MV_BOY_DRINK) { + if (!g_vars->scene16_walkingGirl || !g_vars->scene16_walkingGirl->_movement || g_vars->scene16_walkingGirl->_movement->_id != MV_GRL_DRINK) { + if (g_vars->scene16_mug->_statics->_staticsId == ST_MUG_FULL) { + MessageQueue *mq; + ExCommand *ex; + + if (g_vars->scene16_walkingBoy) { + g_fp->_aniMan->_flags |= 0x180; + + g_vars->scene16_walkingBoy->changeStatics2(ST_BOY_STAND); + g_vars->scene16_walkingBoy->queueMessageQueue(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_BOYKICK), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene16_walkingBoy->_okeyCode); + + ex = new ExCommand(ANI_MAN, 34, 384, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3u; + ex->_field_14 = 384; + ex->_messageNum = 0; + + mq->insertExCommandAt(2, ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } else { + g_fp->_aniMan->_flags |= 1; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_MANDRINK), 0, 1); + + ex = new ExCommand(ANI_MAN, 34, 256, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3u; + ex->_field_14 = 256; + ex->_messageNum = 0; + + mq->addExCommandToEnd(ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1)->changeStatics2(ST_GRL_STAND); + } + + g_fp->_currentScene->getStaticANIObject1ById(ANI_WIRE16, -1)->show1(-1, -1, -1, 0); + } else { + chainObjQueue(g_fp->_aniMan, QU_SC16_TAKEMUG, 1); + } + } + } + } + } +} + +void sceneHandler16_mugClick() { + if (abs(310 - g_fp->_aniMan->_ox) >= 1 || abs(449 - g_fp->_aniMan->_oy) >= 1 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 310, 449, 1, ST_MAN_RIGHT); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC16_MUGCLICK, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags = 2; + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, 310, 449, 0, -1); + } + } else { + sceneHandler16_drink(); + } +} + +void sceneHandler16_showMan() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->show1(-1, -1, -1, 0); + + g_vars->scene16_mug->show1(-1, -1, -1, 0); +} + +void sceneHandler16_showMug() { + chainQueue(QU_SC16_SHOWMUG, 0); +} + +void sceneHandler16_hideMan() { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT); + g_fp->_aniMan->hide(); + + g_vars->scene16_mug->hide(); +} + +void sceneHandler16_hideMug() { + g_vars->scene16_mug->hide(); +} + +void sceneHandler16_hideWire() { + g_vars->scene16_wire->hide(); +} + +void sceneHandler16_showWire() { + g_vars->scene16_wire->show1(-1, -1, -1, 0); +} + +void sceneHandler16_putOnWheel() { + StaticANIObject *ani = g_vars->scene16_walkingBoy; + + if (!ani) + ani = g_vars->scene16_walkingGirl; + + if (ani) + g_vars->scene16_figures.push_back(ani); + + ani = g_vars->scene16_figures.front(); + + g_vars->scene16_figures.pop_front(); + + if (ani) { + MessageQueue *mq; + + if (ani->_id == ANI_BOY) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOBOY), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene16_walkingBoy = ani; + g_vars->scene16_walkingGirl = 0; + } else if (ani->_id == ANI_GIRL) { + if (g_fp->getObjectState(sO_Girl) == g_fp->getObjectEnumState(sO_Girl, sO_IsSwinging)) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC16_GOGIRL), 0, 1); + + mq->replaceKeyCode(-1, ani->_okeyCode); + mq->chain(0); + + g_vars->scene16_walkingBoy = 0; + g_vars->scene16_walkingGirl = ani; + } + } + } +} + +void sceneHandler16_girlROTFL() { + StaticANIObject *girl = g_fp->_currentScene->getStaticANIObject1ById(ANI_GIRL, -1); + + girl->changeStatics2(ST_GRL_LAUGH); + girl->startAnim(MV_GRL_FALL, 0, -1); + + g_vars->scene16_girlIsLaughing = false; +} + +int sceneHandler16(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_SC16_LAUGHSOUND: + sceneHandler16_laughSound(); + break; + + case MSG_SC16_SHOWBEARDED: + sceneHandler16_showBearded(); + break; + + case MSG_SC16_SHOWMUGFULL: + sceneHandler16_showMugFull(); + break; + + case MSG_SC16_FILLMUG: + sceneHandler16_fillMug(); + break; + + case MSG_SC16_STARTLAUGH: + sceneHandler16_startLaugh(); + break; + + case MSG_SC16_MUGCLICK: + if (!g_fp->_aniMan->isIdle() || g_fp->_aniMan->_flags & 0x100) + cmd->_messageKind = 0; + else + sceneHandler16_mugClick(); + + break; + + case MSG_SC16_SHOWMAN: + sceneHandler16_showMan(); + break; + + case MSG_SC16_SHOWMUG: + sceneHandler16_showMug(); + break; + + case MSG_SC16_HIDEMAN: + sceneHandler16_hideMan(); + break; + + case MSG_SC16_HIDEMUG: + sceneHandler16_hideMug(); + break; + + case MSG_SC16_HIDEWIRE: + sceneHandler16_hideWire(); + break; + + case MSG_SC16_SHOWWIRE: + sceneHandler16_showWire(); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene16_placeIsOccupied) { + g_vars->scene16_walkingCount++; + + if (g_vars->scene16_walkingCount < 280) { + sceneHandler16_putOnWheel(); + + g_vars->scene16_walkingCount = 0; + } + } + + if (g_vars->scene16_girlIsLaughing) { + if (g_fp->_aniMan->_movement) + if (g_fp->_aniMan->_movement->_id == MV_MAN_TURN_RL) + sceneHandler16_girlROTFL(); + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene17.cpp b/engines/fullpipe/scenes/scene17.cpp new file mode 100644 index 0000000000..73bf7ab1c0 --- /dev/null +++ b/engines/fullpipe/scenes/scene17.cpp @@ -0,0 +1,285 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene17_initScene(Scene *sc) { + g_vars->scene17_flyState = 1; + g_vars->scene17_sugarIsShown = false; + g_vars->scene17_sceneOldEdgeX = 0; + g_vars->scene17_flyCountdown = 0; + g_vars->scene17_hand = sc->getStaticANIObject1ById(ANI_HAND17, -1); +} + +void scene17_restoreState() { + if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + + g_vars->scene17_handPhase = false; + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + + g_vars->scene17_handPhase = true; + } + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_17")); + + g_vars->scene17_flyState = g_fp->getObjectState(sO_Fly_17); + + if (g_vars->scene17_flyState <= 0 ) { + g_vars->scene17_flyCountdown = g_fp->_rnd->getRandomNumber(600) + 600; + + g_vars->scene17_flyState = g_fp->_rnd->getRandomNumber(4) + 1; + } + + g_fp->setObjectState(sO_Fly_17, g_vars->scene17_flyState - 1); +} + +int scene17_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA2 && g_fp->_objectIdAtCursor != PIC_SC17_RTRUBA) + return g_fp->_cursorId; + + if (!g_vars->scene17_handPhase) + return g_fp->_cursorId; + + int item = g_fp->_inventory->getSelectedItemId(); + + if ((g_fp->_cursorId != PIC_CSR_DEFAULT_INV || item != ANI_INV_COIN) && item != ANI_INV_BOOT && item != ANI_INV_HAMMER) + ; // empty + else + g_fp->_cursorId = PIC_CSR_ITN_INV; + + return g_fp->_cursorId; +} + +void sceneHandler17_drop() { + StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1); + StaticANIObject *jet = g_fp->_currentScene->getStaticANIObject1ById(ANI_JET_17, -1); + + if (mug && mug->_flags & 4) { + mug->changeStatics2(ST_MUG17_EMPTY); + chainQueue(QU_SC17_FILLMUG_DROP, 0); + } else if (jet) { + jet->queueMessageQueue(0); + chainQueue(QU_JET17_DROP, 0); + } +} + +void sceneHandler17_fillBottle() { + StaticANIObject *bottle = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_BOTTLE, -1); + StaticANIObject *mug = g_fp->_currentScene->getStaticANIObject1ById(ANI_MUG_17, -1); + StaticANIObject *boot = g_fp->_currentScene->getStaticANIObject1ById(ANI_BOOT_17, -1); + + if (bottle && (bottle->_flags & 4)) + chainQueue(QU_SC17_FILLBOTTLE, 1); + else if (mug && (mug->_flags & 4) && mug->_statics->_staticsId == ST_MUG17_EMPTY) + chainQueue(QU_SC17_FILLMUG, 1); + else if (boot && (boot->_flags & 4)) + chainQueue(QU_SC17_FILLBOOT, 1); + else + chainQueue(QU_JET17_FLOW, 1); +} + +void sceneHandler17_testTruba() { + if (g_vars->scene17_hand->isIdle()) { + if (!g_vars->scene17_hand->_movement || g_vars->scene17_hand->_movement->_id != MV_HND17_FIGA) { + g_vars->scene17_hand->changeStatics2(ST_HND17_EMPTY); + g_vars->scene17_hand->startAnim(MV_HND17_FIGA, 0, -1); + } + } +} + +void sceneHandler17_showBottle() { + chainQueue(QU_SC17_SHOWBOTTLE, 0); +} + +void sceneHandler17_hideSugar() { + StaticANIObject *sugar = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_SUGAR, -1); + + if (sugar) + sugar->hide(); +} + +void sceneHandler17_showSugar() { + chainQueue(QU_SC17_SHOWSUGAR, 0); + + g_vars->scene17_sugarIsShown = true; +} + +void sceneHandler17_moonshineFill() { + StaticANIObject *moonshiner = g_fp->_currentScene->getStaticANIObject1ById(ANI_SAMOGONSHCHIK, -1); + + if (!(moonshiner->_flags & 0x80)) { + moonshiner->changeStatics2(ST_SMG_SIT); + chainObjQueue(moonshiner, QU_SMG_FILLBOTTLE, 1); + + g_vars->scene17_sugarIsShown = false; + } +} + +void sceneHandler17_updateFlies() { + g_fp->_floaters->genFlies(g_fp->_currentScene, 239, -50, 20, 4); + + g_fp->_floaters->_array2[0]->countdown = g_fp->_rnd->getRandomNumber(5) + 6; + g_fp->_floaters->_array2[0]->val6 = 239; + g_fp->_floaters->_array2[0]->val7 = -50; +} + + +int sceneHandler17(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC17_DROP: + sceneHandler17_drop(); + break; + + case MSG_SC17_UPDATEHAND: + if (g_fp->getObjectState(sO_UsherHand) == g_fp->getObjectEnumState(sO_UsherHand, sO_WithCoin)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + + g_vars->scene17_handPhase = false; + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + + g_vars->scene17_handPhase = true; + } + break; + + case MSG_SC17_FILLBOTTLE: + sceneHandler17_fillBottle(); + break; + + case MSG_SC17_TESTTRUBA: + sceneHandler17_testTruba(); + break; + + case MSG_SC17_SHOWBOTTLE: + sceneHandler17_showBottle(); + break; + + case MSG_SC17_HIDESUGAR: + sceneHandler17_hideSugar(); + break; + + case MSG_SC17_SHOWSUGAR: + sceneHandler17_showSugar(); + break; + + case 29: + { + int pic = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (pic == PIC_SC17_RTRUBA2 || pic == PIC_SC17_RTRUBA) { + if (cmd->_keyCode == ANI_INV_COIN || cmd->_keyCode == ANI_INV_BOOT || cmd->_keyCode == ANI_INV_HAMMER) { + if (g_vars->scene17_handPhase) { + if (g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100)) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene17_hand, cmd->_keyCode); + break; + } + } + } + } + } + } + break; + + case 33: + { + int x = g_vars->scene17_sceneEdgeX; + g_vars->scene17_sceneOldEdgeX = g_vars->scene17_sceneEdgeX; + + if (g_fp->_aniMan2) { + x = g_fp->_aniMan2->_ox; + + g_vars->scene17_sceneEdgeX = x; + + if (x < g_fp->_sceneRect.left + 200) { + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + x = g_vars->scene17_sceneEdgeX; + } + + if (x > g_fp->_sceneRect.right - 200) { + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + x = g_vars->scene17_sceneEdgeX; + } + } + + if (g_vars->scene17_sugarIsShown) { + sceneHandler17_moonshineFill(); + x = g_vars->scene17_sceneEdgeX; + } + + if (g_vars->scene17_handPhase) { + if (g_vars->scene17_sceneOldEdgeX < 410 && x >= 410) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 1); + } else if (g_vars->scene17_sceneOldEdgeX > 410 && x <= 410) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_TOCYCLE, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_ATTRACT, QU_HND17_ATTRACT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene17_hand, ST_HND17_EMPTY, QU_HND17_ASK, 0); + } + } + + --g_vars->scene17_flyCountdown; + + if (!g_vars->scene17_flyCountdown) + sceneHandler17_updateFlies(); + + g_fp->_floaters->update(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene18and19.cpp b/engines/fullpipe/scenes/scene18and19.cpp new file mode 100644 index 0000000000..a965cfb98e --- /dev/null +++ b/engines/fullpipe/scenes/scene18and19.cpp @@ -0,0 +1,49 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene18_preload() { + warning("WARNING: scene18_preload()"); +} + +void scene19_preload(Scene *sc, int key) { + warning("WARNING: scene19_preload()"); +} + + + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene20.cpp b/engines/fullpipe/scenes/scene20.cpp new file mode 100644 index 0000000000..5fed24aabd --- /dev/null +++ b/engines/fullpipe/scenes/scene20.cpp @@ -0,0 +1,155 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene20_setExits(Scene *sc) { + int thingpar; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) + thingpar = 1; + else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) { + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, 1); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 1); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 0); + + return; + } else { + thingpar = 0; + } + + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing, thingpar); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing2, 0); + getSc2MctlCompoundBySceneId(sc->_sceneId)->enableLinks(sO_CloseThing3, 1); +} + +void scene20_initScene(Scene *sc) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene20_grandma = sc->getStaticANIObject1ById(ANI_GRANDMA_20, -1); + + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) + g_fp->setObjectState(sO_Grandma, g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe)); + + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnStool)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_STOOL); + } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_OnTheFloor)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_FLOOR); + } else if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipe) + || g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_NearPipeWithStool)) { + g_vars->scene20_grandma->changeStatics2(ST_GMA20_STAND); + } else { + g_vars->scene20_grandma->hide(); + } + + scene20_setExits(sc); + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_20")); + + for (int i = 0; i < 3; i++) { + g_fp->_floaters->genFlies(sc, g_fp->_rnd->getRandomNumber(101) + 70, g_fp->_rnd->getRandomNumber(51) + 175, 100, 0); + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val13 = g_fp->_rnd->getRandomNumber(9); + } + + g_fp->_currentScene = oldsc; + + g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400; +} + +void sceneHandler20_updateFlies() { + int sz = g_fp->_floaters->_array2.size(); + + if (sz < 3) { + g_fp->_floaters->genFlies(g_fp->_currentScene, 253, 650, 200, 0); + g_fp->_floaters->_array2[sz - 1]->val2 = 250; + g_fp->_floaters->_array2[sz - 1]->val3 = 200; + } else { + int idx = g_fp->_rnd->getRandomNumber(sz); + + g_fp->_floaters->_array2[idx]->countdown = 0; + g_fp->_floaters->_array2[idx]->fflags |= 4u; + g_fp->_floaters->_array2[idx]->val2 = 250; + g_fp->_floaters->_array2[idx]->val3 = 200; + g_fp->_floaters->_array2[idx]->val6 = 253; + g_fp->_floaters->_array2[idx]->val7 = 650; + g_fp->_floaters->_array2[idx]->ani->_priority = 200; + } + + g_vars->scene20_fliesCountdown = g_fp->_rnd->getRandomNumber(200) + 400; +} + +int sceneHandler20(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC20_UPDATELOCKABLE: + scene20_setExits(g_fp->_currentScene); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + --g_vars->scene20_fliesCountdown; + + if (g_vars->scene20_fliesCountdown <= 0) + sceneHandler20_updateFlies(); + + g_fp->_floaters->update(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene21.cpp b/engines/fullpipe/scenes/scene21.cpp new file mode 100644 index 0000000000..5a6509964d --- /dev/null +++ b/engines/fullpipe/scenes/scene21.cpp @@ -0,0 +1,148 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene21_initScene(Scene *sc) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene21_giraffeBottom = sc->getStaticANIObject1ById(ANI_GIRAFFE_BOTTOM, -1); + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG); + g_vars->scene21_pipeIsOpen = true; + g_vars->scene21_wigglePos = 0.0; + g_vars->scene21_giraffeBottomX = g_vars->scene21_giraffeBottom->_ox; + g_vars->scene21_giraffeBottomY = g_vars->scene21_giraffeBottom->_oy; + g_vars->scene21_wiggleTrigger = false; + } else { + g_vars->scene21_pipeIsOpen = false; + } + g_fp->_currentScene = oldsc; + g_fp->initArcadeKeys("SC_21"); +} + +int scene21_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC21_DTRUBA) + + g_fp->_cursorId = PIC_CSR_GOD; + + return g_fp->_cursorId; +} + +void sceneHandler21_doWiggle() { + g_vars->scene21_giraffeBottom->setOXY((int)(cos(g_vars->scene21_wigglePos) * 4.0) + g_vars->scene21_giraffeBottom->_ox, + g_vars->scene21_giraffeBottom->_oy); + + g_vars->scene21_wigglePos += 0.19635; + + if (g_vars->scene21_wigglePos > 6.2831853) { + g_vars->scene21_wigglePos = 0; + + if (!g_vars->scene21_giraffeBottom->_movement) + g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY); + } +} + +int sceneHandler21(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC21_UPDATEASS: + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_HANG); + g_vars->scene21_giraffeBottom->setOXY(g_vars->scene21_giraffeBottomX, g_vars->scene21_giraffeBottomY); + g_vars->scene21_giraffeBottom->changeStatics2(ST_GRFB_SIT); + + g_vars->scene21_pipeIsOpen = false; + + g_fp->setObjectState(sO_LowerPipe_21, g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsClosed)); + } + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode) ) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x <= g_fp->_sceneWidth - 460) { + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + } else { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + } + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene21_pipeIsOpen && !g_vars->scene21_wiggleTrigger) + sceneHandler21_doWiggle(); + + g_vars->scene21_wiggleTrigger = !g_vars->scene21_wiggleTrigger; + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene22.cpp b/engines/fullpipe/scenes/scene22.cpp new file mode 100644 index 0000000000..13c9ab36e9 --- /dev/null +++ b/engines/fullpipe/scenes/scene22.cpp @@ -0,0 +1,395 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene22_initScene(Scene *sc) { + g_vars->scene22_bag = sc->getStaticANIObject1ById(ANI_MESHOK, -1); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + g_vars->scene22_giraffeMiddle = sc->getStaticANIObject1ById(ANI_GIRAFFE_MIDDLE, -1); + g_vars->scene22_dudeIsOnStool = false; + g_vars->scene22_interactionIsDisabled = false; + g_vars->scene22_craneIsOut = true; + + if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen)) + g_vars->scene22_numBagFalls = 0; + else if (g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce)) + g_vars->scene22_numBagFalls = 1; + else if ( g_fp->getObjectState(sO_Bag_22) == g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice)) + g_vars->scene22_numBagFalls = 2; + else { + g_vars->scene22_numBagFalls = 3; + g_vars->scene22_craneIsOut = false; + } + + + if ( g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) + g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_AFTER); + else + g_vars->scene22_giraffeMiddle->changeStatics2(ST_GRFM_NORM); + + g_fp->_currentScene = oldsc; + + g_fp->initArcadeKeys("SC_22"); +} + +int scene22_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != ANI_HANDLE_L) + return g_fp->_cursorId; + + int sel = g_fp->_inventory->getSelectedItemId(); + + if (!sel) { + g_fp->_cursorId = PIC_CSR_ITN; + return g_fp->_cursorId; + } + + if (g_vars->scene22_dudeIsOnStool || (sel != ANI_INV_STOOL && sel != ANI_INV_BOX)) + ; //empty + else + g_fp->_cursorId = PIC_CSR_ITN_INV; + + return g_fp->_cursorId; +} + +void scene22_setBagState() { + if (g_vars->scene22_craneIsOut) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0); + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 1); + } +} + +void sceneHandler22_showStool() { + chainQueue(QU_SC22_SHOWSTOOL, 0); +} + +void sceneHandler22_hideStool() { + g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide(); +} + +void sceneHandler22_handleDown() { + if (g_vars->scene22_bag->_statics->_staticsId == ST_MSH_SIT) { + chainQueue(QU_MSH_CRANEOUT, 1); + g_vars->scene22_interactionIsDisabled = false; + } else { + ++g_vars->scene22_numBagFalls; + + int qid; + + if (g_vars->scene22_numBagFalls == 3) { + chainQueue(QU_SC22_FALLSACK_GMA, 1); + qid = QU_SC22_FALLBROOM; + } else { + qid = QU_SC22_FALLSACK; + } + + chainQueue(qid, 1); + + int state; + + if (g_vars->scene22_numBagFalls) { + if (g_vars->scene22_numBagFalls == 1) { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenOnce); + } else if (g_vars->scene22_numBagFalls == 2) { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_FallenTwice); + } else { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_BrushHasFallen); + } + } else { + state = g_fp->getObjectEnumState(sO_Bag_22, sO_NotFallen); + } + + g_fp->setObjectState(sO_Bag_22, state); + } + + g_vars->scene22_craneIsOut = true; + + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_CRANEOUT, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene22_bag, ST_MSH_SIT, QU_MSH_MOVE, 0); +} + +void sceneHandler22_fromStool(ExCommand *cmd) { + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_FROMSTOOL), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } +} + +void sceneHandler22_stoolLogic(ExCommand *cmd) { + StaticANIObject *ani; + MessageQueue *mq; + int xpos; + int manId; + + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + if (cmd->_keyCode == ANI_INV_STOOL) { + if (abs(841 - g_fp->_aniMan->_ox) <= 1) { + if (abs(449 - g_fp->_aniMan->_oy) <= 1) { + chainQueue(QU_SC22_PUTSTOOL, 1); + g_vars->scene22_interactionIsDisabled = true; + + return; + } + } + goto LABEL_13; + } + + if (cmd->_keyCode == ANI_INV_BOX) { + ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1); + if (!ani || !(ani->_flags & 4)) { + if (abs(841 - g_fp->_aniMan->_ox) <= 1) { + if (abs(449 - g_fp->_aniMan->_oy) <= 1) { + chainObjQueue(g_fp->_aniMan, QU_SC22_TRYBOX, 1); + return; + } + } + LABEL_13: + xpos = 841; + manId = ST_MAN_RIGHT; + LABEL_31: + mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, xpos, 449, 1, manId); + + if (!mq) + return; + + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 841, 449, 0, -1); + return; + } + } else { + if (cmd->_keyCode) + return; + + if (g_vars->scene22_dudeIsOnStool) { + if (g_fp->_aniMan->_movement) + return; + + chainQueue(QU_SC22_HANDLEDOWN, 1); + + g_vars->scene22_interactionIsDisabled = true; + return; + } + + ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1); + if (ani && (ani->_flags & 4)) { + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_ox; + + if (sqrt((double)((841 - x) * (841 - x) + (449 - y) * (449 - y))) + < sqrt((double)((1075 - x) * (1075 - x) + (449 - y) * (449 - y)))) { + if (abs(841 - x) <= 1) { + if (abs(449 - y) <= 1) { + chainQueue(QU_SC22_TOSTOOL, 1); + + g_vars->scene22_interactionIsDisabled = true; + return; + } + } + goto LABEL_13; + } + + if (abs(1075 - x) > 1 || abs(449 - y) > 1) { + xpos = 1075; + manId = ST_MAN_RIGHT | 0x4000; + goto LABEL_31; + } + + MGM mgm; + MGMInfo mgminfo; + + mgm.addItem(ANI_MAN); + mgminfo.ani = g_fp->_aniMan; + mgminfo.staticsId2 = ST_MAN_RIGHT; + mgminfo.x1 = 934; + mgminfo.y1 = 391; + mgminfo.field_1C = 10; + mgminfo.staticsId1 = 0x4145; + mgminfo.x2 = 981; + mgminfo.y2 = 390; + mgminfo.field_10 = 1; + mgminfo.flags = 127; + mgminfo.movementId = rMV_MAN_TURN_SRL; + + mq = mgm.genMovement(&mgminfo); + + ExCommand *ex = mq->getExCommandByIndex(0); + + mq->deleteExCommandByIndex(0, 0); + + delete mq; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC22_TOSTOOL_R), 0, 0); + + mq->insertExCommandAt(2, ex); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_vars->scene22_interactionIsDisabled = true; + } else { + if (abs(1010 - g_fp->_aniMan->_ox) <= 1) { + if (abs(443 - g_fp->_aniMan->_oy) <= 1) { + chainQueue(QU_SC22_TRYHANDLE, 1); + return; + } + } + + mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 1010, 443, 1, ST_MAN_UP); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone()); + + postExCommand(g_fp->_aniMan->_id, 2, 1010, 443, 0, -1); + return; + } + } + } + } +} + +int sceneHandler22(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC22_CRANEOUT_GMA: + chainQueue(QU_MSH_CRANEOUT_GMA, 1); + break; + + case MSG_SC22_CHECKGMABOOT: + if (g_fp->getObjectState(sO_Grandma) == g_fp->getObjectEnumState(sO_Grandma, sO_In_15)) + g_fp->setObjectState(sO_Boot_15, g_fp->getObjectEnumState(sO_Boot_15, sO_IsPresent)); + + break; + + case MSG_SC22_SHOWSTOOL: + sceneHandler22_showStool(); + break; + + case MSG_SC22_HIDESTOOL: + sceneHandler22_hideStool(); + break; + + case MSG_SC22_FROMSTOOL: + g_vars->scene22_dudeIsOnStool = false; + g_vars->scene22_interactionIsDisabled = false; + + getCurrSceneSc2MotionController()->setEnabled(); + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + break; + + case MSG_SC22_ONSTOOL: + g_vars->scene22_dudeIsOnStool = true; + getCurrSceneSc2MotionController()->clearEnabled(); + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + break; + + case MSG_SC22_HANDLEDOWN: + sceneHandler22_handleDown(); + break; + + case 29: + if (!g_vars->scene22_interactionIsDisabled) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_HANDLE_L) { + sceneHandler22_stoolLogic(cmd); + return 0; + } + + if (!g_vars->scene22_dudeIsOnStool) { + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) { + g_fp->processArcade(cmd); + return 0; + } + } + } + return 0; + } + + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_RIGHT && !g_fp->_aniMan->_movement) { + sceneHandler22_fromStool(cmd); + + return 0; + } + } + + cmd->_messageKind = 0; + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x <= g_fp->_sceneWidth - 460) { + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + } else { + g_fp->_currentScene->_x = g_fp->_sceneWidth - x; + } + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + } + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene23.cpp b/engines/fullpipe/scenes/scene23.cpp new file mode 100644 index 0000000000..1f2587eba4 --- /dev/null +++ b/engines/fullpipe/scenes/scene23.cpp @@ -0,0 +1,555 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +bool sceneHandler23_testCalendar() { + int cal0, cal1, cal2, cal3; + + if (g_vars->scene23_calend0->_movement) + cal0 = g_vars->scene23_calend0->_movement->_staticsObj2->_staticsId; + else + cal0 = g_vars->scene23_calend0->_statics->_staticsId; + + if (g_vars->scene23_calend1->_movement) + cal1 = g_vars->scene23_calend1->_movement->_staticsObj2->_staticsId; + else + cal1 = g_vars->scene23_calend1->_statics->_staticsId; + + if (g_vars->scene23_calend2->_movement) + cal2 = g_vars->scene23_calend2->_movement->_staticsObj2->_staticsId; + else + cal2 = g_vars->scene23_calend2->_statics->_staticsId; + + if (g_vars->scene23_calend3->_movement) + cal3 = g_vars->scene23_calend3->_movement->_staticsObj2->_staticsId; + else + cal3 = g_vars->scene23_calend3->_statics->_staticsId; + + return (cal0 == ST_CND_1 && cal1 == ST_CND_4 && cal2 == ST_CND_0 && cal3 == ST_CND_2 && (g_vars->scene23_giraffee->_flags & 4)); +} + +void scene23_initScene(Scene *sc) { + g_vars->scene23_calend0 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 0); + g_vars->scene23_calend1 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 1); + g_vars->scene23_calend2 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 2); + g_vars->scene23_calend3 = sc->getStaticANIObject1ById(ANI_CALENDWHEEL, 3); + g_vars->scene23_topReached = false; + g_vars->scene23_isOnStool = false; + g_vars->scene23_someVar = 0; + g_vars->scene23_giraffeTop = sc->getStaticANIObject1ById(ANI_GIRAFFE_TOP, -1); + g_vars->scene23_giraffee = sc->getStaticANIObject1ById(ANI_GIRAFFEE, -1); + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_23")); + + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) { + sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags |= 4; + + if (g_vars->scene23_giraffee->_statics->_staticsId == ST_GRFG_EMPTY || !(g_vars->scene23_giraffee->_flags & 4)) { + g_vars->scene23_giraffee->changeStatics2(ST_GRFG_BALD); + g_vars->scene23_giraffee->_flags |= 4; + } + g_vars->scene23_calend0->show1(-1, -1, -1, 0); + g_vars->scene23_calend1->show1(-1, -1, -1, 0); + g_vars->scene23_calend2->show1(-1, -1, -1, 0); + g_vars->scene23_calend3->show1(-1, -1, -1, 0); + + sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_OPEN); + } else { + sc->getPictureObjectById(PIC_SC23_BOXOPEN, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BOXCLOSED, 0)->_flags |= 4; + sc->getPictureObjectById(PIC_SC23_BTN1, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN2, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN3, 0)->_flags &= 0xFFFB; + sc->getPictureObjectById(PIC_SC23_BTN4, 0)->_flags &= 0xFFFB; + + g_vars->scene23_giraffee->hide(); + g_vars->scene23_calend0->hide(); + g_vars->scene23_calend1->hide(); + g_vars->scene23_calend2->hide(); + g_vars->scene23_calend3->hide(); + + sc->getStaticANIObject1ById(ANI_LUK23_U, -1)->changeStatics2(ST_LUK23U_CLOSED); + + g_fp->_floaters->genFlies(sc, 600, 90, 0, 0); + } + + if (g_fp->getObjectState(sO_LowerHatch_23) == g_fp->getObjectEnumState(sO_LowerHatch_23, sO_Opened)) { + g_vars->scene23_giraffeTop->show1(-1, -1, -1, 0); + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP); + + if (g_fp->getObjectState(sO_LowerPipe_21) == g_fp->getObjectEnumState(sO_LowerPipe_21, sO_IsOpened)) { + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_KISS); + g_vars->scene23_giraffee->hide(); + } else { + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened) + && (g_vars->scene23_giraffee->_flags & 4)) + g_vars->scene23_giraffeTop->setOXY(614, 362); + else + g_vars->scene23_giraffeTop->setOXY(618, 350); + + if (sceneHandler23_testCalendar()) + g_vars->scene23_calend1->_statics = g_vars->scene23_calend1->getStaticsById(ST_CND_5); + } + + sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_OPEN); + + if (g_fp->getObjectState(sO_Lever_23) == g_fp->getObjectEnumState(sO_Lever_23, sO_Taken)) + sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide(); + + sc->getStaticANIObject1ById(ANI_HANDLE23, -1)->hide(); + } else { + g_vars->scene23_giraffeTop->hide(); + + sc->getStaticANIObject1ById(ANI_LUK23_D, -1)->changeStatics2(ST_LUK23_WHANDLE2); + + sc->getStaticANIObject1ById(ANI_INV_LEVERHANDLE, -1)->hide(); + } + + g_fp->_currentScene = oldsc; +} + +void scene23_setGiraffeState() { + if (g_fp->getObjectState(sO_UpperHatch_23) == g_fp->getObjectEnumState(sO_UpperHatch_23, sO_Opened)) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UL, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene23_giraffeTop, ST_GRFU_UP, QU_GRFU_TURN_UD, 0); + } +} + +int scene23_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC23_LADDERU) { + if (g_vars->scene23_topReached) + return g_fp->_cursorId; + + g_fp->_cursorId = getGameLoaderInventory()->getSelectedItemId() ? PIC_CSR_GOU : PIC_CSR_ITN; // FIXME check + } + + if (g_fp->_objectIdAtCursor == PIC_SC23_BTN1 || g_fp->_objectIdAtCursor == PIC_SC23_BTN2 + || g_fp->_objectIdAtCursor == PIC_SC23_BTN3 || g_fp->_objectIdAtCursor == PIC_SC23_BTN4 + || g_fp->_objectIdAtCursor == ANI_CALENDWHEEL) + g_fp->_cursorId = PIC_CSR_LIFT; + + return g_fp->_cursorId; +} + +void sceneHandler23_showStool() { + chainQueue(QU_SC23_SHOWSTOOL, 0); +} + +void sceneHandler23_hideStool() { + g_fp->_currentScene->getStaticANIObject1ById(ANI_TABURETTE, -1)->hide(); +} + +void sceneHandler23_startKiss() { + g_vars->scene23_giraffeTop->changeStatics2(ST_GRFU_UP); + g_vars->scene23_giraffeTop->startMQIfIdle(QU_SC23_STARTKISS, 0); +} + +void sceneHandler23_spinWheel1() { + int mv = 0; + + switch (g_vars->scene23_calend0->_statics->_staticsId) { + case ST_CND_0: + mv = MV_CND_0_1; + break; + + case ST_CND_1: + mv = MV_CND_1_2; + break; + + case ST_CND_2: + mv = MV_CND_2_3; + break; + + case ST_CND_3: + g_vars->scene23_calend0->changeStatics2(ST_CND_9); + mv = MV_CND_9_0; + break; + + default: + break; + } + + if (mv) + g_vars->scene23_calend0->startAnim(mv, 0, -1); + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_spinWheel2and4(StaticANIObject *ani) { + int mv = 0; + + switch (ani->_statics->_staticsId) { + case ST_CND_0: + mv = MV_CND_0_1; + break; + + case ST_CND_1: + mv = MV_CND_1_2; + break; + + case ST_CND_2: + mv = MV_CND_2_3; + break; + + case ST_CND_3: + mv = MV_CND_3_4; + break; + + case ST_CND_4: + mv = MV_CND_4_5; + break; + + case ST_CND_5: + mv = MV_CND_5_6; + break; + + case ST_CND_6: + mv = MV_CND_6_7; + break; + + case ST_CND_7: + mv = MV_CND_7_8; + break; + + case ST_CND_8: + mv = MV_CND_8_9; + break; + + case ST_CND_9: + mv = MV_CND_9_0; + break; + + default: + break; + } + + if (mv) + ani->startAnim(mv, 0, -1); + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_spinWheel3() { + if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_0) { + g_vars->scene23_calend2->startAnim(MV_CND_0_1, 0, -1); + } else if (g_vars->scene23_calend2->_statics->_staticsId == ST_CND_1) { + g_vars->scene23_calend2->changeStatics2(ST_CND_9); + g_vars->scene23_calend2->startAnim(MV_CND_9_0, 0, -1); + } + + if (sceneHandler23_testCalendar()) + sceneHandler23_startKiss(); +} + +void sceneHandler23_pushButton(ExCommand *cmd) { + if (g_fp->_aniMan->isIdle() || !(g_fp->_aniMan->_flags & 0x100)) { + if (!g_vars->scene23_topReached) { + if (g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220) { + if (g_fp->_aniMan->_ox != 276 || g_fp->_aniMan->_oy != 438 + || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_RIGHT) { + if (g_fp->_msgX == 276 && g_fp->_msgY == 438 ) + return; + + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, 276, 438, 1, ST_MAN_RIGHT); + + if (mq) { + mq->addExCommandToEnd(cmd->createClone());; + + postExCommand(g_fp->_aniMan->_id, 2, 276, 438, 0, -1); + } + } else { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_TOCALENDAR), 0, 0); + + mq->addExCommandToEnd(cmd->createClone());; + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } + + if (!g_vars->scene23_topReached) + return; + } else { + g_vars->scene23_topReached = true; + } + } + + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER) { + int mv = 0; + + switch (cmd->_messageNum) { + case MSG_SC23_CLICKBTN1: + mv = MV_MAN23_PUSH1; + break; + + case MSG_SC23_CLICKBTN2: + mv = MV_MAN23_PUSH2; + break; + + case MSG_SC23_CLICKBTN3: + mv = MV_MAN23_PUSH3; + break; + + case MSG_SC23_CLICKBTN4: + mv = MV_MAN23_PUSH4; + break; + + default: + return; + } + + if (mv) + g_fp->_aniMan->startAnim(mv, 0, -1); + + } + } +} + +void sceneHandler23_sendClick(StaticANIObject *ani) { + int msg = 0; + switch (ani->_okeyCode) { + case 0: + msg = MSG_SC23_CLICKBTN1; + break; + case 1: + msg = MSG_SC23_CLICKBTN2; + break; + case 2: + msg = MSG_SC23_CLICKBTN3; + break; + case 3: + msg = MSG_SC23_CLICKBTN4; + break; + default: + break; + } + + ExCommand *ex = new ExCommand(0, 17, msg, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + ex->postMessage(); +} + +void sceneHandler23_checkReachingTop() { + if (g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_STANDLADDER + || g_fp->_aniMan->_ox != 405 || g_fp->_aniMan->_oy != 220) + g_vars->scene23_topReached = false; + else + g_vars->scene23_topReached = true; +} + +void sceneHandler23_exitCalendar() { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + chainQueue(QU_SC23_FROMCALENDAREXIT, 1); + g_vars->scene23_someVar = 2; + } +} + +void sceneHandler23_fromCalendar(ExCommand *cmd) { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + && !g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMCALENDAR), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + g_vars->scene23_topReached = false; + g_vars->scene23_someVar = 0; + } +} + +void sceneHandler23_fromStool(ExCommand *cmd) { + if (!g_fp->_aniMan->getMessageQueue() && !(g_fp->_aniMan->_flags & 0x100)) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC23_FROMSTOOL), 0, 0); + + mq->addExCommandToEnd(cmd->createClone()); + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + cmd->_messageKind = 0; + } +} + +int sceneHandler23(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC23_FROMSTOOL: + g_vars->scene23_isOnStool = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + break; + + case MSG_SC23_HIDEGIRAFFEE: + g_vars->scene23_giraffee->queueMessageQueue(0); + g_vars->scene23_giraffee->_flags &= 0xFFFB; + break; + + case MSG_SC23_ONSTOOL: + g_vars->scene23_isOnStool = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + break; + + case MSG_SC22_SHOWSTOOL: + sceneHandler23_showStool(); + break; + + case MSG_SC22_HIDESTOOL: + sceneHandler23_hideStool(); + break; + + case MSG_SC23_SPINWHEEL1: + sceneHandler23_spinWheel1(); + break; + + case MSG_SC23_SPINWHEEL2: + sceneHandler23_spinWheel2and4(g_vars->scene23_calend1); + break; + + case MSG_SC23_SPINWHEEL3: + sceneHandler23_spinWheel3(); + break; + + case MSG_SC23_SPINWHEEL4: + sceneHandler23_spinWheel2and4(g_vars->scene23_calend3); + break; + + case MSG_SC23_CLICKBTN1: + case MSG_SC23_CLICKBTN2: + case MSG_SC23_CLICKBTN3: + case MSG_SC23_CLICKBTN4: + sceneHandler23_pushButton(cmd); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_floaters->update(); + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + int picId; + + if (ani && ani->_id == ANI_CALENDWHEEL) { + sceneHandler23_sendClick(ani); + cmd->_messageKind = 0; + } + + sceneHandler23_checkReachingTop(); + + if (g_vars->scene23_topReached) { + picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (picId == PIC_SC23_LADDER) { + sceneHandler23_exitCalendar(); + + cmd->_messageKind = 0; + break; + } + + if (cmd->_sceneClickY > 450) { + sceneHandler23_fromCalendar(cmd); + + cmd->_messageKind = 0; + break; + } + break; + } + + if (!g_vars->scene23_isOnStool) { + picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (picId == PIC_SC23_LADDERU && !g_vars->scene23_topReached) { + sceneHandler23_pushButton(cmd); + + cmd->_messageKind = 0; + break; + } + break; + } + + if (ani && ani->_id == ANI_HANDLE23) { + handleObjectInteraction(g_fp->_aniMan, ani, cmd->_keyCode); + cmd->_messageKind = 0; + } else { + sceneHandler23_fromStool(cmd); + + cmd->_messageKind = 0; + } + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene25.cpp b/engines/fullpipe/scenes/scene25.cpp new file mode 100644 index 0000000000..ba07c3e5b9 --- /dev/null +++ b/engines/fullpipe/scenes/scene25.cpp @@ -0,0 +1,723 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene25_showBoardOnRightFar() { + g_vars->scene25_board->show1(453, 557, MV_BRD25_RIGHT, 0); + g_vars->scene25_board->_priority = 28; +} + +void scene25_showBoardOnRightClose() { + g_vars->scene25_board->show1(632, 557, rMV_BRD25_RIGHT, 0); + g_vars->scene25_board->_priority = 28; +} + +void scene25_initScene(Scene *sc, int entranceId) { + g_vars->scene25_water = sc->getStaticANIObject1ById(ANI_WATER25, -1); + g_vars->scene25_board = sc->getStaticANIObject1ById(ANI_BOARD25, -1); + g_vars->scene25_drop = sc->getStaticANIObject1ById(ANI_DROP_25, -1); + g_vars->scene25_water->setAlpha(0xa0); + g_vars->scene25_drop->setAlpha(0xa0); + g_vars->scene25_dudeIsOnBoard = false; + + if (g_fp->getObjectState(sO_Pool) < g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) { + g_vars->scene25_waterIsPresent = false; + + g_vars->scene25_water->hide(); + } else { + g_vars->scene25_waterIsPresent = true; + + g_fp->playSound(SND_25_006, 1); + } + + int boardState = g_fp->getObjectState(sO_Board_25); + + if (entranceId == TrubaRight) { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_FarAway)) { + scene25_showBoardOnRightFar(); + + g_fp->playSound(SND_25_029, 0); + + g_vars->scene25_boardIsSelectable = false; + } else { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_Nearby) + || boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnRight)) + scene25_showBoardOnRightClose(); + g_vars->scene25_boardIsSelectable = false; + } + } else { + if (boardState == g_fp->getObjectEnumState(sO_Board_25, sO_WithDudeOnLeft)) { + if (!getGameLoaderInventory()->getCountItemsWithId(ANI_INV_BOARD)) { + getGameLoaderInventory()->addItem(ANI_INV_BOARD, 1); + getGameLoaderInventory()->rebuildItemRects(); + } + } else { + g_vars->scene25_boardIsSelectable = true; + } + } + + g_vars->scene25_beardersAreThere = false; + g_vars->scene25_beardersCounter = 0; +} + +int scene25_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_vars->scene25_waterIsPresent) { + int inv = getGameLoaderInventory()->getSelectedItemId(); + + if (g_fp->_objectIdAtCursor == ANI_WATER25) { + if ((g_vars->scene25_boardIsSelectable && (!inv || inv == ANI_INV_BOARD)) || (g_vars->scene25_dudeIsOnBoard && (inv == ANI_INV_LOPAT || !inv))) + g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; // FIXME check + } else if (g_fp->_objectIdAtCursor == ANI_BOARD25 && (!inv || inv == ANI_INV_SWAB || inv == ANI_INV_BROOM || inv == ANI_INV_LOPAT)) { + g_fp->_cursorId = (g_fp->_cursorId != PIC_CSR_DEFAULT) ? PIC_CSR_ITN : PIC_CSR_ITN_INV; + } + } + + return g_fp->_cursorId; +} + +void scene25_setupWater(Scene *a1, int entranceId) { + if (g_vars->scene25_waterIsPresent) { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 0); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 1); + + if (entranceId != TrubaRight) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_25"), "MUSIC2", 0); + } else { + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOFLOOR, 1); + g_fp->_behaviorManager->setBehaviorEnabled(g_vars->scene25_drop, ST_DRP25_EMPTY, QU_DRP25_TOWATER, 0); + } +} + +void sceneHandler25_stopBearders() { + g_vars->scene25_beardersAreThere = false; + + g_vars->scene25_bearders.clear(); +} + +void sceneHandler25_startBearders() { + g_vars->scene25_bearders.clear(); + g_vars->scene25_beardersCounter = 0; + + StaticANIObject *bearded = g_fp->accessScene(SC_COMMON)->getStaticANIObject1ById(ANI_BEARDED_CMN, -1); + + for (int i = 0; i < 3; i++) { + StaticANIObject *ani = new StaticANIObject(bearded); + + g_vars->scene25_bearders.push_back(ani); + + ani->_statics = ani->getStaticsById(ST_BRDCMN_EMPTY); + + g_fp->_currentScene->addStaticANIObject(ani, 1); + } + + g_vars->scene25_beardersAreThere = true; +} + +void sceneHandler25_enterMan() { + if (g_vars->scene25_waterIsPresent) { + chainQueue(QU_SC25_ENTERUP_WATER, 1); + + getCurrSceneSc2MotionController()->clearEnabled(); + } else { + chainQueue(QU_SC25_ENTERUP_FLOOR, 1); + } +} + +void sceneHandler25_enterTruba() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 634 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_MANTOTRUBA; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_MANTOTRUBA_R; + } + + if (qid) { + chainQueue(qid, 1); + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_saveEntrance(int value) { + g_fp->getGameLoaderGameVar()->getSubVarByName("OBJSTATES")->getSubVarByName("SAVEGAME")->setSubVarAsInt("Entrance", value); +} + +void sceneHandler25_toLadder() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 307 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_BACKTOLADDER; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 192 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_BOARDTOLADDER; + } + + if (qid) { + chainQueue(qid, 1); + g_vars->scene25_dudeIsOnBoard = false; + g_vars->scene25_boardIsSelectable = true; + g_vars->scene25_sneezeFlipper = false; + + sceneHandler25_saveEntrance(TrubaUp); + } +} + +void sceneHandler25_animateBearders() { + if (g_fp->_rnd->getRandomNumber(32767) < 218) { + MessageQueue *mq; + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[0]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + + g_vars->scene25_beardersCounter = 0; + + if (g_fp->_rnd->getRandomNumber(32767) < 0x1FFF) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED2), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[1]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + + if (g_fp->_rnd->getRandomNumber(32767) < 8191) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC25_BEARDED3), 0, 1); + + mq->replaceKeyCode(-1, g_vars->scene25_bearders[2]->_okeyCode); + mq->getExCommandByIndex(0)->_x = g_fp->_rnd->getRandomNumber(650) + 100; + mq->chain(0); + } + } + } +} + +void sceneHandler25_sneeze() { + if (g_fp->_rnd->getRandomNumber(32767) % 10) { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) { + g_fp->_aniMan->startAnim(MV_MAN25_ONBOARD, 0, -1); + } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) { + g_fp->_aniMan->startAnim(rMV_MAN25_ONBOARD, 0, -1); + } + } else if (g_fp->_aniMan->_statics->_staticsId == ST_MAN25_ONBOARD) { + g_fp->_aniMan->startAnim(MV_MAN25_CHIH, 0, -1); + } else if (g_fp->_aniMan->_statics->_staticsId == (ST_MAN25_ONBOARD|0x4000)) { + g_fp->_aniMan->startAnim(rMV_MAN25_CHIH, 0, -1); + } +} + +void sceneHandler25_rowShovel() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_ROWTOTRUBA; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_ROWTOLADDER; + + g_fp->playSound(SND_25_030, 0); + } + + if (qid) { + chainQueue(qid, 1); + + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_rowHand() { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(g_fp->_aniMan->_statics->_staticsId); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int id = g_fp->_aniMan->_statics->_staticsId; + int qid = 0; + + if (id == ST_MAN25_ONBOARD && x == 370 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD); + + qid = QU_SC25_TRYROWHAND; + } else if (id == (ST_MAN25_ONBOARD|0x4000) && x == 632 && y == 502) { + g_fp->_aniMan->changeStatics2(ST_MAN25_ONBOARD|0x4000); + + qid = QU_SC25_TRYROWHAND_R; + } + + if (qid) { + chainObjQueue(g_fp->_aniMan, qid, 1); + g_vars->scene25_sneezeFlipper = false; + } +} + +void sceneHandler25_putBoard() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + g_fp->_aniMan->setOXY(281, 481); + + chainQueue(QU_SC25_PUTBOARD, 1); + + g_vars->scene25_dudeIsOnBoard = true; + g_vars->scene25_sneezeFlipper = false; + g_vars->scene25_boardIsSelectable = false; + } +} + +void sceneHandler25_tryWater() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + + chainQueue(QU_SC25_TRYWATER, 1); + } +} + +void sceneHandler25_tryRow(int obj) { + PicAniInfo info; + + g_fp->_aniMan->getPicAniInfo(&info); + g_fp->_aniMan->_messageQueueId = 0; + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + int x = g_fp->_aniMan->_ox; + int y = g_fp->_aniMan->_oy; + + g_fp->_aniMan->setPicAniInfo(&info); + + int qid = 0; + + if (x == 788 && y == 468) { + if (g_vars->scene25_board->_statics->_staticsId == ST_BRD25_RIGHT2) { + if (obj == ANI_INV_BROOM) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + qid = QU_SC25_TRYBROOM; + } + if (obj == ANI_INV_LOPAT) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + qid = QU_SC25_TRYSPADE; + } + + if (qid) { + chainQueue(qid, 1); + + g_fp->playSound(SND_25_028, 0); + + return; + } + + if (obj == ANI_INV_SWAB) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_TRYSWAB, 1); + } else if (!obj) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainObjQueue(g_fp->_aniMan, QU_SC25_TRYHAND, 1); + + g_fp->playSound(SND_25_028, 0); + } + } else if (g_vars->scene25_board->_statics->_staticsId == (ST_MAN_RIGHT|0x4000) && !obj) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_TRUBATOBOARD, 1); + + g_vars->scene25_dudeIsOnBoard = true; + } + } +} + +void sceneHandler25_ladderUp() { + if (g_fp->_aniMan->_statics->_staticsId == ST_MAN_STANDLADDER + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_LADDERDOWN_R) { + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + + chainQueue(QU_SC25_LADDERUP, 1); + } +} + +void sceneHandler25_backToPipe() { + if (!g_fp->_aniMan->_movement && g_fp->_aniMan->_statics->_staticsId == (ST_MAN_RIGHT|0x4000)) { + g_fp->_aniMan->changeStatics2(ST_MAN_RIGHT|0x4000); + + chainQueue(QU_SC25_BACKTOTRUBA, 1); + } +} + +void sceneHandler25_walkOnLadder(StaticANIObject *ani, Common::Point *pnt, MessageQueue *mq, int flag) { + int aniY = ani->_oy; + int newx = 0, newy = 0; + Common::Point point; + ExCommand *ex; + + if (flag) { + if (ani->_movement) { + ani->_movement->calcSomeXY(point, 0); + newx = point.x; + aniY = ani->_oy - point.y; + } + } + + int pntx = pnt->x; + int pnty = pnt->y; + int numObsolete = -1; + int minDistance = 20000; + ExCommand *lastEx = 0; + + for (uint i = 0; i < mq->getCount(); i++) { + int curDistance = abs(pnty - aniY); + + ex = mq->getExCommandByIndex(i); + + if (ex->_messageKind == 1 && ani->_id == ex->_parentId) { + if (ex->_excFlags & 0x10000) { + if (ex->_messageNum == MV_MAN_TOLADDER) + ex->_messageNum = MV_MAN_TOLADDER2; + if (ex->_messageNum == MV_MAN_STARTLADDER) + ex->_messageNum = MV_MAN_STARTLADDER2; + if (ex->_messageNum == MV_MAN_GOLADDER) + ex->_messageNum = MV_MAN_GOLADDER2; + if (ex->_messageNum == MV_MAN_STOPLADDER) + ex->_messageNum = MV_MAN_STOPLADDER2; + } + + if (curDistance < minDistance || numObsolete < 0) { + numObsolete = i; + minDistance = curDistance; + lastEx = ex; + newx = pntx; + newy = pnty; + } + + ani->getMovementById(ex->_messageNum)->calcSomeXY(point, 0); + pntx += point.x; + pnty += point.y; + } + } + + for (int i = 0; i < numObsolete; i++) + mq->deleteExCommandByIndex(0, 1); + + ex = new ExCommand(ani->_id, 34, 256, 0, 0, 0, 1, 0, 0, 0); + + ex->_field_14 = 256; + ex->_messageNum = 0; + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + if (flag && ani->_movement && ani->_movement->_id == mq->getExCommandByIndex(0)->_messageNum) { + mq->deleteExCommandByIndex(0, 1); + + int movId = ani->_movement->_id; + int idx = ani->_movement->_currDynamicPhaseIndex; + + ani->changeStatics2(ani->_movement->_staticsObj1->_staticsId); + ani->setOXY(newx, newy); + + ani->startAnim(movId, mq->_id, -1); + + ani->_movement->setDynamicPhaseIndex(idx); + } else { + if (!lastEx) + error("sceneHandler25_walkOnLadder(): Incorrect state. Please report this to sev"); + + ani->changeStatics2(ani->getMovementById(lastEx->_messageNum)->_staticsObj1->_staticsId); + ani->setOXY(newx, newy); + ani->restartMessageQueue(mq); + } + + ani->_flags |= 1; +} + +bool sceneHandler25_isOnLadder(ExCommand *cmd) { + if ((g_fp->_aniMan->_movement && g_fp->_aniMan->_movement->_id == MV_MAN_GOLADDERDOWN) + || g_fp->_aniMan->_statics->_staticsId == ST_MAN_GOLADDERD) { + Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(PIC_SC25_LADDERDOWN, ANI_MAN, cmd->_keyCode); + + if (!inter) + return 0; + + MessageQueue *mq = new MessageQueue(inter->_messageQueue, 0, 1); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(PIC_SC25_LADDERDOWN, 0); + Common::Point point; + + point.x = inter->_xOffs + pic->_ox; + point.y = inter->_yOffs + pic->_oy; + + mq->setFlags(mq->getFlags() | 1); + + sceneHandler25_walkOnLadder(g_fp->_aniMan, &point, mq, 0); + + return true; + } else { + return false; + } +} + +void sceneHandler25_sub03() { + warning("STUB: sceneHandler25_sub03()"); +} + +int sceneHandler25(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC25_STOPBEARDEDS: + sceneHandler25_stopBearders(); + break; + + case MSG_SC25_STARTBEARDEDS: + sceneHandler25_startBearders(); + break; + + case MSG_SC25_ENTERMAN: + sceneHandler25_enterMan(); + break; + + case MSG_SC25_ENTERTRUBA: + sceneHandler25_enterTruba(); + break; + + case MSG_SC25_TOLADDER: + sceneHandler25_toLadder(); + break; + + case MSG_BRD_TURN: + switch (g_fp->_rnd->getRandomNumber(3)) { + case 0: + g_fp->playSound(SND_25_025, 0); + break; + + case 1: + g_fp->playSound(SND_25_026, 0); + break; + + default: + g_fp->playSound(SND_25_027, 0); + break; + } + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + int y = g_fp->_aniMan2->_oy; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + + if (!g_vars->scene25_waterIsPresent) { + if (y < g_fp->_sceneRect.top + 200) + g_fp->_currentScene->_y = y - 300 - g_fp->_sceneRect.top; + + if (y > g_fp->_sceneRect.bottom - 200) + g_fp->_currentScene->_y = y + 300 - g_fp->_sceneRect.bottom; + } + } + + if (g_vars->scene25_beardersAreThere) { + g_vars->scene25_beardersCounter++; + + if (g_vars->scene25_beardersCounter >= 120) + sceneHandler25_animateBearders(); + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + if (g_vars->scene25_waterIsPresent && !g_vars->scene25_water->_movement) + g_vars->scene25_water->startAnim(MV_WTR25_FLOW, 0, -1); + + if (g_vars->scene25_dudeIsOnBoard && !g_fp->_aniMan->_movement && g_vars->scene25_sneezeFlipper) + sceneHandler25_sneeze(); + + g_vars->scene25_sneezeFlipper = true; + + if (g_vars->scene25_board->_flags & 4) { + if (!g_vars->scene25_board->_movement) { + if (g_vars->scene25_board->_statics->_staticsId & 0x4000) + g_vars->scene25_board->startAnim(rMV_BRD25_RIGHT, 0, -1); + else + g_vars->scene25_board->startAnim(MV_BRD25_RIGHT, 0, -1); + } + } + break; + + case 29: + { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!g_vars->scene25_waterIsPresent) { + if ((picId == PIC_SC25_LADDERUP || picId == PIC_SC25_LADDERDOWN) && sceneHandler25_isOnLadder(cmd)) + cmd->_messageKind = 0; + + break; + } + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani) { + if (g_fp->_aniMan != ani) { + if (g_fp->_aniMan->isIdle()) { + if (!(g_fp->_aniMan->_flags & 0x100)) { + if (ani->_id == ANI_WATER25) { + if (g_vars->scene25_dudeIsOnBoard) { + if (cmd->_keyCode == ANI_INV_LOPAT) + sceneHandler25_rowShovel(); + + if (!cmd->_keyCode) + sceneHandler25_rowHand(); + } else { + if (cmd->_keyCode == ANI_INV_BOARD) + sceneHandler25_putBoard(); + + if (!cmd->_keyCode) + sceneHandler25_tryWater(); + } + } else if (ani->_id == ANI_BOARD25) { + sceneHandler25_tryRow(cmd->_keyCode); + break; + } + break; + } + } + } + } + + if (picId == PIC_SC25_LADDERUP && sceneHandler25_isOnLadder(cmd)) + cmd->_messageKind = 0; + + if (!g_fp->_aniMan->isIdle() || (g_fp->_aniMan->_flags & 0x100)) + break; + + if (g_vars->scene25_dudeIsOnBoard) { + if (picId == PIC_SC25_RTRUBA && !cmd->_keyCode) { + sceneHandler25_enterTruba(); + break; + } + } else { + if (picId != PIC_SC25_RTRUBA) { + if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode) + sceneHandler25_ladderUp(); + break; + } + + if (!cmd->_keyCode) { + sceneHandler25_backToPipe(); + break; + } + } + if (g_vars->scene25_dudeIsOnBoard) { + if (picId != PIC_SC25_LADDERUP || cmd->_keyCode) + break; + + sceneHandler25_toLadder(); + break; + } + + if (picId == PIC_SC25_LADDERUP && !cmd->_keyCode) + sceneHandler25_ladderUp(); + + break; + } + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene26.cpp b/engines/fullpipe/scenes/scene26.cpp new file mode 100644 index 0000000000..91679347e6 --- /dev/null +++ b/engines/fullpipe/scenes/scene26.cpp @@ -0,0 +1,355 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene26_initScene(Scene *sc) { + g_vars->scene26_chhi = sc->getStaticANIObject1ById(ANI_CHHI, -1); + g_vars->scene26_drop = sc->getStaticANIObject1ById(ANI_DROP_26, -1); + g_vars->scene26_sockPic = sc->getPictureObjectById(PIC_SC26_SOCK, 0); + g_vars->scene26_sock = sc->getStaticANIObject1ById(ANI_SOCK_26, -1); + + if (g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_WithSock)) { + g_fp->setObjectState(sO_Hatch_26, g_fp->getObjectEnumState(sO_Hatch_26, sO_Closed)); + g_fp->setObjectState(sO_Sock_26, g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe)); + } + + Interaction *inter = getGameLoaderInteractionController()->getInteractionByObjectIds(ANI_LUK26, ANI_MAN, ANI_INV_SOCK); + + if (getGameLoaderInventory()->getCountItemsWithId(ANI_INV_VENT) == 0) + inter->_flags &= 0xFFFDFFFF; + else + inter->_flags |= 0x20000; + + if (g_fp->getObjectState(sO_Sock_26) == g_fp->getObjectEnumState(sO_Sock_26, sO_HangsOnPipe)) + g_vars->scene26_sockPic->_flags |= 4; + else + g_vars->scene26_sockPic->_flags &= 0xFFFB; + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) + g_fp->playSound(SND_26_018, 1); +} + +int scene26_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor != ANI_VENT || g_fp->_cursorId != PIC_CSR_DEFAULT) { + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC26_LTRUBA) + g_fp->_cursorId = PIC_CSR_GOL; + } else { + g_fp->_cursorId = PIC_CSR_ITN; + } + + return g_fp->_cursorId; +} + +void sceneHandler26_updateDrop() { + if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed)) + g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 0); + else + g_fp->_behaviorManager->setFlagByStaticAniObject(g_vars->scene26_drop, 1); +} + +void scene26_setupDrop(Scene *sc) { + sceneHandler26_updateDrop(); +} + +void sceneHandler26_showChi() { + g_vars->scene26_chhi->changeStatics2(ST_CHI_EMPTY); + + chainQueue(QU_CHI_SHOW, 1); +} + +void sceneHandler26_updatePool() { + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Valve1_26)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Overfull)); + else if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Full)); + + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Valve1_26)) { + if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_Full)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)); + } + + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Valve1_26)) { + if (g_fp->getObjectState(sO_Pool) >= g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) + g_fp->setObjectState(sO_Pool, g_fp->getObjectEnumState(sO_Pool, sO_Empty)); + } +} + +void sceneHandler26_hideChi() { + g_vars->scene26_chhi->changeStatics2(ST_CHI_NORM); + + chainQueue(QU_CHI_HIDE, 1); +} + +void sceneHandler26_testVent() { + if (!g_vars->scene26_activeVent) + return; + + if (g_vars->scene26_activeVent->_okeyCode == 0) { + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) + g_fp->stopAllSoundInstances(SND_26_018); + else + g_fp->playSound(SND_26_018, 1); + + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) { + chainQueue(QU_SC26_AUTOCLOSE2, 0); + + g_fp->playSound(SND_26_020, 0); + } + + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) { + chainQueue(QU_SC26_AUTOCLOSE3, 0); + + g_fp->playSound(SND_26_020, 0); + } + } else if (g_vars->scene26_activeVent->_okeyCode == 1) { + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Opened)) + g_fp->playSound(SND_26_020, 0); + else + g_fp->playSound(SND_26_019, 0); + + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full)) + g_fp->playSound(SND_26_003, 0); + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) { + g_fp->stopAllSoundInstances(SND_26_018); + + chainQueue(QU_SC26_AUTOCLOSE1, 0); + } + } else if (g_vars->scene26_activeVent->_okeyCode == 2) { + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Opened)) + g_fp->playSound(SND_26_020, 0); + else + g_fp->playSound(SND_26_019, 0); + + if (g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Overfull) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_Full) + || g_fp->getObjectState(sO_Pool) == g_fp->getObjectEnumState(sO_Pool, sO_HalfFull)) + g_fp->playSound(SND_26_003, 0); + + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Opened)) { + g_fp->stopAllSoundInstances(SND_26_018); + + chainQueue(QU_SC26_AUTOCLOSE1, 0); + } + } +} + +void sceneHandler26_showVent() { + if (g_vars->scene26_activeVent) { + int id = g_vars->scene26_activeVent->_statics->_staticsId; + + if (id == ST_VNT26_UP2) { + g_vars->scene26_activeVent->changeStatics2(ST_VNT26_RIGHT2); + } else { + if (id != ST_VNT26_RIGHT2) + return; + + g_vars->scene26_activeVent->changeStatics2(ST_VNT26_UP2); + } + g_vars->scene26_activeVent->show1(-1, -1, -1, 0); + } +} + +void sceneHandler26_hideVent() { + if (g_vars->scene26_activeVent) + g_vars->scene26_activeVent->hide(); +} + +void sceneHandler26_animateVents(StaticANIObject *ani) { + int qId = 0; + + switch (ani->_okeyCode) { + case 0: + if (g_fp->getObjectState(sO_Valve1_26) == g_fp->getObjectEnumState(sO_Valve1_26, sO_Closed)) + qId = QU_SC26_OPEN1; + else + qId = QU_SC26_CLOSE1; + + break; + + case 1: + if (g_fp->getObjectState(sO_Valve2_26) == g_fp->getObjectEnumState(sO_Valve2_26, sO_Closed)) + qId = QU_SC26_OPEN2; + else + qId = QU_SC26_CLOSE2; + + break; + + case 2: + if (g_fp->getObjectState(sO_Valve3_26) == g_fp->getObjectEnumState(sO_Valve3_26, sO_Closed)) + qId = QU_SC26_OPEN3; + else + qId = QU_SC26_CLOSE3; + + break; + + case 3: + if (g_fp->getObjectState(sO_Valve4_26) == g_fp->getObjectEnumState(sO_Valve4_26, sO_Closed)) + qId = QU_SC26_OPEN4; + else + qId = QU_SC26_CLOSE4; + + break; + + case 4: + if (g_fp->getObjectState(sO_Valve5_26) == g_fp->getObjectEnumState(sO_Valve5_26, sO_Closed)) + qId = QU_SC26_OPEN5; + else + qId = QU_SC26_CLOSE5; + + break; + + default: + return; + } + + if (qId) { + MessageQueue *mq = g_fp->_currentScene->getMessageQueueById(qId); + + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + } +} + +void sceneHandler26_clickVent(StaticANIObject *ani, ExCommand *cmd) { + if (ani->_okeyCode || g_fp->getObjectState(sO_Hatch_26) == g_fp->getObjectEnumState(sO_Hatch_26, sO_Opened)) { + if (g_fp->_aniMan->isIdle() && !(g_fp->_aniMan->_flags & 0x100)) { + g_vars->scene26_activeVent = ani; + + int x = ani->_ox - 20; + int y = ani->_oy + 61; + + if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(y - g_fp->_aniMan->_oy) > 1 || g_fp->_aniMan->_movement || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, y, 1, ST_MAN_UP); + + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC26_CLICKVENT, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 3; + ex->_keyCode = ani->_okeyCode; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, x, y, 0, -1); + } + } else { + sceneHandler26_animateVents(ani); + } + } + } + + cmd->_messageKind = 0; +} + +int sceneHandler26(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC26_UPDATEDROP: + sceneHandler26_updateDrop(); + break; + + case MSG_SC26_SHOWCHI: + sceneHandler26_showChi(); + break; + + case MSG_SC26_UPDATEPOOL: + sceneHandler26_updatePool(); + break; + + case MSG_SC26_HIDECHI: + sceneHandler26_hideChi(); + break; + + case MSG_SC26_TESTVENT: + sceneHandler26_testVent(); + break; + + case MSG_SC26_SHOWVENT: + sceneHandler26_showVent(); + break; + + case MSG_SC26_CLICKVENT: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT, cmd->_keyCode); + + if (ani && ani->_id == ANI_VENT) + sceneHandler26_clickVent(ani, cmd); + + break; + } + + case MSG_SC26_HIDEVENT: + sceneHandler26_hideVent(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_VENT) + sceneHandler26_clickVent(ani, cmd); + + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene28.cpp b/engines/fullpipe/scenes/scene28.cpp new file mode 100644 index 0000000000..62afd128c2 --- /dev/null +++ b/engines/fullpipe/scenes/scene28.cpp @@ -0,0 +1,474 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" +#include "fullpipe/floaters.h" + +namespace Fullpipe { + +void scene28_initScene(Scene *sc) { + g_vars->scene28_fliesArePresent = true; + g_vars->scene28_beardedDirection = true; + g_vars->scene28_darkeningObject = 0; + g_vars->scene28_lighteningObject = 0; + g_vars->scene28_headDirection = false; + g_vars->scene28_headBeardedFlipper = false; + g_vars->scene28_lift6inside = false; + + g_fp->_floaters->init(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28")); + + g_fp->initArcadeKeys("SC_28"); +} + +int scene28_updateCursor() { + g_fp->updateCursorCommon(); + if (g_fp->_objectIdAtCursor == ANI_LIFT || g_fp->_objectIdAtCursor == ANI_LIFT_28) + if (g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + + return g_fp->_cursorId; +} + +void sceneHandler28_lift1ShowAfter() { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1); + + g_fp->_aniMan->_statics = g_fp->_aniMan->getStaticsById(ST_MAN_SIT|0x4000); + g_fp->_aniMan->setOXY(ani->_ox + 7, ani->_oy); + g_fp->_aniMan->_priority = ani->_priority; + g_fp->_aniMan->show1(-1, -1, -1, 0); +} + +void sceneHandler28_makeFaces(ExCommand *cmd) { + g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0)->_flags &= 0xFFFB; + + g_vars->scene28_lighteningObject = 0; + + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + if (mq) { + int frames[5]; + + frames[0] = MV_WMN28_IN_1; + frames[1] = MV_WMN28_IN_2; + frames[2] = MV_WMN28_IN_3; + frames[3] = MV_WMN28_IN_4; + frames[4] = MV_WMN28_IN_5; + + for (int i = 0; i < 5; i++) { + int pos; + + while (frames[pos = g_fp->_rnd->getRandomNumber(4)] == 0) + ; + + mq->getExCommandByIndex(i)->_messageNum = frames[pos]; + + frames[pos] = 0; + } + } +} + +void sceneHandler28_trySecondaryPers() { + MessageQueue *mq; + int x; + + if (g_vars->scene28_headBeardedFlipper) { + if (g_vars->scene28_beardedDirection) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 20; + mq->getExCommandByIndex(0)->_keyCode = 1; + mq->replaceKeyCode(-1, 1); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.left - 40; + mq->getExCommandByIndex(0)->_y += 20; + mq->getExCommandByIndex(0)->_keyCode = 2; + mq->replaceKeyCode(-1, 2); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOR), 0, 1); + + x = g_fp->_sceneRect.left - 60; + } else { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 20; + mq->getExCommandByIndex(0)->_keyCode = 1; + mq->replaceKeyCode(-1, 1); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + mq->getExCommandByIndex(0)->_x = g_fp->_sceneRect.right + 40; + mq->getExCommandByIndex(0)->_y += 20; + mq->getExCommandByIndex(0)->_keyCode = 2; + mq->replaceKeyCode(-1, 2); + mq->chain(0); + + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_BRD28_GOL), 0, 1); + + x = g_fp->_sceneRect.right + 60; + } + + mq->getExCommandByIndex(0)->_x = x; + mq->getExCommandByIndex(0)->_y += 40; + mq->getExCommandByIndex(0)->_keyCode = 3; + mq->replaceKeyCode(-1, 3); + mq->chain( 0); + + g_vars->scene28_beardedDirection = !g_vars->scene28_beardedDirection; + } else { + if (g_vars->scene28_headDirection) { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOR), 0, 1); + + x = g_fp->_sceneRect.left - 40; + } else { + mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_GLV28_GOL), 0, 1); + + x = g_fp->_sceneRect.right + 40; + } + + mq->getExCommandByIndex(0)->_x = x; + mq->chain(0); + + g_vars->scene28_headDirection = !g_vars->scene28_headDirection; + } + + g_vars->scene28_headBeardedFlipper = !g_vars->scene28_headBeardedFlipper; +} + +void sceneHandler28_turnOn2() { + if (g_vars->scene28_fliesArePresent) { + g_fp->_floaters->genFlies(g_fp->_currentScene, 1013, 329, 60, 4); + + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30; + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12; + + g_fp->_floaters->genFlies(g_fp->_currentScene, 1074, 311, 60, 4); + + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->val15 = 30; + g_fp->_floaters->_array2[g_fp->_floaters->_array2.size() - 1]->countdown = g_fp->_rnd->getRandomNumber(12) + 12; + } + + g_vars->scene28_fliesArePresent = false; +} + +void sceneHandler28_startWork1() { + g_fp->_aniMan->hide(); + + StaticANIObject *man = g_fp->_currentScene->getStaticANIObject1ById(ANI_MAN_28, -1); + + man->_statics = man->getStaticsById(ST_MAN28_RIGHT); + man->setOXY(g_fp->_aniMan->_ox, g_fp->_aniMan->_oy); + man->_priority = g_fp->_aniMan->_priority; + man->show1(-1, -1, -1, 0); + + chainQueue(QU_SC28_LIFT1_WORK, 1); +} + +void sceneHandler28_lift0Start() { + chainQueue(QU_SC28_LIFT0_START, 1); +} + +void sceneHandler28_lift1Start() { + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + chainQueue(QU_SC28_LIFT1_START, 1); +} + +void sceneHandler28_lift2Start() { + chainQueue(QU_SC28_LIFT2_START, 1); +} + +void sceneHandler28_lift3Start() { + chainQueue(QU_SC28_LIFT3_START, 1); +} + +void sceneHandler28_lift4Start() { + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + chainQueue(QU_SC28_WMN_START, 1); +} + +void sceneHandler28_lift5Start() { + chainQueue(QU_SC28_LIFT5_START, 1); +} + +void sceneHandler28_lift6Start() { + g_fp->_aniMan->_flags |= 1; + + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 0); + + StaticANIObject *woman = g_fp->_currentScene->getStaticANIObject1ById(ANI_TIOTIA, -1); + + if (woman && (woman->_flags & 4)) + chainQueue(QU_SC28_LIFT6_START2, 1); + else + chainQueue(QU_SC28_LIFT6_START, 1); +} + +void sceneHandler28_clickLift(int keycode) { + int x = 0; + + switch (keycode) { + case 0: x = 600; break; + case 1: x = 824; break; + case 2: x = 1055; break; + case 3: x = 1286; break; + case 4: x = 1517; break; + case 5: x = 1748; break; + case 6: x = 1979; break; + } + + if (abs(x - g_fp->_aniMan->_ox) > 1 || abs(472 - g_fp->_aniMan->_oy) > 1 + || g_fp->_aniMan->_movement + || g_fp->_aniMan->_statics->_staticsId != ST_MAN_UP) { + MessageQueue *mq = getCurrSceneSc2MotionController()->method34(g_fp->_aniMan, x, 472, 1, ST_MAN_UP); + if (mq) { + ExCommand *ex = new ExCommand(0, 17, MSG_SC28_CLICKLIFT, 0, 0, 0, 1, 0, 0, 0); + ex->_excFlags |= 3; + + mq->addExCommandToEnd(ex); + + postExCommand(g_fp->_aniMan->_id, 2, x, 472, 0, -1); + } + } else { + switch (keycode) { + case 0: + sceneHandler28_lift0Start(); + break; + case 1: + sceneHandler28_lift1Start(); + break; + case 2: + sceneHandler28_lift2Start(); + break; + case 3: + sceneHandler28_lift3Start(); + break; + case 4: + sceneHandler28_lift4Start(); + break; + case 5: + sceneHandler28_lift5Start(); + break; + case 6: + sceneHandler28_lift6Start(); + break; + default: + return; + } + } +} + +int sceneHandler28(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC28_LIFT6MUSIC: + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC_TIOTIA", 1); + break; + + case MSG_SC28_LIFT6INSIDE: + g_vars->scene28_lift6inside = true; + break; + + case MSG_SC28_LIFT1_SHOWAFTER: + sceneHandler28_lift1ShowAfter(); + break; + + case MSG_SC28_MAKEFACES: + sceneHandler28_makeFaces(cmd); + break; + + case MSG_SC28_TRYVTORPERS: + sceneHandler28_trySecondaryPers(); + break; + + case MSG_SC28_TURNOFF_0: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_TURNON_0: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK0, 0); + break; + + case MSG_SC28_TURNON_1: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + break; + + case MSG_SC28_TURNOFF_1: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK1, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_TURNON_2: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + sceneHandler28_turnOn2(); + break; + + case MSG_SC28_TURNOFF_2: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK2, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_TURNON_3: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + break; + + case MSG_SC28_TURNOFF_3: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK3, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_TURNON_4: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + break; + + case MSG_SC28_TURNOFF_4: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK4, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_TURNON_6: + g_vars->scene28_darkeningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + break; + + case MSG_SC28_TURNOFF_6: + g_vars->scene28_lighteningObject = g_fp->_currentScene->getPictureObjectById(PIC_SC28_DARK6, 0); + g_vars->scene28_lighteningObject->_flags |= 4; + break; + + case MSG_SC28_STARTWORK1: + sceneHandler28_startWork1(); + break; + + case MSG_SC28_CLICKLIFT: + sceneHandler28_clickLift(cmd->_keyCode); + break; + + case MSG_SC28_ENDLIFT1: + case MSG_SC28_ENDLIFT6: + case MSG_SC28_ENDCABIN: + g_fp->_behaviorManager->setFlagByStaticAniObject(g_fp->_aniMan, 1); + g_fp->_aniMan->_flags &= 0xFEFF; + break; + + case 29: + { + if (g_vars->scene28_lift6inside) { + chainObjQueue(g_fp->_aniMan, QU_SC28_LIFT6_END, 1); + + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_28"), "MUSIC", 1); + + g_vars->scene28_lift6inside = false; + } + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani) + if (ani->_id == ANI_LIFT || ani->_id == ANI_LIFT_28 ) { + sceneHandler28_clickLift(ani->_okeyCode); + + cmd->_messageKind = 0; + break; + } + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene28_darkeningObject) { + if (g_vars->scene28_darkeningObject->_picture->getAlpha() > 10) { + g_vars->scene28_darkeningObject->_picture->setAlpha(g_vars->scene28_darkeningObject->_picture->getAlpha() - 10); + } else { + g_vars->scene28_darkeningObject->_flags &= 0xFFFB; + + g_vars->scene28_darkeningObject = 0; + } + } + + if (g_vars->scene28_lighteningObject) { + if (g_vars->scene28_lighteningObject->_picture->getAlpha() < 0xF9u) { + g_vars->scene28_lighteningObject->_picture->setAlpha(g_vars->scene28_lighteningObject->_picture->getAlpha() + 6); + } else { + g_vars->scene28_lighteningObject->_picture->setAlpha(0xff); + + g_vars->scene28_lighteningObject = 0; + } + } + + g_fp->_floaters->update(); + + for (uint i = 0; i < g_fp->_floaters->_array2.size(); i++) + if (g_fp->_floaters->_array2[i]->val13 == 1) + g_fp->_floaters->_array2[i]->ani->_priority = 15; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene30.cpp b/engines/fullpipe/scenes/scene30.cpp new file mode 100644 index 0000000000..59cb83efcd --- /dev/null +++ b/engines/fullpipe/scenes/scene30.cpp @@ -0,0 +1,152 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene30_enablePass(Scene *sc) { + MovGraphLink *lnk = getSc2MctlCompoundBySceneId(sc->_sceneId)->getLinkByName(sO_WayToPipe); + + if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll)) + lnk->_flags &= 0xDFFFFFFF; + else + lnk->_flags |= 0x20000000; +} + +void scene30_initScene(Scene *sc, int flag) { + Scene *oldsc = g_fp->_currentScene; + + g_vars->scene30_leg = sc->getStaticANIObject1ById(ANI_LEG, -1); + g_fp->_currentScene = sc; + + if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_ShowingHeel)) + g_vars->scene30_leg->changeStatics2(ST_LEG_UP); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithoutJugs)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithBig)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN1); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithSmall)) + g_vars->scene30_leg->changeStatics2(ST_LEG_DOWN2); + else if (g_fp->getObjectState(sO_Leg) == g_fp->getObjectEnumState(sO_Leg, sO_WithAll)) + g_vars->scene30_leg->changeStatics2(ST_LEG_EMPTY); + + g_fp->_currentScene = oldsc; + + scene30_enablePass(sc); + + if (flag == LiftUp || flag == LiftDown) + g_vars->scene30_liftFlag = 0; + else + g_vars->scene30_liftFlag = 1; + + g_fp->lift_setButton(sO_Level8, ST_LBN_8N); + + g_fp->lift_sub5(sc, QU_SC30_ENTERLIFT, QU_SC30_EXITLIFT); +} + +int scene30_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId == PIC_CSR_ITN && g_fp->_objectIdAtCursor == PIC_SC30_LTRUBA) { + g_fp->_cursorId = PIC_CSR_GOL; + } + return g_fp->_cursorId; +} + +int sceneHandler30(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch(cmd->_messageNum) { + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC30_UPDATEPATH: + scene30_enablePass(g_fp->_currentScene); + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + + cmd->_messageKind = 0; + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene31.cpp b/engines/fullpipe/scenes/scene31.cpp new file mode 100644 index 0000000000..587fc6aaef --- /dev/null +++ b/engines/fullpipe/scenes/scene31.cpp @@ -0,0 +1,126 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene31_initScene(Scene *sc) { + g_vars->scene31_chantingCountdown = 0; + g_vars->scene31_cactus = sc->getStaticANIObject1ById(ANI_CACTUS_31, -1); + + if (g_fp->getObjectState(sO_Cactus) == g_fp->getObjectEnumState(sO_Cactus, sO_HasGrown)) { + Scene *oldsc = g_fp->_currentScene; + g_fp->_currentScene = sc; + + g_vars->scene31_cactus->changeStatics2(ST_CTS31_GROWN2); + g_vars->scene31_cactus->_priority = 22; + + g_fp->_currentScene = oldsc; + } else { + g_vars->scene31_cactus->hide(); + } + + g_vars->scene31_plusMinus = sc->getStaticANIObject1ById(ANI_PLUSMINUS, -1); + + if (g_fp->getObjectState(sO_Guard_3) == g_fp->getObjectEnumState(sO_Guard_3, sO_Off)) + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS); + else + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS); +} + +void sceneHandler31_testCactus(ExCommand *cmd) { + if ((g_vars->scene31_cactus->_flags & 4) && g_vars->scene31_cactus->_statics->_staticsId == ST_CTS31_GROWN2) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (mq) { + mq->getExCommandByIndex(0)->_messageKind = 0; + mq->getExCommandByIndex(0)->_excFlags |= 1; + + mq->getExCommandByIndex(1)->_messageKind = 0; + mq->getExCommandByIndex(1)->_excFlags |= 1; + } + } +} + +int sceneHandler31(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC31_TESTCACTUS: + sceneHandler31_testCactus(cmd); + break; + + case MSG_SC15_STOPCHANTING: + g_fp->stopAllSoundInstances(SND_31_001); + + g_vars->scene31_chantingCountdown = 120; + break; + + case MSG_SC31_PULL: + if ( g_vars->scene31_plusMinus->_statics->_staticsId == ST_PMS_MINUS) + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_PLUS); + else + g_vars->scene31_plusMinus->_statics = g_vars->scene31_plusMinus->getStaticsById(ST_PMS_MINUS); + + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene31_chantingCountdown > 0) { + --g_vars->scene31_chantingCountdown; + + if (!g_vars->scene31_chantingCountdown) + g_fp->playSound(SND_31_001, 1); + } + + g_fp->_behaviorManager->updateBehaviors(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene32.cpp b/engines/fullpipe/scenes/scene32.cpp new file mode 100644 index 0000000000..c93e888e51 --- /dev/null +++ b/engines/fullpipe/scenes/scene32.cpp @@ -0,0 +1,431 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene32_initScene(Scene *sc) { + g_vars->scene32_flagIsWaving = false; + g_vars->scene32_flagNeedsStopping = false; + g_vars->scene32_dudeIsSitting = false; + g_vars->scene32_cactusCounter = -1; + g_vars->scene32_dudeOnLadder = false; + g_vars->scene32_cactusIsGrowing = false; + g_vars->scene32_flag = sc->getStaticANIObject1ById(ANI_FLAG, -1); + g_vars->scene32_cactus = sc->getStaticANIObject1ById(ANI_CACTUS, -1); + g_vars->scene32_massOrange = sc->getStaticANIObject1ById(ANI_TESTO_ORANGE, -1); + g_vars->scene32_massBlue = sc->getStaticANIObject1ById(ANI_TESTO_BLUE, -1); + g_vars->scene32_massGreen = sc->getStaticANIObject1ById(ANI_TESTO_GREEN, -1); + g_vars->scene32_button = sc->getStaticANIObject1ById(ANI_BUTTON_32, -1); + + g_vars->scene32_massOrange->startAnim(MV_TSTO_FLOW, 0, -1); + g_vars->scene32_massOrange->_movement->setDynamicPhaseIndex(15); + + g_vars->scene32_massGreen->startAnim(MV_TSTG_FLOW, 0, -1); + g_vars->scene32_massGreen->_movement->setDynamicPhaseIndex(26); + + Scene *oldsc = g_fp->_currentScene; + StaticANIObject *ani; + + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Lies)) { + ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + if (ani) { + g_fp->_currentScene = sc; + + ani->changeStatics2(ST_HDL_LAID); + } + } else { + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) { + ani = sc->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + + g_fp->_currentScene = sc; + + if (ani) + ani->changeStatics2(ST_HDL_PLUGGED); + + g_vars->scene32_button->changeStatics2(ST_BTN32_ON); + } + } + + g_fp->_currentScene = oldsc; + + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) { + MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK32_START), 0, 0); + + mq->sendNextCommand(); + } + + g_fp->lift_setButton(sO_Level9, ST_LBN_9N); + g_fp->lift_sub5(sc, QU_SC32_ENTERLIFT, QU_SC32_EXITLIFT); + + g_fp->initArcadeKeys("SC_32"); +} + +void scene32_setupMusic() { + if (g_fp->lift_checkButton(sO_Level6)) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_32"), "MUSIC2", 1); +} + +int scene32_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC32_LADDER && g_fp->_cursorId == PIC_CSR_ITN) + g_fp->_cursorId = g_vars->scene32_dudeOnLadder ? PIC_CSR_GOD : PIC_CSR_GOU; // TODO FIXME doublecheck + + return g_fp->_cursorId; +} + +void sceneHandler32_tryCube() { + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33)) + chainQueue(QU_KBK32_GO, 0); +} + +void sceneHandler32_startCactus() { + g_vars->scene32_cactusCounter = 48; + g_vars->scene32_cactusIsGrowing = false; +} + +void sceneHandler32_spin(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (!mq || mq->getCount() == 0) + return; + + ExCommand *ex = mq->getExCommandByIndex(0); + ExCommand *newex; + + if ((g_vars->scene32_cactus->_movement && g_vars->scene32_cactus->_movement->_id == MV_CTS_DEFAULT) + || g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_GROWUP) { + for (int i = 0; i < 12; i++) { + newex = ex->createClone(); + newex->_excFlags |= 2; + mq->insertExCommandAt(1, newex); + } + + g_vars->scene32_cactus->changeStatics2(ST_CTS_GROWUP); + + chainQueue(QU_CTS_BACK, 1); + + g_vars->scene32_cactusIsGrowing = false; + + return; + } + + if (g_vars->scene32_cactus->_statics->_staticsId == ST_CTS_EMPTY && g_vars->scene32_cactusCounter < 0) { + for (int i = 0; i < 2; i++) { + newex = ex->createClone(); + newex->_excFlags |= 2; + mq->insertExCommandAt(1, newex); + } + + chainQueue(QU_KDK_DRIZZLE, 0); + } +} + +void sceneHandler32_startFlagLeft() { + g_vars->scene32_flag->changeStatics2(ST_FLG_NORM); + g_vars->scene32_flag->startAnim(MV_FLG_STARTL, 0, -1); + + g_vars->scene32_flagIsWaving = true; +} + +void sceneHandler32_startFlagRight() { + g_vars->scene32_flag->changeStatics2(ST_FLG_NORM); + g_vars->scene32_flag->startAnim(MV_FLG_STARTR, 0, -1); + + g_vars->scene32_flagIsWaving = true; +} + +void sceneHandler32_trySit(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (!mq || mq->getCount() == 0) + return; + + ExCommand *ex = mq->getExCommandByIndex(0); + + if (g_vars->scene32_cactusIsGrowing || g_vars->scene32_cactus->_movement + || g_vars->scene32_cactus->_statics->_staticsId != ST_CTS_EMPTY + || (g_vars->scene32_cactusCounter >= 0 && g_vars->scene32_cactusCounter <= 20)) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } else { + ex->_parentId = ANI_MAN; + ex->_messageKind = 1; + ex->_messageNum = MV_MAN32_SITDOWN; + ex->_keyCode = g_fp->_aniMan->_okeyCode; + + g_vars->scene32_dudeIsSitting = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + } +} + +void sceneHandler32_buttonPush() { + if (g_fp->getObjectState(sO_ClockHandle) == g_fp->getObjectEnumState(sO_ClockHandle, sO_In_32_Sticks)) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObject1ById(ANI_INV_HANDLE, -1); + if (ani) + ani->changeStatics2(ST_HDL_PLUGGED); + + chainQueue(QU_SC32_FALLHANDLE, 1); + + g_vars->scene32_button->changeStatics2(ST_BTN32_OFF); + } +} + +void sceneHandler32_installHandle() { + chainQueue(QU_SC32_SHOWHANDLE, 0); + + g_vars->scene32_button->changeStatics2(ST_BTN32_ON); +} + +void sceneHandler32_animateCactus() { + if (g_fp->_aniMan->_statics->_staticsId != ST_MAN32_SIT) + chainQueue(QU_CTS_GROW, 1); + else + chainQueue(QU_CTS_GROWMAN, 1); + + g_vars->scene32_cactusCounter = -1; + g_vars->scene32_cactusIsGrowing = true; +} + +void sceneHandler32_ladderLogic(ExCommand *cmd) { + MessageQueue *mq = new MessageQueue(g_fp->_currentScene->getMessageQueueById(QU_SC32_FROMLADDER), 0, 0); + + if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) != PIC_SC32_LADDER) + mq->addExCommandToEnd(cmd->createClone()); + + mq->setFlags(mq->getFlags() | 1); + + g_fp->_aniMan->changeStatics2(ST_MAN_STANDLADDER); + if (!mq->chain(g_fp->_aniMan)) + delete mq; + + g_vars->scene32_dudeOnLadder = false; + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); +} + +void sceneHandler32_potLogic(ExCommand *cmd) { + if (g_vars->scene32_cactusCounter < 0 || g_vars->scene32_cactusCounter > 20) { + MessageQueue *mq = new MessageQueue(g_fp->_globalMessageQueueList->compact()); + + ExCommand *ex = new ExCommand(ANI_MAN, 1, MV_MAN32_STANDUP, 0, 0, 0, 1, 0, 0, 0); + + ex->_excFlags |= 2; + + mq->addExCommandToEnd(ex); + + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (!ani || ani->_id != ANI_KADKA) + mq->addExCommandToEnd(cmd->createClone()); + + mq->setFlags(mq->getFlags() | 1); + mq->chain(0); + + getCurrSceneSc2MotionController()->setEnabled(); + getGameLoaderInteractionController()->enableFlag24(); + + g_vars->scene32_dudeIsSitting = false; + } +} + +int sceneHandler32(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_LIFT_CLOSEDOOR: + g_fp->lift_closedoorSeq(); + break; + + case MSG_LIFT_EXITLIFT: + g_fp->lift_exitSeq(cmd); + break; + + case MSG_LIFT_STARTEXITQUEUE: + g_fp->lift_startExitQueue(); + break; + + case MSG_SC32_TRUBATOBACK: + g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 20; + break; + + case MSG_SC32_TRUBATOFRONT: + g_fp->_currentScene->getPictureObjectById(PIC_SC32_RTRUBA, 0)->_priority = 0; + break; + + case MSG_LIFT_CLICKBUTTON: + g_fp->lift_animation3(); + break; + + case MSG_SC33_TRYKUBIK: + sceneHandler32_tryCube(); + break; + + case MSG_SC32_STARTCACTUS: + sceneHandler32_startCactus(); + break; + + case MSG_SC32_STOPFLAG: + g_vars->scene32_flagIsWaving = false; + g_vars->scene32_flagNeedsStopping = true; + break; + + case MSG_SC32_SPIN: + sceneHandler32_spin(cmd); + break; + + case MSG_SC32_STARTFLAGLEFT : + sceneHandler32_startFlagLeft(); + break; + + case MSG_SC32_STARTFLAGRIGHT: + sceneHandler32_startFlagRight(); + break; + + case MSG_SC32_TRYSIT: + sceneHandler32_trySit(cmd); + break; + + case MSG_LIFT_GO: + g_fp->lift_goAnimation(); + break; + + case MSG_SC32_ONLADDER: + g_vars->scene32_dudeOnLadder = true; + + getCurrSceneSc2MotionController()->clearEnabled(); + getGameLoaderInteractionController()->disableFlag24(); + break; + + case MSG_SC6_BTNPUSH: + sceneHandler32_buttonPush(); + break; + + case 64: + g_fp->lift_sub05(cmd); + break; + + case MSG_SC6_INSTHANDLE: + sceneHandler32_installHandle(); + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (!g_vars->scene32_flag->_movement) { + if (g_vars->scene32_flagIsWaving) { + if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT) + g_vars->scene32_flag->startAnim(MV_FLG_CYCLER, 0, -1); + else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT) + g_vars->scene32_flag->startAnim(MV_FLG_CYCLEL, 0, -1); + } + + if (g_vars->scene32_flagNeedsStopping && !g_vars->scene32_flagIsWaving) { + if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_RIGHT) + g_vars->scene32_flag->startAnim(MV_FLG_STOPR, 0, -1); + else if (g_vars->scene32_flag->_statics->_staticsId == ST_FLG_LEFT) + g_vars->scene32_flag->startAnim(MV_FLG_STOPL, 0, -1); + + g_vars->scene32_flagNeedsStopping = false; + } + } + + if (g_vars->scene32_cactusCounter) { + if (g_vars->scene32_cactusCounter > 0) + --g_vars->scene32_cactusCounter; + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + } else { + sceneHandler32_animateCactus(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + } + break; + + case 29: + if (g_vars->scene32_dudeOnLadder) { + sceneHandler32_ladderLogic(cmd); + cmd->_messageKind = 0; + break; + } + + if (!g_vars->scene32_dudeIsSitting || g_fp->_aniMan->_movement) { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + + if (ani && ani->_id == ANI_LIFTBUTTON) { + g_fp->lift_sub1(ani); + + cmd->_messageKind = 0; + break; + } + + if (g_fp->_cursorId == PIC_CSR_GOFAR_R || g_fp->_cursorId == PIC_CSR_GOFAR_L) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) + || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + break; + } + + if (!g_vars->scene32_cactusIsGrowing) + sceneHandler32_potLogic(cmd); + + cmd->_messageKind = 0; + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene33.cpp b/engines/fullpipe/scenes/scene33.cpp new file mode 100644 index 0000000000..209198c0f3 --- /dev/null +++ b/engines/fullpipe/scenes/scene33.cpp @@ -0,0 +1,314 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +const int ventsInit[9] = { 0, 0, 1, 0, 0, 1, 0, 0, 1 }; + +void scene33_initScene(Scene *sc) { + g_vars->scene33_mug = sc->getStaticANIObject1ById(ANI_MUG_33, -1); + g_vars->scene33_jettie = sc->getStaticANIObject1ById(ANI_JETTIE_FLOW, -1); + g_vars->scene33_cube = 0; + g_vars->scene33_cubeX = -1; + g_vars->scene33_handleIsDown = false; + + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_33)) { + MessageQueue *mq = new MessageQueue(sc->getMessageQueueById(QU_KBK33_START), 0, 0); + + mq->sendNextCommand(); + } + + + for (int i = 0; i < 9; i++) { + g_vars->scene33_ventsX[i] = sc->getStaticANIObject1ById(ANI_VENT_33, i)->_ox; + + g_vars->scene33_ventsState[i] = ventsInit[i]; + } + + g_fp->initArcadeKeys("SC_33"); +} + +void scene33_setupMusic() { + if (g_fp->lift_checkButton(sO_Level6)) + g_fp->playTrack(g_fp->getGameLoaderGameVar()->getSubVarByName("SC_33"), "MUSIC2", 1); +} + +int scene33_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_objectIdAtCursor == PIC_SC33_ZONES && g_fp->_cursorId == PIC_CSR_DEFAULT) + g_fp->_cursorId = PIC_CSR_ITN; + + return g_fp->_cursorId; +} + +void sceneHandler33_processJettie(ExCommand *cmd) { + MessageQueue *mq = g_fp->_globalMessageQueueList->getMessageQueueById(cmd->_parId); + + if (mq && g_vars->scene33_jettie->_movement) { + ExCommand *ex = mq->getExCommandByIndex(0); + + if (ex) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } + + ex = mq->getExCommandByIndex(1); + + if (ex) { + ex->_messageKind = 0; + ex->_excFlags |= 1; + } + } +} + +void sceneHandler33_switchVent(StaticANIObject *ani) { + int mv = 0; + + if (ani->_statics->_staticsId == ST_VNT33_DOWN) + mv = MV_VNT33_TURNR; + + if (ani->_statics->_staticsId == ST_VNT33_RIGHT) + mv = MV_VNT33_TURND; + + if (mv) + ani->startAnim(mv, 0, -1); + + g_vars->scene33_ventsState[ani->_okeyCode] = !g_vars->scene33_ventsState[ani->_okeyCode]; +} + +void sceneHandler33_processVents() { + for (int i = 0; i < 9; i++) + if (((g_vars->scene33_cubeX < g_vars->scene33_ventsX[i]) != (g_vars->scene33_cube->_ox < g_vars->scene33_ventsX[i])) + && g_vars->scene33_ventsState[i] != ventsInit[i]) + sceneHandler33_switchVent(g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, i)); + + g_vars->scene33_cubeX = g_vars->scene33_cube->_ox; +} + +void sceneHandler33_tryCube() { + if (g_fp->getObjectState(sO_Cube) == g_fp->getObjectEnumState(sO_Cube, sO_In_32)) + chainQueue(QU_KBK33_GO, 0); +} + +void sceneHandler33_pour() { + bool solved = true; + + for (int i = 0; i < 9; i++) + if (g_vars->scene33_ventsState[i] != ventsInit[i]) + solved = false; + + if (solved) { + if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_EMPTY) { + g_vars->scene33_jettie->startAnim(MV_JTI33_POUR, 0, -1); + + g_vars->scene33_handleIsDown = false; + + return; + } + + if ((g_vars->scene33_mug->_flags & 4) && g_vars->scene33_mug->_statics->_staticsId == ST_MUG33_FULL) { + g_vars->scene33_jettie->startAnim(MV_JTI33_POURFULL, 0, -1); + + g_vars->scene33_handleIsDown = false; + + return; + } + + g_vars->scene33_jettie->startAnim(MV_JTI33_FLOW, 0, -1); + } + + g_vars->scene33_handleIsDown = false; +} + +void sceneHandler33_handleDown() { + if (!g_vars->scene33_handleIsDown && !g_vars->scene33_jettie->_movement && !g_vars->scene33_jettie->getMessageQueue() ) { + chainQueue(QU_SC33_STARTWATER, 0); + + g_vars->scene33_handleIsDown = true; + } +} + +void sceneHandler33_zoneClickProcess(StaticANIObject *ani) { + if (!ani->_movement) { + sceneHandler33_switchVent(ani); + + StaticANIObject *vent1 = 0; + StaticANIObject *vent2 = 0; + + switch (ani->_okeyCode) { + case 0: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3); + break; + + case 1: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 3); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4); + break; + + case 2: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 4); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0); + break; + + case 3: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 0); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1); + break; + + case 4: + vent1 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 1); + vent2 = g_fp->_currentScene->getStaticANIObject1ById(ANI_VENT_33, 2); + break; + + default: + return; + } + + if (vent1) { + sceneHandler33_switchVent(vent1); + sceneHandler33_switchVent(vent2); + } + } +} + +void sceneHandler33_clickZones(ExCommand *cmd) { + StaticANIObject *closest = 0; + double mindist = 1e10; + + for (uint i = 0; i < g_fp->_currentScene->_staticANIObjectList1.size(); i++) { + StaticANIObject *ani = (StaticANIObject *)g_fp->_currentScene->_staticANIObjectList1[i]; + + if (ani->_id == ANI_VENT_33) { + int dx = ani->_ox - cmd->_sceneClickX; + int dy = ani->_oy - cmd->_sceneClickY; + double dist = sqrt((double)(dx * dx + dy * dy)); + + if (dist < mindist) { + mindist = dist; + closest = ani; + } + } + } + + if (closest) + sceneHandler33_zoneClickProcess(closest); +} + +int sceneHandler33(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case MSG_SC32_TRUBATOFRONT: + g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 0; + break; + + case MSG_SC32_TRUBATOBACK: + g_fp->_currentScene->getPictureObjectById(PIC_SC33_LTRUBA, 0)->_priority = 20; + break; + + case MSG_SC33_TESTMUG: + sceneHandler33_processJettie(cmd); + break; + + case MSG_SC33_UPDATEKUBIK: + g_vars->scene33_cube = g_fp->_currentScene->getStaticANIObject1ById(ANI_KUBIK, -1); + + if (g_vars->scene33_cube) + g_vars->scene33_cubeX = g_vars->scene33_cube->_ox; + + break; + + case MSG_SC33_TRYKUBIK: + sceneHandler33_tryCube(); + break; + + case MSG_SC33_POUR: + sceneHandler33_pour(); + break; + + case MSG_SC33_HANDLEDOWN: + sceneHandler33_handleDown(); + break; + + case 29: + { + StaticANIObject *ani = g_fp->_currentScene->getStaticANIObjectAtPos(g_fp->_sceneRect.left + cmd->_x, g_fp->_sceneRect.top + cmd->_y); + + if (!ani || !canInteractAny(g_fp->_aniMan, ani, cmd->_keyCode)) { + int picId = g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY); + PictureObject *pic = g_fp->_currentScene->getPictureObjectById(picId, 0); + + if (pic && pic->_id == PIC_SC33_ZONES) { + sceneHandler33_clickZones(cmd); + break; + } + + if (!pic || !canInteractAny(g_fp->_aniMan, pic, cmd->_keyCode)) { + if ((g_fp->_sceneRect.right - cmd->_sceneClickX < 47 && g_fp->_sceneRect.right < g_fp->_sceneWidth - 1) || (cmd->_sceneClickX - g_fp->_sceneRect.left < 47 && g_fp->_sceneRect.left > 0)) + g_fp->processArcade(cmd); + } + } + break; + } + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + if (g_vars->scene33_cube) + sceneHandler33_processVents(); + + g_fp->_behaviorManager->updateBehaviors(); + + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/scenes/scene36.cpp b/engines/fullpipe/scenes/scene36.cpp new file mode 100644 index 0000000000..7d237fd395 --- /dev/null +++ b/engines/fullpipe/scenes/scene36.cpp @@ -0,0 +1,94 @@ +/* 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. + * + */ + +#include "fullpipe/fullpipe.h" + +#include "fullpipe/objectnames.h" +#include "fullpipe/constants.h" + +#include "fullpipe/gameloader.h" +#include "fullpipe/motion.h" +#include "fullpipe/scenes.h" +#include "fullpipe/statics.h" + +#include "fullpipe/interaction.h" +#include "fullpipe/behavior.h" + + +namespace Fullpipe { + +void scene36_initScene(Scene *sc) { + g_vars->scene36_rotohrust = sc->getStaticANIObject1ById(ANI_ROTOHRUST, -1); + g_vars->scene36_scissors = sc->getStaticANIObject1ById(ANI_SCISSORS_36, -1); +} + +int scene36_updateCursor() { + g_fp->updateCursorCommon(); + + if (g_fp->_cursorId != PIC_CSR_ITN || g_fp->_objectIdAtCursor != ANI_ROTOHRUST) { + if (g_fp->_objectIdAtCursor == PIC_SC36_MASK && g_fp->_cursorId == PIC_CSR_DEFAULT && (g_vars->scene36_scissors->_flags & 4)) + g_fp->_cursorId = PIC_CSR_ITN; + } else if (g_vars->scene36_rotohrust->_statics->_staticsId == ST_RHT_OPEN) + g_fp->_cursorId = PIC_CSR_GOL; + + return g_fp->_cursorId; +} + +int sceneHandler36(ExCommand *cmd) { + if (cmd->_messageKind != 17) + return 0; + + switch (cmd->_messageNum) { + case 29: + if (g_fp->_currentScene->getPictureObjectIdAtPos(cmd->_sceneClickX, cmd->_sceneClickY) == PIC_SC36_MASK) + if (g_vars->scene36_scissors) + if (g_vars->scene36_scissors->_flags & 4) + if (g_fp->_aniMan->isIdle()) + if (!(g_fp->_aniMan->_flags & 0x100) && g_fp->_msgObjectId2 != g_vars->scene36_scissors->_id ) { + handleObjectInteraction(g_fp->_aniMan, g_vars->scene36_scissors, cmd->_keyCode); + + cmd->_messageKind = 0; + } + + break; + + case 33: + if (g_fp->_aniMan2) { + int x = g_fp->_aniMan2->_ox; + + if (x < g_fp->_sceneRect.left + 200) + g_fp->_currentScene->_x = x - 300 - g_fp->_sceneRect.left; + + if (x > g_fp->_sceneRect.right - 200) + g_fp->_currentScene->_x = x + 300 - g_fp->_sceneRect.right; + } + + g_fp->_behaviorManager->updateBehaviors(); + g_fp->startSceneTrack(); + + break; + } + + return 0; +} + +} // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp index a08152e94c..cf66cb40a1 100644 --- a/engines/fullpipe/sound.cpp +++ b/engines/fullpipe/sound.cpp @@ -23,8 +23,13 @@ #include "fullpipe/fullpipe.h" #include "fullpipe/objects.h" +#include "fullpipe/scene.h" #include "fullpipe/sound.h" #include "fullpipe/ngiarchive.h" +#include "common/memstream.h" +#include "audio/audiostream.h" +#include "audio/decoders/vorbis.h" +#include "audio/decoders/wave.h" namespace Fullpipe { @@ -77,6 +82,9 @@ Sound::Sound() { _description = 0; } +Sound::~Sound() { + warning("STUB: Sound::~Sound()"); +} bool Sound::load(MfcArchive &file, NGIArchive *archive) { debug(5, "Sound::load()"); @@ -113,14 +121,36 @@ void Sound::setPanAndVolumeByStaticAni() { void FullpipeEngine::setSceneMusicParameters(GameVar *var) { warning("STUB: FullpipeEngine::setSceneMusicParameters()"); + // TODO: Finish this (MINDELAY, MAXDELAY, LOCAL, SEQUENCE, STARTDELAY etc) + stopAllSoundStreams(); + _musicGameVar = var; } void FullpipeEngine::startSceneTrack() { - debug(3, "STUB: FullpipeEngine::startSceneTrack()"); + // TODO: Finish this +#ifdef USE_VORBIS + if (g_fp->_mixer->isSoundHandleActive(_sceneTrackHandle)) + return; + + GameVar *musicTrackVar = _musicGameVar->getSubVarByName("MUSIC")->getSubVarByName("TRACKS")->_subVars; + if (!musicTrackVar) + return; + + char *trackName = musicTrackVar->_varName; + Common::File *track = new Common::File(); + if (!track->open(trackName)) { + warning("Could not open %s", trackName); + delete track; + return; + } + Audio::RewindableAudioStream *ogg = Audio::makeVorbisStream(track, DisposeAfterUse::YES); + g_fp->_mixer->playStream(Audio::Mixer::kMusicSoundType, &_sceneTrackHandle, ogg); +#endif } void FullpipeEngine::stopAllSounds() { - warning("STUB: FullpipeEngine::stopAllSounds()"); + // TODO: Differences from stopAllSoundStreams() + g_fp->_mixer->stopAll(); } void FullpipeEngine::toggleMute() { @@ -128,7 +158,18 @@ void FullpipeEngine::toggleMute() { } void FullpipeEngine::playSound(int id, int flag) { - warning("STUB: FullpipeEngine::playSound(%d, %d)", id, flag); + SoundList *soundList = g_fp->_currentScene->_soundList; + Sound *sound = soundList->getSoundById(id); + if (!sound) { + warning("playSound: Can't find sound with ID %d", id); + return; + } + byte *soundData = sound->loadData(); + Common::MemoryReadStream *dataStream = new Common::MemoryReadStream(soundData, sound->getDataSize()); + Audio::RewindableAudioStream *wav = Audio::makeWAVStream(dataStream, DisposeAfterUse::YES); + Audio::AudioStream *audioStream = new Audio::LoopingAudioStream(wav, (flag == 1) ? 0 : 1); + Audio::SoundHandle handle = sound->getHandle(); + g_fp->_mixer->playStream(Audio::Mixer::kSFXSoundType, &handle, audioStream); } void FullpipeEngine::playTrack(GameVar *sceneVar, const char *name, bool delayed) { @@ -144,11 +185,18 @@ void FullpipeEngine::stopSoundStream2() { } void FullpipeEngine::stopAllSoundStreams() { - warning("STUB: FullpipeEngine::stopAllSoundStreams()"); + // TODO: Differences from stopAllSounds() + g_fp->_mixer->stopAll(); } void FullpipeEngine::stopAllSoundInstances(int id) { - warning("STUB: FullpipeEngine::stopAllSoundInstances(%d)", id); + SoundList *soundList = g_fp->_currentScene->_soundList; + for (int i = 0; i < soundList->getCount(); i++) { + Sound *sound = soundList->getSoundByIndex(i); + if (sound->getId() == id) { + g_fp->_mixer->stopHandle(sound->getHandle()); + } + } } } // End of namespace Fullpipe diff --git a/engines/fullpipe/sound.h b/engines/fullpipe/sound.h index e2b271fe2c..ca64832c04 100644 --- a/engines/fullpipe/sound.h +++ b/engines/fullpipe/sound.h @@ -32,12 +32,17 @@ class Sound : public MemoryObject { int _directSoundBuffer; int _directSoundBuffers[7]; byte *_soundData; + Audio::SoundHandle _handle; - public: +public: Sound(); + virtual ~Sound(); + virtual bool load(MfcArchive &file, NGIArchive *archive); virtual bool load(MfcArchive &file) { assert(0); return false; } // Disable base class void updateVolume(); + int getId() const { return _id; } + Audio::SoundHandle getHandle() const { return _handle; } void setPanAndVolumeByStaticAni(); }; @@ -55,6 +60,13 @@ class SoundList : public CObject { int getCount() { return _soundItemsCount; } Sound *getSoundByIndex(int idx) { return _soundItems[idx]; } + Sound *getSoundById(int id) { + for (int i = 0; i < _soundItemsCount; i++) { + if (_soundItems[i]->getId() == id) + return _soundItems[i]; + } + return NULL; + } }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/stateloader.cpp b/engines/fullpipe/stateloader.cpp index 9c54947b35..fdf38ada1f 100644 --- a/engines/fullpipe/stateloader.cpp +++ b/engines/fullpipe/stateloader.cpp @@ -31,6 +31,7 @@ #include "fullpipe/scene.h" #include "fullpipe/statics.h" #include "fullpipe/interaction.h" +#include "fullpipe/gameloader.h" #include "fullpipe/constants.h" @@ -146,6 +147,8 @@ bool GameProject::load(MfcArchive &file) { GameProject::~GameProject() { free(_headerFilename); + + delete _sceneTagList; } GameVar::GameVar() { @@ -159,6 +162,10 @@ GameVar::GameVar() { _varName = 0; } +GameVar::~GameVar() { + warning("STUB: GameVar::~GameVar()"); +} + bool GameVar::load(MfcArchive &file) { _varName = file.readPascalString(); _varType = file.readUint32LE(); @@ -321,4 +328,8 @@ bool PicAniInfo::load(MfcArchive &file) { return true; } +void FullpipeEngine::updateMap(PreloadItem *pre) { + warning("STUB: FullpipeEngine::updateMap()"); +} + } // End of namespace Fullpipe diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index 2af9cff743..87b308007b 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -127,6 +127,10 @@ StaticANIObject::StaticANIObject() { _objtype = kObjTypeStaticANIObject; } +StaticANIObject::~StaticANIObject() { + warning("STUB: StaticANIObject::~StaticANIObject()"); +} + StaticANIObject::StaticANIObject(StaticANIObject *src) : GameObject(src) { _shadowsOn = src->_shadowsOn; _field_30 = src->_field_30; @@ -281,6 +285,29 @@ void StaticANIObject::queueMessageQueue(MessageQueue *mq) { } } +void StaticANIObject::restartMessageQueue(MessageQueue *mq) { + ExCommand *ex = mq->getExCommandByIndex(0); + if (ex) { + while (ex->_messageKind != 1 || ex->_parentId != _id) { + ex->_parId = 0; + ex->_excFlags |= 2; + ex->handleMessage(); + + mq->deleteExCommandByIndex(0, 0); + + ex = mq->getExCommandByIndex(0); + + if (!ex) + return; + } + + if (ex) { + startAnim(ex->_messageNum, mq->_id, -1); + mq->deleteExCommandByIndex(0, 1); + } + } +} + MessageQueue *StaticANIObject::getMessageQueue() { if (this->_messageQueueId <= 0) return 0; @@ -302,6 +329,10 @@ bool StaticANIObject::trySetMessageQueue(int msgNum, int qId) { return true; } +void StaticANIObject::startMQIfIdle(int qId, int flag) { + warning("STUB: StaticANIObject::startMQIfIdle()"); +} + bool StaticANIObject::isIdle() { if (_messageQueueId) { MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId); @@ -632,6 +663,10 @@ void StaticANIObject::initMovements() { ((Movement *)_movements[i])->removeFirstPhase(); } +void StaticANIObject::preloadMovements(MovTable *mt) { + warning("STUB: StaticANIObject::preloadMovements()"); +} + Common::Point *StaticANIObject::getCurrDimensions(Common::Point &p) { Picture *pic; @@ -708,7 +743,7 @@ void StaticANIObject::update(int counterdiff) { ex = dyn->getExCommand(); if (ex && ex->_messageKind != 35) { - newex = new ExCommand(ex); + newex = ex->createClone(); newex->_excFlags |= 2; if (newex->_messageKind == 17) { newex->_parentId = _id; @@ -741,7 +776,7 @@ void StaticANIObject::update(int counterdiff) { ex = dyn->getExCommand(); if (ex) { if (ex->_messageKind == 35) { - newex = new ExCommand(ex); + newex = ex->createClone(); newex->_excFlags |= 2; newex->sendMessage(); } @@ -1048,7 +1083,7 @@ bool StaticANIObject::startAnim(int movementId, int messageQueueId, int dynPhase ExCommand *ex = _movement->_currDynamicPhase->getExCommand(); if (ex) { if (ex->_messageKind == 35) { - ExCommand *newex = new ExCommand(ex); + ExCommand *newex = ex->createClone(); newex->_excFlags |= 2; newex->sendMessage(); } @@ -1183,6 +1218,10 @@ Movement::Movement() { _somePoint.y = 0; } +Movement::~Movement() { + warning("STUB: Movement::~Movement()"); +} + Movement::Movement(Movement *src, StaticANIObject *ani) { _lastFrameSpecialFlag = 0; _flipFlag = src->_flipFlag; @@ -1528,6 +1567,25 @@ int Movement::calcDuration() { return res; } +int Movement::countPhasesWithFlag(int maxidx, int flag) { + int res = 0; + int sz; + + if (_currMovement) + sz = _currMovement->_dynamicPhases.size(); + else + sz = _dynamicPhases.size(); + + if (maxidx < 0) + maxidx = sz; + + for (int i = 0; i < maxidx && i < sz; i++) + if (getDynamicPhaseByIndex(i)->_dynFlags & flag) + res++; + + return res; +} + void Movement::setDynamicPhaseIndex(int index) { debug(7, "Movement::setDynamicPhaseIndex(%d)", index); while (_currDynamicPhaseIndex < index) @@ -1852,7 +1910,7 @@ DynamicPhase::DynamicPhase(DynamicPhase *src, bool reverse) { _field_7C = src->_field_7C; if (src->getExCommand()) - _exCommand = new ExCommand(src->getExCommand()); + _exCommand = src->getExCommand()->createClone(); else _exCommand = 0; @@ -1917,6 +1975,8 @@ bool StaticPhase::load(MfcArchive &file) { assert (g_fp->_gameProjectVersion >= 12); + warning("StaticPhase::load(): Code continues here"); + return true; } diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index c8537dfa97..3f1f14c7bf 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -132,6 +132,8 @@ class Movement : public GameObject { public: Movement(); + virtual ~Movement(); + Movement(Movement *src, StaticANIObject *ani); Movement(Movement *src, int *flag1, int flag2, StaticANIObject *ani); @@ -153,6 +155,7 @@ class Movement : public GameObject { DynamicPhase *getDynamicPhaseByIndex(int idx); int calcDuration(); + int countPhasesWithFlag(int maxidx, int flag); void removeFirstPhase(); bool gotoNextFrame(void (*_callback1)(int, Common::Point *point, int, int), void (*callback2)(int *)); @@ -186,11 +189,12 @@ class StaticANIObject : public GameObject { int _counter; int _someDynamicPhaseIndex; - public: +public: int16 _sceneId; - public: +public: StaticANIObject(); + virtual ~StaticANIObject(); StaticANIObject(StaticANIObject *src); virtual bool load(MfcArchive &file); @@ -212,11 +216,14 @@ class StaticANIObject : public GameObject { void deleteFromGlobalMessageQueue(); void queueMessageQueue(MessageQueue *msg); + void restartMessageQueue(MessageQueue *msg); MessageQueue *getMessageQueue(); bool trySetMessageQueue(int msgNum, int qId); + void startMQIfIdle(int qId, int flag); void initMovements(); void loadMovementsPixelData(); + void preloadMovements(MovTable *mt); void setSomeDynamicPhaseIndex(int val) { _someDynamicPhaseIndex = val; } void adjustSomeXY(); @@ -250,6 +257,9 @@ class StaticANIObject : public GameObject { struct MovTable { int count; int16 *movs; + + MovTable() { count = 0; movs = 0; } + ~MovTable() { free(movs); } }; } // End of namespace Fullpipe diff --git a/engines/fullpipe/utils.h b/engines/fullpipe/utils.h index 64f56ced0a..5714fd3b4c 100644 --- a/engines/fullpipe/utils.h +++ b/engines/fullpipe/utils.h @@ -66,6 +66,8 @@ class MfcArchive : public Common::SeekableReadStream { enum ObjType { kObjTypeDefault, + kObjTypeExCommand, + kObjTypeExCommand2, kObjTypeMovGraph, kObjTypeMovGraphLink, kObjTypeMovGraphNode, @@ -115,6 +117,7 @@ class MemoryObject : CObject { void load() { loadFile(_memfilename); } byte *getData(); byte *loadData(); + int getDataSize() const { return _dataSize; } bool testFlags(); diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index b7c6a9b5a9..615eace374 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -60,10 +60,6 @@ */ namespace Hopkins { -#define DEBUG_BASIC 1 -#define DEBUG_INTERMEDIATE 2 -#define DEBUG_DETAILED 3 - #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 480 diff --git a/engines/mortevielle/actions.cpp b/engines/mortevielle/actions.cpp index b68dd48b0f..6f57019cf2 100644 --- a/engines/mortevielle/actions.cpp +++ b/engines/mortevielle/actions.cpp @@ -40,7 +40,7 @@ namespace Mortevielle { * @remarks Originally called 'taller' */ void MortevielleEngine::fctMove() { - int oldMenu = (_menu._moveMenu[6]._menuId << 8) | _menu._moveMenu[6]._actionId; + int oldMenu = (_menu->_moveMenu[6]._menuId << 8) | _menu->_moveMenu[6]._actionId; if ((_coreVar._currPlace == ROOM26) && (_currAction == oldMenu)) { _coreVar._currPlace = LANDING; _caff = _coreVar._currPlace; @@ -65,10 +65,10 @@ void MortevielleEngine::fctMove() { if (_num == 1) { _coreVar._currPlace = OWN_ROOM; - _menu.setDestinationText(OWN_ROOM); + _menu->setDestinationText(OWN_ROOM); } else if (_num == 7) { _coreVar._currPlace = ATTIC; - _menu.setDestinationText(ATTIC); + _menu->setDestinationText(ATTIC); } else if (_num != 6) _coreVar._currPlace = ROOM26; @@ -85,10 +85,10 @@ void MortevielleEngine::fctMove() { } exitRoom(); int menuChoice = 1; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; while (oldMenu != _currAction) { ++menuChoice; - oldMenu = (_menu._moveMenu[menuChoice]._menuId << 8) | _menu._moveMenu[menuChoice]._actionId; + oldMenu = (_menu->_moveMenu[menuChoice]._menuId << 8) | _menu->_moveMenu[menuChoice]._actionId; } switch (_coreVar._currPlace) { @@ -97,14 +97,14 @@ void MortevielleEngine::fctMove() { gotoManorFront(); else if (menuChoice == 2) checkManorDistance(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case INSIDE_WELL: if (menuChoice == 1) floodedInWell(); else if (menuChoice == 2) gotoManorBack(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); return; case BUREAU: if (menuChoice == 1) @@ -193,7 +193,7 @@ void MortevielleEngine::fctMove() { if ((menuChoice < 5) || (menuChoice == 13) || (menuChoice == 14)) prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } /** @@ -224,7 +224,7 @@ void MortevielleEngine::fctTake() { _coreVar._secretPassageObjectId = 0; if (_coreVar._currPlace == WELL) _coreVar._wellObjectId = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); _obpart = false; prepareDisplayText(); } else { @@ -325,7 +325,7 @@ void MortevielleEngine::fctInventoryTake() { int oldMenu = 0; do { ++inventIndex; - oldMenu = (_menu._inventoryMenu[inventIndex]._menuId << 8) | _menu._inventoryMenu[inventIndex]._actionId; + oldMenu = (_menu->_inventoryMenu[inventIndex]._menuId << 8) | _menu->_inventoryMenu[inventIndex]._actionId; } while (oldMenu != _currAction); int cz = 0; int cy = 0; @@ -336,7 +336,7 @@ void MortevielleEngine::fctInventoryTake() { } while (cz != inventIndex); cz = _coreVar._inventory[cy]; _coreVar._inventory[cy] = 0; - _menu.setInventoryText(); + _menu->setInventoryText(); putInHand(cz); _crep = 998; clearDescriptionBar(); @@ -536,7 +536,7 @@ void MortevielleEngine::fctSearch() { if (_curSearchObjId != 0) { _searchCount = 0; _heroSearching = true; - _menu.setSearchMenu(); + _menu->setSearchMenu(); prepareNextObject(); } else _crep = 997; @@ -607,7 +607,7 @@ void MortevielleEngine::fctOpen() { if (_caff == ROOM26) { if (_roomDoorId != OWN_ROOM) { - _currAction = _menu._opcodeEnter; + _currAction = _menu->_opcodeEnter; _syn = true; } else _crep = 997; @@ -663,11 +663,11 @@ void MortevielleEngine::fctOpen() { || (_coreVar._currPlace == PURPLE_ROOM) || (_coreVar._currPlace == BLUE_ROOM)) { if (getRandomNumber(1, 4) == 3) - _soundManager.startSpeech(7, 9, 1); + _soundManager->startSpeech(7, 9, 1); } _openObjects[i] = _num; displayAnimFrame(1, _num); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); } int tmpPlace = _coreVar._currPlace; if (_coreVar._currPlace == CRYPT) @@ -731,21 +731,21 @@ void MortevielleEngine::fctPlace() { displayAnimFrame(1, 1); handleDescriptionText(2, 165); displayEmptyHand(); - _soundManager.startSpeech(6, -9, 1); + _soundManager->startSpeech(6, -9, 1); // Do you want to enter the hidden passage? - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { Common::String alertTxt = getString(582); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); - bool enterPassageFl = _dialogManager.showKnowledgeCheck(); - _mouse.hideMouse(); + bool enterPassageFl = _dialogManager->showKnowledgeCheck(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); clearDescriptionBar(); clearVerbBar(); - _mouse.showMouse(); + _mouse->showMouse(); prepareRoom(); drawClock(); if (_currBitIndex != 0) @@ -753,18 +753,18 @@ void MortevielleEngine::fctPlace() { else displayAloneText(); - _menu.displayMenu(); + _menu->displayMenu(); if (enterPassageFl) { _coreVar._currPlace = SECRET_PASSAGE; - _menu.setDestinationText(SECRET_PASSAGE); + _menu->setDestinationText(SECRET_PASSAGE); } else { - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); setPal(14); drawPicture(); displayAnimFrame(1, 2); displayAnimFrame(1, 1); alertTxt = getString(577); - _dialogManager.show(alertTxt); + _dialogManager->show(alertTxt); displayAnimFrame(2, 1); _crep = 166; } @@ -832,8 +832,8 @@ void MortevielleEngine::fctTurn() { _crep = 997; if ((_coreVar._currPlace == ATTIC) && (_coreVar._atticRodHoleObjectId == 159) && (_coreVar._atticBallHoleObjectId == 141)) { handleDescriptionText(2, 167); - _soundManager.startSpeech(7, 9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(7, 9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) _endGame = true; else @@ -842,8 +842,8 @@ void MortevielleEngine::fctTurn() { if ((_coreVar._currPlace == SECRET_PASSAGE) && (_coreVar._secretPassageObjectId == 143)) { handleDescriptionText(2, 175); clearVerbBar(); - _soundManager.startSpeech(6, -9, 1); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + _soundManager->startSpeech(6, -9, 1); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); if (answer == 1) { _coreVar._currPlace = CRYPT; prepareDisplayText(); @@ -949,7 +949,7 @@ void MortevielleEngine::fctKnock() { displayTextInVerbBar(getEngineString(S_HIT)); if (_coreVar._currPlace == LANDING) { - _dialogManager.show(getEngineString(S_BEFORE_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_BEFORE_USE_DEP_MENU)); return; } @@ -967,7 +967,7 @@ void MortevielleEngine::fctKnock() { if (_coreVar._currPlace == ROOM26) { int rand = (getRandomNumber(0, 8)) - 4; - _soundManager.startSpeech(11, rand, 1); + _soundManager->startSpeech(11, rand, 1); int pres = getPresenceStats(rand, _coreVar._faithScore, _roomDoorId); if (_roomDoorId != OWN_ROOM) { if (pres != -500) { @@ -1132,7 +1132,7 @@ void MortevielleEngine::fctEat() { _coreVar._currPlace = DINING_ROOM; _caff = DINING_ROOM; resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); int day, hour, minute; updateHour(day, hour, minute); @@ -1168,7 +1168,7 @@ void MortevielleEngine::fctEat() { void MortevielleEngine::fctEnter() { if ((_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) { gotoDiningRoom(); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } else if (_coreVar._currPlace == LANDING) showMoveMenuAlert(); else if (_roomDoorId == OWN_ROOM) @@ -1185,15 +1185,15 @@ void MortevielleEngine::fctEnter() { _crep = 179; else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); int charIndex = convertBitIndexToCharacterIndex(pres); ++_coreVar._faithScore; _coreVar._currPlace = LANDING; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[charIndex]._menuId << 8) | _menu._discussMenu[charIndex]._actionId; + _currAction = (_menu->_discussMenu[charIndex]._menuId << 8) | _menu->_discussMenu[charIndex]._actionId; _syn = true; if (_roomDoorId == JULIA_ROOM) { _col = true; @@ -1207,14 +1207,14 @@ void MortevielleEngine::fctEnter() { } } else { int randVal = (getRandomNumber(0, 10)) - 5; - _soundManager.startSpeech(7, randVal, 1); + _soundManager->startSpeech(7, randVal, 1); displayAnimFrame(1, 1); - _soundManager.waitSpeech(); + _soundManager->waitSpeech(); _coreVar._currPlace = _roomDoorId; prepareDisplayText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); _roomDoorId = OWN_ROOM; _savedBitIndex = 0; _currBitIndex = 0; @@ -1237,7 +1237,7 @@ void MortevielleEngine::fctSleep() { prepareDisplayText(); drawPictureWithText(); resetRoomVariables(_coreVar._currPlace); - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); } clearVerbBar(); clearDescriptionBar(); @@ -1261,7 +1261,7 @@ void MortevielleEngine::fctSleep() { if (hour > 23) hour = 0; prepareRoom(); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); _anyone = false; } while (answer != 1); _crep = 998; @@ -1321,7 +1321,7 @@ void MortevielleEngine::fctLeave() { if (_crep == 0) _crep = nextPlace; resetRoomVariables(nextPlace); - _menu.setDestinationText(nextPlace); + _menu->setDestinationText(nextPlace); } } @@ -1351,7 +1351,7 @@ void MortevielleEngine::fctWait() { return; } handleDescriptionText(2, 102); - answer = _dialogManager.show(getEngineString(S_YES_NO)); + answer = _dialogManager->show(getEngineString(S_YES_NO)); } while (answer != 2); _crep = 998; if (!_anyone) @@ -1394,7 +1394,7 @@ void MortevielleEngine::fctDiscuss() { int oldMenu; do { ++cx; - oldMenu = (_menu._discussMenu[cx]._menuId << 8) | _menu._discussMenu[cx]._actionId; + oldMenu = (_menu->_discussMenu[cx]._menuId << 8) | _menu->_discussMenu[cx]._actionId; } while (oldMenu != _currAction); _caff = 69 + cx; drawPictureWithText(); @@ -1403,7 +1403,7 @@ void MortevielleEngine::fctDiscuss() { } testKey(false); menuUp(); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); @@ -1417,13 +1417,13 @@ void MortevielleEngine::fctDiscuss() { } lib[46] = lib[45]; lib[45] = ' '; - _mouse.showMouse(); + _mouse->showMouse(); do { choice = 0; int posX = 0; int posY = 0; for (int icm = 1; icm < 43; icm++) { - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (_coreVar._availableQuestion[icm] == '*') { // If question already asked, write it in reverse video if (questionAsked[icm]) @@ -1438,17 +1438,17 @@ void MortevielleEngine::fctDiscuss() { } else posY += 8; } - _screenSurface.putxy(320, 176); + _screenSurface->putxy(320, 176); displayQuestionText(lib[46], 0); char retKey = '\0'; bool click; do { bool dummyFl; - _mouse.moveMouse(dummyFl, retKey); + _mouse->moveMouse(dummyFl, retKey); if (shouldQuit()) return; - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); x *= (3 - kResolutionScaler); if (x > 319) cx = 41; @@ -1462,7 +1462,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1481,7 +1481,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[choice]) displayQuestionText(lib[choice], 0); else @@ -1494,7 +1494,7 @@ void MortevielleEngine::fctDiscuss() { posX = 320; else posX = 0; - _screenSurface.putxy(posX, posY); + _screenSurface->putxy(posX, posY); if (questionAsked[ix]) displayQuestionText(lib[ix], 0); else @@ -1533,11 +1533,11 @@ void MortevielleEngine::fctDiscuss() { _coreVar._faithScore += 3; displId = 139; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(displId); - _mouse.showMouse(); + _mouse->showMouse(); if ((displId == 84) || (displId == 86)) { _coreVar._pctHintFound[5] = '*'; _coreVar._availableQuestion[7] = '*'; @@ -1551,32 +1551,32 @@ void MortevielleEngine::fctDiscuss() { _coreVar._pctHintFound[8] = '*'; _coreVar._availableQuestion[32] = '*'; } - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); - _mouse.showMouse(); + _mouse->showMouse(); } } while ((choice != 46) && (displId != 138)); if (_col) { _coreVar._faithScore += (3 * (_coreVar._faithScore / 10)); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(138); - _mouse.showMouse(); + _mouse->showMouse(); _col = false; _coreVar._currPlace = LANDING; } _controlMenu = 0; - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawRightFrame(); - _mouse.showMouse(); + _mouse->showMouse(); showPeoplePresent(_currBitIndex); prepareRoom(); drawClock(); prepareDisplayText(); /* chech;*/ - _menu.setDestinationText(_coreVar._currPlace); + _menu->setDestinationText(_coreVar._currPlace); clearVerbBar(); } @@ -1625,13 +1625,13 @@ void MortevielleEngine::endGame() { clearVerbBar(); handleDescriptionText(9, 1509); testKey(false); - _mouse.hideMouse(); + _mouse->hideMouse(); _caff = 70; - _text.taffich(); + _text->taffich(); clearScreen(); drawDiscussionBox(); startDialog(141); - _mouse.showMouse(); + _mouse->showMouse(); clearUpperLeftPart(); handleDescriptionText(9, 1509); handleDescriptionText(2, 142); @@ -1667,7 +1667,7 @@ void MortevielleEngine::askRestart() { _day = 0; handleDescriptionText(2, 180); - int answer = _dialogManager.show(getEngineString(S_YES_NO)); + int answer = _dialogManager->show(getEngineString(S_YES_NO)); _quitGame = (answer != 1); } diff --git a/engines/mortevielle/debugger.cpp b/engines/mortevielle/debugger.cpp index 4ef5151c81..4b39462cde 100644 --- a/engines/mortevielle/debugger.cpp +++ b/engines/mortevielle/debugger.cpp @@ -25,7 +25,8 @@ namespace Mortevielle { -Debugger::Debugger() : GUI::Debugger() { +Debugger::Debugger(MortevielleEngine *vm) : GUI::Debugger() { + _vm = vm; DCmd_Register("continue", WRAP_METHOD(Debugger, Cmd_Exit)); DCmd_Register("show_questions", WRAP_METHOD(Debugger, Cmd_showAllQuestions)); DCmd_Register("reset_parano", WRAP_METHOD(Debugger, Cmd_resetParano)); @@ -52,8 +53,4 @@ bool Debugger::Cmd_resetParano(int argc, const char **argv) { return true; } -void Debugger::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/debugger.h b/engines/mortevielle/debugger.h index 9041d90110..6e1006681c 100644 --- a/engines/mortevielle/debugger.h +++ b/engines/mortevielle/debugger.h @@ -39,9 +39,8 @@ protected: bool Cmd_resetParano(int argc, const char **argv); public: - Debugger(); + Debugger(MortevielleEngine *vm); virtual ~Debugger() {} - void setParent(MortevielleEngine *vm); }; } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.cpp b/engines/mortevielle/dialogs.cpp index 9a2ade60ab..09a4227cc0 100644 --- a/engines/mortevielle/dialogs.cpp +++ b/engines/mortevielle/dialogs.cpp @@ -35,15 +35,19 @@ namespace Mortevielle { +DialogManager::DialogManager(MortevielleEngine *vm) { + _vm = vm; +} + /** * Alert function - Show * @remarks Originally called 'do_alert' */ int DialogManager::show(const Common::String &msg) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); while (_vm->keyPressed()) _vm->getChar(); @@ -63,7 +67,7 @@ int DialogManager::show(const Common::String &msg) { } else { drawAlertBox(8, 7, colNumb); int i = 0; - _vm->_screenSurface._textPos.y = 70; + _vm->_screenSurface->_textPos.y = 70; do { curPos.x = 320; Common::String displayStr = ""; @@ -72,9 +76,9 @@ int DialogManager::show(const Common::String &msg) { displayStr += alertStr[i]; curPos.x -= 3; } - _vm->_screenSurface.putxy(curPos.x, _vm->_screenSurface._textPos.y); - _vm->_screenSurface._textPos.y += 6; - _vm->_screenSurface.drawString(displayStr, 4); + _vm->_screenSurface->putxy(curPos.x, _vm->_screenSurface->_textPos.y); + _vm->_screenSurface->_textPos.y += 6; + _vm->_screenSurface->drawString(displayStr, 4); ++i; } while (alertStr[i] != ']'); } @@ -99,17 +103,17 @@ int DialogManager::show(const Common::String &msg) { limit[2][1] = ((uint)(320 + ((uint)esp >> 1)) / 2) * kResolutionScaler; limit[2][2] = (limit[2][1]) + 40; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); int id = 0; bool dummyFl = false; bool test3; do { char dummyKey = '\377'; - _vm->_mouse.moveMouse(dummyFl, dummyKey); + _vm->_mouse->moveMouse(dummyFl, dummyKey); if (_vm->shouldQuit()) return 0; - curPos = _vm->_mouse._pos; + curPos = _vm->_mouse->_pos; bool newaff = false; if ((curPos.y > 95) && (curPos.y < 105)) { bool test1 = (curPos.x > limit[1][1]) && (curPos.x < limit[1][2]); @@ -125,56 +129,56 @@ int DialogManager::show(const Common::String &msg) { else ix = 2; if (ix != id) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); if (id != 0) { setPosition(id, coldep, esp); Common::String tmpStr(" "); tmpStr += buttonStr[id]; tmpStr += " "; - _vm->_screenSurface.drawString(tmpStr, 0); + _vm->_screenSurface->drawString(tmpStr, 0); } setPosition(ix, coldep, esp); Common::String tmp2 = " "; tmp2 += buttonStr[ix]; tmp2 += " "; - _vm->_screenSurface.drawString(tmp2, 1); + _vm->_screenSurface->drawString(tmp2, 1); id = ix; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } } } if ((id != 0) && !newaff) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); setPosition(id, coldep, esp); Common::String tmp3(" "); tmp3 += buttonStr[id]; tmp3 += " "; - _vm->_screenSurface.drawString(tmp3, 0); + _vm->_screenSurface->drawString(tmp3, 0); id = 0; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } test3 = (curPos.y > 95) && (curPos.y < 105) && (((curPos.x > limit[1][1]) && (curPos.x < limit[1][2])) || ((curPos.x > limit[2][1]) && (curPos.x < limit[2][2]))); } while (!_vm->getMouseClick()); _vm->setMouseClick(false); - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); if (!test3) { id = 1; setPosition(1, coldep, esp); Common::String tmp4(" "); tmp4 += buttonStr[1]; tmp4 += " "; - _vm->_screenSurface.drawString(tmp4, 1); + _vm->_screenSurface->drawString(tmp4, 1); } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); /* Restore the background area */ - _vm->_screenSurface.copyFrom(_vm->_backgroundSurface, 0, 0); + _vm->_screenSurface->copyFrom(_vm->_backgroundSurface, 0, 0); return id; } @@ -221,7 +225,7 @@ void DialogManager::decodeAlertDetails(Common::String inputStr, int &choiceNumb, } void DialogManager::setPosition(int ji, int coldep, int esp) { - _vm->_screenSurface.putxy(coldep + (40 + esp) * (ji - 1), 98); + _vm->_screenSurface->putxy(coldep + (40 + esp) * (ji - 1), 98); } /** @@ -235,9 +239,9 @@ void DialogManager::drawAlertBox(int firstLine, int lineNum, int width) { int y = (firstLine - 1) * 8; int xx = x + width; int yy = y + (lineNum * 8); - _vm->_screenSurface.fillRect(15, Common::Rect(x, y, xx, yy)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); - _vm->_screenSurface.fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); + _vm->_screenSurface->fillRect(15, Common::Rect(x, y, xx, yy)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, y + 2, xx, y + 4)); + _vm->_screenSurface->fillRect(0, Common::Rect(x, yy - 4, xx, yy - 2)); } /** @@ -259,13 +263,13 @@ void DialogManager::setButtonText(Common::String c, int coldep, int nbcase, Comm while (str[l].size() < 3) str[l] += ' '; - _vm->_screenSurface.putxy(x, 98); + _vm->_screenSurface->putxy(x, 98); Common::String tmp(" "); tmp += str[l]; tmp += " "; - _vm->_screenSurface.drawString(tmp, 0); + _vm->_screenSurface->drawString(tmp, 0); x += esp + 40; } } @@ -292,13 +296,13 @@ bool DialogManager::showKnowledgeCheck() { int correctCount = 0; for (int indx = 0; indx < 10; ++indx) { - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); _vm->clearScreen(); - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); int dialogHeight = 23; - _vm->_screenSurface.fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); + _vm->_screenSurface->fillRect(15, Common::Rect(0, 14, 630, dialogHeight)); Common::String tmpStr = _vm->getString(textIndexArr[indx]); - _vm->_text.displayStr(tmpStr, 20, 15, 100, 2, 0); + _vm->_text->displayStr(tmpStr, 20, 15, 100, 2, 0); int firstOption; int lastOption; @@ -318,7 +322,7 @@ bool DialogManager::showKnowledgeCheck() { tmpStr = _vm->getString(j); if ((int) tmpStr.size() > maxLength) maxLength = tmpStr.size(); - _vm->_text.displayStr(tmpStr, 100, optionPosY, 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, optionPosY, 100, 1, 0); choiceArray[prevChoice] = tmpStr; optionPosY += 8; } @@ -333,7 +337,7 @@ bool DialogManager::showKnowledgeCheck() { } coor[lastOption - firstOption + 2]._enabled = false; int rep = 6; - _vm->_screenSurface.drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); + _vm->_screenSurface->drawBox(80, 33, 40 + (maxLength * rep), (lastOption - firstOption) * 8 + 16, 15); rep = 0; prevChoice = 0; @@ -342,26 +346,26 @@ bool DialogManager::showKnowledgeCheck() { _vm->setMouseClick(false); bool flag; char key; - _vm->_mouse.moveMouse(flag, key); + _vm->_mouse->moveMouse(flag, key); if (_vm->shouldQuit()) return false; currChoice = 1; - while (coor[currChoice]._enabled && !_vm->_mouse.isMouseIn(coor[currChoice]._rect)) + while (coor[currChoice]._enabled && !_vm->_mouse->isMouseIn(coor[currChoice]._rect)) ++currChoice; if (coor[currChoice]._enabled) { if ((prevChoice != 0) && (prevChoice != currChoice)) { tmpStr = choiceArray[prevChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); } if (prevChoice != currChoice) { tmpStr = choiceArray[currChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); + _vm->_text->displayStr(tmpStr, 100, 27 + (currChoice * 8), 100, 1, 1); prevChoice = currChoice; } } else if (prevChoice != 0) { tmpStr = choiceArray[prevChoice] + '$'; - _vm->_text.displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); + _vm->_text->displayStr(tmpStr, 100, 27 + (prevChoice * 8), 100, 1, 0); prevChoice = 0; } } while (!((prevChoice != 0) && _vm->getMouseClick())); @@ -391,17 +395,17 @@ void DialogManager::drawF3F8() { Common::String f8 = _vm->getEngineString(S_F8); // Write the F3 and F8 text strings - _vm->_screenSurface.putxy(3, 44); - _vm->_screenSurface.drawString(f3, 5); - _vm->_screenSurface._textPos.y = 51; - _vm->_screenSurface.drawString(f8, 5); + _vm->_screenSurface->putxy(3, 44); + _vm->_screenSurface->drawString(f3, 5); + _vm->_screenSurface->_textPos.y = 51; + _vm->_screenSurface->drawString(f8, 5); // Get the width of the written text strings - int f3Width = _vm->_screenSurface.getStringWidth(f3); - int f8Width = _vm->_screenSurface.getStringWidth(f8); + int f3Width = _vm->_screenSurface->getStringWidth(f3); + int f8Width = _vm->_screenSurface->getStringWidth(f8); // Write out the bounding box - _vm->_screenSurface.drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); + _vm->_screenSurface->drawBox(0, 42, MAX(f3Width, f8Width) + 6, 18, 7); } /** @@ -412,7 +416,7 @@ void DialogManager::drawF3F8() { void DialogManager::checkForF8(int SpeechNum, bool drawFrame2Fl) { _vm->testKeyboard(); do { - _vm->_soundManager.startSpeech(SpeechNum, 0, 0); + _vm->_soundManager->startSpeech(SpeechNum, 0, 0); _vm->_key = waitForF3F8(); if (_vm->shouldQuit()) return; @@ -442,7 +446,7 @@ int DialogManager::waitForF3F8() { void DialogManager::displayIntroScreen(bool drawFrame2Fl) { _vm->_caff = 50; _vm->_maff = 0; - _vm->_text.taffich(); + _vm->_text->taffich(); _vm->draw(63, 12); if (drawFrame2Fl) displayIntroFrame2(); @@ -466,7 +470,4 @@ void DialogManager::displayIntroFrame2() { _vm->handleDescriptionText(2, kDialogStringIndex + 143); } -void DialogManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} } // End of namespace Mortevielle diff --git a/engines/mortevielle/dialogs.h b/engines/mortevielle/dialogs.h index 3f30851960..03dfc78023 100644 --- a/engines/mortevielle/dialogs.h +++ b/engines/mortevielle/dialogs.h @@ -51,7 +51,8 @@ private: void drawAlertBox(int firstLine, int lineNum, int width); void setButtonText(Common::String c, int coldep, int nbcase, Common::String *str, int esp); public: - void setParent(MortevielleEngine *vm); + DialogManager(MortevielleEngine *vm); + int show(const Common::String &msg); void drawF3F8(); void checkForF8(int SpeechNum, bool drawFrame2Fl); diff --git a/engines/mortevielle/graphics.cpp b/engines/mortevielle/graphics.cpp index daf7926438..18b0e7f1c1 100644 --- a/engines/mortevielle/graphics.cpp +++ b/engines/mortevielle/graphics.cpp @@ -881,6 +881,10 @@ GfxSurface::~GfxSurface() { * Screen surface *-------------------------------------------------------------------------*/ +ScreenSurface::ScreenSurface(MortevielleEngine *vm) { + _vm = vm; +} + /** * Called to populate the font data from the passed file */ @@ -1070,7 +1074,7 @@ void ScreenSurface::drawString(const Common::String &l, int command) { if (l == "") return; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); Common::Point pt = _textPos; int charWidth = 6; @@ -1082,11 +1086,11 @@ void ScreenSurface::drawString(const Common::String &l, int command) { case 0: case 2: color = 15; - _vm->_screenSurface.fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(0, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 1: case 3: - _vm->_screenSurface.fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); + _vm->_screenSurface->fillRect(15, Common::Rect(pt.x, pt.y, x, pt.y + 7)); break; case 5: color = 15; @@ -1099,10 +1103,10 @@ void ScreenSurface::drawString(const Common::String &l, int command) { pt.x += 1; pt.y += 1; for (x = 1; (x <= (int)l.size()) && (l[x - 1] != 0); ++x) { - _vm->_screenSurface.writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); + _vm->_screenSurface->writeCharacter(Common::Point(pt.x, pt.y), l[x - 1], color); pt.x += charWidth; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -1133,7 +1137,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(abs((int)(a * i + b)), i), coul); + _vm->_screenSurface->setPixel(Common::Point(abs((int)(a * i + b)), i), coul); i += step; } while (i != yy); } else { @@ -1145,7 +1149,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { else step = 1; do { - _vm->_screenSurface.setPixel(Common::Point(i, abs((int)(a * i + b))), coul); + _vm->_screenSurface->setPixel(Common::Point(i, abs((int)(a * i + b))), coul); i = i + step; } while (i != xx); } @@ -1156,12 +1160,7 @@ void ScreenSurface::drawLine(int x, int y, int xx, int yy, int coul) { * @remarks Originally called 'paint_rect' */ void ScreenSurface::drawRectangle(int x, int y, int dx, int dy) { - _vm->_screenSurface.fillRect(11, Common::Rect(x, y, x + dx, y + dy)); + _vm->_screenSurface->fillRect(11, Common::Rect(x, y, x + dx, y + dy)); } -void ScreenSurface::setParent(MortevielleEngine *vm) { - _vm = vm; -} - - } // End of namespace Mortevielle diff --git a/engines/mortevielle/graphics.h b/engines/mortevielle/graphics.h index e31f5da29a..7f0d4823cb 100644 --- a/engines/mortevielle/graphics.h +++ b/engines/mortevielle/graphics.h @@ -91,6 +91,8 @@ private: byte _fontData[FONT_NUM_CHARS * FONT_HEIGHT]; public: + ScreenSurface(MortevielleEngine *vm); + Common::Point _textPos; // Original called xwhere/ywhere void readFontData(Common::File &f, int dataSize); Graphics::Surface lockArea(const Common::Rect &bounds); @@ -106,7 +108,6 @@ public: int getStringWidth(const Common::String &s); void drawLine(int x, int y, int xx, int yy, int coul); void drawRectangle(int x, int y, int dx, int dy); - void setParent(MortevielleEngine *vm); // TODO: Refactor code to remove this method, for increased performance void setPixel(const Common::Point &pt, int palIndex); diff --git a/engines/mortevielle/menu.cpp b/engines/mortevielle/menu.cpp index 641a527c98..14fc8d4084 100644 --- a/engines/mortevielle/menu.cpp +++ b/engines/mortevielle/menu.cpp @@ -48,7 +48,8 @@ const byte menuConstants[8][4] = { {62, 46, 13, 10} }; -Menu::Menu() { +Menu::Menu(MortevielleEngine *vm) { + _vm = vm; _opcodeAttach = _opcodeWait = _opcodeForce = _opcodeSleep = OPCODE_NONE; _opcodeListen = _opcodeEnter = _opcodeClose = _opcodeSearch = OPCODE_NONE; _opcodeKnock = _opcodeScratch = _opcodeRead = _opcodeEat = OPCODE_NONE; @@ -295,8 +296,8 @@ void Menu::enableMenuItem(MenuItem item) { } void Menu::displayMenu() { - _vm->_mouse.hideMouse(); - _vm->_screenSurface.fillRect(7, Common::Rect(0, 0, 639, 10)); + _vm->_mouse->hideMouse(); + _vm->_screenSurface->fillRect(7, Common::Rect(0, 0, 639, 10)); int col = 28 * kResolutionScaler; for (int charNum = 0; charNum < 6; charNum++) { @@ -310,9 +311,9 @@ void Menu::displayMenu() { uint msk = 0x80; for (int pt = 0; pt <= 7; ++pt) { if ((_charArr[charNum][idx] & msk) != 0) { - _vm->_screenSurface.setPixel(Common::Point(x + 1, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y + 1), 0); - _vm->_screenSurface.setPixel(Common::Point(x, y), 9); + _vm->_screenSurface->setPixel(Common::Point(x + 1, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y + 1), 0); + _vm->_screenSurface->setPixel(Common::Point(x, y), 9); } msk >>= 1; ++x; @@ -322,7 +323,7 @@ void Menu::displayMenu() { } col += 48 * kResolutionScaler; } - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -348,7 +349,7 @@ void Menu::invert(int indx) { int menuIndex = _msg4 & 0xFF; - _vm->_screenSurface.putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); + _vm->_screenSurface->putxy(menuConstants[_msg3 - 1][0] << 3, (menuIndex + 1) << 3); Common::String str; switch (_msg3) { @@ -388,7 +389,7 @@ void Menu::invert(int indx) { break; } if ((str[0] != '*') && (str[0] != '<')) - _vm->_screenSurface.drawString(str, indx); + _vm->_screenSurface->drawString(str, indx); else _msg4 = OPCODE_NONE; } @@ -419,71 +420,71 @@ void Menu::util(Common::Point pos) { */ void Menu::menuDown(int ii) { // Make a copy of the current screen surface for later restore - _vm->_backgroundSurface.copyFrom(_vm->_screenSurface); + _vm->_backgroundSurface.copyFrom(*_vm->_screenSurface); // Draw the menu int minX = menuConstants[ii - 1][0] << 3; int lineNum = menuConstants[ii - 1][3]; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); int deltaX = 6; int maxX = minX + (menuConstants[ii - 1][2] * deltaX) + 6; if ((ii == 4) && (_vm->getLanguage() == Common::EN_ANY)) // Extra width needed for Self menu in English version maxX = 435; - _vm->_screenSurface.fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); - _vm->_screenSurface.putxy(minX, 16); + _vm->_screenSurface->fillRect(15, Common::Rect(minX, 12, maxX, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(maxX, 12, maxX + 4, 10 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->fillRect(0, Common::Rect(minX, 8 + (menuConstants[ii - 1][1] << 1), maxX + 4, 12 + (menuConstants[ii - 1][1] << 1))); + _vm->_screenSurface->putxy(minX, 16); for (int i = 1; i <= lineNum; i++) { switch (ii) { case 1: if (_inventoryStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_inventoryStringArray[i], 4); + _vm->_screenSurface->drawString(_inventoryStringArray[i], 4); break; case 2: if (_moveStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_moveStringArray[i], 4); + _vm->_screenSurface->drawString(_moveStringArray[i], 4); break; case 3: if (_actionStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_actionStringArray[i], 4); + _vm->_screenSurface->drawString(_actionStringArray[i], 4); break; case 4: if (_selfStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_selfStringArray[i], 4); + _vm->_screenSurface->drawString(_selfStringArray[i], 4); break; case 5: if (_discussStringArray[i][0] != '*') - _vm->_screenSurface.drawString(_discussStringArray[i], 4); + _vm->_screenSurface->drawString(_discussStringArray[i], 4); break; case 6: - _vm->_screenSurface.drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_SAVE_LOAD + i), 4); break; case 7: { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 1); s += ' '; s += (char)(48 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; case 8: if (i == 1) - _vm->_screenSurface.drawString(_vm->getEngineString(S_RESTART), 4); + _vm->_screenSurface->drawString(_vm->getEngineString(S_RESTART), 4); else { Common::String s = _vm->getEngineString(S_SAVE_LOAD + 2); s += ' '; s += (char)(47 + i); - _vm->_screenSurface.drawString(s, 4); + _vm->_screenSurface->drawString(s, 4); } break; default: break; } - _vm->_screenSurface.putxy(minX, _vm->_screenSurface._textPos.y + 8); + _vm->_screenSurface->putxy(minX, _vm->_screenSurface->_textPos.y + 8); } _multiTitle = true; - _vm->_mouse.showMouse(); + _vm->_mouse->showMouse(); } /** @@ -492,11 +493,11 @@ void Menu::menuDown(int ii) { void Menu::menuUp(int msgId) { if (_multiTitle) { /* Restore the background area */ - assert(_vm->_screenSurface.pitch == _vm->_backgroundSurface.pitch); + assert(_vm->_screenSurface->pitch == _vm->_backgroundSurface.pitch); // Get a pointer to the source and destination of the area to restore const byte *pSrc = (const byte *)_vm->_backgroundSurface.getBasePtr(0, 10); - Graphics::Surface destArea = _vm->_screenSurface.lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface destArea = _vm->_screenSurface->lockArea(Common::Rect(0, 10, SCREEN_WIDTH, SCREEN_HEIGHT)); byte *pDest = (byte *)destArea.getPixels(); // Copy the data @@ -523,7 +524,7 @@ void Menu::updateMenu() { if (!_menuActive) return; - Common::Point curPos = _vm->_mouse._pos; + Common::Point curPos = _vm->_mouse->_pos; if (!_vm->getMouseClick()) { if (curPos == _vm->_prevPos) return; @@ -590,10 +591,6 @@ void Menu::updateMenu() { } } -void Menu::setParent(MortevielleEngine *vm) { - _vm = vm; -} - void Menu::initMenu() { Common::File f; diff --git a/engines/mortevielle/menu.h b/engines/mortevielle/menu.h index debf5b09b6..d8a3b4d0d6 100644 --- a/engines/mortevielle/menu.h +++ b/engines/mortevielle/menu.h @@ -60,7 +60,7 @@ private: void menuDown(int ii); public: - Menu(); + Menu(MortevielleEngine *vm); bool _menuActive; bool _menuSelected; @@ -103,7 +103,6 @@ public: int _opcodeSLook; MenuItem _actionMenu[12]; - void setParent(MortevielleEngine *vm); void readVerbNums(Common::File &f, int dataSize); void setText(MenuItem item, Common::String name); void setDestinationText(int roomId); diff --git a/engines/mortevielle/mortevielle.cpp b/engines/mortevielle/mortevielle.cpp index d434150977..34372ba32a 100644 --- a/engines/mortevielle/mortevielle.cpp +++ b/engines/mortevielle/mortevielle.cpp @@ -47,17 +47,16 @@ namespace Mortevielle { MortevielleEngine *g_vm; MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc): - Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle"), - _soundManager(_mixer) { + Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") { g_vm = this; - _debugger.setParent(this); - _dialogManager.setParent(this); - _screenSurface.setParent(this); - _mouse.setParent(this); - _text.setParent(this); - _soundManager.setParent(this); - _savegameManager.setParent(this); - _menu.setParent(this); + _debugger = new Debugger(this); + _dialogManager = new DialogManager(this); + _screenSurface = new ScreenSurface(this); + _mouse = new MouseHandler(this); + _text = new TextHandler(this); + _soundManager = new SoundManager(this, _mixer); + _savegameManager = new SavegameManager(this); + _menu = new Menu(this); _lastGameFrame = 0; _mouseClick = false; @@ -105,6 +104,15 @@ MortevielleEngine::MortevielleEngine(OSystem *system, const MortevielleGameDescr } MortevielleEngine::~MortevielleEngine() { + delete _menu; + delete _savegameManager; + delete _soundManager; + delete _text; + delete _mouse; + delete _screenSurface; + delete _dialogManager; + delete _debugger; + free(_curPict); free(_curAnim); free(_rightFramePict); @@ -140,7 +148,7 @@ bool MortevielleEngine::canSaveGameStateCurrently() { * Load in a savegame at the specified slot number */ Common::Error MortevielleEngine::loadGameState(int slot) { - return _savegameManager.loadGame(slot); + return _savegameManager->loadGame(slot); } /** @@ -150,7 +158,7 @@ Common::Error MortevielleEngine::saveGameState(int slot, const Common::String &d if (slot == 0) return Common::kWritingFailed; - return _savegameManager.saveGame(slot, desc); + return _savegameManager->saveGame(slot, desc); } /** @@ -196,7 +204,7 @@ Common::ErrorCode MortevielleEngine::initialize() { DebugMan.addDebugChannel(kMortevielleGraphics, "graphics", "Graphics debugging"); // Set up an intermediate screen surface - _screenSurface.create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); + _screenSurface->create(SCREEN_WIDTH, SCREEN_HEIGHT, Graphics::PixelFormat::createFormatCLUT8()); _txxFileFl = false; // Load texts from TXX files @@ -205,7 +213,7 @@ Common::ErrorCode MortevielleEngine::initialize() { // Load the mort.dat resource Common::ErrorCode result = loadMortDat(); if (result != Common::kNoError) { - _screenSurface.free(); + _screenSurface->free(); return result; } @@ -235,8 +243,8 @@ Common::ErrorCode MortevielleEngine::initialize() { testKeyboard(); clearScreen(); - _soundManager.loadNoise(); - _soundManager.loadAmbiantSounds(); + _soundManager->loadNoise(); + _soundManager->loadAmbiantSounds(); return Common::kNoError; } @@ -278,13 +286,13 @@ Common::ErrorCode MortevielleEngine::loadMortDat() { if (!strncmp(dataType, "FONT", 4)) { // Font resource - _screenSurface.readFontData(f, dataSize); + _screenSurface->readFontData(f, dataSize); } else if (!strncmp(dataType, "SSTR", 4)) { readStaticStrings(f, dataSize, kStaticStrings); } else if ((!strncmp(dataType, "GSTR", 4)) && (!_txxFileFl)) { readStaticStrings(f, dataSize, kGameStrings); } else if (!strncmp(dataType, "VERB", 4)) { - _menu.readVerbNums(f, dataSize); + _menu->readVerbNums(f, dataSize); } else { // Unknown section f.skip(dataSize); @@ -369,21 +377,21 @@ Common::Error MortevielleEngine::run() { showIntroduction(); else { _caff = 51; - _text.taffich(); + _text->taffich(); } // Either load the initial game state savegame, or the specified savegame number adzon(); resetVariables(); if (loadSlot != 0) - _savegameManager.loadSavegame(generateSaveFilename(loadSlot)); + _savegameManager->loadSavegame(generateSaveFilename(loadSlot)); // Run the main game loop mainGame(); // Cleanup (allocated in initialize()) - _screenSurface.free(); - free(_soundManager._cfiphBuffer); + _screenSurface->free(); + free(_soundManager->_cfiphBuffer); free(_cfiecBuffer); return Common::kNoError; @@ -393,13 +401,13 @@ Common::Error MortevielleEngine::run() { * Show the game introduction */ void MortevielleEngine::showIntroduction() { - _dialogManager.displayIntroScreen(false); - _dialogManager.checkForF8(142, false); + _dialogManager->displayIntroScreen(false); + _dialogManager->checkForF8(142, false); if (shouldQuit()) return; - _dialogManager.displayIntroFrame2(); - _dialogManager.checkForF8(143, true); + _dialogManager->displayIntroFrame2(); + _dialogManager->checkForF8(143, true); if (shouldQuit()) return; @@ -419,13 +427,13 @@ void MortevielleEngine::mainGame() { for (_crep = 1; _crep <= _x26KeyCount; ++_crep) decodeNumber(&_cfiecBuffer[161 * 16], (_cfiecBufferSize - (161 * 16)) / 64); - _menu.initMenu(); + _menu->initMenu(); charToHour(); initGame(); clearScreen(); drawRightFrame(); - _mouse.showMouse(); + _mouse->showMouse(); // Loop to play the game do { diff --git a/engines/mortevielle/mortevielle.h b/engines/mortevielle/mortevielle.h index 5ae94987a0..579e495b65 100644 --- a/engines/mortevielle/mortevielle.h +++ b/engines/mortevielle/mortevielle.h @@ -427,17 +427,18 @@ public: byte *_curAnim; byte *_rightFramePict; - Debugger _debugger; - ScreenSurface _screenSurface; PaletteManager _paletteManager; GfxSurface _backgroundSurface; Common::RandomSource _randomSource; - SoundManager _soundManager; - SavegameManager _savegameManager; - Menu _menu; - MouseHandler _mouse; - TextHandler _text; - DialogManager _dialogManager; + + Debugger *_debugger; + ScreenSurface *_screenSurface; + SoundManager *_soundManager; + SavegameManager *_savegameManager; + Menu *_menu; + MouseHandler *_mouse; + TextHandler *_text; + DialogManager *_dialogManager; MortevielleEngine(OSystem *system, const MortevielleGameDescription *gameDesc); ~MortevielleEngine(); @@ -448,7 +449,7 @@ public: virtual Common::Error saveGameState(int slot, const Common::String &desc); virtual Common::Error run(); virtual void pauseEngineIntern(bool pause); - virtual GUI::Debugger *getDebugger() {return &_debugger;} + virtual GUI::Debugger *getDebugger() {return _debugger;} uint32 getGameFlags() const; Common::Language getLanguage() const; Common::Language getOriginalLanguage() const; diff --git a/engines/mortevielle/mouse.cpp b/engines/mortevielle/mouse.cpp index 480b4381ef..2077a4cdc5 100644 --- a/engines/mortevielle/mouse.cpp +++ b/engines/mortevielle/mouse.cpp @@ -33,6 +33,10 @@ namespace Mortevielle { +MouseHandler::MouseHandler(MortevielleEngine *vm) { + _vm = vm; +} + /** * Initialize the mouse * @remarks Originally called 'init_mouse' @@ -264,8 +268,4 @@ bool MouseHandler::isMouseIn(Common::Rect r) { return false; } -void MouseHandler::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 90d1ef310e..81c02dc8bd 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -38,8 +38,8 @@ private: MortevielleEngine *_vm; public: Common::Point _pos; + MouseHandler(MortevielleEngine *vm); - void setParent(MortevielleEngine *vm); void initMouse(); void hideMouse(); void showMouse(); diff --git a/engines/mortevielle/outtext.cpp b/engines/mortevielle/outtext.cpp index d50f4005de..2518b317d5 100644 --- a/engines/mortevielle/outtext.cpp +++ b/engines/mortevielle/outtext.cpp @@ -35,6 +35,10 @@ namespace Mortevielle { +TextHandler::TextHandler(MortevielleEngine *vm) { + _vm = vm; +} + /** * Next word * @remarks Originally called 'l_motsuiv' @@ -59,7 +63,7 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int // Safeguard: add $ just in case inputStr += '$'; - _vm->_screenSurface.putxy(x, y); + _vm->_screenSurface->putxy(x, y); int tab = 6; dx *= 6; dy *= 6; @@ -73,19 +77,19 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int while (!stringParsed) { switch (inputStr[p]) { case '@': - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; ++p; xc = x; yc += 6; - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); break; case ' ': s += ' '; xc += tab; ++p; if (nextWord(p, inputStr.c_str(), tab) + xc > xf) { - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); s = ""; xc = x; yc += 6; @@ -96,20 +100,20 @@ void TextHandler::displayStr(Common::String inputStr, int x, int y, int dx, int do { j = x; do { - _vm->_screenSurface.putxy(j, i); - _vm->_screenSurface.drawString(" ", 0); + _vm->_screenSurface->putxy(j, i); + _vm->_screenSurface->drawString(" ", 0); j += 6; } while (j <= xf); i += 6; } while (i <= yf); yc = y; } - _vm->_screenSurface.putxy(xc, yc); + _vm->_screenSurface->putxy(xc, yc); } break; case '$': stringParsed = true; - _vm->_screenSurface.drawString(s, typ); + _vm->_screenSurface->drawString(s, typ); break; default: s += inputStr[p]; @@ -218,7 +222,7 @@ void TextHandler::taffich() { } _vm->_destinationOk = true; - _vm->_mouse.hideMouse(); + _vm->_mouse->hideMouse(); drawingStartPos = 0; Common::String filename, altFilename; @@ -291,8 +295,8 @@ void TextHandler::taffich() { } loadAniFile(filename, drawingStartPos, drawingSize); } - _vm->_mouse.showMouse(); - if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu._opcodeEnter)) { + _vm->_mouse->showMouse(); + if ((a < COAT_ARMS) && ((_vm->_maff < COAT_ARMS) || (_vm->_coreVar._currPlace == LANDING)) && (_vm->_currAction != _vm->_menu->_opcodeEnter)) { if ((a == ATTIC) || (a == CELLAR)) _vm->displayAloneText(); else if (!_vm->_blo) @@ -301,8 +305,4 @@ void TextHandler::taffich() { } } -void TextHandler::setParent(MortevielleEngine *vm) { - _vm = vm; -} - } // End of namespace Mortevielle diff --git a/engines/mortevielle/outtext.h b/engines/mortevielle/outtext.h index 44868036d5..397ca850dd 100644 --- a/engines/mortevielle/outtext.h +++ b/engines/mortevielle/outtext.h @@ -38,7 +38,8 @@ private: MortevielleEngine *_vm; int nextWord(int p, const char *ch, int &tab); public: - void setParent(MortevielleEngine *vm); + TextHandler (MortevielleEngine *vm); + void displayStr(Common::String inputStr, int x, int y, int dx, int dy, int typ); void loadPictureFile(Common::String filename, Common::String altFilename, int32 skipSize, int length); void loadAniFile(Common::String filename, int32 skipSize, int length); diff --git a/engines/mortevielle/saveload.cpp b/engines/mortevielle/saveload.cpp index c14a03cd60..77a9a6371e 100644 --- a/engines/mortevielle/saveload.cpp +++ b/engines/mortevielle/saveload.cpp @@ -37,7 +37,7 @@ namespace Mortevielle { static const char SAVEGAME_ID[4] = { 'M', 'O', 'R', 'T' }; -void SavegameManager::setParent(MortevielleEngine *vm) { +SavegameManager::SavegameManager(MortevielleEngine *vm) { _vm = vm; } @@ -116,14 +116,14 @@ bool SavegameManager::loadSavegame(const Common::String &filename) { * Load a saved game */ Common::Error SavegameManager::loadGame(const Common::String &filename) { - g_vm->_mouse.hideMouse(); + g_vm->_mouse->hideMouse(); g_vm->displayEmptyHand(); if (loadSavegame(filename)) { /* Initialization */ g_vm->charToHour(); g_vm->initGame(); g_vm->gameLoaded(); - g_vm->_mouse.showMouse(); + g_vm->_mouse->showMouse(); return Common::kNoError; } else return Common::kUnknownError; @@ -136,7 +136,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { Common::OutSaveFile *f; int i; - g_vm->_mouse.hideMouse(); + g_vm->_mouse->hideMouse(); g_vm->hourToChar(); for (i = 0; i <= 389; ++i) @@ -165,7 +165,7 @@ Common::Error SavegameManager::saveGame(int n, const Common::String &saveName) { // Skipped: dialog asking to swap floppy - g_vm->_mouse.showMouse(); + g_vm->_mouse->showMouse(); return Common::kNoError; } @@ -191,7 +191,7 @@ void SavegameManager::writeSavegameHeader(Common::OutSaveFile *out, const Common // Create a thumbnail and save it Graphics::Surface *thumb = new Graphics::Surface(); - Graphics::Surface s = g_vm->_screenSurface.lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); + Graphics::Surface s = g_vm->_screenSurface->lockArea(Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)); ::createThumbnail(thumb, (const byte *)s.getPixels(), SCREEN_WIDTH, SCREEN_HEIGHT, thumbPalette); Graphics::saveThumbnail(*out, *thumb); diff --git a/engines/mortevielle/saveload.h b/engines/mortevielle/saveload.h index 79747e6889..9c21b0c294 100644 --- a/engines/mortevielle/saveload.h +++ b/engines/mortevielle/saveload.h @@ -56,7 +56,8 @@ private: void sync_save(Common::Serializer &sz); public: - void setParent(MortevielleEngine *vm); + SavegameManager(MortevielleEngine *vm); + bool loadSavegame(const Common::String &filename); Common::Error loadGame(const Common::String &filename); Common::Error saveGame(int n, const Common::String &saveName); diff --git a/engines/mortevielle/sound.cpp b/engines/mortevielle/sound.cpp index b670246726..c39c8e7024 100644 --- a/engines/mortevielle/sound.cpp +++ b/engines/mortevielle/sound.cpp @@ -55,7 +55,8 @@ namespace Mortevielle { const byte _tabdph[16] = {0, 10, 2, 0, 2, 10, 3, 0, 3, 7, 5, 0, 6, 7, 7, 10}; const byte _tabdbc[18] = {7, 23, 7, 14, 13, 9, 14, 9, 5, 12, 6, 12, 13, 4, 0, 4, 5, 9}; -SoundManager::SoundManager(Audio::Mixer *mixer) { +SoundManager::SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer) { + _vm = vm; _mixer = mixer; _audioStream = nullptr; _ambiantNoiseBuf = nullptr; @@ -281,10 +282,6 @@ void SoundManager::playSong(const byte* buf, uint size, uint loops) { _mixer->stopHandle(songHandle); } -void SoundManager::setParent(MortevielleEngine *vm) { - _vm = vm; -} - void SoundManager::spfrac(int wor) { _queue[2]._rep = (uint)wor >> 12; if ((_soundType == 0) && (_queue[2]._code != 9)) { diff --git a/engines/mortevielle/sound.h b/engines/mortevielle/sound.h index cc0567fd98..5321c8946c 100644 --- a/engines/mortevielle/sound.h +++ b/engines/mortevielle/sound.h @@ -84,15 +84,13 @@ private: void litph(tablint &t, int typ, int tempo); public: - SoundManager(Audio::Mixer *mixer); + SoundManager(MortevielleEngine *vm, Audio::Mixer *mixer); ~SoundManager(); Audio::Mixer *_mixer; Audio::SoundHandle _soundHandle; uint16 *_cfiphBuffer; - void setParent(MortevielleEngine *vm); - int decodeMusic(const byte *PSrc, byte *PDest, int size); void playSong(const byte *buf, uint usize, uint loops); void loadAmbiantSounds(); diff --git a/engines/mortevielle/utils.cpp b/engines/mortevielle/utils.cpp index c4f2d5714b..6e0f266f9b 100644 --- a/engines/mortevielle/utils.cpp +++ b/engines/mortevielle/utils.cpp @@ -50,9 +50,9 @@ bool MortevielleEngine::keyPressed() { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } // Delay briefly to keep CPU usage down @@ -92,8 +92,8 @@ bool MortevielleEngine::handleEvents() { case Common::EVENT_LBUTTONUP: case Common::EVENT_MOUSEMOVE: _mousePos = Common::Point(event.mouse.x, event.mouse.y / 2); - _mouse._pos.x = event.mouse.x; - _mouse._pos.y = event.mouse.y / 2; + _mouse->_pos.x = event.mouse.x; + _mouse->_pos.y = event.mouse.y / 2; if (event.type == Common::EVENT_LBUTTONDOWN) _mouseClick = true; @@ -121,8 +121,8 @@ void MortevielleEngine::addKeypress(Common::Event &evt) { // Check for debugger if ((evt.kbd.keycode == Common::KEYCODE_d) && (evt.kbd.flags & Common::KBD_CTRL)) { // Attach to the debugger - _debugger.attach(); - _debugger.onFrame(); + _debugger->attach(); + _debugger->onFrame(); } else if ((evt.kbd.keycode >= Common::KEYCODE_a) && (evt.kbd.keycode <= Common::KEYCODE_z)) { // Handle alphabetic keys if (evt.kbd.hasFlags(Common::KBD_CTRL)) @@ -208,7 +208,7 @@ void MortevielleEngine::initMouse() { CursorMan.replaceCursor(CURSOR_ARROW_DATA, 16, 16, 0, 0, 0xff); CursorMan.showMouse(true); - _mouse.initMouse(); + _mouse->initMouse(); } /** @@ -237,9 +237,9 @@ void MortevielleEngine::delay(int amount) { while (g_system->getMillis() < endTime) { if (g_system->getMillis() > (_lastGameFrame + GAME_FRAME_DELAY)) { _lastGameFrame = g_system->getMillis(); - _screenSurface.updateScreen(); + _screenSurface->updateScreen(); - _debugger.onFrame(); + _debugger->onFrame(); } g_system->delayMillis(10); @@ -261,8 +261,8 @@ void MortevielleEngine::handleAction() { bool handledOpcodeFl = false; _controlMenu = 0; if (!_keyPressedEsc) { - _menu.drawMenu(); - _menu._menuDisplayed = true; + _menu->drawMenu(); + _menu->_menuDisplayed = true; temps = 0; _key = 0; funct = false; @@ -270,28 +270,28 @@ void MortevielleEngine::handleAction() { _inMainGameLoop = true; do { - _menu.updateMenu(); + _menu->updateMenu(); prepareRoom(); - _mouse.moveMouse(funct, inkey); + _mouse->moveMouse(funct, inkey); if (shouldQuit()) return; ++temps; if (keyPressed() || _mouseClick) { - _soundManager._mixer->stopHandle(_soundManager._soundHandle); + _soundManager->_mixer->stopHandle(_soundManager->_soundHandle); } - } while (!((_menu._menuSelected) || (temps > lim) || (funct) || (_anyone))); + } while (!((_menu->_menuSelected) || (temps > lim) || (funct) || (_anyone))); _inMainGameLoop = false; - _menu.eraseMenu(); - _menu._menuDisplayed = false; - if (_menu._menuSelected && (_currMenu == MENU_SAVE)) { + _menu->eraseMenu(); + _menu->_menuDisplayed = false; + if (_menu->_menuSelected && (_currMenu == MENU_SAVE)) { Common::String saveName = Common::String::format("Savegame #%d", _currAction & 15); - _savegameManager.saveGame(_currAction & 15, saveName); + _savegameManager->saveGame(_currAction & 15, saveName); } - if (_menu._menuSelected && (_currMenu == MENU_LOAD)) - _savegameManager.loadGame((_currAction & 15) - 1); + if (_menu->_menuSelected && (_currMenu == MENU_LOAD)) + _savegameManager->loadGame((_currAction & 15) - 1); if (inkey == '\103') { /* F9 */ - temps = _dialogManager.show(_hintPctMessage); + temps = _dialogManager->show(_hintPctMessage); return; } else if (inkey == '\77') { if ((_menuOpcode != OPCODE_NONE) && ((_currMenu == MENU_ACTION) || (_currMenu == MENU_SELF))) { @@ -321,12 +321,12 @@ void MortevielleEngine::handleAction() { _menuOpcode = _currAction; if (!_anyone) { if ((_heroSearching) || (_obpart)) { - if (_mouse._pos.y < 12) + if (_mouse->_pos.y < 12) return; - if ((_currAction == _menu._opcodeSound) || (_currAction == _menu._opcodeLift)) { + if ((_currAction == _menu->_opcodeSound) || (_currAction == _menu->_opcodeLift)) { handledOpcodeFl = true; - if ((_currAction == _menu._opcodeLift) || (_obpart)) { + if ((_currAction == _menu->_opcodeLift) || (_obpart)) { endSearch(); _caff = _coreVar._currPlace; _crep = 998; @@ -341,7 +341,7 @@ void MortevielleEngine::handleAction() { handleOpcode(); if ((_controlMenu == 0) && (! _loseGame) && (! _endGame)) { - _text.taffich(); + _text->taffich(); if (_destinationOk) { _destinationOk = false; drawPicture(); @@ -389,7 +389,7 @@ void MortevielleEngine::setTextColor(int col) { */ void MortevielleEngine::prepareScreenType1() { // Large drawing - _screenSurface.drawBox(0, 11, 512, 164, 15); + _screenSurface->drawBox(0, 11, 512, 164, 15); } /** @@ -500,51 +500,51 @@ void MortevielleEngine::resetPresenceInRooms(int roomId) { * @remarks Originally called 'affper' */ void MortevielleEngine::showPeoplePresent(int bitIndex) { - int xp = 580 - (_screenSurface.getStringWidth("LEO") / 2); + int xp = 580 - (_screenSurface->getStringWidth("LEO") / 2); for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu->disableMenuItem(_menu->_discussMenu[i]); clearUpperRightPart(); if ((bitIndex & 128) == 128) { - _screenSurface.putxy(xp, 24); - _screenSurface.drawString("LEO", 4); - _menu.enableMenuItem(_menu._discussMenu[1]); + _screenSurface->putxy(xp, 24); + _screenSurface->drawString("LEO", 4); + _menu->enableMenuItem(_menu->_discussMenu[1]); } if ((bitIndex & 64) == 64) { - _screenSurface.putxy(xp, 32); - _screenSurface.drawString("PAT", 4); - _menu.enableMenuItem(_menu._discussMenu[2]); + _screenSurface->putxy(xp, 32); + _screenSurface->drawString("PAT", 4); + _menu->enableMenuItem(_menu->_discussMenu[2]); } if ((bitIndex & 32) == 32) { - _screenSurface.putxy(xp, 40); - _screenSurface.drawString("GUY", 4); - _menu.enableMenuItem(_menu._discussMenu[3]); + _screenSurface->putxy(xp, 40); + _screenSurface->drawString("GUY", 4); + _menu->enableMenuItem(_menu->_discussMenu[3]); } if ((bitIndex & 16) == 16) { - _screenSurface.putxy(xp, 48); - _screenSurface.drawString("EVA", 4); - _menu.enableMenuItem(_menu._discussMenu[4]); + _screenSurface->putxy(xp, 48); + _screenSurface->drawString("EVA", 4); + _menu->enableMenuItem(_menu->_discussMenu[4]); } if ((bitIndex & 8) == 8) { - _screenSurface.putxy(xp, 56); - _screenSurface.drawString("BOB", 4); - _menu.enableMenuItem(_menu._discussMenu[5]); + _screenSurface->putxy(xp, 56); + _screenSurface->drawString("BOB", 4); + _menu->enableMenuItem(_menu->_discussMenu[5]); } if ((bitIndex & 4) == 4) { - _screenSurface.putxy(xp, 64); - _screenSurface.drawString("LUC", 4); - _menu.enableMenuItem(_menu._discussMenu[6]); + _screenSurface->putxy(xp, 64); + _screenSurface->drawString("LUC", 4); + _menu->enableMenuItem(_menu->_discussMenu[6]); } if ((bitIndex & 2) == 2) { - _screenSurface.putxy(xp, 72); - _screenSurface.drawString("IDA", 4); - _menu.enableMenuItem(_menu._discussMenu[7]); + _screenSurface->putxy(xp, 72); + _screenSurface->drawString("IDA", 4); + _menu->enableMenuItem(_menu->_discussMenu[7]); } if ((bitIndex & 1) == 1) { - _screenSurface.putxy(xp, 80); - _screenSurface.drawString("MAX", 4); - _menu.enableMenuItem(_menu._discussMenu[8]); + _screenSurface->putxy(xp, 80); + _screenSurface->drawString("MAX", 4); + _menu->enableMenuItem(_menu->_discussMenu[8]); } _currBitIndex = bitIndex; } @@ -605,7 +605,7 @@ int MortevielleEngine::getPresenceStatsGreenRoom() { else if ((hour >= 0) && (hour < 8)) retVal = 70; - _menu.updateMenu(); + _menu->updateMenu(); return retVal; } @@ -698,19 +698,19 @@ int MortevielleEngine::getPresenceStatsRedRoom() { */ void MortevielleEngine::displayAloneText() { for (int i = 1; i <= 8; ++i) - _menu.disableMenuItem(_menu._discussMenu[i]); + _menu->disableMenuItem(_menu->_discussMenu[i]); Common::String sYou = getEngineString(S_YOU); Common::String sAre = getEngineString(S_ARE); Common::String sAlone = getEngineString(S_ALONE); clearUpperRightPart(); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sYou) / 2), 30); - _screenSurface.drawString(sYou, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAre) / 2), 50); - _screenSurface.drawString(sAre, 4); - _screenSurface.putxy(580 - (_screenSurface.getStringWidth(sAlone) / 2), 70); - _screenSurface.drawString(sAlone, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sYou) / 2), 30); + _screenSurface->drawString(sYou, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAre) / 2), 50); + _screenSurface->drawString(sAre, 4); + _screenSurface->putxy(580 - (_screenSurface->getStringWidth(sAlone) / 2), 70); + _screenSurface->drawString(sAlone, 4); _currBitIndex = 0; } @@ -1255,24 +1255,24 @@ void MortevielleEngine::startMusicOrSpeech(int so) { ; } else if ((!_introSpeechPlayed) && (!_coreVar._alreadyEnteredManor)) { // Type 1: Speech - _soundManager.startSpeech(10, 1, 1); + _soundManager->startSpeech(10, 1, 1); _introSpeechPlayed = true; } else { if (((_coreVar._currPlace == MOUNTAIN) || (_coreVar._currPlace == MANOR_FRONT) || (_coreVar._currPlace == MANOR_BACK)) && (getRandomNumber(1, 3) == 2)) // Type 1: Speech - _soundManager.startSpeech(9, getRandomNumber(2, 4), 1); + _soundManager->startSpeech(9, getRandomNumber(2, 4), 1); else if ((_coreVar._currPlace == CHAPEL) && (getRandomNumber(1, 2) == 1)) // Type 1: Speech - _soundManager.startSpeech(8, 1, 1); + _soundManager->startSpeech(8, 1, 1); else if ((_coreVar._currPlace == WELL) && (getRandomNumber(1, 2) == 2)) // Type 1: Speech - _soundManager.startSpeech(12, 1, 1); + _soundManager->startSpeech(12, 1, 1); else if (_coreVar._currPlace == INSIDE_WELL) // Type 1: Speech - _soundManager.startSpeech(13, 1, 1); + _soundManager->startSpeech(13, 1, 1); else // Type 2 : music - _soundManager.startSpeech(getRandomNumber(1, 17), 1, 2); + _soundManager->startSpeech(getRandomNumber(1, 17), 1, 2); } } @@ -1284,13 +1284,13 @@ void MortevielleEngine::loseGame() { resetOpenObjects(); _roomDoorId = OWN_ROOM; _curSearchObjId = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); if (!_blo) getPresence(MANOR_FRONT); _loseGame = true; clearUpperLeftPart(); - _screenSurface.drawBox(60, 35, 400, 50, 15); + _screenSurface->drawBox(60, 35, 400, 50, 15); handleDescriptionText(9, _crep); clearDescriptionBar(); clearVerbBar(); @@ -1333,20 +1333,20 @@ void MortevielleEngine::startDialog(int16 rep) { assert(rep >= 0); - _mouse.hideMouse(); + _mouse->hideMouse(); Common::String dialogStr = getString(rep + kDialogStringIndex); - _text.displayStr(dialogStr, 230, 4, 65, 26, 5); - _dialogManager.drawF3F8(); + _text->displayStr(dialogStr, 230, 4, 65, 26, 5); + _dialogManager->drawF3F8(); key = 0; do { - _soundManager.startSpeech(rep, haut[_caff - 69], 0); - key = _dialogManager.waitForF3F8(); + _soundManager->startSpeech(rep, haut[_caff - 69], 0); + key = _dialogManager->waitForF3F8(); if (shouldQuit()) return; } while (key != 66); clearScreen(); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1357,7 +1357,7 @@ void MortevielleEngine::endSearch() { _heroSearching = false; _obpart = false; _searchCount = 0; - _menu.unsetSearchMenu(); + _menu->unsetSearchMenu(); } /** @@ -1379,17 +1379,17 @@ void MortevielleEngine::gotoDiningRoom() { showPeoplePresent(_currBitIndex); _caff = 77; drawPictureWithText(); - _screenSurface.drawBox(223, 47, 155, 92, 15); + _screenSurface->drawBox(223, 47, 155, 92, 15); handleDescriptionText(2, 33); testKey(false); menuUp(); - _mouse.hideMouse(); + _mouse->hideMouse(); clearScreen(); drawDiscussionBox(); startDialog(140); drawRightFrame(); drawClock(); - _mouse.showMouse(); + _mouse->showMouse(); _coreVar._currPlace = OWN_ROOM; prepareDisplayText(); resetPresenceInRooms(DINING_ROOM); @@ -1451,8 +1451,8 @@ void MortevielleEngine::floodedInWell() { * @remarks Originally called 'antegame' */ void MortevielleEngine::gameLoaded() { - _mouse.hideMouse(); - _menu._menuDisplayed = false; + _mouse->hideMouse(); + _menu->_menuDisplayed = false; _loseGame = true; _anyone = false; _destinationOk = true; @@ -1490,11 +1490,11 @@ void MortevielleEngine::gameLoaded() { handleDescriptionText(2, _crep); clearVerbBar(); _endGame = false; - _menu.setDestinationText(_coreVar._currPlace); - _menu.setInventoryText(); + _menu->setDestinationText(_coreVar._currPlace); + _menu->setInventoryText(); if (_coreVar._selectedObjectId != 0) displayItemInHand(_coreVar._selectedObjectId + 400); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1508,7 +1508,7 @@ void MortevielleEngine::handleOpcode() { _keyPressedEsc = false; if (!_anyone) { if (_uptodatePresence) { - if ((_currMenu == MENU_MOVE) || (_currAction == _menu._opcodeLeave) || (_currAction == _menu._opcodeSleep) || (_currAction == _menu._opcodeEat)) { + if ((_currMenu == MENU_MOVE) || (_currAction == _menu->_opcodeLeave) || (_currAction == _menu->_opcodeSleep) || (_currAction == _menu->_opcodeEat)) { _controlMenu = 4; menuUp(); return; @@ -1521,60 +1521,60 @@ void MortevielleEngine::handleOpcode() { fctDiscuss(); else if (_currMenu == MENU_INVENTORY) fctInventoryTake(); - else if (_currAction == _menu._opcodeAttach) + else if (_currAction == _menu->_opcodeAttach) fctAttach(); - else if (_currAction == _menu._opcodeWait) + else if (_currAction == _menu->_opcodeWait) fctWait(); - else if (_currAction == _menu._opcodeForce) + else if (_currAction == _menu->_opcodeForce) fctForce(); - else if (_currAction == _menu._opcodeSleep) + else if (_currAction == _menu->_opcodeSleep) fctSleep(); - else if (_currAction == _menu._opcodeListen) + else if (_currAction == _menu->_opcodeListen) fctListen(); - else if (_currAction == _menu._opcodeEnter) + else if (_currAction == _menu->_opcodeEnter) fctEnter(); - else if (_currAction == _menu._opcodeClose) + else if (_currAction == _menu->_opcodeClose) fctClose(); - else if (_currAction == _menu._opcodeSearch) + else if (_currAction == _menu->_opcodeSearch) fctSearch(); - else if (_currAction == _menu._opcodeKnock) + else if (_currAction == _menu->_opcodeKnock) fctKnock(); - else if (_currAction == _menu._opcodeScratch) + else if (_currAction == _menu->_opcodeScratch) fctScratch(); - else if (_currAction == _menu._opcodeRead) + else if (_currAction == _menu->_opcodeRead) fctRead(); - else if (_currAction == _menu._opcodeEat) + else if (_currAction == _menu->_opcodeEat) fctEat(); - else if (_currAction == _menu._opcodePlace) + else if (_currAction == _menu->_opcodePlace) fctPlace(); - else if (_currAction == _menu._opcodeOpen) + else if (_currAction == _menu->_opcodeOpen) fctOpen(); - else if (_currAction == _menu._opcodeTake) + else if (_currAction == _menu->_opcodeTake) fctTake(); - else if (_currAction == _menu._opcodeLook) + else if (_currAction == _menu->_opcodeLook) fctLook(); - else if (_currAction == _menu._opcodeSmell) + else if (_currAction == _menu->_opcodeSmell) fctSmell(); - else if (_currAction == _menu._opcodeSound) + else if (_currAction == _menu->_opcodeSound) fctSound(); - else if (_currAction == _menu._opcodeLeave) + else if (_currAction == _menu->_opcodeLeave) fctLeave(); - else if (_currAction == _menu._opcodeLift) + else if (_currAction == _menu->_opcodeLift) fctLift(); - else if (_currAction == _menu._opcodeTurn) + else if (_currAction == _menu->_opcodeTurn) fctTurn(); - else if (_currAction == _menu._opcodeSSearch) + else if (_currAction == _menu->_opcodeSSearch) fctSelfSearch(); - else if (_currAction == _menu._opcodeSRead) + else if (_currAction == _menu->_opcodeSRead) fctSelfRead(); - else if (_currAction == _menu._opcodeSPut) + else if (_currAction == _menu->_opcodeSPut) fctSelfPut(); - else if (_currAction == _menu._opcodeSLook) + else if (_currAction == _menu->_opcodeSLook) fctSelftLook(); _hiddenHero = false; - if (_currAction == _menu._opcodeSHide) + if (_currAction == _menu->_opcodeSHide) fctSelfHide(); } else if (_anyone) { interactNPC(); @@ -1640,9 +1640,9 @@ void MortevielleEngine::charToHour() { * @remarks Originally called 'clsf1' */ void MortevielleEngine::clearUpperLeftPart() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(0, 11, 514, 175)); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->fillRect(0, Common::Rect(0, 11, 514, 175)); + _mouse->showMouse(); } /** @@ -1650,16 +1650,16 @@ void MortevielleEngine::clearUpperLeftPart() { * @remarks Originally called 'clsf2' */ void MortevielleEngine::clearDescriptionBar() { - _mouse.hideMouse(); + _mouse->hideMouse(); if (_largestClearScreen) { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 199)); - _screenSurface.drawBox(0, 176, 634, 23, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 199)); + _screenSurface->drawBox(0, 176, 634, 23, 15); _largestClearScreen = false; } else { - _screenSurface.fillRect(0, Common::Rect(1, 176, 633, 190)); - _screenSurface.drawBox(0, 176, 634, 14, 15); + _screenSurface->fillRect(0, Common::Rect(1, 176, 633, 190)); + _screenSurface->drawBox(0, 176, 634, 14, 15); } - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -1667,10 +1667,10 @@ void MortevielleEngine::clearDescriptionBar() { * @remarks Originally called 'clsf3' */ void MortevielleEngine::clearVerbBar() { - _mouse.hideMouse(); - _screenSurface.fillRect(0, Common::Rect(1, 192, 633, 199)); - _screenSurface.drawBox(0, 191, 634, 8, 15); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->fillRect(0, Common::Rect(1, 192, 633, 199)); + _screenSurface->drawBox(0, 191, 634, 8, 15); + _mouse->showMouse(); } /** @@ -1680,10 +1680,10 @@ void MortevielleEngine::clearVerbBar() { void MortevielleEngine::clearUpperRightPart() { Common::String st; - _mouse.hideMouse(); + _mouse->hideMouse(); // Clear ambiance description - _screenSurface.fillRect(15, Common::Rect(544, 93, 600, 98)); + _screenSurface->fillRect(15, Common::Rect(544, 93, 600, 98)); if (_coreVar._faithScore < 33) st = getEngineString(S_COOL); else if (_coreVar._faithScore < 66) @@ -1691,13 +1691,13 @@ void MortevielleEngine::clearUpperRightPart() { else if (_coreVar._faithScore > 65) st = getEngineString(S_MALSAINE); - int x1 = 580 - (_screenSurface.getStringWidth(st) / 2); - _screenSurface.putxy(x1, 92); - _screenSurface.drawString(st, 4); + int x1 = 580 - (_screenSurface->getStringWidth(st) / 2); + _screenSurface->putxy(x1, 92); + _screenSurface->drawString(st, 4); // Clear person list - _screenSurface.fillRect(15, Common::Rect(560, 24, 610, 86)); - _mouse.showMouse(); + _screenSurface->fillRect(15, Common::Rect(560, 24, 610, 86)); + _mouse->showMouse(); } /** @@ -1713,7 +1713,7 @@ int MortevielleEngine::getRandomNumber(int minval, int maxval) { * @remarks Originally called 'aldepl' */ void MortevielleEngine::showMoveMenuAlert() { - _dialogManager.show(getEngineString(S_USE_DEP_MENU)); + _dialogManager->show(getEngineString(S_USE_DEP_MENU)); } /** @@ -2074,10 +2074,10 @@ void MortevielleEngine::loadCFIPH() { error("Missing file - *cfiph.mor"); } - _soundManager._cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); + _soundManager->_cfiphBuffer = (uint16 *)malloc(sizeof(uint16) * (f.size() / 2)); for (int i = 0; i < (f.size() / 2); ++i) - _soundManager._cfiphBuffer[i] = f.readUint16BE(); + _soundManager->_cfiphBuffer[i] = f.readUint16BE(); f.close(); } @@ -2102,10 +2102,10 @@ void MortevielleEngine::music() { f.read(compMusicBuf, size); f.close(); - int musicSize = _soundManager.decodeMusic(compMusicBuf, musicBuf, size); + int musicSize = _soundManager->decodeMusic(compMusicBuf, musicBuf, size); free(compMusicBuf); - _soundManager.playSong(musicBuf, musicSize, 5); + _soundManager->playSong(musicBuf, musicSize, 5); while (keyPressed()) getChar(); @@ -2120,14 +2120,14 @@ void MortevielleEngine::showTitleScreen() { clearScreen(); handleDescriptionText(7, 2035); _caff = 51; - _text.taffich(); + _text->taffich(); testKeyboard(); clearScreen(); draw(0, 0); Common::String cpr = "COPYRIGHT 1989 : LANKHOR"; - _screenSurface.putxy(104 + 72 * kResolutionScaler, 185); - _screenSurface.drawString(cpr, 0); + _screenSurface->putxy(104 + 72 * kResolutionScaler, 185); + _screenSurface->drawString(cpr, 0); } /** @@ -2135,10 +2135,10 @@ void MortevielleEngine::showTitleScreen() { * @remarks Originally called 'dessine' */ void MortevielleEngine::draw(int x, int y) { - _mouse.hideMouse(); + _mouse->hideMouse(); setPal(_numpal); displayPicture(_curPict, x, y); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -2147,9 +2147,9 @@ void MortevielleEngine::draw(int x, int y) { */ void MortevielleEngine::drawRightFrame() { setPal(89); - _mouse.hideMouse(); + _mouse->hideMouse(); displayPicture(_rightFramePict, 0, 0); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -2205,7 +2205,7 @@ void MortevielleEngine::prepareRoom() { _minute = 30; drawClock(); } - if (_mouse._pos.y < 12) + if (_mouse->_pos.y < 12) return; if (!_blo) { @@ -2221,8 +2221,8 @@ void MortevielleEngine::prepareRoom() { int newTime = readclock(); if ((newTime - _currentTime) > _inGameHourDuration) { - bool activeMenu = _menu._menuActive; - _menu.eraseMenu(); + bool activeMenu = _menu->_menuActive; + _menu->eraseMenu(); _currentHourCount += ((newTime - _currentTime) / _inGameHourDuration); _currentTime = newTime; switch (_place) { @@ -2280,8 +2280,8 @@ void MortevielleEngine::prepareRoom() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_HEAR_NOISE)); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(1, rand, 1); - _soundManager.waitSpeech(); + _soundManager->startSpeech(1, rand, 1); + _soundManager->waitSpeech(); clearVerbBar(); } } @@ -2289,7 +2289,7 @@ void MortevielleEngine::prepareRoom() { } if (activeMenu) - _menu.drawMenu(); + _menu->drawMenu(); } } _endTime = readclock(); @@ -2315,15 +2315,15 @@ void MortevielleEngine::drawClock() { const int y = 123; const int rg = 9; - _mouse.hideMouse(); + _mouse->hideMouse(); - _screenSurface.drawRectangle(570, 118, 20, 10); - _screenSurface.drawRectangle(578, 114, 6, 18); + _screenSurface->drawRectangle(570, 118, 20, 10); + _screenSurface->drawRectangle(578, 114, 6, 18); if (_minute == 0) - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y - rg), 1); else - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)x >> 1) * kResolutionScaler, (y + rg), 1); int hour12 = _hour; if (hour12 > 12) @@ -2331,20 +2331,20 @@ void MortevielleEngine::drawClock() { if (hour12 == 0) hour12 = 12; - _screenSurface.drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); - _mouse.showMouse(); - _screenSurface.putxy(568, 154); + _screenSurface->drawLine(((uint)x >> 1) * kResolutionScaler, y, ((uint)(x + cv[0][hour12 - 1]) >> 1) * kResolutionScaler, y + cv[1][hour12 - 1], 1); + _mouse->showMouse(); + _screenSurface->putxy(568, 154); if (_hour > 11) - _screenSurface.drawString("PM ", 1); + _screenSurface->drawString("PM ", 1); else - _screenSurface.drawString("AM ", 1); + _screenSurface->drawString("AM ", 1); - _screenSurface.putxy(550, 160); + _screenSurface->putxy(550, 160); if ((_day >= 0) && (_day <= 8)) { Common::String tmp = getEngineString(S_DAY); tmp.insertChar((char)(_day + 49), 0); - _screenSurface.drawString(tmp, 1); + _screenSurface->drawString(tmp, 1); } } @@ -2376,7 +2376,7 @@ Common::String MortevielleEngine::copy(const Common::String &s, int idx, size_t * @remarks Originally called 'hirs' */ void MortevielleEngine::clearScreen() { - _screenSurface.clearScreen(); + _screenSurface->clearScreen(); } /** @@ -2391,8 +2391,8 @@ void MortevielleEngine::initCaveOrCellar() { prepareScreenType2(); displayTextInVerbBar(getEngineString(S_SOMEONE_ENTERS)); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(2, rand, 1); - _soundManager.waitSpeech(); + _soundManager->startSpeech(2, rand, 1); + _soundManager->waitSpeech(); // The original was doing here a useless loop. // It has been removed @@ -2416,7 +2416,7 @@ void MortevielleEngine::displayControlMenu() { void MortevielleEngine::displayPicture(const byte *pic, int x, int y) { GfxSurface surface; surface.decode(pic); - _screenSurface.drawPicture(surface, x, y); + _screenSurface->drawPicture(surface, x, y); } void MortevielleEngine::adzon() { @@ -2465,7 +2465,7 @@ void MortevielleEngine::displayTextInDescriptionBar(int x, int y, int nb, int me Common::String tmpStr = getString(mesgId); if ((y == 182) && ((int) tmpStr.size() > nb)) y = 176; - _text.displayStr(tmpStr, x, y, nb, 20, _textColor); + _text->displayStr(tmpStr, x, y, nb, 20, _textColor); } /** @@ -2482,7 +2482,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { _largestClearScreen = false; clearDescriptionBar(); - _text.displayStr(tmpStr, 8, 176, 85, 3, 5); + _text->displayStr(tmpStr, 8, 176, 85, 3, 5); } else { mapMessageId(mesgId); switch (f) { @@ -2511,7 +2511,7 @@ void MortevielleEngine::handleDescriptionText(int f, int mesgId) { i = 5; Common::String tmpStr = getString(mesgId); - _text.displayStr(tmpStr, 80, 40, 60, 25, i); + _text->displayStr(tmpStr, 80, 40, 60, 25, i); if (mesgId == 180) _coreVar._pctHintFound[6] = '*'; @@ -2584,32 +2584,32 @@ void MortevielleEngine::resetOpenObjects() { */ void MortevielleEngine::displayTextBlock(Common::String text) { // Some dead code was present in the original: removed - _screenSurface.putxy(8, 177); + _screenSurface->putxy(8, 177); int tlig = 59 + (kResolutionScaler - 1) * 36; if ((int)text.size() < tlig) - _screenSurface.drawString(text, 5); + _screenSurface->drawString(text, 5); else if ((int)text.size() < (tlig << 1)) { - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, tlig << 1), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, tlig << 1), 5); } else { _largestClearScreen = true; clearDescriptionBar(); - _screenSurface.putxy(8, 176); - _screenSurface.drawString(copy(text, 1, (tlig - 1)), 5); - _screenSurface.putxy(8, 182); - _screenSurface.drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); - _screenSurface.putxy(8, 190); - _screenSurface.drawString(copy(text, tlig << 1, tlig * 3), 5); + _screenSurface->putxy(8, 176); + _screenSurface->drawString(copy(text, 1, (tlig - 1)), 5); + _screenSurface->putxy(8, 182); + _screenSurface->drawString(copy(text, tlig, ((tlig << 1) - 1)), 5); + _screenSurface->putxy(8, 190); + _screenSurface->drawString(copy(text, tlig << 1, tlig * 3), 5); } } void MortevielleEngine::displayTextInVerbBar(Common::String text) { clearVerbBar(); - _screenSurface.putxy(8, 192); - _screenSurface.drawString(text, 5); + _screenSurface->putxy(8, 192); + _screenSurface->drawString(text, 5); } /** @@ -2622,8 +2622,8 @@ void MortevielleEngine::displayItemInHand(int objId) { if (objId != 500) strp = getString(objId - 501 + kInventoryStringIndex); - _menu.setText(_menu._inventoryMenu[8], strp); - _menu.disableMenuItem(_menu._inventoryMenu[8]); + _menu->setText(_menu->_inventoryMenu[8], strp); + _menu->disableMenuItem(_menu->_inventoryMenu[8]); } /** @@ -2831,7 +2831,7 @@ int MortevielleEngine::getPresence(int roomId) { * @remarks Originally called 'writetp' */ void MortevielleEngine::displayQuestionText(Common::String s, int cmd) { - _screenSurface.drawString(s, cmd); + _screenSurface->drawString(s, cmd); } /** @@ -2855,7 +2855,7 @@ void MortevielleEngine::displayAnimFrame(int frameNum, int animId) { GfxSurface surface; surface.decode(&_curAnim[offset]); - _screenSurface.drawPicture(surface, 0, 12); + _screenSurface->drawPicture(surface, 0, 12); prepareScreenType1(); } @@ -2868,10 +2868,10 @@ void MortevielleEngine::drawPicture() { clearUpperLeftPart(); if (_caff > 99) { draw(60, 33); - _screenSurface.drawBox(118, 32, 291, 122, 15); // Medium box + _screenSurface->drawBox(118, 32, 291, 122, 15); // Medium box } else if (_caff > 69) { draw(112, 48); // Heads - _screenSurface.drawBox(222, 47, 155, 92, 15); + _screenSurface->drawBox(222, 47, 155, 92, 15); } else { draw(0, 12); prepareScreenType1(); @@ -2910,7 +2910,7 @@ void MortevielleEngine::drawPicture() { } void MortevielleEngine::drawPictureWithText() { - _text.taffich(); + _text->taffich(); drawPicture(); _destinationOk = false; } @@ -2924,7 +2924,7 @@ void MortevielleEngine::testKey(bool d) { int x, y; bool click; - _mouse.hideMouse(); + _mouse->hideMouse(); displayStatusInDescriptionBar('K'); // Wait for release from any key or mouse button @@ -2932,7 +2932,7 @@ void MortevielleEngine::testKey(bool d) { _key = gettKeyPressed(); do { - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); quest = keyPressed(); if (quest && shouldQuit()) return; @@ -2943,14 +2943,14 @@ void MortevielleEngine::testKey(bool d) { if (d) prepareRoom(); quest = keyPressed(); - _mouse.getMousePosition(x, y, click); + _mouse->getMousePosition(x, y, click); if (shouldQuit()) return; } while (!(quest || (click) || (d && _anyone))); if (quest) gettKeyPressed(); setMouseClick(false); - _mouse.showMouse(); + _mouse->showMouse(); } /** @@ -3061,7 +3061,7 @@ void MortevielleEngine::getSearchDescription(int objId) { * @remarks Originally called 'mennor' */ void MortevielleEngine::menuUp() { - _menu.menuUp(_currMenu); + _menu->menuUp(_currMenu); } /** @@ -3070,7 +3070,7 @@ void MortevielleEngine::menuUp() { */ void MortevielleEngine::drawDiscussionBox() { draw(10, 80); - _screenSurface.drawBox(18, 79, 155, 92, 15); + _screenSurface->drawBox(18, 79, 155, 92, 15); } /** @@ -3101,7 +3101,7 @@ void MortevielleEngine::addObjectToInventory(int objectId) { if (_coreVar._inventory[i] == 0) { _coreVar._inventory[i] = objectId; - _menu.setInventoryText(); + _menu->setInventoryText(); } else // Inventory is full _crep = 139; @@ -3112,8 +3112,8 @@ void MortevielleEngine::addObjectToInventory(int objectId) { * @remarks Originally called 'quelquun' */ void MortevielleEngine::interactNPC() { - if (_menu._menuDisplayed) - _menu.eraseMenu(); + if (_menu->_menuDisplayed) + _menu->eraseMenu(); endSearch(); _crep = 997; @@ -3123,9 +3123,9 @@ L1: _crep = 138; handleDescriptionText(2, _crep); if (_crep == 138) - _soundManager.startSpeech(5, 2, 1); + _soundManager->startSpeech(5, 2, 1); else - _soundManager.startSpeech(4, 4, 1); + _soundManager->startSpeech(4, 4, 1); if (_openObjCount == 0) _coreVar._faithScore += 2; @@ -3134,12 +3134,12 @@ L1: else _coreVar._faithScore += 3 * (_coreVar._faithScore / 10); exitRoom(); - _menu.setDestinationText(LANDING); + _menu->setDestinationText(LANDING); int charIdx = convertBitIndexToCharacterIndex(_currBitIndex); _caff = 69 + charIdx; _crep = _caff; _currMenu = MENU_DISCUSS; - _currAction = (_menu._discussMenu[charIdx]._menuId << 8) | _menu._discussMenu[charIdx]._actionId; + _currAction = (_menu->_discussMenu[charIdx]._menuId << 8) | _menu->_discussMenu[charIdx]._actionId; _syn = true; _col = true; } else { @@ -3150,15 +3150,15 @@ L1: } else { handleDescriptionText(2, 136); int rand = (getRandomNumber(0, 4)) - 2; - _soundManager.startSpeech(3, rand, 1); + _soundManager->startSpeech(3, rand, 1); clearDescriptionBar(); displayAloneText(); resetRoomVariables(MANOR_FRONT); prepareDisplayText(); } } - if (_menu._menuDisplayed) - _menu.drawMenu(); + if (_menu->_menuDisplayed) + _menu->drawMenu(); } /** @@ -3206,25 +3206,25 @@ void MortevielleEngine::displayStatusArrow() { touch = '\0'; do { - _mouse.moveMouse(qust, touch); + _mouse->moveMouse(qust, touch); if (shouldQuit()) return; if (getMouseClick()) - inRect = (_mouse._pos.x < 256 * kResolutionScaler) && (_mouse._pos.y < 176) && (_mouse._pos.y > 12); + inRect = (_mouse->_pos.x < 256 * kResolutionScaler) && (_mouse->_pos.y < 176) && (_mouse->_pos.y > 12); prepareRoom(); } while (!(qust || inRect || _anyone)); if (qust && (touch == '\103')) - _dialogManager.show(_hintPctMessage); + _dialogManager->show(_hintPctMessage); } while (!((touch == '\73') || ((touch == '\104') && (_x != 0) && (_y != 0)) || (_anyone) || (inRect))); if (touch == '\73') _keyPressedEsc = true; if (inRect) { - _x = _mouse._pos.x; - _y = _mouse._pos.y; + _x = _mouse->_pos.x; + _y = _mouse->_pos.y; } } @@ -3292,7 +3292,7 @@ void MortevielleEngine::displayLookScreen(int objId) { int mdes = _caff; _caff = objId; - if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu._opcodeSLook)) { + if (((_caff > 29) && (_caff < 33)) || (_caff == 144) || (_caff == 147) || (_caff == 149) || (_currAction == _menu->_opcodeSLook)) { drawPictureWithText(); if ((_caff > 29) && (_caff < 33)) handleDescriptionText(2, _caff); @@ -3305,7 +3305,7 @@ void MortevielleEngine::displayLookScreen(int objId) { } else { _obpart = true; _crep = _caff + 400; - _menu.setSearchMenu(); + _menu->setSearchMenu(); } } @@ -3357,10 +3357,10 @@ int MortevielleEngine::checkLeaveSecretPassage() { * @remarks Originally called 'fenat' */ void MortevielleEngine::displayStatusInDescriptionBar(char stat) { - _mouse.hideMouse(); - _screenSurface.writeCharacter(Common::Point(306, 193), stat, 12); - _screenSurface.drawBox(300, 191, 16, 8, 15); - _mouse.showMouse(); + _mouse->hideMouse(); + _screenSurface->writeCharacter(Common::Point(306, 193), stat, 12); + _screenSurface->drawBox(300, 191, 16, 8, 15); + _mouse->showMouse(); } /** diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 31eee4da55..5e9981caa6 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -79,7 +79,7 @@ GameModule::GameModule(NeverhoodEngine *vm) _mainMenuRequested(false) { // Other initializations moved to actual engine class - _vm->_soundMan->playSoundThree(0x002D0031, 0x8861079); + _vm->_soundMan->playSoundThree(0x002D0031, 0x08861079); SetMessageHandler(&GameModule::handleMessage); } @@ -95,7 +95,7 @@ void GameModule::handleMouseMove(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseMove(%d, %d)", x, y); - sendPointMessage(_childObject, 0, mousePos); + sendPointMessage(_childObject, NM_MOUSE_MOVE, mousePos); } } @@ -115,7 +115,19 @@ void GameModule::handleMouseUp(int16 x, int16 y) { mousePos.x = x; mousePos.y = y; debug(2, "GameModule::handleMouseUp(%d, %d)", x, y); - sendPointMessage(_childObject, 0x0002, mousePos); + sendPointMessage(_childObject, NM_MOUSE_RELEASE, mousePos); + } +} + +void GameModule::handleWheelUp() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELUP, 0); + } +} + +void GameModule::handleWheelDown() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELDOWN, 0); } } @@ -415,6 +427,8 @@ void GameModule::checkRequests() { _vm->_audioResourceMan->stopAllSounds(); _vm->_soundMan->stopAllMusic(); _vm->_soundMan->stopAllSounds(); + // Reinsert turning sound because SoundMan::stopAllSounds() removes it + _vm->_soundMan->playSoundThree(0x002D0031, 0x08861079); delete _childObject; delete _prevChildObject; _childObject = NULL; diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 2f2fecf463..198f8f6715 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -40,6 +40,8 @@ public: void handleMouseMove(int16 x, int16 y); void handleMouseDown(int16 x, int16 y); void handleMouseUp(int16 x, int16 y); + void handleWheelUp(); + void handleWheelDown(); void handleSpaceKey(); void handleAsciiKey(char key); void handleKeyDown(Common::KeyCode keyCode); diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp index 490959020f..e976844c16 100644 --- a/engines/neverhood/graphics.cpp +++ b/engines/neverhood/graphics.cpp @@ -299,11 +299,11 @@ void unpackSpriteRle(const byte *source, int width, int height, byte *dest, int } source += copy; } - dest += destPitch; if (replaceColors) for (int xc = 0; xc < width; xc++) if (dest[xc] == oldColor) dest[xc] = newColor; + dest += destPitch; } } rows = READ_LE_UINT16(source); diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index cf634d7d42..b332418cf5 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -412,7 +412,6 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb _ticksTime = _vm->_system->getMillis() + 202100; - _vm->toggleSoundUpdate(true); _musicResource = new MusicResource(_vm); _musicResource->load(0x30812225); _musicResource->play(0); @@ -422,7 +421,6 @@ CreditsScene::CreditsScene(NeverhoodEngine *vm, Module *parentModule, bool canAb CreditsScene::~CreditsScene() { _musicResource->unload(); delete _musicResource; - _vm->toggleSoundUpdate(false); } void CreditsScene::update() { @@ -1027,6 +1025,12 @@ uint32 GameStateMenu::handleMessage(int messageNum, const MessageParam ¶m, E break; } break; + case NM_MOUSE_WHEELUP: + _listBox->scrollUp(); + break; + case NM_MOUSE_WHEELDOWN: + _listBox->scrollDown(); + break; } return 0; } @@ -1079,7 +1083,7 @@ static const NRect kLoadGameMenuButtonCollisionBounds[] = { { 182, 358, 241, 433 } }; -static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kLoadGameMenuListBoxRect = { 0, 0, 320, 272 }; static const NRect kLoadGameMenuTextEditRect = { 0, 0, 320, 17 }; static const NRect kLoadGameMenuMouseRect = { 263, 48, 583, 65 }; @@ -1112,7 +1116,7 @@ static const NRect kDeleteGameMenuButtonCollisionBounds[] = { { 395, 278, 452, 372 } }; -static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 271 }; +static const NRect kDeleteGameMenuListBoxRect = { 0, 0, 320, 272 }; static const NRect kDeleteGameMenuTextEditRect = { 0, 0, 320, 17 }; DeleteGameMenu::DeleteGameMenu(NeverhoodEngine *vm, Module *parentModule, SavegameList *savegameList) diff --git a/engines/neverhood/messages.h b/engines/neverhood/messages.h index 7f165787bf..5f1e1b87dd 100644 --- a/engines/neverhood/messages.h +++ b/engines/neverhood/messages.h @@ -28,6 +28,7 @@ namespace Neverhood { enum NeverhoodMessage { NM_MOUSE_MOVE = 0x0000, NM_MOUSE_CLICK = 0x0001, + NM_MOUSE_RELEASE = 0x0002, NM_MOUSE_HIDE = 0x101D, NM_MOUSE_SHOW = 0x101E, NM_KEYPRESS_SPACE = 0x0009, @@ -56,15 +57,19 @@ enum NeverhoodMessage { NM_KLAYMEN_CLOSE_DOOR = 0x4809, NM_KLAYMEN_MOVE_OBJECT = 0x480A, NM_KLAYMEN_LOWER_LEVER = 0x480F, - NM_KLAYMEN_PICKUP = 0x4812, - NM_KLAYMEN_PRESS_BUTTON = 0x4816, - NM_KLAYMEN_INSERT_DISK = 0x481A, + NM_KLAYMEN_PICKUP = 0x4812, + NM_KLAYMEN_PRESS_BUTTON = 0x4816, + NM_KLAYMEN_INSERT_DISK = 0x481A, NM_KLAYMEN_TURN_TO_USE = 0x481D, NM_KLAYMEN_RETURN_FROM_USE = 0x481E, - NM_KLAYMEN_RELEASE_LEVER = 0x4827, + NM_KLAYMEN_RELEASE_LEVER = 0x4827, NM_MOVE_TO_BACK = 0x482A, - NM_MOVE_TO_FRONT = 0x482B + NM_MOVE_TO_FRONT = 0x482B, + + // New to ScummVM + NM_MOUSE_WHEELUP = 0xF000, + NM_MOUSE_WHEELDOWN = 0xF001 }; } // End of namespace Neverhood diff --git a/engines/neverhood/module.cpp b/engines/neverhood/module.cpp index d1578e680c..3ef4554334 100644 --- a/engines/neverhood/module.cpp +++ b/engines/neverhood/module.cpp @@ -48,7 +48,7 @@ void Module::draw() { uint32 Module::handleMessage(int messageNum, const MessageParam ¶m, Entity *sender) { switch (messageNum) { case 0x0008: - sendMessage(_parentModule, 8, 0); + sendMessage(_parentModule, 0x0008, 0); return 0; case 0x1009: _moduleResult = param.asInteger(); diff --git a/engines/neverhood/modules/module1600.cpp b/engines/neverhood/modules/module1600.cpp index d66d5c1b8e..76c5ca93d2 100644 --- a/engines/neverhood/modules/module1600.cpp +++ b/engines/neverhood/modules/module1600.cpp @@ -307,7 +307,7 @@ Scene1608::Scene1608(NeverhoodEngine *vm, Module *parentModule, int which) _clipRect2 = _clipRect1; _clipRect2.y2 = 215; _kmScene1608->setClipRect(_clipRect1); - _asCar->setClipRect(_clipRect1); + _asCar->setClipRect(_clipRect3); _asIdleCarLower->setClipRect(_clipRect1); _asIdleCarFull->setClipRect(_clipRect1); _asTape = insertSprite<AsScene1201Tape>(this, 13, 1100, 412, 443, 0x9148A011); @@ -401,7 +401,7 @@ void Scene1608::upRidingCar() { sendPointMessage(_asCar, 0x2004, _mouseClickPos); _mouseClicked = false; } - if (_asCar->getX() < 300) { + if (_asCar->getY() < 330) { if (_carClipFlag) { _carClipFlag = false; _asCar->setClipRect(_clipRect1); diff --git a/engines/neverhood/modules/module2800.cpp b/engines/neverhood/modules/module2800.cpp index 8f23de33db..5d892de224 100644 --- a/engines/neverhood/modules/module2800.cpp +++ b/engines/neverhood/modules/module2800.cpp @@ -59,154 +59,123 @@ Module2800::~Module2800() { _vm->_soundMan->deleteGroup(0x64210814); } +#define statueCloseup(backgroundFileHash, cursorFileHash) \ + _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); \ + createStaticScene(backgroundFileHash, cursorFileHash) + void Module2800::createScene(int sceneNum, int which) { debug(1, "Module2800::createScene(%d, %d)", sceneNum, which); _sceneNum = sceneNum; + + if (_sceneNum != 1001) + _vm->gameState().sceneNum = _sceneNum; + switch (_sceneNum) { - case 0: - _vm->gameState().sceneNum = 0; + case 0: // in front of radio _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); _childObject = new Scene2801(_vm, this, which); break; - case 1: - _vm->gameState().sceneNum = 1; + case 1: // radio _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); if (getGlobalVar(V_RADIO_ENABLED)) _childObject = new Scene2802(_vm, this, which); else createStaticScene(0x000C6444, 0xC6440008); break; - case 2: - _vm->gameState().sceneNum = 2; + case 2: // outside shrink machine _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); if (getGlobalVar(V_KLAYMEN_SMALL)) _childObject = new Scene2803Small(_vm, this, which); else _childObject = new Scene2803(_vm, this, which); break; - case 3: - _vm->gameState().sceneNum = 3; + case 3: // glass cylinder with diamonds _childObject = new Scene2804(_vm, this, which); break; - case 4: - _vm->gameState().sceneNum = 4; + case 4: // outside the transporter _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2805(_vm, this, which); break; - case 5: - _vm->gameState().sceneNum = 5; + case 5: // left test tube room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2806(_vm, this, which); break; - case 6: - _vm->gameState().sceneNum = 6; + case 6: // the three test tubes next to the window _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2807(_vm, this, which); break; - case 7: - _vm->gameState().sceneNum = 7; + case 7: // left test tube room closeup _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2808(_vm, this, 0); break; - case 8: - _vm->gameState().sceneNum = 8; + case 8: // right test tube room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2809(_vm, this, which); break; - case 9: - _vm->gameState().sceneNum = 9; + case 9: // statue room _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2810(_vm, this, which); break; - case 10: - _vm->gameState().sceneNum = 10; + case 10: // right test tube room closeup _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2808(_vm, this, 1); break; - case 11: - _vm->gameState().sceneNum = 11; + case 11: // disk player room (above the statue room) _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2812(_vm, this, which); break; case 12: - _vm->gameState().sceneNum = 12; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0000A245, 0x0A241008); + statueCloseup(0x0000A245, 0x0A241008); break; case 13: - _vm->gameState().sceneNum = 13; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x81C60635, 0x60631814); + statueCloseup(0x81C60635, 0x60631814); break; case 14: - _vm->gameState().sceneNum = 14; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0xCA811204, 0x11200CA0); + statueCloseup(0xCA811204, 0x11200CA0); break; case 15: - _vm->gameState().sceneNum = 15; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x2D438A00, 0x38A042DC); + statueCloseup(0x2D438A00, 0x38A042DC); break; case 16: - _vm->gameState().sceneNum = 16; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0A806204, 0x062000A0); + statueCloseup(0x0A806204, 0x062000A0); break; case 17: - _vm->gameState().sceneNum = 17; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x010F9284, 0xF9280018); + statueCloseup(0x010F9284, 0xF9280018); break; case 18: - _vm->gameState().sceneNum = 18; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x0100022B, 0x0022F018); + statueCloseup(0x0100022B, 0x0022F018); break; case 19: - _vm->gameState().sceneNum = 19; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x10866205, 0x66201100); + statueCloseup(0x10866205, 0x66201100); break; case 20: - _vm->gameState().sceneNum = 20; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x01C58000, 0x58004014); + statueCloseup(0x01C58000, 0x58004014); break; - case 21: - _vm->gameState().sceneNum = 21; + case 21: // statue with ladder down button _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); _childObject = new Scene2822(_vm, this, which); break; case 22: - _vm->gameState().sceneNum = 22; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x9408121E, 0x8121A948); + statueCloseup(0x9408121E, 0x8121A948); break; case 23: - _vm->gameState().sceneNum = 23; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x048C0600, 0xC0604040); + statueCloseup(0x048C0600, 0xC0604040); break; case 24: - _vm->gameState().sceneNum = 24; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); - createStaticScene(0x04270A94, 0x70A9004A); + statueCloseup(0x04270A94, 0x70A9004A); break; - case 25: - _vm->gameState().sceneNum = 25; + case 25: // window _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); if (getGlobalVar(V_SHRINK_LIGHTS_ON)) createStaticScene(0x01600204, 0x0020001E); else createStaticScene(0x08611204, 0x1120008E); break; - case 26: - _vm->gameState().sceneNum = 26; - _vm->_soundMan->startMusic(0xD2FA4D14, 0, 2); + case 26: // disk player + _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 2); _childObject = new DiskplayerScene(_vm, this, 4); break; - case 1001: + case 1001: // tower rotation video _vm->_soundMan->stopMusic(0xD2FA4D14, 0, 0); _musicResource->stop(0); _currentMusicFileHash = 0; @@ -217,6 +186,8 @@ void Module2800::createScene(int sceneNum, int which) { _childObject->handleUpdate(); } +#undef statueCloseup + void Module2800::updateScene() { if (!updateChild()) { switch (_sceneNum) { @@ -603,7 +574,7 @@ uint32 Scene2802::handleMessage(int messageNum, const MessageParam ¶m, Entit } } break; - case 0x0002: + case NM_MOUSE_RELEASE: if (_countdown1 == 0) _currTuneStatus = 0; else { diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index b961bccea7..6b1f2d9346 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -178,6 +178,12 @@ void NeverhoodEngine::mainLoop() { case Common::EVENT_RBUTTONUP: _gameModule->handleMouseUp(event.mouse.x, event.mouse.y); break; + case Common::EVENT_WHEELUP: + _gameModule->handleWheelUp(); + break; + case Common::EVENT_WHEELDOWN: + _gameModule->handleWheelDown(); + break; case Common::EVENT_QUIT: _system->quit(); break; @@ -191,13 +197,12 @@ void NeverhoodEngine::mainLoop() { _gameModule->draw(); _console->onFrame(); _screen->update(); + if (_updateSound) + _soundMan->update(); nextFrameTime = _screen->getNextFrameTime(); }; - if (_updateSound) { - _soundMan->update(); - _audioResourceMan->updateMusic(); - } + _audioResourceMan->updateMusic(); _system->updateScreen(); _system->delayMillis(10); diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index 941bcc3cd3..134fec7163 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -119,7 +119,7 @@ void Palette::startFadeToBlack(int counter) { _fadeToG = 0; _fadeToB = 0; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 1; } @@ -131,7 +131,7 @@ void Palette::startFadeToWhite(int counter) { _fadeToG = 255; _fadeToB = 255; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 1; } @@ -140,7 +140,7 @@ void Palette::startFadeToPalette(int counter) { if (counter == 0) counter = 1; _palCounter = counter; - _fadeStep = 255 / counter; + _fadeStep = calculateFadeStep(counter); _status = 2; } @@ -203,4 +203,11 @@ void Palette::fadeColor(byte *rgb, byte toR, byte toG, byte toB) { #undef FADE } +int Palette::calculateFadeStep(int counter) { + int fadeStep = 255 / counter; + if (255 % counter) + fadeStep++; + return fadeStep; +} + } // End of namespace Neverhood diff --git a/engines/neverhood/palette.h b/engines/neverhood/palette.h index c83207caae..016f856104 100644 --- a/engines/neverhood/palette.h +++ b/engines/neverhood/palette.h @@ -61,6 +61,7 @@ protected: int _fadeStep; void update(); void fadeColor(byte *rgb, byte toR, byte toG, byte toB); + int calculateFadeStep(int counter); }; } // End of namespace Neverhood diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp index 4b4982f68e..014e094b94 100644 --- a/engines/neverhood/smackerplayer.cpp +++ b/engines/neverhood/smackerplayer.cpp @@ -21,6 +21,7 @@ */ #include "graphics/palette.h" +#include "neverhood/gamemodule.h" #include "neverhood/smackerplayer.h" #include "neverhood/palette.h" #include "neverhood/resourceman.h" @@ -160,7 +161,7 @@ void SmackerPlayer::close() { void SmackerPlayer::gotoFrame(int frameNumber) { if (_smackerDecoder) { _smackerDecoder->forceSeekToFrame(frameNumber); - _smackerDecoder->decodeNextFrame(); + updateFrame(); } } @@ -251,6 +252,15 @@ void SmackerPlayer::updatePalette() { tempPalette[i * 4 + 1] = smackerPalette[i * 3 + 1]; tempPalette[i * 4 + 2] = smackerPalette[i * 3 + 2]; } + + // WORKAROUND: Scene 3, module 3000 defines a black color 255 instead of + // white, which results in the mouse cursor showing black. I'm not sure if + // color 255 is always supposed to be white. It's not feasible to check + // all scenes for a glitch that only seems to manifest in one, therefore + // we define color 255 to be white only for that scene. + if (_vm->_gameModule->getCurrentModuleNum() == 3000 && _vm->_gameState.sceneNum == 3) + tempPalette[255 * 4 + 0] = tempPalette[255 * 4 + 1] = tempPalette[255 * 4 + 2] = 0xFF; + _palette->copyPalette(tempPalette, 0, 256, 0); } diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 6888cc56bc..5821fd6df3 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -241,13 +241,13 @@ void SoundItem::update() { if (_playOnceAfterCountdown) { if (_currCountdown == 0) _currCountdown = _initialCountdown; - else if (--_currCountdown == 0) + else if (--_currCountdown <= 0) _soundResource->play(); } else if (_playOnceAfterRandomCountdown) { if (_currCountdown == 0) { if (_minCountdown > 0 && _maxCountdown > 0 && _minCountdown < _maxCountdown) _currCountdown = _vm->_rnd->getRandomNumberRng(_minCountdown, _maxCountdown); - } else if (--_currCountdown == 0) + } else if (--_currCountdown <= 0) _soundResource->play(); } else if (_playLooping && !_soundResource->isPlaying()) _soundResource->playLooping(); @@ -257,8 +257,8 @@ void SoundItem::update() { SoundMan::SoundMan(NeverhoodEngine *vm) : _vm(vm), _soundIndex1(-1), _soundIndex2(-1), _soundIndex3(-1), - _initialCountdown(0), _playOnceAfterCountdown(false), - _initialCountdown3(0), _playOnceAfterCountdown3(false) { + _initialCountdown(15), _playOnceAfterCountdown(false), + _initialCountdown3(9), _playOnceAfterCountdown3(false) { } SoundMan::~SoundMan() { @@ -379,7 +379,6 @@ void SoundMan::update() { if (soundItem) soundItem->update(); } - for (uint i = 0; i < _musicItems.size(); ++i) { MusicItem *musicItem = _musicItems[i]; if (musicItem) diff --git a/engines/sci/resource.h b/engines/sci/resource.h index c4c8e543b2..6a22f48086 100644 --- a/engines/sci/resource.h +++ b/engines/sci/resource.h @@ -554,6 +554,7 @@ class SoundResource { public: struct Channel { byte number; + byte flags; byte poly; uint16 prio; uint16 size; diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp index 268180b531..8e1568f564 100644 --- a/engines/sci/resource_audio.cpp +++ b/engines/sci/resource_audio.cpp @@ -599,6 +599,7 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers _tracks->channels = new Channel[_tracks->channelCount]; memset(_tracks->channels, 0, sizeof(Channel) * _tracks->channelCount); channel = &_tracks->channels[0]; + channel->flags |= 2; // don't remap (SCI0 doesn't have remapping) if (_soundVersion == SCI_VERSION_0_EARLY) { channel->data = resource->data + 0x11; channel->size = resource->size - 0x11; @@ -676,33 +677,52 @@ SoundResource::SoundResource(uint32 resourceNr, ResourceManager *resMan, SciVers channelNr = 0; while (channelCount--) { channel = &_tracks[trackNr].channels[channelNr]; - channel->prio = READ_LE_UINT16(data); uint dataOffset = READ_LE_UINT16(data + 2); - if (dataOffset < resource->size) { - channel->data = resource->data + dataOffset; - channel->size = READ_LE_UINT16(data + 4); - channel->curPos = 0; - // FIXME: number contains (low nibble) channel and (high nibble) flags - // 0x20 is set on rhythm channels to prevent remapping - channel->number = *channel->data; - channel->poly = *(channel->data + 1); - channel->time = channel->prev = 0; - channel->data += 2; // skip over header - channel->size -= 2; // remove header size - if (channel->number == 0xFE) { // Digital channel - _tracks[trackNr].digitalChannelNr = channelNr; - _tracks[trackNr].digitalSampleRate = READ_LE_UINT16(channel->data); - _tracks[trackNr].digitalSampleSize = READ_LE_UINT16(channel->data + 2); - _tracks[trackNr].digitalSampleStart = READ_LE_UINT16(channel->data + 4); - _tracks[trackNr].digitalSampleEnd = READ_LE_UINT16(channel->data + 6); - channel->data += 8; // Skip over header - channel->size -= 8; - } - _tracks[trackNr].channelCount++; - channelNr++; - } else { + + if (dataOffset >= resource->size) { warning("Invalid offset inside sound resource %d: track %d, channel %d", resourceNr, trackNr, channelNr); + data += 6; + continue; + } + + channel->data = resource->data + dataOffset; + channel->size = READ_LE_UINT16(data + 4); + channel->curPos = 0; + channel->number = *channel->data; + + channel->poly = *(channel->data + 1) & 0x0F; + channel->prio = *(channel->data + 1) >> 4; + channel->time = channel->prev = 0; + channel->data += 2; // skip over header + channel->size -= 2; // remove header size + if (channel->number == 0xFE) { // Digital channel + _tracks[trackNr].digitalChannelNr = channelNr; + _tracks[trackNr].digitalSampleRate = READ_LE_UINT16(channel->data); + _tracks[trackNr].digitalSampleSize = READ_LE_UINT16(channel->data + 2); + _tracks[trackNr].digitalSampleStart = READ_LE_UINT16(channel->data + 4); + _tracks[trackNr].digitalSampleEnd = READ_LE_UINT16(channel->data + 6); + channel->data += 8; // Skip over header + channel->size -= 8; + channel->flags = 0; + } else { + channel->flags = channel->number >> 4; + channel->number = channel->number & 0x0F; + + // 0x20 is set on rhythm channels to prevent remapping + // CHECKME: Which SCI versions need that set manually? + channel->flags = (*channel->data) >> 4; + if (channel->number == 9) + channel->flags |= 2; + // Note: flag 1: channel start offset is 0 instead of 10 + // (currently: everything 0) + // also: don't map the channel to device + // flag 2: don't remap + // flag 4: start muted + // QfG2 lacks flags 2 and 4, and uses (flags >= 1) as + // the condition for starting offset 0, without the "don't map" } + _tracks[trackNr].channelCount++; + channelNr++; data += 6; } } else { diff --git a/engines/sci/sound/midiparser_sci.cpp b/engines/sci/sound/midiparser_sci.cpp index 186fc18a5c..6f250e0a3a 100644 --- a/engines/sci/sound/midiparser_sci.cpp +++ b/engines/sci/sound/midiparser_sci.cpp @@ -58,6 +58,10 @@ MidiParser_SCI::MidiParser_SCI(SciVersion soundVersion, SciMusic *music) : _resetOnPause = false; _pSnd = 0; + + _mainThreadCalled = false; + + resetStateTracking(); } MidiParser_SCI::~MidiParser_SCI() { @@ -68,10 +72,12 @@ MidiParser_SCI::~MidiParser_SCI() { } void MidiParser_SCI::mainThreadBegin() { + assert(!_mainThreadCalled); _mainThreadCalled = true; } void MidiParser_SCI::mainThreadEnd() { + assert(_mainThreadCalled); _mainThreadCalled = false; } @@ -83,12 +89,21 @@ bool MidiParser_SCI::loadMusic(SoundResource::Track *track, MusicEntry *psnd, in for (int i = 0; i < 16; i++) { _channelUsed[i] = false; - _channelRemap[i] = -1; _channelMuted[i] = false; _channelVolume[i] = 127; + + if (_soundVersion <= SCI_VERSION_0_LATE) + _channelRemap[i] = i; + else + _channelRemap[i] = -1; } - _channelRemap[9] = 9; // never map channel 9, because that's used for percussion - _channelRemap[15] = 15; // never map channel 15, because thats used by sierra internally + + // FIXME: SSCI does not always start playing a track at the first byte. + // By default it skips 10 (or 13?) bytes containing prio/voices, patch, + // volume, pan commands in fixed locations, and possibly a signal + // in channel 15. We should initialize state tracking to those values + // so that they automatically get set up properly when the channels get + // mapped. See also the related FIXME in MidiParser_SCI::processEvent. if (channelFilterMask) { // SCI0 only has 1 data stream, but we need to filter out channels depending on music hardware selection @@ -314,31 +329,26 @@ byte *MidiParser_SCI::midiFilterChannels(int channelMask) { return _mixedData; } -// This will get called right before actual playing and will try to own the used channels -void MidiParser_SCI::tryToOwnChannels() { - // We don't have SciMusic in case debug command show_instruments is used - if (!_music) - return; - for (int curChannel = 0; curChannel < 15; curChannel++) { - if (_channelUsed[curChannel]) { - if (_channelRemap[curChannel] == -1) { - _channelRemap[curChannel] = _music->tryToOwnChannel(_pSnd, curChannel); - } - } - } -} +void MidiParser_SCI::resetStateTracking() { + for (int i = 0; i < 16; ++i) { + ChannelState &s = _channelState[i]; + s._modWheel = 0; + s._pan = 64; + s._patch = 0; // TODO: Initialize properly (from data in LoadMusic?) + s._note = -1; + s._sustain = false; + s._pitchWheel = 0x2000; + s._voices = 0; -void MidiParser_SCI::lostChannels() { - for (int curChannel = 0; curChannel < 15; curChannel++) - if ((_channelUsed[curChannel]) && (curChannel != 9)) - _channelRemap[curChannel] = -1; + _channelVolume[i] = 127; + } } void MidiParser_SCI::sendInitCommands() { - // reset our "global" volume and channel volumes + resetStateTracking(); + + // reset our "global" volume _volume = 127; - for (int i = 0; i < 16; i++) - _channelVolume[i] = 127; // Set initial voice count if (_pSnd) { @@ -390,53 +400,119 @@ void MidiParser_SCI::sendFromScriptToDriver(uint32 midi) { // this happens for cmdSendMidi at least in sq1vga right at the start, it's a script issue return; } - if (_channelRemap[midiChannel] == -1) { - // trying to send to an unmapped channel - // this happens for cmdSendMidi at least in sq1vga right at the start, scripts are pausing the sound - // and then sending manually. it's a script issue - return; - } sendToDriver(midi); } void MidiParser_SCI::sendToDriver(uint32 midi) { - byte midiChannel = midi & 0xf; - - if ((midi & 0xFFF0) == 0x4EB0) { - // this is channel mute only for sci1 - // it's velocity control for sci0 - if (_soundVersion >= SCI_VERSION_1_EARLY) { - _channelMuted[midiChannel] = midi & 0xFF0000 ? true : false; - return; // don't send this to driver at all - } - } + // State tracking + trackState(midi); - // Is channel muted? if so, don't send command - if (_channelMuted[midiChannel]) + if ((midi & 0xFFF0) == 0x4EB0 && _soundVersion >= SCI_VERSION_1_EARLY) { + // Mute. Handled in trackState(). + // CHECKME: Should we send this on to the driver? return; + } if ((midi & 0xFFF0) == 0x07B0) { // someone trying to set channel volume? int channelVolume = (midi >> 16) & 0xFF; - // Remember, if we need to set it ourselves - _channelVolume[midiChannel] = channelVolume; // Adjust volume accordingly to current local volume channelVolume = channelVolume * _volume / 127; - midi = (midi & 0xFFF0) | ((channelVolume & 0xFF) << 16); + midi = (midi & 0xFFFF) | ((channelVolume & 0xFF) << 16); } + // Channel remapping + byte midiChannel = midi & 0xf; int16 realChannel = _channelRemap[midiChannel]; if (realChannel == -1) return; midi = (midi & 0xFFFFFFF0) | realChannel; + sendToDriver_raw(midi); +} + +void MidiParser_SCI::sendToDriver_raw(uint32 midi) { if (_mainThreadCalled) _music->putMidiCommandInQueue(midi); else _driver->send(midi); } +void MidiParser_SCI::trackState(uint32 b) { + // We keep track of most of the state of a midi channel, so we can + // at any time reset the device to the current state, even if the + // channel has been temporarily disabled due to remapping. + + byte command = b & 0xf0; + byte channel = b & 0xf; + byte op1 = (b >> 8) & 0x7f; + byte op2 = (b >> 16) & 0x7f; + + ChannelState &s = _channelState[channel]; + + switch (command) { + case 0x90: + if (op2 != 0) { + // note on + s._note = op1; + break; + } + // else, fall-through + case 0x80: + // note off + if (s._note == op1) + s._note = -1; + break; + case 0xB0: + // control change + switch (op1) { + case 0x01: // mod wheel + s._modWheel = op2; + break; + case 0x07: // channel volume + _channelVolume[channel] = op2; + break; + case 0x0A: // pan + s._pan = op2; + break; + case 0x40: // sustain + s._sustain = (op2 != 0); + break; + case 0x4B: // voices + s._voices = op2; + _pSnd->_chan[channel]._voices = op2; // Also sync our MusicEntry + break; + case 0x4E: // mute + // This is channel mute only for sci1. + // (It's velocity control for sci0, but we don't need state in sci0) + if (_soundVersion >= SCI_VERSION_1_EARLY) { + // FIXME: mute is a level, not a bool, in some SCI versions + bool m = op2; + if (_pSnd->_chan[channel]._mute != m) { + _pSnd->_chan[channel]._mute = m; + // TODO: If muting/unmuting a channel, remap channels. + warning("Mute change without immediate remapping (mainThread = %d)", _mainThreadCalled); + } + } + break; + default: + break; + } + break; + case 0xC0: + // program change + s._patch = op1; + break; + case 0xE0: + // pitchwheel + s._pitchWheel = (op2 << 7) | op1; + break; + default: + break; + } +} + void MidiParser_SCI::parseNextEvent(EventInfo &info) { info.start = _position._playPos; info.delta = 0; @@ -477,8 +553,10 @@ void MidiParser_SCI::parseNextEvent(EventInfo &info) { case 0xE: info.basic.param1 = *(_position._playPos++); info.basic.param2 = *(_position._playPos++); - if (info.command() == 0x9 && info.basic.param2 == 0) + if (info.command() == 0x9 && info.basic.param2 == 0) { + // NoteOn with param2==0 is a NoteOff info.event = info.channel() | 0x80; + } info.length = 0; break; @@ -809,4 +887,44 @@ void MidiParser_SCI::setVolume(byte volume) { } } +void MidiParser_SCI::remapChannel(int channel, int devChannel) { + if (_channelRemap[channel] == devChannel) + return; + + _channelRemap[channel] = devChannel; + + if (devChannel == -1) + return; + +// debug(" restoring state: channel %d on devChannel %d", channel, devChannel); + + // restore state + ChannelState &s = _channelState[channel]; + + int channelVolume = _channelVolume[channel]; + channelVolume = (channelVolume * _volume / 127) & 0xFF; + byte pitch1 = s._pitchWheel & 0x7F; + byte pitch2 = (s._pitchWheel >> 7) & 0x7F; + + sendToDriver_raw(0x0040B0 | devChannel); // sustain off + sendToDriver_raw(0x004BB0 | devChannel | (s._voices << 16)); + sendToDriver_raw(0x0000C0 | devChannel | (s._patch << 8)); + sendToDriver_raw(0x0007B0 | devChannel | (channelVolume << 16)); + sendToDriver_raw(0x000AB0 | devChannel | (s._pan << 16)); + sendToDriver_raw(0x0001B0 | devChannel | (s._modWheel << 16)); + sendToDriver_raw(0x0040B0 | devChannel | (s._sustain ? 0x7F0000 : 0)); + sendToDriver_raw(0x0000E0 | devChannel | (pitch1 << 8) | (pitch2 << 16)); + + // CHECKME: Some SSCI version send a control change 0x4E with s._note as + // parameter. + // We need to investigate how (and if) drivers should act on this. + // Related: controller 0x4E is used for 'mute' in the midiparser. + // This could be a bug in SSCI that went unnoticed because few (or no?) + // drivers implement controller 0x4E + + // NB: The line below is _not_ valid since s._note can be 0xFF. + // SSCI handles this out of band in the driver interface. + // sendToDriver_raw(0x004EB0 | devChannel | (s._note << 16); +} + } // End of namespace Sci diff --git a/engines/sci/sound/midiparser_sci.h b/engines/sci/sound/midiparser_sci.h index 5784dca1ab..7e24c34144 100644 --- a/engines/sci/sound/midiparser_sci.h +++ b/engines/sci/sound/midiparser_sci.h @@ -79,20 +79,23 @@ public: const byte *getMixedData() const { return _mixedData; } byte getSongReverb(); - void tryToOwnChannels(); - void lostChannels(); void sendFromScriptToDriver(uint32 midi); void sendToDriver(uint32 midi); void sendToDriver(byte status, byte firstOp, byte secondOp) { sendToDriver(status | ((uint32)firstOp << 8) | ((uint32)secondOp << 16)); } + void remapChannel(int channel, int devChannel); + protected: void parseNextEvent(EventInfo &info); void processEvent(const EventInfo &info, bool fireEvents = true); byte *midiMixChannels(); byte *midiFilterChannels(int channelMask); byte midiGetNextChannel(long ticker); + void resetStateTracking(); + void trackState(uint32 midi); + void sendToDriver_raw(uint32 midi); SciMusic *_music; @@ -113,6 +116,19 @@ protected: int16 _channelRemap[16]; bool _channelMuted[16]; byte _channelVolume[16]; + + struct ChannelState { + int8 _modWheel; + int8 _pan; + int8 _patch; + int8 _note; + bool _sustain; + int16 _pitchWheel; + int8 _voices; + }; + + ChannelState _channelState[16]; + }; } // End of namespace Sci diff --git a/engines/sci/sound/music.cpp b/engines/sci/sound/music.cpp index 8c6d0d6431..f46c1dfbb0 100644 --- a/engines/sci/sound/music.cpp +++ b/engines/sci/sound/music.cpp @@ -33,7 +33,7 @@ #include "sci/sound/midiparser_sci.h" #include "sci/sound/music.h" -//#define DISABLE_REMAPPING +//#define DEBUG_REMAP namespace Sci { @@ -47,6 +47,8 @@ SciMusic::SciMusic(SciVersion soundVersion, bool useDigitalSFX) for (int i = 0; i < 16; i++) { _usedChannel[i] = 0; _channelRemap[i] = -1; + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; } _queuedCommands.reserve(1000); @@ -291,6 +293,15 @@ void SciMusic::sortPlayList() { } void SciMusic::soundInitSnd(MusicEntry *pSnd) { + // Remove all currently mapped channels of this MusicEntry first, + // since they will no longer be valid. + for (int i = 0; i < 16; ++i) { + if (_channelMap[i]._song == pSnd) { + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; + } + } + int channelFilterMask = 0; SoundResource::Track *track = pSnd->soundRes->getTrackByType(_pMidiDrv->getPlayId()); @@ -337,6 +348,27 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { // Find out what channels to filter for SCI0 channelFilterMask = pSnd->soundRes->getChannelFilterMask(_pMidiDrv->getPlayId(), _pMidiDrv->hasRhythmChannel()); + for (int i = 0; i < 16; ++i) + pSnd->_usedChannels[i] = 0xFF; + for (int i = 0; i < track->channelCount; ++i) { + SoundResource::Channel &chan = track->channels[i]; + + pSnd->_usedChannels[i] = chan.number; + pSnd->_chan[chan.number]._dontRemap = (chan.flags & 2); + pSnd->_chan[chan.number]._prio = chan.prio; + pSnd->_chan[chan.number]._voices = chan.poly; + + // CHECKME: Some SCI versions use chan.flags & 1 for this: + pSnd->_chan[chan.number]._dontMap = false; + + // FIXME: Most MIDI tracks use the first 10 bytes for + // fixed MIDI commands. SSCI skips those the first iteration, + // but _does_ update channel state (including volume) with + // them. Specifically, prio/voices, patch, volume, pan. + // This should probably be implemented in + // MidiParser_SCI::loadMusic. + } + pSnd->pMidiParser->mainThreadBegin(); // loadMusic() below calls jumpToTick. // Disable sound looping and hold before jumpToTick is called, @@ -358,64 +390,6 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) { } } -// This one checks, if requested channel is available -> in that case give -// caller that channel. Otherwise look for an unused one -int16 SciMusic::tryToOwnChannel(MusicEntry *caller, int16 bestChannel) { -#ifdef DISABLE_REMAPPING - return bestChannel; -#endif - - // Don't even try this for SCI0 - if (_soundVersion <= SCI_VERSION_0_LATE) - return bestChannel; - if (!_usedChannel[bestChannel]) { - // currently unused, so give it to caller directly - _usedChannel[bestChannel] = caller; - _channelRemap[bestChannel] = bestChannel; - return bestChannel; - } - // otherwise look for unused channel - for (int channelNr = _driverFirstChannel; channelNr < 15; channelNr++) { - if (channelNr == 9) // never map to channel 9 (percussion) - continue; - if (!_usedChannel[channelNr]) { - _usedChannel[channelNr] = caller; - _channelRemap[bestChannel] = channelNr; - return channelNr; - } - } - // nothing found, don't map channel at all - // sierra did this as well, although i'm not sure if we act exactly the same way - // maybe they removed channels from previous playing music - return -1; -} - -void SciMusic::freeChannels(MusicEntry *caller) { - // Remove used channels - for (int i = 0; i < 15; i++) { - if (_usedChannel[i] == caller) { - if (_channelRemap[i] != -1) { - // athrxx: The original handles this differently. It seems to be checking for (and effecting) necessary - // remaps / resets etc. more or less all the time. There are several more tables to keep track of everything. - // I don't know whether all of that is needed and to which SCI versions it applies, though. - // At least it is necessary to release the allocated channels inside the driver. Otherwise these channels - // won't be available any more (e.g. after half of the KQ5 FM-Towns intro there will be no more music - // since the driver can't pick up any more channels). The channels also have to be reset to - // default values, since the original does the same (although in a different manny) and the music will be wrong - // otherwise (at least KQ5 FM-Towns). - - sendMidiCommand(0x4000e0 | _channelRemap[i]); // Reset pitch wheel - sendMidiCommand(0x0040b0 | _channelRemap[i]); // Release pedal - sendMidiCommand(0x004bb0 | _channelRemap[i]); // Release assigned driver channels - } - _usedChannel[i] = 0; - _channelRemap[i] = -1; - } - } - // Also tell midiparser, that he lost ownership - caller->pMidiParser->lostChannels(); -} - void SciMusic::soundPlay(MusicEntry *pSnd) { _mutex.lock(); @@ -481,28 +455,6 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); - if (pSnd->status != kSoundPaused) { - // Stop any in progress music fading, as that will reset the - // volume of the sound channels that the faded song occupies.. - // Fixes bug #3266480 and partially fixes bug #3041738. - // CHECKME: Is this the right thing to do? Are these - // overlapping channels not a deeper underlying problem? - for (uint i = 0; i < playListCount; i++) { - // Is another MIDI song being faded down? If yes, stop it - // immediately instead - if (_playList[i]->fadeStep < 0 && _playList[i]->pMidiParser) { - _playList[i]->status = kSoundStopped; - if (_soundVersion <= SCI_VERSION_0_LATE) - _playList[i]->isQueued = false; - _playList[i]->pMidiParser->stop(); - freeChannels(_playList[i]); - _playList[i]->fadeStep = 0; - _playList[i]->fadeCompleted = true; - } - } - } - - pSnd->pMidiParser->tryToOwnChannels(); if (pSnd->status != kSoundPaused) pSnd->pMidiParser->sendInitCommands(); pSnd->pMidiParser->setVolume(pSnd->volume); @@ -532,6 +484,10 @@ void SciMusic::soundPlay(MusicEntry *pSnd) { } pSnd->status = kSoundPlaying; + + _mutex.lock(); + remapChannels(); + _mutex.unlock(); } void SciMusic::soundStop(MusicEntry *pSnd) { @@ -549,8 +505,8 @@ void SciMusic::soundStop(MusicEntry *pSnd) { // allNotesOff() again if (previousStatus == kSoundPlaying) pSnd->pMidiParser->stop(); - freeChannels(pSnd); pSnd->pMidiParser->mainThreadEnd(); + remapChannels(); } pSnd->fadeStep = 0; // end fading, if fading was in progress @@ -586,8 +542,10 @@ void SciMusic::soundSetPriority(MusicEntry *pSnd, byte prio) { void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->status = kSoundStopped; + _mutex.lock(); + remapChannels(); + if (pSnd->pMidiParser) { - Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); pSnd->pMidiParser->unloadMusic(); pSnd->pMidiParser->mainThreadEnd(); @@ -595,6 +553,8 @@ void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->pMidiParser = NULL; } + _mutex.unlock(); + if (pSnd->pStreamAud) { _pMixer->stopHandle(pSnd->hCurrentAud); delete pSnd->pStreamAud; @@ -603,7 +563,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { pSnd->pLoopStream = 0; } - Common::StackLock lock(_mutex); + _mutex.lock(); uint sz = _playList.size(), i; // Remove sound from playlist for (i = 0; i < sz; i++) { @@ -614,6 +574,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) { break; } } + _mutex.unlock(); } void SciMusic::soundPause(MusicEntry *pSnd) { @@ -639,8 +600,8 @@ void SciMusic::soundPause(MusicEntry *pSnd) { Common::StackLock lock(_mutex); pSnd->pMidiParser->mainThreadBegin(); pSnd->pMidiParser->pause(); - freeChannels(pSnd); pSnd->pMidiParser->mainThreadEnd(); + remapChannels(); } } } @@ -789,6 +750,14 @@ MusicEntry::MusicEntry() { pStreamAud = 0; pLoopStream = 0; pMidiParser = 0; + + for (int i = 0; i < 16; ++i) { + _usedChannels[i] = 0xFF; + _chan[i]._prio = 127; + _chan[i]._voices = 0; + _chan[i]._dontRemap = false; + _chan[i]._mute = false; + } } MusicEntry::~MusicEntry() { @@ -857,4 +826,447 @@ void MusicEntry::setSignal(int newSignal) { } } + +void ChannelRemapping::swap(int i, int j) { + DeviceChannelUsage t1; + int t2; + bool t3; + + t1 = _map[i]; _map[i] = _map[j]; _map[j] = t1; + t2 = _prio[i]; _prio[i] = _prio[j]; _prio[j] = t2; + t2 = _voices[i]; _voices[i] = _voices[j]; _voices[j] = t2; + t3 = _dontRemap[i]; _dontRemap[i] = _dontRemap[j]; _dontRemap[j] = t3; +} + +void ChannelRemapping::evict(int i) { + _freeVoices += _voices[i]; + + _map[i]._song = 0; + _map[i]._channel = -1; + _prio[i] = 0; + _voices[i] = 0; + _dontRemap[i] = false; +} + +void ChannelRemapping::clear() { + for (int i = 0; i < 16; ++i) { + _map[i]._song = 0; + _map[i]._channel = -1; + _prio[i] = 0; + _voices[i] = 0; + _dontRemap[i] = false; + } +} + +ChannelRemapping& ChannelRemapping::operator=(ChannelRemapping& other) { + for (int i = 0; i < 16; ++i) { + _map[i] = other._map[i]; + _prio[i] = other._prio[i]; + _voices[i] = other._voices[i]; + _dontRemap[i] = other._dontRemap[i]; + } + _freeVoices = other._freeVoices; + + return *this; +} + +int ChannelRemapping::lowestPrio() const { + int max = 0; + int channel = -1; + for (int i = 0; i < 16; ++i) { + if (_prio[i] > max) { + max = _prio[i]; + channel = i; + } + } + return channel; +} + + +void SciMusic::remapChannels() { + if (_soundVersion <= SCI_VERSION_0_LATE) + return; + + // NB: This function should only be called from the main thread, + // with _mutex locked + + + ChannelRemapping *map = determineChannelMap(); + + DeviceChannelUsage currentMap[16]; + +#ifdef DEBUG_REMAP + debug("Remap results:"); +#endif + + // Save current map, and then start from an empty map + for (int i = 0; i < 16; ++i) { + currentMap[i] = _channelMap[i]; + _channelMap[i]._song = 0; + _channelMap[i]._channel = -1; + } + + // Inform MidiParsers of any unmapped channels + const MusicList::iterator end = _playList.end(); + int songIndex = -1; + for (MusicList::iterator i = _playList.begin(); i != end; ++i) { + MusicEntry *song = *i; + songIndex++; + + if (!song || !song->pMidiParser) + continue; + + bool channelMapped[16]; +#ifdef DEBUG_REMAP + bool channelUsed[16]; +#endif + for (int j = 0; j < 16; ++j) { + channelMapped[j] = false; +#ifdef DEBUG_REMAP + channelUsed[j] = false; +#endif + } + + for (int j = 0; j < 16; ++j) { + if (map->_map[j]._song == song) { + int channel = map->_map[j]._channel; + assert(channel >= 0 && channel <= 0x0F); + channelMapped[channel] = true; + } +#ifdef DEBUG_REMAP + if (song->_usedChannels[j] <= 0x0F) + channelUsed[song->_usedChannels[j]] = true; +#endif + } + + for (int j = 0; j < 16; ++j) { + if (!channelMapped[j]) { + song->pMidiParser->mainThreadBegin(); + song->pMidiParser->remapChannel(j, -1); + song->pMidiParser->mainThreadEnd(); +#ifdef DEBUG_REMAP + if (channelUsed[j]) + debug(" Unmapping song %d, channel %d", songIndex, j); +#endif + } + } + } + + // Now reshuffle the channels on the device. + + // First, set up any dontRemap channels + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song || !map->_map[i]._song->pMidiParser || !map->_dontRemap[i]) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + _channelMap[i] = map->_map[i]; + map->_map[i]._song = 0; // mark as done + + // If this channel was not yet mapped to the device, reset it + if (currentMap[i] != _channelMap[i]) { +#ifdef DEBUG_REMAP + debug(" Mapping (dontRemap) song %d, channel %d to device channel %d", songIndex, _channelMap[i]._channel, i); +#endif + _channelMap[i]._song->pMidiParser->mainThreadBegin(); + _channelMap[i]._song->pMidiParser->remapChannel(_channelMap[i]._channel, i); + _channelMap[i]._song->pMidiParser->mainThreadEnd(); + } + + } + + // Next, we look for channels which were already playing. + // We keep those on the same device channel as before. + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + + for (int j = 0; j < 16; ++j) { + if (map->_map[i] == currentMap[j]) { + // found it + _channelMap[j] = map->_map[i]; + map->_map[i]._song = 0; // mark as done +#ifdef DEBUG_REMAP + debug(" Keeping song %d, channel %d on device channel %d", songIndex, _channelMap[j]._channel, j); +#endif + break; + } + } + } + + // Then, remap the rest. + for (int i = 0; i < 16; ++i) { + + if (!map->_map[i]._song || !map->_map[i]._song->pMidiParser) + continue; + + songIndex = -1; + for (MusicList::iterator iter = _playList.begin(); iter != end; ++iter) { + songIndex++; + if (map->_map[i]._song == *iter) + break; + } + + for (int j = _driverLastChannel; j >= _driverFirstChannel; --j) { + if (_channelMap[j]._song == 0) { + _channelMap[j] = map->_map[i]; + map->_map[i]._song = 0; +#ifdef DEBUG_REMAP + debug(" Mapping song %d, channel %d to device channel %d", songIndex, _channelMap[j]._channel, j); +#endif + _channelMap[j]._song->pMidiParser->mainThreadBegin(); + _channelMap[j]._song->pMidiParser->remapChannel(_channelMap[j]._channel, j); + _channelMap[j]._song->pMidiParser->mainThreadEnd(); + break; + } + } + + } + + // And finally, stop any empty channels + for (int i = _driverFirstChannel; i <= _driverLastChannel; ++i) { + if (!_channelMap[i]._song) + resetDeviceChannel(i); + } + + delete map; +} + + +ChannelRemapping *SciMusic::determineChannelMap() { +#ifdef DEBUG_REMAP + debug("Remap: avail chans: %d-%d", _driverFirstChannel, _driverLastChannel); +#endif + + ChannelRemapping *map = new ChannelRemapping; + ChannelRemapping backupMap; + map->clear(); + map->_freeVoices = _pMidiDrv->getPolyphony(); + + if (_playList.empty()) + return map; + + // TODO: set reverb, either from first song, or from global??? + + MusicList::iterator songIter; + int songIndex = -1; + for (songIter = _playList.begin(); songIter != _playList.end(); ++songIter) { + songIndex++; + MusicEntry *song = *songIter; + if (song->status != kSoundPlaying) + continue; + + // If song is digital, skip. + // CHECKME: Is this condition correct? + if (!song->pMidiParser) { +#ifdef DEBUG_REMAP + debug(" Song %d (%p), digital?", songIndex, (void*)song); +#endif + continue; + } + + +#ifdef DEBUG_REMAP + debug(" Song %d (%p), prio %d", songIndex, (void*)song, song->priority); +#endif + + // Store backup. If we fail to map this song, we will revert to this. + backupMap = *map; + + bool songMapped = true; + + for (int i = 0; i < 16; ++i) { + int c = song->_usedChannels[i]; + if (c == 0xFF || c == 0xFE || c == 0x0F) + continue; + const MusicEntryChannel &channel = song->_chan[c]; + if (channel._dontMap) + continue; + if (channel._mute) + continue; + +#ifdef DEBUG_REMAP + debug(" Channel %d: prio %d, %d voice%s%s", c, channel._prio, channel._voices, channel._voices == 1 ? "" : "s", channel._dontRemap ? ", dontRemap" : "" ); +#endif + + DeviceChannelUsage dc = { song, c }; + + // our target + int devChannel = -1; + + if (channel._dontRemap && map->_map[c]._song == 0) { + // unremappable channel, with channel still free + devChannel = c; + } + + // try to find a free channel + if (devChannel == -1) { + for (int j = 0; j < 16; ++j) { + if (map->_map[j] == dc) { + // already mapped?! (Can this happen?) + devChannel = j; + break; + } + if (map->_map[j]._song) + continue; + + if (j >= _driverFirstChannel && j <= _driverLastChannel) + devChannel = j; + } + } + + int prio = channel._prio; + if (prio > 0) { + // prio > 0 means non-essential + prio = (16 - prio) + 16*songIndex; + } + + if (devChannel == -1 && prio > 0) { + // no empty channel, but this isn't an essential channel, + // so we just skip it. +#ifdef DEBUG_REMAP + debug(" skipping non-essential"); +#endif + continue; + } + + // try to empty a previous channel if this is an essential channel + if (devChannel == -1) { + devChannel = map->lowestPrio(); + if (devChannel != -1) + map->evict(devChannel); + } + + if (devChannel == -1) { + // failed to map this song. +#ifdef DEBUG_REMAP + debug(" no free (or lower priority) channel found"); +#endif + songMapped = false; + break; + } + + if (map->_map[devChannel] == dc) { + // already mapped?! (Can this happen?) + continue; + } + + int neededVoices = channel._voices; + // do we have enough free voices? + // We only care for essential channels + if (map->_freeVoices < neededVoices && prio > 0) { + do { + int j = map->lowestPrio(); + if (j == -1) { +#ifdef DEBUG_REMAP + debug(" not enough voices; need %d, have %d", neededVoices, map->_freeVoices); +#endif + // failed to free enough voices. + songMapped = false; + break; + } +#ifdef DEBUG_REMAP + debug(" creating room for voices; evict %d", j); +#endif + map->evict(j); + } while (map->_freeVoices < neededVoices); + + if (!songMapped) { + // failed to map this song. + break; + } + } + + // We have a channel and enough free voices now. +#ifdef DEBUG_REMAP + debug(" trying to map to %d", devChannel); +#endif + + map->_map[devChannel] = dc; + map->_voices[devChannel] = neededVoices; + map->_prio[devChannel] = prio; + map->_dontRemap[devChannel] = channel._dontRemap; + map->_freeVoices -= neededVoices; + + if (!channel._dontRemap || devChannel == c) { + // If this channel fits here, we're done. +#ifdef DEBUG_REMAP + debug(" OK"); +#endif + continue; + } + + // If this channel can't be remapped, we need to move it or fail. + + if (!map->_dontRemap[c]) { + // Target channel can be remapped, so just swap + map->swap(devChannel, c); + continue; + } +#ifdef DEBUG_REMAP + debug(" but %d is already dontRemap", c); +#endif + + if (prio > 0) { + // Channel collision, but this channel is non-essential, + // so drop it. + // TODO: Maybe we should have checked this before making room? + map->evict(devChannel); + continue; + } + + if (map->_prio[c] > 0) { + // Channel collision, but the other channel is non-essential, + // so we take its place. + map->evict(c); + map->swap(devChannel, c); + continue; + } + + // Otherwise, we have two essential channels claiming the same + // device channel. + songMapped = false; + break; + } + + if (!songMapped) { + // We failed to map this song, so unmap all its channels. +#ifdef DEBUG_REMAP + debug(" Failed song"); +#endif + *map = backupMap; + } + } + + return map; +} + +void SciMusic::resetDeviceChannel(int devChannel) { + // NB: This function should only be called from the main thread + + assert(devChannel >= 0 && devChannel <= 0x0F); + + putMidiCommandInQueue(0x0040B0 | devChannel); // sustain off + putMidiCommandInQueue(0x007BB0 | devChannel); // notes off + putMidiCommandInQueue(0x004BB0 | devChannel); // release voices +} + + + } // End of namespace Sci diff --git a/engines/sci/sound/music.h b/engines/sci/sound/music.h index 40236c8445..23a072cb26 100644 --- a/engines/sci/sound/music.h +++ b/engines/sci/sound/music.h @@ -52,6 +52,17 @@ class SegManager; typedef Common::Array<uint16> SignalQueue; + +struct MusicEntryChannel { + // Channel info + int8 _prio; // 0 = essential; lower is higher priority + int8 _voices; + bool _dontRemap; + bool _dontMap; + bool _mute; +}; + + class MusicEntry : public Common::Serializable { public: // Do not get these directly for the sound objects! @@ -90,6 +101,8 @@ public: Audio::Mixer::SoundType soundType; + int _usedChannels[16]; + MusicEntryChannel _chan[16]; MidiParser_SCI *pMidiParser; // this is used for storing signals, when the current signal is not yet @@ -114,6 +127,27 @@ public: virtual void saveLoadWithSerializer(Common::Serializer &ser); }; +struct DeviceChannelUsage { + MusicEntry *_song; + int _channel; + bool operator==(const DeviceChannelUsage& other) const { return _song == other._song && _channel == other._channel; } + bool operator!=(const DeviceChannelUsage& other) const { return !(*this == other); } +}; + +struct ChannelRemapping { + DeviceChannelUsage _map[16]; + int _prio[16]; + int _voices[16]; + bool _dontRemap[16]; + int _freeVoices; + + void clear(); + void swap(int i, int j); + void evict(int i); + ChannelRemapping& operator=(ChannelRemapping& other); + int lowestPrio() const; +}; + typedef Common::Array<MusicEntry *> MusicList; typedef Common::Array<uint32> MidiCommandQueue; @@ -198,9 +232,6 @@ public: // where a deadlock can occur Common::Mutex _mutex; - int16 tryToOwnChannel(MusicEntry *caller, int16 bestChannel); - void freeChannels(MusicEntry *caller); - protected: void sortPlayList(); @@ -213,6 +244,11 @@ protected: // If true and a sound has a digital track, the sound from the AdLib track is played bool _useDigitalSFX; + // remapping: + void remapChannels(); + ChannelRemapping *determineChannelMap(); + void resetDeviceChannel(int devChannel); + private: MusicList _playList; bool _soundOn; @@ -221,6 +257,8 @@ private: int8 _channelRemap[16]; int8 _globalReverb; + DeviceChannelUsage _channelMap[16]; + MidiCommandQueue _queuedCommands; MusicType _musicType; diff --git a/engines/teenagent/callbacks.cpp b/engines/teenagent/callbacks.cpp index 3e6e40a8fa..4761cabc78 100644 --- a/engines/teenagent/callbacks.cpp +++ b/engines/teenagent/callbacks.cpp @@ -1808,6 +1808,10 @@ bool TeenAgentEngine::processCallback(uint16 addr) { displayMessage(dsAddr_uninterestingHaystackMsg); // "I don't see anything interesting about this haystack" break; + case 0x6663: + displayMessage(dsAddr_uninterestingHaystackMsg); // "I don't see anything interesting about this haystack" + break; + case 0x666a: displayMessage(dsAddr_moreComplicatedMsg); // "It's more complicated than that" break; diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 7f27c43a22..16fe45044b 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2964,8 +2964,9 @@ void SceneObjectList::draw() { g_globals->_sceneManager._sceneBgOffset.y); } - // Set up the flag mask - uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1; + // Set up the flag mask. Currently, paneNum is always set to 0, so the check is meaningless + // uint32 flagMask = (paneNum == 0) ? OBJFLAG_PANE_0 : OBJFLAG_PANE_1; + uint32 flagMask = OBJFLAG_PANE_0; // Initial loop to set up object list and update object position, priority, and flags for (SynchronizedList<SceneObject *>::iterator i = g_globals->_sceneObjects->begin(); diff --git a/engines/tsage/detection_tables.h b/engines/tsage/detection_tables.h index 0f7f1e49bb..123f04f8e2 100644 --- a/engines/tsage/detection_tables.h +++ b/engines/tsage/detection_tables.h @@ -171,7 +171,20 @@ static const tSageGameDescription gameDescriptions[] = { GType_Ringworld2, GF_CD | GF_ALT_REGIONS }, - + // Return to Ringworld - Demo + { + { + "ringworld2", + "CD Demo", + AD_ENTRY1s("r2rw.rlb", "c8e1a82c67c3caf57368eadde13dc15f", 32384464), + Common::EN_ANY, + Common::kPlatformDOS, + ADGF_CD | ADGF_TESTING, + GUIO0() + }, + GType_Ringworld2, + GF_CD | GF_ALT_REGIONS | GF_DEMO + }, { AD_TABLE_END_MARKER, 0, 0 } }; diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp index 6baa654214..0ba60384bf 100644 --- a/engines/tsage/events.cpp +++ b/engines/tsage/events.cpp @@ -156,7 +156,7 @@ void EventsClass::setCursor(CursorType cursorType) { // No cursor g_globals->setFlag(122); - if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() != GType_Ringworld)) { + if ((g_vm->getGameID() != GType_Ringworld) || ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_DEMO))) { CursorMan.showMouse(false); return; } diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 50d4b4e008..9b1b0f1dcb 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -64,17 +64,39 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _stripNum = 0; _gfxEdgeAdjust = 3; - if (g_vm->getFeatures() & GF_DEMO) { - _gfxFontNumber = 0; - _gfxColors.background = 6; - _gfxColors.foreground = 0; - _fontColors.background = 255; - _fontColors.foreground = 6; - _dialogCenter.y = 80; - // Workaround in order to use later version of the engine - _color1 = _gfxColors.foreground; - _color2 = _gfxColors.foreground; - _color3 = _gfxColors.foreground; + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) { + _gfxFontNumber = 0; + _gfxColors.background = 6; + _gfxColors.foreground = 0; + _fontColors.background = 255; + _fontColors.foreground = 6; + _dialogCenter.y = 80; + // Workaround in order to use later version of the engine + _color1 = _gfxColors.foreground; + _color2 = _gfxColors.foreground; + _color3 = _gfxColors.foreground; + } else if (g_vm->getFeatures() & GF_CD) { + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 0; + _fontColors.background = 51; + _fontColors.foreground = 54; + _color1 = 18; + _color2 = 18; + _color3 = 18; + } else { + // Floppy version + _gfxFontNumber = 50; + _gfxColors.background = 53; + _gfxColors.foreground = 18; + _fontColors.background = 51; + _fontColors.foreground = 54; + // Workaround in order to use later version of the engine + _color1 = _gfxColors.foreground; + _color2 = _gfxColors.foreground; + _color3 = _gfxColors.foreground; + } } else if (g_vm->getGameID() == GType_BlueForce) { // Blue Force _gfxFontNumber = 0; @@ -94,26 +116,6 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface _color2 = 15; _color3 = 4; _dialogCenter.y = 100; - } else if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_CD)) { - _gfxFontNumber = 50; - _gfxColors.background = 53; - _gfxColors.foreground = 0; - _fontColors.background = 51; - _fontColors.foreground = 54; - _color1 = 18; - _color2 = 18; - _color3 = 18; - } else { - // Ringworld - _gfxFontNumber = 50; - _gfxColors.background = 53; - _gfxColors.foreground = 18; - _fontColors.background = 51; - _fontColors.foreground = 54; - // Workaround in order to use later version of the engine - _color1 = _gfxColors.foreground; - _color2 = _gfxColors.foreground; - _color3 = _gfxColors.foreground; } _screenSurface.setScreenSurface(); _gfxManagers.push_back(&_gfxManagerInstance); diff --git a/engines/tsage/graphics.cpp b/engines/tsage/graphics.cpp index fa3ed33302..97857aca34 100644 --- a/engines/tsage/graphics.cpp +++ b/engines/tsage/graphics.cpp @@ -1390,7 +1390,10 @@ void GfxManager::copyFrom(GfxSurface &src, const Rect &srcBounds, const Rect &de GfxFont::GfxFont() { - _fontNumber = (g_vm->getFeatures() & GF_DEMO) ? 0 : 50; + if ((g_vm->getGameID() == GType_Ringworld) && (g_vm->getFeatures() & GF_DEMO)) + _fontNumber = 0; + else + _fontNumber = 50; _numChars = 0; _bpp = 0; _fontData = NULL; diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 25eafbb171..ef212bc52a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -65,8 +65,12 @@ Scene *Ringworld2Game::createScene(int sceneNumber) { // Deck #2 - By Lift return new Scene200(); case 205: - // Star-field Credits - return new Scene205(); + if (g_vm->getFeatures() & GF_DEMO) + // End of Demo + return new Scene205Demo(); + else + // Star-field Credits + return new Scene205(); case 250: // Lift return new Scene250(); @@ -374,7 +378,16 @@ void SceneExt::postInit(SceneObjectList *OwnerList) { int prevScene = R2_GLOBALS._sceneManager._previousScene; int sceneNumber = R2_GLOBALS._sceneManager._sceneNumber; - if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) + if (g_vm->getFeatures() & GF_DEMO) { + if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) + || (prevScene == 0) || (sceneNumber == 600) + || ((prevScene == 205 || prevScene == 180) && (sceneNumber == 100))) { + R2_GLOBALS._uiElements._active = true; + R2_GLOBALS._uiElements.show(); + } else { + R2_GLOBALS._uiElements.updateInventory(); + } + } else if (((prevScene == -1) && (sceneNumber != 180) && (sceneNumber != 205) && (sceneNumber != 50)) || (sceneNumber == 50) || ((sceneNumber == 100) && (prevScene == 0 || prevScene == 180 || prevScene == 205))) { R2_GLOBALS._uiElements._active = true; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 7fdc1dc8a7..e04f294b22 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2519,6 +2519,72 @@ void Scene205::handleText() { } /*-------------------------------------------------------------------------- + * Scene 205 Demo - End of Demo + * + *--------------------------------------------------------------------------*/ + +void Scene205Demo::Action1::signal() { + Scene205Demo *scene = (Scene205Demo *)R2_GLOBALS._sceneManager._scene; + + switch (_actionIndex++) { + case 0: + setDelay(2); + break; + case 1: + MessageDialog::show2(BUY_FULL_GAME_MSG, OK_BTN_STRING); + setDelay(1); + break; + case 2: + scene->leaveScene(); + break; + default: + break; + } +} + +/*--------------------------------------------------------------------------*/ + +void Scene205Demo::leaveScene() { + if (g_globals->getFlag(85)) + R2_GLOBALS._sceneManager.changeScene(160); + else + R2_GLOBALS._sceneManager.changeScene(R2_GLOBALS._sceneManager._previousScene); + + BF_GLOBALS._scenePalette.loadPalette(0); + BF_GLOBALS._scenePalette.refresh(); +} + +void Scene205Demo::postInit(SceneObjectList *OwnerList) { + R2_GLOBALS._sceneManager._hasPalette = true; + R2_GLOBALS._scenePalette.loadPalette(0); + + loadScene(1000); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._player.enableControl(); + + SceneExt::postInit(); + + _sound1.play(337); + _stripManager.addSpeaker(&_animationPlayer); + + setAction(&_action1); +} + +void Scene205Demo::remove() { + R2_GLOBALS._sound1.fadeOut2(NULL); + SceneExt::remove(); +} + +void Scene205Demo::process(Event &event) { + if ((event.eventType == EVENT_KEYPRESS) && (event.kbd.keycode == Common::KEYCODE_ESCAPE)) { + event.handled = true; + leaveScene(); + } else { + Scene::process(event); + } +} + +/*-------------------------------------------------------------------------- * Scene 250 - Lift * *--------------------------------------------------------------------------*/ @@ -3550,7 +3616,11 @@ void Scene300::signal() { R2_GLOBALS.setFlag(40); break; case 6: - R2_GLOBALS._sceneManager.changeScene(1000); + if (g_vm->getFeatures() & GF_DEMO) { + R2_GLOBALS.setFlag(85); + R2_GLOBALS._sceneManager.changeScene(205); + } else + R2_GLOBALS._sceneManager.changeScene(1000); break; default: break; @@ -3611,8 +3681,14 @@ void Scene300::signal() { case 16: if (_stripManager._exitMode == 1) { - R2_GLOBALS._player.setAction(NULL); - R2_GLOBALS._sceneManager.changeScene(1000); + if (g_vm->getFeatures() & GF_DEMO) { + R2_GLOBALS._player.setAction(NULL); + R2_GLOBALS.setFlag(85); + R2_GLOBALS._sceneManager.changeScene(205); + } else { + R2_GLOBALS._player.setAction(NULL); + R2_GLOBALS._sceneManager.changeScene(1000); + } } else { R2_GLOBALS._player.setAction(&_action1); R2_GLOBALS._player.enableControl(CURSOR_TALK); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 0e68b67ee7..216039a348 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -304,6 +304,24 @@ public: virtual void dispatch(); }; +class Scene205Demo: public SceneExt { + /* Actions */ + class Action1: public Action { + public: + virtual void signal(); + }; +private: + void leaveScene(); +public: + VisualSpeaker _animationPlayer; + ASound _sound1; + Action1 _action1; +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void process(Event &event); +}; + class Scene250: public SceneExt { class Button: public SceneActor { public: diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 0025d0ba61..075420a1c9 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -11491,16 +11491,7 @@ void Scene1800::signal() { R2_GLOBALS._walkRegions.disableRegion(10); R2_GLOBALS._walkRegions.disableRegion(11); R2_GLOBALS.setFlag(63); - - // The following check is completely dumb. - // Either an original bug, or dead code. - if (R2_GLOBALS.getFlag(63)) { - R2_GLOBALS._player.enableControl(CURSOR_WALK); - } else { - _sceneMode = 10; - R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - _stripManager.start(545, this); - } + R2_GLOBALS._player.enableControl(CURSOR_WALK); break; case 1802: R2_GLOBALS.clearFlag(14); diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 3c850cf8dc..fb08195180 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -253,6 +253,8 @@ char const *const USE_INTERCEPTOR = "Do you want to use your interceptor card?"; char const *const USE_DOUBLE_AGENT = "Do you want to use your double agent?"; char const *const NEED_INSTRUCTIONS = "Do you want instructions?"; char const *const WRONG_ANSWER_MSG = "Wrong respond value sent."; +char const *const BUY_FULL_GAME_MSG = "To order the complete game, RETURN TO RINGWORLD, call 1-800-482-3766!"; + const byte scene1550JunkLocationsDefault[] = { 20, 7, 41, 6, 3, 6, 42, 11, diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index c18f31fdfc..334a240f28 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -206,6 +206,7 @@ extern char const *const USE_DOUBLE_AGENT; extern char const *const NEED_INSTRUCTIONS; extern char const *const WRONG_ANSWER_MSG; +extern char const *const BUY_FULL_GAME_MSG; // Scene 1550 arrays of constants extern const byte scene1550JunkLocationsDefault[]; extern const byte scene1550AreaMap[]; diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp index 80e2116c54..36708e373e 100644 --- a/engines/tsage/tsage.cpp +++ b/engines/tsage/tsage.cpp @@ -39,10 +39,12 @@ TSageEngine::TSageEngine(OSystem *system, const tSageGameDescription *gameDesc) g_vm = this; DebugMan.addDebugChannel(kRingDebugScripts, "scripts", "Scripts debugging"); _debugger = nullptr; - if (g_vm->getFeatures() & GF_DEMO) - _debugger = new DemoDebugger(); - else if (g_vm->getGameID() == GType_Ringworld) - _debugger = new RingworldDebugger(); + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) + _debugger = new DemoDebugger(); + else + _debugger = new RingworldDebugger(); + } else if (g_vm->getGameID() == GType_BlueForce) _debugger = new BlueForceDebugger(); else if (g_vm->getGameID() == GType_Ringworld2) @@ -76,16 +78,16 @@ void TSageEngine::initialize() { // Set up the resource manager g_resourceManager = new ResourceManager(); - if (g_vm->getFeatures() & GF_DEMO) { - // Add the single library file associated with the demo - g_resourceManager->addLib(getPrimaryFilename()); - g_globals = new Globals(); - - } else if (g_vm->getGameID() == GType_Ringworld) { - g_resourceManager->addLib("RING.RLB"); - g_resourceManager->addLib("TSAGE.RLB"); - g_globals = new Globals(); - + if (g_vm->getGameID() == GType_Ringworld) { + if (g_vm->getFeatures() & GF_DEMO) { + // Add the single library file associated with the demo + g_resourceManager->addLib(getPrimaryFilename()); + g_globals = new Globals(); + } else { + g_resourceManager->addLib("RING.RLB"); + g_resourceManager->addLib("TSAGE.RLB"); + g_globals = new Globals(); + } } else if (g_vm->getGameID() == GType_BlueForce) { g_resourceManager->addLib("BLUE.RLB"); if (g_vm->getFeatures() & GF_FLOPPY) { diff --git a/engines/wintermute/detection_tables.h b/engines/wintermute/detection_tables.h index 16cd3caa23..e7f2ed90a9 100644 --- a/engines/wintermute/detection_tables.h +++ b/engines/wintermute/detection_tables.h @@ -295,6 +295,19 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Czech) + { + "dirtysplit", + "", + { + {"czech.dcp", 0, "08a71446467cf8f9444cfea446b46ad6", 127697934}, + {"data.dcp", 0, "8b4b81b718bf65f30a67fc0b1e329eb5", 88577623}, + }, + Common::CZ_CZE, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (English) { "dirtysplit", @@ -305,6 +318,20 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (French) + { + "dirtysplit", + "", + { + {"french.dcp", 0, "a0508dedebd0fe478d0158fa4c2a1136", 125534323}, + {"data.dcp", 0, "e6d70c7f5d181b761cfcf974adf9186a", 88577623}, + AD_LISTEND + }, + Common::FR_FRA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Dirty Split (German) { "dirtysplit", @@ -315,6 +342,32 @@ static const ADGameDescription gameDescriptions[] = { ADGF_UNSTABLE, GUIO0() }, + // Dirty Split (Italian) + { + "dirtysplit", + "", + { + {"italian.dcp", 0, "8108807fbd8af70be1ec452d0fd1131b", 125513726}, + {"data.dcp", 0, "35a150e22af274185883fdbb142c6fb1", 88577623}, + }, + Common::IT_ITA, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, + // Dirty Split (Spanish) + { + "dirtysplit", + "", + { + {"spanish.dcp", 0, "b3982c0a5e85b42e1e38240fef004aa4", 164428596}, + {"data.dcp", 0, "63766d6c68b9f00b632ea1736fc8a95c", 88577621}, + }, + Common::ES_ESP, + Common::kPlatformWindows, + ADGF_UNSTABLE, + GUIO0() + }, // Des Reves Elastiques Avec Mille Insectes Nommes Georges { "dreaming", diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index ce04db8a67..a3ec66a29d 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -620,7 +620,10 @@ applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { template<typename PixelType> inline void VectorRendererSpec<PixelType>:: blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { - if (sizeof(PixelType) == 4) { + if (alpha == 0xff) { + // fully opaque pixel, don't blend + *ptr = color | _alphaMask; + } else if (sizeof(PixelType) == 4) { const byte sR = (color & _redMask) >> _format.rShift; const byte sG = (color & _greenMask) >> _format.gShift; const byte sB = (color & _blueMask) >> _format.bShift; @@ -628,15 +631,17 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { byte dR = (*ptr & _redMask) >> _format.rShift; byte dG = (*ptr & _greenMask) >> _format.gShift; byte dB = (*ptr & _blueMask) >> _format.bShift; + byte dA = (*ptr & _alphaMask) >> _format.aShift; dR += ((sR - dR) * alpha) >> 8; dG += ((sG - dG) * alpha) >> 8; dB += ((sB - dB) * alpha) >> 8; + dA += ((0xff - dA) * alpha) >> 8; *ptr = ((dR << _format.rShift) & _redMask) | ((dG << _format.gShift) & _greenMask) | ((dB << _format.bShift) & _blueMask) - | (*ptr & _alphaMask); + | ((dA << _format.aShift) & _alphaMask); } else if (sizeof(PixelType) == 2) { int idst = *ptr; int isrc = color; @@ -651,7 +656,9 @@ blendPixelPtr(PixelType *ptr, PixelType color, uint8 alpha) { (_blueMask & ((idst & _blueMask) + ((int)(((int)(isrc & _blueMask) - (int)(idst & _blueMask)) * alpha) >> 8))) | - (idst & _alphaMask)); + (_alphaMask & ((idst & _alphaMask) + + ((int)(((int)(_alphaMask) - + (int)(idst & _alphaMask)) * alpha) >> 8)))); } else { error("Unsupported BPP format: %u", (uint)sizeof(PixelType)); } @@ -691,8 +698,7 @@ darkenFill(PixelType *ptr, PixelType *end) { // assuming at least 3 alpha bits mask |= 3 << _format.aShift; - PixelType addA = (PixelType)(255 >> _format.aLoss) << _format.aShift; - addA -= (addA >> 2); + PixelType addA = (PixelType)(3 << (_format.aShift + 6 - _format.aLoss)); while (ptr != end) { // Darken the colour, and increase the alpha diff --git a/gui/about.cpp b/gui/about.cpp index 3bb1934e28..459a6b5490 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -56,7 +56,7 @@ enum { static const char *copyright_text[] = { "", -"C0""Copyright (C) 2001-2013 The ScummVM project", +"C0""Copyright (C) 2001-2014 The ScummVM Team", "C0""http://www.scummvm.org", "", "C0""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 binary.", diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 35627dd584..9aa322e12e 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -133,6 +133,14 @@ Debugger *g_readline_debugger; char *readline_completionFunction(const char *text, int state) { return g_readline_debugger->readlineComplete(text, state); } + +#ifdef USE_READLINE_INT_COMPLETION +typedef int RLCompFunc_t(const char *, int); +#else +typedef char *RLCompFunc_t(const char *, int); +#endif + + } // end of anonymous namespace #endif @@ -162,7 +170,7 @@ void Debugger::enter() { // TODO: add support for saving/loading history? g_readline_debugger = this; - rl_completion_entry_function = &readline_completionFunction; + rl_completion_entry_function = (RLCompFunc_t *)&readline_completionFunction; char *line_read = 0; do { diff --git a/po/be_BY.po b/po/be_BY.po index 4c36c65f71..20b03b7725 100644 --- a/po/be_BY.po +++ b/po/be_BY.po @@ -1,5 +1,5 @@ # Belarusian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Ivan Lukyanov <greencis@mail.ru>, 2013. # diff --git a/po/ca_ES.po b/po/ca_ES.po index f201be5cba..b8238939a0 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -1,5 +1,5 @@ # Catalan translation for ScummVM. -# Copyright (C) 2007-2013 ScummVM Team +# Copyright (C) 2007-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Jordi Vilalta Prat <jvprat@jvprat.com>, 2007-2011. # diff --git a/po/cs_CZ.po b/po/cs_CZ.po index 4b330af830..67a21573b4 100644 --- a/po/cs_CZ.po +++ b/po/cs_CZ.po @@ -1,5 +1,5 @@ # Czech translation for ScummVM. -# Copyright (C) 2001-2013 ScummVM Team +# Copyright (C) 2001-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Zbynìk Schwarz <zbynek.schwarz@gmail.com>, 2011-2013. # diff --git a/po/da_DA.po b/po/da_DA.po index bb7ed32c83..192ceeb50d 100644 --- a/po/da_DA.po +++ b/po/da_DA.po @@ -1,5 +1,5 @@ # Dansk translation for ScummVM -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Steffen Nyeland <steffen@nyeland.dk>, 2010. # diff --git a/po/de_DE.po b/po/de_DE.po index fac3c1f103..7275e136f2 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -1,5 +1,5 @@ # German translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Simon Sawatzki <SimSaw@gmx.de>, Lothar Serra Mari, 2013. # diff --git a/po/es_ES.po b/po/es_ES.po index 6bc001682d..a859019924 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -1,5 +1,5 @@ # Spanish translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Tomás Maidagan, 2011. # @@ -1,5 +1,5 @@ # Basque translation for ScummVM. -# Copyright (C) 2012-2013 ScummVM Team +# Copyright (C) 2012-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Mikel Iturbe Urretxa <mikel@hamahiru.org>, 2012. # diff --git a/po/fi_FI.po b/po/fi_FI.po index 5471e5db58..73aac4cc9c 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -1,5 +1,5 @@ # Finnish translation for ScummVM. -# Copyright (c) 2012-2013 ScummVM Team +# Copyright (c) 2012-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Toni Saarela <saarela@gmail.com>, 2012. # diff --git a/po/fr_FR.po b/po/fr_FR.po index a853d190aa..c4978d4292 100644 --- a/po/fr_FR.po +++ b/po/fr_FR.po @@ -1,5 +1,5 @@ # French translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Thierry Crozat <criezy@scummvm.org>, 2011. # diff --git a/po/gl_ES.po b/po/gl_ES.po index cce9a5dfa7..3e0b92bef0 100644 --- a/po/gl_ES.po +++ b/po/gl_ES.po @@ -1,5 +1,5 @@ # Galician translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Santiago G. Sanz <s.sanz@uvigo.es>, 2013. # diff --git a/po/hu_HU.po b/po/hu_HU.po index 89bfa80d56..ae8f7a5aa9 100644 --- a/po/hu_HU.po +++ b/po/hu_HU.po @@ -1,5 +1,5 @@ # Hungarian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # George Kormendi <grubycza@hotmail.com>, 2010. # diff --git a/po/it_IT.po b/po/it_IT.po index cd449c269a..ddba2a0066 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -1,5 +1,5 @@ # Italian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Matteo 'Maff' Angelino <matteo.maff at gmail dot com>, 2010. # diff --git a/po/nb_NO.po b/po/nb_NO.po index f41e71f8ae..b438b53d78 100644 --- a/po/nb_NO.po +++ b/po/nb_NO.po @@ -1,5 +1,5 @@ # Norwegian (Bokmaal) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Einar Johan T. Sømåen <einarjohants@gmail.com>, 2010. # diff --git a/po/nn_NO.po b/po/nn_NO.po index 2c09192d5c..443fae2970 100644 --- a/po/nn_NO.po +++ b/po/nn_NO.po @@ -1,5 +1,5 @@ # Norwegian (Nynorsk) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Einar Johan T. Sømåen <einarjohants@gmail.com>, 2010. # diff --git a/po/pl_PL.po b/po/pl_PL.po index 38cedb55d7..826846dfcb 100644 --- a/po/pl_PL.po +++ b/po/pl_PL.po @@ -1,5 +1,5 @@ # Polish translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Grajpopolsku.pl <grajpopolsku@gmail.com>, 2011-2013. # diff --git a/po/pt_BR.po b/po/pt_BR.po index a3a5c3935c..595f36d56c 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -1,5 +1,5 @@ # Portuguese (Brazilian) translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Saulo Benigno <saulobenigno@gmail.com>, 2010. # diff --git a/po/ru_RU.po b/po/ru_RU.po index 8e52f3f342..dc0fc6cc80 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -1,5 +1,5 @@ # Russian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Eugene Sandulenko <sev@scummvm.org>, 2010` # diff --git a/po/se_SE.po b/po/se_SE.po index 0031e2dc06..eaff1de836 100644 --- a/po/se_SE.po +++ b/po/se_SE.po @@ -1,5 +1,5 @@ # Swedish translation for ScummVM. -# Copyright (C) 2011-2013 ScummVM Team +# Copyright (C) 2011-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Hampus Flink <hampus.flink@gmail.com>, 2011. # diff --git a/po/uk_UA.po b/po/uk_UA.po index 2a42ff47d9..5c27fcd479 100644 --- a/po/uk_UA.po +++ b/po/uk_UA.po @@ -1,5 +1,5 @@ # Ukrainian translation for ScummVM. -# Copyright (C) 2010-2013 ScummVM Team +# Copyright (C) 2010-2014 ScummVM Team # This file is distributed under the same license as the ScummVM package. # Lubomyr Lisen, 2010. # diff --git a/video/avi_decoder.cpp b/video/avi_decoder.cpp index 36fe83fa19..7f5a557474 100644 --- a/video/avi_decoder.cpp +++ b/video/avi_decoder.cpp @@ -59,6 +59,8 @@ namespace Video { #define ID_MIDS MKTAG('m','i','d','s') #define ID_TXTS MKTAG('t','x','t','s') #define ID_JUNK MKTAG('J','U','N','K') +#define ID_JUNQ MKTAG('J','U','N','Q') +#define ID_DMLH MKTAG('d','m','l','h') #define ID_STRF MKTAG('s','t','r','f') #define ID_MOVI MKTAG('m','o','v','i') #define ID_REC MKTAG('r','e','c',' ') @@ -155,9 +157,11 @@ bool AVIDecoder::parseNextChunk() { case ID_STRD: // Extra stream info, safe to ignore case ID_VEDT: // Unknown, safe to ignore case ID_JUNK: // Alignment bytes, should be ignored + case ID_JUNQ: // Same as JUNK, safe to ignore case ID_ISFT: // Metadata, safe to ignore case ID_DISP: // Metadata, should be safe to ignore case ID_STRN: // Metadata, safe to ignore + case ID_DMLH: // OpenDML extension, contains an extra total frames field, safe to ignore skipChunk(size); break; case ID_IDX1: diff --git a/video/smk_decoder.cpp b/video/smk_decoder.cpp index 3dbcebcde4..0247fe5dc9 100644 --- a/video/smk_decoder.cpp +++ b/video/smk_decoder.cpp @@ -726,16 +726,15 @@ void SmackerDecoder::SmackerVideoTrack::unpackPalette(Common::SeekableReadStream } else { // top 2 bits are 00 sz++; // get the lower 6 bits for each component (0x3f = 00111111) - byte b = b0 & 0x3f; + byte r = b0 & 0x3f; byte g = (*p++) & 0x3f; - byte r = (*p++) & 0x3f; + byte b = (*p++) & 0x3f; - assert(g < 0xc0 && b < 0xc0); - - // upscale to full 8-bit color values by multiplying by 4 - *pal++ = b * 4; - *pal++ = g * 4; - *pal++ = r * 4; + // upscale to full 8-bit color values. The Multimedia Wiki suggests + // a lookup table for this, but this should produce the same result. + *pal++ = (r * 4 + r / 16); + *pal++ = (g * 4 + g / 16); + *pal++ = (b * 4 + b / 16); } } |