diff options
author | johndoe123 | 2015-11-18 13:03:45 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2018-07-20 06:43:33 +0000 |
commit | a30a31868b44d3218e59c6eca42bf1d924b996e8 (patch) | |
tree | b258104ca4918bcc6d7c5b28e6ea99583bd38de6 | |
parent | 88ea89118473e149de077f2c620dc5424e1ed1a2 (diff) | |
download | scummvm-rg350-a30a31868b44d3218e59c6eca42bf1d924b996e8.tar.gz scummvm-rg350-a30a31868b44d3218e59c6eca42bf1d924b996e8.tar.bz2 scummvm-rg350-a30a31868b44d3218e59c6eca42bf1d924b996e8.zip |
ILLUSIONS: Move screen shaker effects into separate file
-rw-r--r-- | engines/illusions/duckman/duckman_screenshakereffects.cpp | 102 | ||||
-rw-r--r-- | engines/illusions/duckman/duckman_screenshakereffects.h | 34 | ||||
-rw-r--r-- | engines/illusions/duckman/duckman_specialcode.cpp | 67 | ||||
-rw-r--r-- | engines/illusions/module.mk | 1 |
4 files changed, 139 insertions, 65 deletions
diff --git a/engines/illusions/duckman/duckman_screenshakereffects.cpp b/engines/illusions/duckman/duckman_screenshakereffects.cpp new file mode 100644 index 0000000000..44f3ebc0ee --- /dev/null +++ b/engines/illusions/duckman/duckman_screenshakereffects.cpp @@ -0,0 +1,102 @@ +/* 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 "illusions/duckman/illusions_duckman.h" +#include "illusions/duckman/duckman_specialcode.h" +#include "illusions/duckman/duckman_inventory.h" +#include "illusions/duckman/propertytimers.h" +#include "illusions/duckman/scriptopcodes_duckman.h" +#include "illusions/actor.h" +#include "illusions/resources/scriptresource.h" +#include "illusions/specialcode.h" + +#include "engines/util.h" + +namespace Illusions { + +static const ScreenShakerPoint kShakerPoints0[] = { + {0, -2}, {0, -4}, {0, -3}, {0, -1}, {0, 1} +}; + +static const ScreenShakeEffect kShakerEffect0 = { + ARRAYSIZE(kShakerPoints0), 5, kShakerPoints0 +}; + +static const ScreenShakerPoint kShakerPoints1[] = { + {-4, -5}, {4, 5}, {-3, -4}, {3, 4}, {-2, -3}, {2, 3}, {-1, -2}, + { 1, 2}, {0, -1} +}; + +static const ScreenShakeEffect kShakerEffect1 = { + ARRAYSIZE(kShakerPoints1), 2, kShakerPoints1 +}; + +static const ScreenShakerPoint kShakerPoints2[] = { + {0, -3}, {0, 3}, {0, -2}, {0, 2}, {0, -2}, {0, 2}, {0, -1}, + {0, 1}, {0, -1}, +}; + +static const ScreenShakeEffect kShakerEffect2 = { + ARRAYSIZE(kShakerPoints2), 2, kShakerPoints2 +}; + +static const ScreenShakerPoint kShakerPoints3[] = { + {0, 1}, {0, -1}, {0, -2}, {0, 0}, {(int16)32768, 0} +}; + +static const ScreenShakeEffect kShakerEffect3 = { + ARRAYSIZE(kShakerPoints3), 2, kShakerPoints3 +}; + +static const ScreenShakerPoint kShakerPoints4[] = { + {0, 4}, {0, -1}, {0, 3}, {0, -2}, {0, 1}, {0, -1}, {0, 1}, {0, -1} +}; + +static const ScreenShakeEffect kShakerEffect4 = { + ARRAYSIZE(kShakerPoints4), 5, kShakerPoints4 +}; + +static const ScreenShakerPoint kShakerPoints5[] = { + {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, + {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, + {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, + {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0} +}; + +static const ScreenShakeEffect kShakerEffect5 = { + ARRAYSIZE(kShakerPoints5), 2, kShakerPoints5 +}; + +static const ScreenShakeEffect *kShakerEffects[] = { + &kShakerEffect0, + &kShakerEffect1, + &kShakerEffect2, + &kShakerEffect3, + &kShakerEffect4, + &kShakerEffect5 +}; + +const ScreenShakeEffect *getScreenShakeEffect(byte index) { + return kShakerEffects[index]; +} + +} // End of namespace Illusions diff --git a/engines/illusions/duckman/duckman_screenshakereffects.h b/engines/illusions/duckman/duckman_screenshakereffects.h new file mode 100644 index 0000000000..c868ce4fbe --- /dev/null +++ b/engines/illusions/duckman/duckman_screenshakereffects.h @@ -0,0 +1,34 @@ +/* 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. + * + */ + +#ifndef ILLUSIONS_DUCKMAN_SCREENSHAKEEFFECTS_H +#define ILLUSIONS_DUCKMAN_SCREENSHAKEEFFECTS_H + +#include "illusions/illusions.h" + +namespace Illusions { + +const ScreenShakeEffect *getScreenShakeEffect(byte index); + +} // End of namespace Illusions + +#endif // ILLUSIONS_DUCKMAN_SCREENSHAKEEFFECTS_H diff --git a/engines/illusions/duckman/duckman_specialcode.cpp b/engines/illusions/duckman/duckman_specialcode.cpp index af52183097..d0d8a5c798 100644 --- a/engines/illusions/duckman/duckman_specialcode.cpp +++ b/engines/illusions/duckman/duckman_specialcode.cpp @@ -21,6 +21,7 @@ */ #include "illusions/duckman/illusions_duckman.h" +#include "illusions/duckman/duckman_screenshakereffects.h" #include "illusions/duckman/duckman_specialcode.h" #include "illusions/duckman/duckman_inventory.h" #include "illusions/duckman/propertytimers.h" @@ -79,73 +80,9 @@ void DuckmanSpecialCode::run(uint32 specialCodeId, OpCall &opCall) { } } -// TODO Move to separate file - -static const ScreenShakerPoint kShakerPoints0[] = { - {0, -2}, {0, -4}, {0, -3}, {0, -1}, {0, 1} -}; - -static const ScreenShakeEffect kShakerEffect0 = { - ARRAYSIZE(kShakerPoints0), 5, kShakerPoints0 -}; - -static const ScreenShakerPoint kShakerPoints1[] = { - {-4, -5}, {4, 5}, {-3, -4}, {3, 4}, {-2, -3}, {2, 3}, {-1, -2}, - { 1, 2}, {0, -1} -}; - -static const ScreenShakeEffect kShakerEffect1 = { - ARRAYSIZE(kShakerPoints1), 2, kShakerPoints1 -}; - -static const ScreenShakerPoint kShakerPoints2[] = { - {0, -3}, {0, 3}, {0, -2}, {0, 2}, {0, -2}, {0, 2}, {0, -1}, - {0, 1}, {0, -1}, -}; - -static const ScreenShakeEffect kShakerEffect2 = { - ARRAYSIZE(kShakerPoints2), 2, kShakerPoints2 -}; - -static const ScreenShakerPoint kShakerPoints3[] = { - {0, 1}, {0, -1}, {0, -2}, {0, 0}, {(int16)32768, 0} -}; - -static const ScreenShakeEffect kShakerEffect3 = { - ARRAYSIZE(kShakerPoints3), 2, kShakerPoints3 -}; - -static const ScreenShakerPoint kShakerPoints4[] = { - {0, 4}, {0, -1}, {0, 3}, {0, -2}, {0, 1}, {0, -1}, {0, 1}, {0, -1} -}; - -static const ScreenShakeEffect kShakerEffect4 = { - ARRAYSIZE(kShakerPoints4), 5, kShakerPoints4 -}; - -static const ScreenShakerPoint kShakerPoints5[] = { - {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, - {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, - {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0}, - {0, -1}, {0, 0}, {0, 1}, {0, 0}, {0, -1}, {0, 0}, {0, 1}, {0, 0} -}; - -static const ScreenShakeEffect kShakerEffect5 = { - ARRAYSIZE(kShakerPoints5), 2, kShakerPoints5 -}; - -static const ScreenShakeEffect *kShakerEffects[] = { - &kShakerEffect0, - &kShakerEffect1, - &kShakerEffect2, - &kShakerEffect3, - &kShakerEffect4, - &kShakerEffect5 -}; - void DuckmanSpecialCode::spcStartScreenShaker(OpCall &opCall) { ARG_BYTE(effect); - const ScreenShakeEffect *shakerEffect = kShakerEffects[effect]; + const ScreenShakeEffect *shakerEffect = getScreenShakeEffect(effect); _vm->startScreenShaker(shakerEffect->_pointsCount, shakerEffect->_duration, shakerEffect->_points, opCall._threadId); } diff --git a/engines/illusions/module.mk b/engines/illusions/module.mk index d1df55c6a9..083e2f5980 100644 --- a/engines/illusions/module.mk +++ b/engines/illusions/module.mk @@ -15,6 +15,7 @@ MODULE_OBJS := \ dictionary.o \ duckman/duckman_dialog.o \ duckman/duckman_inventory.o \ + duckman/duckman_screenshakereffects.o \ duckman/duckman_specialcode.o \ duckman/illusions_duckman.o \ duckman/propertytimers.o \ |