ScummVM API documentation
extra.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef TWINE_SCENE_EXTRA_H
23#define TWINE_SCENE_EXTRA_H
24
25#include "common/scummsys.h"
26#include "common/rect.h"
27#include "twine/scene/actor.h"
28
29namespace TwinE {
30
31#define EXTRA_MAX_ENTRIES 50
32
33#define EXTRA_SPECIAL_MASK 0x8000
34
35struct ShapeData {
36 int16 x;
37 int16 z;
38};
39
40struct ExtraShape {
41 int n;
42 const ShapeData *data;
43};
44
45enum ExtraType {
46 TIME_OUT = 1 << 0, // 0x0001
47 FLY = 1 << 1, // 0x0002
48 END_OBJ = 1 << 2, // 0x0004
49 END_COL = 1 << 3, // 0x0008
50 STOP_COL = 1 << 4, // 0x0010
51 TAKABLE = 1 << 5, // 0x0020
52 FLASH = 1 << 6, // 0x0040
53 SEARCH_OBJ = 1 << 7, // 0x0080
54 IMPACT = 1 << 8, // 0x0100
55 MAGIC_BALL_KEY = 1 << 9, // 0x0200
56 TIME_IN = 1 << 10, // 0x0400
57 ONE_FRAME = 1 << 11, // 0x0800
58 EXPLOSION = 1 << 12, // 0x1000 EXTRA_EXPLO
59 WAIT_NO_COL = 1 << 13, // 0x2000 EXTRA_WAIT_NO_COL
60 WAIT_SOME_TIME = 1 << 14, // 0x4000
61 COMPUTE_TRAJ = 1 << 15 // 0x8000 used in dotemu enhanced to render the magic ball trajectories
62};
63
65 int16 sprite = 0;
66 IVec3 pos;
67 IVec3 lastPos;
68 IVec3 destPos;
69
70 RealValue trackActorMove;
71
72 uint16 type = 0;
73 int16 angle = 0; // weight
74 int32 spawnTime = 0; // memo timer 50hz
75 union payload { // field_ 1C
76 int16 lifeTime;
77 int16 actorIdx;
78 int16 extraIdx;
79 int16 unknown;
80 } payload{0};
81 int16 strengthOfHit = 0; // apply damage if != 0
82 int16 info1 = 0; // various - number for zone giver
83};
84
85class TwinEEngine;
86
87class Extra {
88private:
89 TwinEEngine *_engine;
90
91 void initFly(ExtraListStruct *extra, int32 xAngle, int32 yAngle, int32 x, int32 extraAngle);
92 void bounceExtra(ExtraListStruct *extra, int32 x, int32 y, int32 z);
93 int32 searchBonusKey() const;
94 int32 extraSearchKey(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 extraIdx);
95 void aff2DShape(const ExtraShape &shapeTable, int32 x, int32 y, int32 color, int32 angle, int32 zoom, Common::Rect &renderRect);
96
97public:
98 Extra(TwinEEngine *engine);
99 ExtraListStruct _extraList[EXTRA_MAX_ENTRIES];
100
101 int32 extraSearch(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActor, int32 maxSpeed, int32 strengthOfHit);
102
109 int32 addExtraExplode(int32 x, int32 y, int32 z);
110
111 inline int32 extraExplo(const IVec3 &pos) {
112 return addExtraExplode(pos.x, pos.y, pos.z);
113 }
114
117
118 int32 initSpecial(int32 x, int32 y, int32 z, ExtraSpecialType type);
119 int32 addExtraBonus(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount);
120
121 inline int32 addExtraBonus(const IVec3 &pos, int32 xAngle, int32 yAngle, int32 type, int32 bonusAmount) {
122 return addExtraBonus(pos.x, pos.y, pos.z, xAngle, yAngle, type, bonusAmount);
123 }
124
125 int32 throwExtra(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle, int32 strengthOfHit);
126 int32 addExtraAiming(int32 actorIdx, int32 x, int32 y, int32 z, int32 spriteIdx, int32 targetActorIdx, int32 finalAngle, int32 strengthOfHit);
127 void addExtraThrowMagicball(int32 x, int32 y, int32 z, int32 xAngle, int32 yAngle, int32 xRotPoint, int32 extraAngle);
128
129 void affSpecial(int32 extraIdx, int32 x, int32 y, Common::Rect &renderRect);
130
131 int getBonusSprite(BonusParameter bonusParameter) const;
132
135};
136
137} // namespace TwinE
138
139#endif
Definition: extra.h:87
void clearExtra()
int32 addExtraExplode(int32 x, int32 y, int32 z)
void gereExtras()
Definition: twine.h:207
Definition: rect.h:536
Definition: actor.h:119
Definition: extra.h:64
uint16 type
Definition: extra.h:72
int16 sprite
Definition: extra.h:65
Definition: extra.h:40
Definition: shared.h:127
Definition: actor.h:40
Definition: extra.h:35
Definition: extra.h:75