ScummVM API documentation
character_extras.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//
23// CharacterExtras is a separate runtime character data. Historically it was
24// separated from the design-time CharacterInfo, because the latter is exposed
25// to script API and plugin API in such way that its memory layout could not
26// be changed at all. Although, today this is less of an issue (see comment
27// to CharacterInfo).
28//
29// TODO: in the long run it will be beneficial to remake this into a more
30// explicit runtime Character class, while perhaps keeping CharacterInfo only
31// to load design-time data.
32//
33//=============================================================================
34
35#ifndef AGS_ENGINE_AC_CHARACTER_EXTRAS_H
36#define AGS_ENGINE_AC_CHARACTER_EXTRAS_H
37
38#include "ags/shared/ac/character_info.h"
39#include "ags/engine/ac/runtime_defines.h"
40
41namespace AGS3 {
42
43// Forward declaration
44namespace AGS {
45namespace Shared {
46class Stream;
47}
48}
49using namespace AGS; // FIXME later
50
51// The CharacterInfo struct size is fixed because it's exposed to script
52// and plugin API, therefore new stuff has to go here
54 short invorder[MAX_INVORDER] = {};
55 short invorder_count = 0;
56 // TODO: implement full AABB and keep updated, so that engine could rely on these cached values all time = 0;
57 // TODO: consider having both fixed AABB and volatile one that changes with animation frame (unless you change how anims work)
58 short width = 0;
59 short height = 0;
60 short zoom = 100;
61 short xwas = 0;
62 short ywas = 0;
63 short tint_r = 0;
64 short tint_g = 0;
65 short tint_b = 0;
66 short tint_level = 0;
67 short tint_light = 0;
68 int8 process_idle_this_time = 0;
69 int8 slow_move_counter = 0;
70 short animwait = 0;
71 int anim_volume = 100; // default animation volume (relative factor)
72 int cur_anim_volume = 100; // current animation sound volume (relative factor)
73
74 // Following fields are deriatives of the above (calculated from these
75 // and other factors), and hence are not serialized.
76 //
77 // zoom factor of sprite offsets, fixed at 100 in backwards compatible mode
78 int zoom_offs = 100;
79
80 int GetEffectiveY(CharacterInfo *chi) const; // return Y - Z
81
82 // Calculate wanted frame sound volume based on multiple factors
83 int GetFrameSoundVolume(CharacterInfo *chi) const;
84 // Process the current animation frame for the character:
85 // play linked sounds, and so forth.
86 void CheckViewFrame(CharacterInfo *chi);
87
88 // Read character extra data from saves.
89 void ReadFromSavegame(Shared::Stream *in, CharacterSvgVersion save_ver);
90 void WriteToSavegame(Shared::Stream *out) const;
91};
92
93} // namespace AGS3
94
95#endif
Definition: stream.h:52
Definition: character_extras.h:53
Definition: character_info.h:117