2021-05-17 18:47:39 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 17:47:58 +00:00
|
|
|
* 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 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2021-05-17 18:47:39 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* aint32 with this program; if not, write to the Free Software
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Based on the original sources
|
|
|
|
* Faery Tale II -- The Halls of the Dead
|
|
|
|
* (c) 1993-1996 The Wyrmkeep Entertainment Co.
|
|
|
|
*/
|
|
|
|
|
2021-06-23 12:41:01 +00:00
|
|
|
#include "saga2/saga2.h"
|
2021-05-31 22:55:54 +00:00
|
|
|
#include "saga2/objproto.h"
|
2021-05-17 18:47:39 +00:00
|
|
|
#include "saga2/spellbuk.h"
|
2021-05-31 22:55:54 +00:00
|
|
|
#include "saga2/spelshow.h"
|
2021-05-17 18:47:39 +00:00
|
|
|
|
|
|
|
namespace Saga2 {
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
// General contents
|
|
|
|
// This file contains the effectron sprite selection functions
|
|
|
|
|
|
|
|
/* ===================================================================== *
|
|
|
|
Inlines
|
|
|
|
* ===================================================================== */
|
|
|
|
|
|
|
|
// random sprite from primary range
|
2022-09-27 12:41:58 +00:00
|
|
|
#define PRIMARY (effectron->_parent->_dProto->_primarySpriteNo?\
|
|
|
|
(effectron->_parent->_dProto->_primarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->_dProto->_primarySpriteNo - 1)):\
|
|
|
|
effectron->_parent->_dProto->_primarySpriteID)
|
2021-05-17 18:47:39 +00:00
|
|
|
// random sprite from secondary range
|
2022-09-27 12:41:58 +00:00
|
|
|
#define SECONDARY (effectron->_parent->_dProto->_secondarySpriteNo?\
|
|
|
|
(effectron->_parent->_dProto->_secondarySpriteID + g_vm->_rnd->getRandomNumber(effectron->_parent->_dProto->_secondarySpriteNo - 1)):\
|
|
|
|
effectron->_parent->_dProto->_secondarySpriteID)
|
2021-05-17 18:47:39 +00:00
|
|
|
// ordered sprite from primary range
|
2022-09-27 12:41:58 +00:00
|
|
|
#define SEQUENTIAL (effectron->_parent->_dProto->_primarySpriteNo?\
|
|
|
|
(effectron->_parent->_dProto->_primarySpriteID + effectron->_stepNo%effectron->_parent->_dProto->_primarySpriteNo):\
|
|
|
|
effectron->_parent->_dProto->_primarySpriteID)
|
2021-05-17 18:47:39 +00:00
|
|
|
// ordered sprite from secondary range
|
2022-09-27 12:41:58 +00:00
|
|
|
#define SECUENTIAL (effectron->_parent->_dProto->_secondarySpriteNo?\
|
|
|
|
(effectron->_parent->_dProto->_secondarySpriteID + effectron->_stepNo%effectron->_parent->_dProto->_secondarySpriteNo):\
|
|
|
|
effectron->_parent->_dProto->_secondarySpriteID)
|
2021-05-17 18:47:39 +00:00
|
|
|
// ordered sprite from primary range for exchange
|
2022-09-27 12:41:58 +00:00
|
|
|
#define SEMIQUENTIAL (effectron->_parent->_dProto->_primarySpriteNo?\
|
|
|
|
(effectron->_parent->_dProto->_primarySpriteID + (effectron->_partno/2)%effectron->_parent->_dProto->_primarySpriteNo):\
|
|
|
|
effectron->_parent->_dProto->_primarySpriteID)
|
2021-05-17 18:47:39 +00:00
|
|
|
|
|
|
|
/* ===================================================================== *
|
|
|
|
Color mapping selection
|
|
|
|
* ===================================================================== */
|
|
|
|
|
|
|
|
// color map selection
|
|
|
|
int16 whichColorMap(EffectID eid, const Effectron *const effectron) {
|
|
|
|
int16 rval = 0;
|
|
|
|
switch (eid) {
|
2022-10-29 12:33:52 +00:00
|
|
|
case keAreaInvisible:
|
|
|
|
case keAreaAura:
|
|
|
|
case keAreaGlow:
|
|
|
|
case keAreaProjectile:
|
|
|
|
case keAreaExchange:
|
|
|
|
case keAreaMissle:
|
|
|
|
case keAreaBeam:
|
|
|
|
case keAreaWall:
|
2021-05-17 18:47:39 +00:00
|
|
|
rval = 0;
|
|
|
|
break;
|
2022-10-29 12:33:52 +00:00
|
|
|
case keAreaSquare:
|
|
|
|
case keAreaBall:
|
|
|
|
case keAreaStorm:
|
2022-09-27 12:41:58 +00:00
|
|
|
rval = (effectron->_parent->_effSeq == 0) ? 0 : 1;
|
2021-05-17 18:47:39 +00:00
|
|
|
break;
|
2022-10-29 12:33:52 +00:00
|
|
|
case keAreaBolt:
|
2022-09-27 11:34:43 +00:00
|
|
|
rval = ((effectron->_partno % 3) == 1) ? 0 : 1;
|
2021-05-17 18:47:39 +00:00
|
|
|
break;
|
2022-10-29 12:33:52 +00:00
|
|
|
case keAreaCone:
|
2022-09-27 11:34:43 +00:00
|
|
|
rval = ((effectron->_partno / 9) == 0) ? 0 : 1;
|
2021-05-17 18:47:39 +00:00
|
|
|
break;
|
2022-10-29 12:33:52 +00:00
|
|
|
case keAreaWave:
|
2022-09-27 11:34:43 +00:00
|
|
|
rval = ((effectron->_partno / 17) == 0) ? 0 : 1;
|
2021-05-17 18:47:39 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* ===================================================================== *
|
|
|
|
Effect specific code
|
|
|
|
* ===================================================================== */
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(invisibleSprites) {
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(auraSprites) {
|
2022-09-27 12:41:58 +00:00
|
|
|
if (effectron->_parent->_effSeq)
|
2021-05-17 18:47:39 +00:00
|
|
|
return SECUENTIAL;
|
|
|
|
return SEQUENTIAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(wallSprites) {
|
|
|
|
return SEQUENTIAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(projectileSprites) {
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(exchangeSprites) {
|
|
|
|
return SEMIQUENTIAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(beamSprites) {
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(boltSprites) {
|
2022-09-27 11:34:43 +00:00
|
|
|
if ((effectron->_partno % 3) == 1)
|
2021-05-17 18:47:39 +00:00
|
|
|
return PRIMARY;
|
|
|
|
return SECONDARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(coneSprites) {
|
2022-09-27 11:34:43 +00:00
|
|
|
if ((effectron->_partno / 9) == 0)
|
2021-05-17 18:47:39 +00:00
|
|
|
return PRIMARY;
|
|
|
|
return SECONDARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(ballSprites) {
|
2022-09-27 12:41:58 +00:00
|
|
|
if (effectron->_parent->_effSeq)
|
2021-05-17 18:47:39 +00:00
|
|
|
return SECONDARY;
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(squareSprites) {
|
2022-09-27 12:41:58 +00:00
|
|
|
if (effectron->_parent->_effSeq)
|
2021-05-17 18:47:39 +00:00
|
|
|
return SECONDARY;
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(waveSprites) {
|
2022-09-27 11:34:43 +00:00
|
|
|
if ((effectron->_partno / 17) == 0)
|
2021-05-17 18:47:39 +00:00
|
|
|
return PRIMARY;
|
|
|
|
return SECONDARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(stormSprites) {
|
2022-09-27 12:41:58 +00:00
|
|
|
if (effectron->_parent->_effSeq)
|
2021-05-17 18:47:39 +00:00
|
|
|
return SECONDARY;
|
|
|
|
return PRIMARY;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(RandomFacing) {
|
2021-06-02 23:05:45 +00:00
|
|
|
return g_vm->_rnd->getRandomNumber(255);
|
2021-05-17 18:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SPELLSPRITATIONFUNCTION(FaceOut) {
|
2021-06-02 23:05:45 +00:00
|
|
|
return g_vm->_rnd->getRandomNumber(255);
|
2021-05-17 18:47:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // end of namespace Saga2
|